axi_tdl 0.0.7 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/gem-push.yml +42 -0
  3. data/.github/workflows/ruby.yml +35 -0
  4. data/.travis.yml +9 -0
  5. data/Gemfile +4 -0
  6. data/README.EN.md +317 -0
  7. data/README.md +24 -18
  8. data/Rakefile +1 -5
  9. data/axi_tdl.gemspec +4 -4
  10. data/lib/axi/AXI4/axi4_dpram_cache.rb +1 -0
  11. data/lib/axi/AXI4/axi4_dpram_cache.sv +4 -4
  12. data/lib/axi/AXI4/axis_to_axi4_wr.rb +5 -0
  13. data/lib/axi/AXI4/axis_to_axi4_wr.sv +7 -7
  14. data/lib/axi/AXI4/packet_partition/axi4_partition_rd_verb.sv +1 -1
  15. data/lib/axi/AXI4/packet_partition/data_inf_partition.sv +2 -2
  16. data/lib/axi/AXI_stream/axi_stream_latency.sv +56 -0
  17. data/lib/axi/AXI_stream/axi_stream_split_channel.sv +20 -20
  18. data/lib/axi/AXI_stream/axis_head_cut_verc.rb +99 -43
  19. data/lib/axi/AXI_stream/axis_head_cut_verc.sv +36 -39
  20. data/lib/axi/AXI_stream/axis_insert_copy.sv +1 -1
  21. data/lib/axi/AXI_stream/axis_length_split_with_user.sv +87 -0
  22. data/lib/axi/AXI_stream/axis_pipe_sync_seam.rb +41 -0
  23. data/lib/axi/AXI_stream/axis_pipe_sync_seam.sv +48 -0
  24. data/lib/axi/AXI_stream/axis_rom_contect_sim.rb +1 -0
  25. data/lib/axi/AXI_stream/packet_fifo/axi_stream_packet_long_fifo.sv +37 -16
  26. data/lib/axi/AXI_stream/parse_big_field_table_A2.sv +3 -2
  27. data/lib/axi/data_interface/data_inf_c/data_c_pipe_force_vld_bind_data.sv +1 -1
  28. data/lib/axi/data_interface/data_inf_c/data_c_pipe_sync.sv +70 -0
  29. data/lib/axi/data_interface/data_inf_c/data_c_pipe_sync_seam.rb +49 -0
  30. data/lib/axi/data_interface/data_inf_c/data_c_pipe_sync_seam.sv +84 -0
  31. data/lib/axi_tdl.rb +12 -0
  32. data/lib/axi_tdl/version.rb +1 -1
  33. data/lib/tdl/SDL/axistream/axi_stream_packet_long_fifo_sdl.rb +1 -0
  34. data/lib/tdl/SDL/path_lib.rb +1 -1
  35. data/lib/tdl/SDL/vcs_axi4_comptable.rb +9 -0
  36. data/lib/tdl/SDL/vcs_axis_comptable.rb +17 -0
  37. data/lib/tdl/SDL/vcs_data_c_comptable.rb +9 -0
  38. data/lib/tdl/class_hdl/hdl_always_ff.rb +1 -1
  39. data/lib/tdl/class_hdl/hdl_redefine_opertor.rb +15 -3
  40. data/lib/tdl/examples/11_test_unit/tb_exp_test_unit.sv +1 -0
  41. data/lib/tdl/examples/2_hdl_class/module_def.rb +2 -1
  42. data/lib/tdl/examples/2_hdl_class/test_inst_sugar.rb +3 -1
  43. data/lib/tdl/examples/2_hdl_class/tmp/always_ff_test.sv +1 -1
  44. data/lib/tdl/examples/2_hdl_class/tmp/test_function.sv +2 -2
  45. data/lib/tdl/examples/2_hdl_class/tmp/test_module_var.sv +1 -1
  46. data/lib/tdl/examples/8_top_module/tb_test_top.sv +1 -0
  47. data/lib/tdl/examples/9_itegration/tb_test_tttop.sv +0 -2
  48. data/lib/tdl/exlib/test_point.rb +8 -2
  49. data/lib/tdl/sdlmodule/sdlmodule.rb +64 -0
  50. data/lib/tdl/sdlmodule/sdlmodule_draw.rb +13 -0
  51. data/lib/tdl/sdlmodule/top_module.rb +1 -0
  52. data/lib/tdl/tdl.rb +14 -2
  53. data/lib/tdl/tdlerror/tdlerror.rb +1 -0
  54. metadata +128 -14
  55. data/Gemfile.lock +0 -28
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d0ae825b35bd8f0680262cd912deaab26389908ef2ec6714b41ec78cac3396c2
4
- data.tar.gz: dac56ef59fba0409fd2be3d416b27ada73f2883148d753cd2c8b77506bc569dc
3
+ metadata.gz: 54ad63bab726d7657a764ee9ba830d4db48a7f12eda602e79dd25ed24a48290a
4
+ data.tar.gz: e2251135f036fd5ea2c4c8e4e754afa9ac2e67c3b6283c7685ae341fcd6961d5
5
5
  SHA512:
