axi_tdl 0.0.9 → 0.0.10
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.EN.md +317 -0
- data/README.md +19 -19
- data/axi_tdl.gemspec +2 -2
- data/lib/axi_tdl/version.rb +1 -1
- data/lib/tdl/tdl.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4759dac8387adffa17116bb46d781e95156d52700ca985b2d1ab14afc7d1d0a3
|
4
|
+
data.tar.gz: bda1a78909b2cecd01e34bff94660820f2c446c2c6526c5b59c574d98df028d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e401a4d8363b77942116f3990e804abae4e885c6a047728fe68b342fe90b94cb35be7b174612587cd58a6bfe63b3eb5903ea959a5f7f814343ec1013785ed5e1
|
7
|
+
data.tar.gz: ff8e318a2713db70c974372a5c0cd92a53cc3c320f20cec7eb79eab72b6c65f0031b5c596d9a7acee93ef654a107922dbcdb1621520e1ab04707eb336314bddb
|
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,53 +1,53 @@
|
|
1
1
|
# Axi
|
2
|
-
  
|
2
|
+
  axi是一个 axi4 拓展库,它使用的是删减版的AXI4协议,使用systemverilog开发,除此外我还拓展了AXI4的一些信号。
|
3
3
|
|
4
|
-
  axi hdl
|
4
|
+
  axi hdl 所在路径可以如下Ruby 脚本获取
|
5
5
|
```ruby
|
6
6
|
require 'axi_tdl'
|
7
7
|
AxiTdl::AXI_PATH
|
8
8
|
```
|
9
|
-
#
|
10
|
-
 &emsp
|
9
|
+
# 其他
|
10
|
+
  此库还包含一个简单的接口定义, 接口信号只有 `valid`, `ready`, 和 `data`. 对于一些轻量设计很有帮助。
|
11
11
|
|
12
|
-
##
|
13
|
-
  tdl
|
12
|
+
## tdl 是什么?
|
13
|
+
  tdl 是一种硬件构造语言, 和chisel类似, 但是更加有趣, 他是一种基于Ruby的DSL. 最终它会编译输出systemverilog。 tdl也是基于axi库做的设计。这两部分都包含这此gem包中。
|
14
14
|
|
15
|
-
##
|
16
|
-
 &emsp
|
15
|
+
## tdl 能做什么?
|
16
|
+
  使用tdl做设计开发, 语法类似systemverilog,这样更亲切。不止于此, tdl加入了大量的验证语法。tdl创建的初衷就是为了快速构建`逻辑系统`, 这就是tdl和其他硬件构造语言最大的区别。
|
17
17
|
|
18
|
-
##
|
18
|
+
## 安装
|
19
19
|
|
20
|
-
|
20
|
+
Gemfile中添加:
|
21
21
|
|
22
22
|
```ruby
|
23
23
|
gem 'axi_tdl'
|
24
24
|
```
|
25
25
|
|
26
|
-
|
26
|
+
然后执行:
|
27
27
|
|
28
28
|
$ bundle
|
29
29
|
|
30
|
-
|
30
|
+
或则通过gem命令安装:
|
31
31
|
|
32
32
|
$ gem install axi_tdl
|
33
33
|
|
34
|
-
##
|
34
|
+
## 代码示例
|
35
35
|
|
36
|
-
### 1.
|
37
|
-
|
36
|
+
### 1. 定义模块
|
37
|
+
在当前tdl所在的路径创建一个systemverilog模块文件,模块名为 `test_module`.
|
38
38
|
```ruby
|
39
39
|
TdlBuild.test_module(__dir__) do
|
40
40
|
## Other code
|
41
41
|
end
|
42
42
|
```
|
43
|
-
|
43
|
+
输出的systemverilog 文件如下:
|
44
44
|
```systemverilog
|
45
45
|
`timescale 1ns/1ps
|
46
46
|
module test_module(
|
47
47
|
);
|
48
48
|
endmodule
|
49
49
|
```
|
50
|
-
### 2.
|
50
|
+
### 2. 端口
|
51
51
|
```ruby
|
52
52
|
TdlBuild.test_module(__dir__) do
|
53
53
|
input.clock - 'clock'
|
@@ -72,7 +72,7 @@ module test_module (
|
|
72
72
|
endmodule
|
73
73
|
```
|
74
74
|
|
75
|
-
## 3.
|
75
|
+
## 3. 接口
|
76
76
|
```ruby
|
77
77
|
TdlBuild.test_interface(__dir__) do
|
78
78
|
|
@@ -270,7 +270,7 @@ endgenerate
|
|
270
270
|
endmodule
|
271
271
|
```
|
272
272
|
|
273
|
-
## 6.
|
273
|
+
## 6. 合并 logic
|
274
274
|
```ruby
|
275
275
|
TdlBuild.test_logic_combin(__dir__) do
|
276
276
|
logic[7] - 'a0'
|
data/axi_tdl.gemspec
CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Cook.Darwin"]
|
10
10
|
spec.email = ["cook_darwin@hotmail.com"]
|
11
11
|
|
12
|
-
spec.summary = %q{Axi
|
13
|
-
spec.description = %q{tdl
|
12
|
+
spec.summary = %q{Axi 是一个轻量级的AXI4库. Tdl 是一种硬件构造语言}
|
13
|
+
spec.description = %q{tdl 是一种硬件构造语言, 和chisel类似, 但是更加有趣, 他是一种基于Ruby的DSL. 最终它会编译输出systemverilog 。 }
|
14
14
|
spec.homepage = "https://www.github.com/CookDarwin/axi_tdl"
|
15
15
|
# spec.homepage = "https://rubygems.org/gems/axi_tdl"
|
16
16
|
spec.license = "LGPL-2.1"
|
data/lib/axi_tdl/version.rb
CHANGED
data/lib/tdl/tdl.rb
CHANGED
@@ -127,7 +127,7 @@ require_relative "./exlib/dve_tcl.rb"
|
|
127
127
|
|
128
128
|
## === INIT BLOCK Methods =====
|
129
129
|
$argvs_hash = {}
|
130
|
-
$argvs_hash = Parser.parse($TdlARGV || ARGV)
|
130
|
+
$argvs_hash = Parser.parse($TdlARGV || ARGV)
|
131
131
|
TopModule.sim = $argvs_hash[:sim]
|
132
132
|
|
133
133
|
class Tdl
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: axi_tdl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cook.Darwin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,8 +66,8 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
description: 'tdl
|
70
|
-
|
69
|
+
description: 'tdl 是一种硬件构造语言, 和chisel类似, 但是更加有趣, 他是一种基于Ruby的DSL. 最终它会编译输出systemverilog
|
70
|
+
。 '
|
71
71
|
email:
|
72
72
|
- cook_darwin@hotmail.com
|
73
73
|
executables: []
|
@@ -79,6 +79,7 @@ files:
|
|
79
79
|
- Gemfile
|
80
80
|
- Gemfile.lock
|
81
81
|
- LICENSE
|
82
|
+
- README.EN.md
|
82
83
|
- README.md
|
83
84
|
- Rakefile
|
84
85
|
- axi_tdl.gemspec
|
@@ -1394,5 +1395,5 @@ requirements: []
|
|
1394
1395
|
rubygems_version: 3.0.6
|
1395
1396
|
signing_key:
|
1396
1397
|
specification_version: 4
|
1397
|
-
summary: Axi
|
1398
|
+
summary: Axi 是一个轻量级的AXI4库. Tdl 是一种硬件构造语言
|
1398
1399
|
test_files: []
|