axi_tdl 0.0.6 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +7 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +2 -2
- data/README.EN.md +317 -0
- data/README.md +24 -18
- data/Rakefile +0 -4
- data/axi_tdl.gemspec +2 -2
- data/lib/axi/AXI4/axi4_dpram_cache.rb +1 -0
- data/lib/axi/AXI4/axi4_dpram_cache.sv +4 -4
- data/lib/axi/AXI4/axis_to_axi4_wr.rb +5 -0
- data/lib/axi/AXI4/axis_to_axi4_wr.sv +7 -7
- data/lib/axi/AXI4/packet_partition/axi4_partition_rd_verb.sv +1 -1
- data/lib/axi/AXI4/packet_partition/data_inf_partition.sv +2 -2
- data/lib/axi/AXI_stream/axi_stream_latency.sv +56 -0
- data/lib/axi/AXI_stream/axi_stream_split_channel.sv +20 -20
- data/lib/axi/AXI_stream/axis_head_cut_verc.rb +99 -43
- data/lib/axi/AXI_stream/axis_head_cut_verc.sv +36 -39
- data/lib/axi/AXI_stream/axis_insert_copy.sv +1 -1
- data/lib/axi/AXI_stream/axis_length_split_with_user.sv +87 -0
- data/lib/axi/AXI_stream/axis_pipe_sync_seam.rb +41 -0
- data/lib/axi/AXI_stream/axis_pipe_sync_seam.sv +48 -0
- data/lib/axi/AXI_stream/axis_rom_contect_sim.rb +1 -0
- data/lib/axi/AXI_stream/packet_fifo/axi_stream_packet_long_fifo.sv +37 -16
- data/lib/axi/AXI_stream/parse_big_field_table_A2.sv +3 -2
- data/lib/axi/data_interface/data_inf_c/data_c_pipe_force_vld_bind_data.sv +1 -1
- data/lib/axi/data_interface/data_inf_c/data_c_pipe_sync.sv +70 -0
- data/lib/axi/data_interface/data_inf_c/data_c_pipe_sync_seam.rb +49 -0
- data/lib/axi/data_interface/data_inf_c/data_c_pipe_sync_seam.sv +84 -0
- data/lib/axi_tdl.rb +12 -0
- data/lib/axi_tdl/version.rb +1 -1
- data/lib/tdl/SDL/axistream/axi_stream_packet_long_fifo_sdl.rb +1 -0
- data/lib/tdl/SDL/path_lib.rb +1 -1
- data/lib/tdl/SDL/vcs_axi4_comptable.rb +9 -0
- data/lib/tdl/SDL/vcs_axis_comptable.rb +17 -0
- data/lib/tdl/SDL/vcs_data_c_comptable.rb +9 -0
- data/lib/tdl/class_hdl/hdl_redefine_opertor.rb +15 -3
- data/lib/tdl/examples/11_test_unit/tb_exp_test_unit.sv +2 -0
- data/lib/tdl/examples/2_hdl_class/module_def.rb +2 -1
- data/lib/tdl/examples/2_hdl_class/test_inst_sugar.rb +3 -1
- data/lib/tdl/examples/2_hdl_class/tmp/always_ff_test.sv +1 -1
- data/lib/tdl/examples/2_hdl_class/tmp/test_function.sv +2 -2
- data/lib/tdl/examples/8_top_module/tb_test_top.sv +0 -1
- data/lib/tdl/examples/9_itegration/tb_test_tttop.sv +0 -1
- data/lib/tdl/exlib/test_point.rb +8 -2
- data/lib/tdl/sdlmodule/sdlmodule.rb +64 -0
- data/lib/tdl/sdlmodule/sdlmodule_draw.rb +13 -0
- data/lib/tdl/sdlmodule/top_module.rb +1 -0
- data/lib/tdl/tdl.rb +14 -2
- data/lib/tdl/tdlerror/tdlerror.rb +1 -0
- metadata +118 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03e8f9086b6e1326e9849ff395e11faea688133c8b46f86e8dc4da52e238d5cd
|
4
|
+
data.tar.gz: 5b587690396c2372e2d2dc108e12af3f962a4c650fa5cdbd86c431a496474aed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8466b40ffc4dfa857a073a9ba89bf77175642dc6cfde0e07aeb9424c13256353bf017ca39b4b79c68e33f79bd76cffbcc20b8b6657fb9a18c128d3281165edd
|
7
|
+
data.tar.gz: e59a41054498b284ac257d522bfa083bebd7a341968b7607c0f20aa2dc10c8e67f7c847a6ecbdfa3f1223011167e9955918d2fdbaf9fc474ec739ffbbf58fa68
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
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
|
-
  
|
3
|
-
# Other
|
4
|
-
  It contain a simple interface that only define three signals, `valid`, `ready`, and `data`. I think it is useful for design.
|
2
|
+
  axi是一个 axi4 拓展库,它使用的是删减版的AXI4协议,使用systemverilog开发,除此外我还拓展了AXI4的一些信号。
|
5
3
|
|
6
|
-
|
7
|
-
|
4
|
+
  axi hdl 所在路径可以如下Ruby 脚本获取
|
5
|
+
```ruby
|
6
|
+
require 'axi_tdl'
|
7
|
+
AxiTdl::AXI_PATH
|
8
|
+
```
|
9
|
+
# 其他
|
10
|
+
  此库还包含一个简单的接口定义, 接口信号只有 `valid`, `ready`, 和 `data`. 对于一些轻量设计很有帮助。
|
11
|
+
|
12
|
+
## tdl 是什么?
|
13
|
+
  tdl 是一种硬件构造语言, 和chisel类似, 但是更加有趣, 他是一种基于Ruby的DSL. 最终它会编译输出systemverilog。 tdl也是基于axi库做的设计。这两部分都包含这此gem包中。
|
8
14
|
|
9
|
-
##
|
10
|
-
 &emsp
|
15
|
+
## tdl 能做什么?
|
16
|
+
  使用tdl做设计开发, 语法类似systemverilog,这样更亲切。不止于此, tdl加入了大量的验证语法。tdl创建的初衷就是为了快速构建`逻辑系统`, 这就是tdl和其他硬件构造语言最大的区别。
|
11
17
|
|
12
|
-
##
|
18
|
+
## 安装
|
13
19
|
|
14
|
-
|
20
|
+
Gemfile中添加:
|
15
21
|
|
16
22
|
```ruby
|
17
23
|
gem 'axi_tdl'
|
18
24
|
```
|
19
25
|
|
20
|
-
|
26
|
+
然后执行:
|
21
27
|
|
22
28
|
$ bundle
|
23
29
|
|
24
|
-
|
30
|
+
或则通过gem命令安装:
|
25
31
|
|
26
32
|
$ gem install axi_tdl
|
27
33
|
|
28
|
-
##
|
34
|
+
## 代码示例
|
29
35
|
|
30
|
-
### 1.
|
31
|
-
|
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
|
-
|
43
|
+
输出的systemverilog 文件如下:
|
38
44
|
```systemverilog
|
39
45
|
`timescale 1ns/1ps
|
40
46
|
module test_module(
|
41
47
|
);
|
42
48
|
endmodule
|
43
49
|
```
|
44
|
-
### 2.
|
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.
|
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.
|
273
|
+
## 6. 合并 logic
|
268
274
|
```ruby
|
269
275
|
TdlBuild.test_logic_combin(__dir__) do
|
270
276
|
logic[7] - 'a0'
|