6
- metadata.gz: a1418ec55197a4cff6fdbaadfd30b942c7b3ed349c69a0b79d9b8a0ee48c6c6261b8d5b729356e3f41c8a96f10dbd460aead590e3c3a15c06d5de761a905c585
7
- data.tar.gz: 8914485b24d7f2233c3c12d47e5cc853642afe31996acb36fcff9035c447a5ec5376d9adbea26c9846207bca02ea0e0bd6e7fab89e1a088007bf7eec13365255
6
+ metadata.gz: 0037dac29e8452b3719a24647f0f712a3f195721fa71755af8c2f8b6783e110ac18641749ee68db9aa3f52597e29cbf319f9899664a6fef8d9ad27ce6b7265c6
7
+ data.tar.gz: 246a589f4776261bd265141ea44428b2b532f42589fe59905139f08fcd73751c7da1546cf0445b1e1c3bc24cf413abf813b75e24f4dfa72e4b1e8e6f5bde319f
@@ -0,0 +1,42 @@
1
+ name: Ruby Gem
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ pull_request:
7
+ branches: [ main ]
8
+
9
+ jobs:
10
+ build:
11
+ name: Build + Publish
12
+ runs-on: ubuntu-latest
13
+
14
+ steps:
15
+ - uses: actions/checkout@v2
16
+ - name: Set up Ruby 2.6
17
+ uses: actions/setup-ruby@v1
18
+ with:
19
+ ruby-version: 2.6.x
20
+
21
+ - name: Publish to GPR
22
+ run: |
23
+ mkdir -p $HOME/.gem
24
+ touch $HOME/.gem/credentials
25
+ chmod 0600 $HOME/.gem/credentials
26
+ printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
27
+ gem build *.gemspec
28
+ gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
29
+ env:
30
+ GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
31
+ OWNER: ${{ github.repository_owner }}
32
+
33
+ - name: Publish to RubyGems
34
+ run: |
35
+ mkdir -p $HOME/.gem
36
+ touch $HOME/.gem/credentials
37
+ chmod 0600 $HOME/.gem/credentials
38
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
39
+ gem build *.gemspec
40
+ gem push *.gem
41
+ env:
42
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
@@ -0,0 +1,35 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ main ]
13
+ pull_request:
14
+ branches: [ main ]
15
+
16
+ jobs:
17
+ test:
18
+
19
+ runs-on: ubuntu-latest
20
+ strategy:
21
+ matrix:
22
+ ruby-version: ['2.6', '2.7', '3.0']
23
+
24
+ steps:
25
+ - uses: actions/checkout@v2
26
+ - name: Set up Ruby
27
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
28
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
29
+ # uses: ruby/setup-ruby@v1
30
+ uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
31
+ with:
32
+ ruby-version: ${{ matrix.ruby-version }}
33
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
34
+ - name: Run tests
35
+ run: bundle exec rake test
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ before_install:
3
+ - gem install bundler
4
+
5
+ rvm:
6
+ - 2.6
7
+ - 3.0
8
+
9
+ script: rake test
data/Gemfile CHANGED
@@ -4,3 +4,7 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
5
  # Specify your gem's dependencies in axi_tdl.gemspec
6
6
  gemspec
7
+
8
+ gem 'rake'
9
+ # gem 'minitest',"~> 5.10"
10
+ # gem 'pry',"~> 0.11"
data/README.EN.md ADDED
@@ -0,0 +1,317 @@
1
+ # Axi
2
+   It is a wonderful library of axi4, but it is not full axi4, It is designed by systemverilog. I compact axi4 and add something to it.
3
+
4
+   axi hdl path
5
+ ```ruby
6
+ require 'axi_tdl'
7
+ AxiTdl::AXI_PATH
8
+ ```
9
+ # Other
10
+   It contain a simple interface that only define three signals, `valid`, `ready`, and `data`. I think it is useful for design.
11
+
12
+ ## What is tdl?
13
+   tdl is a hardware Construction language, it like chisel, but more intresting. It is a DSL and base on ruby. Finally, it convert to systemverilog. And it depend on the axi library of my other github respo.
14
+
15
+ ## What tdl can do?
16
+   When you write RTL code by tdl, it look like systemverilog. And not only that, you can verify design by tdl. Even more, you can construct `Logic System`, I think it is main difference between tdl and other hardware Construction languages.
17
+
18
+ ## Installation
19
+
20
+ Add this line to your application's Gemfile:
21
+
22
+ ```ruby
23
+ gem 'axi_tdl'
24
+ ```
25
+
26
+ And then execute:
27
+
28
+ $ bundle
29
+
30
+ Or install it yourself as:
31
+
32
+ $ gem install axi_tdl
33
+
34
+ ## Code Example
35
+
36
+ ### 1. define module
37
+ It will create a module of systemverilog that name is `test_module` in current dir.
38
+ ```ruby
39
+ TdlBuild.test_module(__dir__) do
40
+ ## Other code
41
+ end
42
+ ```
43
+ the sv file look like this
44
+ ```systemverilog
45
+ `timescale 1ns/1ps
46
+ module test_module(
47
+ );
48
+ endmodule
49
+ ```
50
+ ### 2. ports
51
+ ```ruby
52
+ TdlBuild.test_module(__dir__) do
53
+ input.clock - 'clock'
54
+ input.reset('low') - 'rst_n'
55
+ input - 'd0'
56
+ input[32] - 'd32'
57
+ output[16] - 'o16'
58
+ output.logic[8] - 'o8'
59
+ output.logic - 'o1'
60
+ end
61
+ ```
62
+ ```systemverilog
63
+ module test_module (
64
+ input clock,
65
+ input rst_n,
66
+ input d0,
67
+ input [31:0] d32,
68
+ output [15:0] o16,
69
+ output logic[7:0] o8,
70
+ output logic o1
71
+ );
72
+ endmodule
73
+ ```
74
+
75
+ ## 3. interface
76
+ ```ruby
77
+ TdlBuild.test_interface(__dir__) do
78
+
79
+ input.clock - 'clock'
80
+ input.reset('low') - 'rst_n'
81
+ input - 'd0'
82
+ input[32] - 'd32'
83
+ output[16] - 'o16'
84
+ output.logic[8] - 'o8'
85
+ output.logic - 'o1'
86
+
87
+ port.axis.slaver - 'axis_in'
88
+ port.axis.master - 'axis_out'
89
+ port.axis.mirror - 'axis_mirror'
90
+
91
+ port.data_c.master - 'intf_data_inf'
92
+ port.axi4.slaver - 'taxi4_inf'
93
+
94
+ end
95
+ ```
96
+ ```systemverilog
97
+ module test_module (
98
+ input clock,
99
+ input rst_n,
100
+ input d0,
101
+ input [31:0] d32,
102
+ output [15:0] o16,
103
+ output logic[7:0] o8,
104
+ output logic o1,
105
+ axi_stream_inf.slaver axis_in,
106
+ axi_stream_inf.master axis_out,
107
+ axi_stream_inf.mirror axis_mirror,
108
+ data_inf_c.master intf_data_inf,
109
+ axi_inf.slaver taxi4_inf
110
+ );
111
+ end
112
+ ```
113
+ ## 4. always assign
114
+ ```ruby
115
+ TdlBuild.test_module(__dir__) do
116
+ input.clock - 'clock'
117
+ input.reset('low') - 'rst_n'
118
+ input - 'd0'
119
+ input[32] - 'd32'
120
+ output[16] - 'o16'
121
+ output.logic[8] - 'o8'
122
+ output.logic - 'o1'
123
+
124
+ port.axis.slaver - 'axis_in'
125
+ port.axis.master - 'axis_out'
126
+ port.axis.mirror - 'axis_mirror'
127
+
128
+ port.data_c.master - 'intf_data_inf'
129
+ port.axi4.slaver - 'taxi4_inf'
130
+
131
+
132
+ always_ff(posedge: clock,negedge: rst_n) do
133
+ IF ~rst_n do
134
+ o16 <= 0.A
135
+ end
136
+ ELSE do
137
+ IF d0 do
138
+ o16 <= 1.A
139
+ end
140
+ ELSE do
141
+ o16 <= o16 + 1.b1
142
+ end
143
+ end
144
+ end
145
+
146
+ always_comb do
147
+ o8 <= d32[7,0]
148
+ end
149
+
150
+ Assign do
151
+ o1 <= 1.b0
152
+ end
153
+ end
154
+ ```
155
+ ```systemverilog
156
+ module test_module (
157
+ input clock,
158
+ input rst_n,
159
+ input d0,
160
+ input [31:0] d32,
161
+ output [15:0] o16,
162
+ output logic[7:0] o8,
163
+ output logic o1,
164
+ axi_stream_inf.slaver axis_in,
165
+ axi_stream_inf.master axis_out,
166
+ axi_stream_inf.mirror axis_mirror,
167
+ data_inf_c.master intf_data_inf,
168
+ axi_inf.slaver taxi4_inf
169
+ );
170
+
171
+ always_ff@(posedge clock,negedge rst_n) begin
172
+ if(~rst_n)begin
173
+ o16 <= '0;
174
+ end
175
+ else begin
176
+ if(d0)begin
177
+ o16 <= '1;
178
+ end
179
+ else begin
180
+ o16 <= ( o16+1'b1);
181
+ end
182
+ end
183
+ end
184
+
185
+ always_comb begin
186
+ o8 = d32[7:0];
187
+ end
188
+
189
+ assign o1 = 1'b0;
190
+
191
+ endmodule
192
+ ```
193
+ ## 5. generate
194
+ ```ruby
195
+ TdlBuild.test_generate(__dir__) do
196
+ parameter.NUM 8
197
+ input[8] - 'ain'
198
+ output[8] - 'bout'
199
+
200
+ input[param.NUM,6] - 'cin'
201
+ output[6,param.NUM] - 'dout'
202
+
203
+ input[param.NUM] - 'ein'
204
+ output[param.NUM] - 'fout'
205
+
206
+ generate(8) do |kk|
207
+ Assign do
208
+ bout[kk] <= ain[7-kk]
209
+ end
210
+ end
211
+
212
+ generate(param.NUM) do |cc|
213
+ IF cc < 4 do
214
+ Assign do
215
+ dout[cc] <= cin[cc]
216
+ end
217
+ end
218
+ ELSE do
219
+ Assign do
220
+ dout[cc] <= cin[cc] + cc
221
+ end
222
+ end
223
+ end
224
+
225
+ generate(param.NUM,6) do |ii,gg|
226
+ Assign do
227
+ fout[ii][gg] <= ein[gg][ii]
228
+ end
229
+ end
230
+ end
231
+ ```
232
+ ```systemverilog
233
+ module test_generate #(
234
+ parameter NUM = 8
235
+ )(
236
+ input [7:0] ain,
237
+ output [7:0] bout,
238
+ input [5:0] cin [NUM-1:0],
239
+ output [ NUM-1:0] dout [6-1:0],
240
+ input [ NUM-1:0] ein,
241
+ output [ NUM-1:0] fout
242
+ );
243
+
244
+ generate
245
+ for(genvar KK0=0;KK0 < 8;KK0++)begin
246
+ assign bout[ KK0] = ain[ 7-( KK0)];
247
+ end
248
+ endgenerate
249
+
250
+ generate
251
+ for(genvar KK0=0;KK0 < NUM;KK0++)begin
252
+
253
+ if( KK0<4)begin
254
+ assign dout[ KK0] = cin[ KK0];
255
+ end
256
+ else begin
257
+ assign dout[ KK0] = ( cin[ KK0]+( KK0));
258
+ end
259
+ end
260
+ endgenerate
261
+
262
+ generate
263
+ for(genvar KK0=0;KK0 < NUM;KK0++)begin
264
+ for(genvar KK1=0;KK1 < 6;KK1++)begin
265
+ assign fout[ KK0][ KK1] = ein[ KK1][ KK0];
266
+ end
267
+ end
268
+ endgenerate
269
+
270
+ endmodule
271
+ ```
272
+
273
+ ## 6. combin logic
274
+ ```ruby
275
+ TdlBuild.test_logic_combin(__dir__) do
276
+ logic[7] - 'a0'
277
+ logic[5] - 'a1'
278
+ logic[9] - 'a2'
279
+ logic[9+5+7] - 'ca'
280
+
281
+ logic[2,8] - 'b0'
282
+ logic[16] - 'b1'
283
+ logic[32] - 'cb'
284
+
285
+ logic[1,8] - 'c0'
286
+ logic[3,8] - 'c1'
287
+ logic[2,16] - 'cc'
288
+
289
+ Assign do
290
+ ca <= logic_bind_(a0, a1, a2)
291
+ cb <= self.>>(b1, b0)
292
+ cc <= self.<<(c0, c1)
293
+ end
294
+ end
295
+ ```
296
+ ```systemverilog
297
+ module test_logic_combin ();
298
+
299
+ logic [7-1:0] a0 ;
300
+ logic [5-1:0] a1 ;
301
+ logic [9-1:0] a2 ;
302
+ logic [21-1:0] ca ;
303
+ logic [8-1:0] b0[2-1:0] ;
304
+ logic [16-1:0] b1 ;
305
+ logic [32-1:0] cb ;
306
+ logic [8-1:0] c0[1-1:0] ;
307
+ logic [8-1:0] c1[3-1:0] ;
308
+ logic [16-1:0] cc[2-1:0] ;
309
+
310
+ assign ca = {a0,a1,a2};
311
+ assign cb = {>>{b1,b0}};
312
+ assign cc = {<<{c0,c1}};
313
+
314
+ endmodule
315
+ ```
316
+
317
+
data/README.md CHANGED
@@ -1,47 +1,53 @@
1
1
  # Axi
2
- &emsp;&emsp;It is a wonderful library of axi4, but it is not full axi4, It is designed by systemverilog. I compact axi4 and add something to it.
3
- # Other
4
- &emsp;&emsp;It contain a simple interface that only define three signals, `valid`, `ready`, and `data`. I think it is useful for design.
2
+ &emsp;&emsp;axi是一个 axi4 拓展库,它使用的是删减版的AXI4协议,使用systemverilog开发,除此外我还拓展了AXI4的一些信号。
5
3
 
6
- ## What is tdl?
7
- &emsp;&emsp;tdl is a hardware Construction language, it like chisel, but more intresting. It is a DSL and base on ruby. Finally, it convert to systemverilog. And it depend on the axi library of my other github respo.
4
+ &emsp;&emsp;axi hdl 所在路径可以如下Ruby 脚本获取
5
+ ```ruby
6
+ require 'axi_tdl'
7
+ AxiTdl::AXI_PATH
8
+ ```
9
+ # 其他
10
+ &emsp;&emsp;此库还包含一个简单的接口定义, 接口信号只有 `valid`, `ready`, 和 `data`. 对于一些轻量设计很有帮助。
11
+
12
+ ## tdl 是什么?
13
+ &emsp;&emsp;tdl 是一种硬件构造语言, 和chisel类似, 但是更加有趣, 他是一种基于Ruby的DSL. 最终它会编译输出systemverilog。 tdl也是基于axi库做的设计。这两部分都包含这此gem包中。
8
14
 
9
- ## What tdl can do?
10
- &emsp;&emsp;When you write RTL code by tdl, it look like systemverilog. And not only that, you can verify design by tdl. Even more, you can construct `Logic System`, I think it is main difference between tdl and other hardware Construction languages.
15
+ ## tdl 能做什么?
16
+ &emsp;&emsp;使用tdl做设计开发, 语法类似systemverilog,这样更亲切。不止于此, tdl加入了大量的验证语法。tdl创建的初衷就是为了快速构建`逻辑系统`, 这就是tdl和其他硬件构造语言最大的区别。
11
17
 
12
- ## Installation
18
+ ## 安装
13
19
 
14
- Add this line to your application's Gemfile:
20
+ Gemfile中添加:
15
21
 
16
22
  ```ruby
17
23
  gem 'axi_tdl'
18
24
  ```
19
25
 
20
- And then execute:
26
+ 然后执行:
21
27
 
22
28
  $ bundle
23
29
 
24
- Or install it yourself as:
30
+ 或则通过gem命令安装:
25
31
 
26
32
  $ gem install axi_tdl
27
33
 
28
- ## Code Example
34
+ ## 代码示例
29
35
 
30
- ### 1. define module
31
- It will create a module of systemverilog that name is `test_module` in current dir.
36
+ ### 1. 定义模块
37
+ 在当前tdl所在的路径创建一个systemverilog模块文件,模块名为 `test_module`.
32
38
  ```ruby
33
39
  TdlBuild.test_module(__dir__) do
34
40
  ## Other code
35
41
  end
36
42
  ```
37
- the sv file look like this
43
+ 输出的systemverilog 文件如下:
38
44
  ```systemverilog
39
45
  `timescale 1ns/1ps
40
46
  module test_module(
41
47
  );
42
48
  endmodule
43
49
  ```
44
- ### 2. ports
50
+ ### 2. 端口
45
51
  ```ruby
46
52
  TdlBuild.test_module(__dir__) do
47
53
  input.clock - 'clock'
@@ -66,7 +72,7 @@ module test_module (
66
72
  endmodule
67
73
  ```
68
74
 
69
- ## 3. interface
75
+ ## 3. 接口
70
76
  ```ruby
71
77
  TdlBuild.test_interface(__dir__) do
72
78
 
@@ -264,7 +270,7 @@ endgenerate
264
270
  endmodule
265
271
  ```
266
272
 
267
- ## 6. combin logic
273
+ ## 6. 合并 logic
268
274
  ```ruby
269
275
  TdlBuild.test_logic_combin(__dir__) do
270
276
  logic[7] - 'a0'