axi_tdl 0.0.9 → 0.0.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/gem-push.yml +44 -0
- data/.github/workflows/ruby.yml +35 -0
- data/.gitignore +3 -1
- data/.travis.yml +9 -0
- data/Gemfile +4 -0
- data/README.EN.md +322 -0
- data/README.md +24 -20
- data/Rakefile +2 -6
- data/axi_tdl.gemspec +5 -6
- data/lib/axi/AXI4/axi4_direct_B1.sv +23 -23
- data/lib/axi/AXI4/axi4_dpram_cache.sv +33 -33
- data/lib/axi/AXI4/axis_to_axi4_wr.rb +1 -0
- data/lib/axi/AXI4/axis_to_axi4_wr.sv +20 -20
- data/lib/axi/AXI4/packet_partition/axi4_partition_rd_verb.sv +32 -32
- data/lib/axi/AXI4/packet_partition/data_inf_partition.rb +2 -0
- data/lib/axi/AXI4/packet_partition/data_inf_partition.sv +71 -71
- data/lib/axi/AXI4/wide_axis_to_axi4_wr.rb +2 -1
- data/lib/axi/AXI4/wide_axis_to_axi4_wr.sv +23 -23
- data/lib/axi/AXI_stream/axi_stream_split_channel.rb +7 -1
- data/lib/axi/AXI_stream/axis_head_cut_verb.sv +6 -2
- data/lib/axi/AXI_stream/axis_insert_copy.rb +18 -4
- data/lib/axi/AXI_stream/axis_sim_master_model.rb +28 -0
- data/lib/axi/AXI_stream/axis_sim_slaver_model.rb +26 -0
- data/lib/axi/AXI_stream/axis_sim_verify_by_coe.sv +101 -0
- data/lib/axi/AXI_stream/axis_split_channel_verb.rb +2 -0
- data/lib/axi/common/common_ram_sim_wrapper.sv +9 -9
- data/lib/axi/common/common_ram_wrapper.sv +12 -12
- data/lib/axi/data_interface/data_inf_c/data_c_pipe_sync_seam.sv +26 -26
- data/lib/axi/data_interface/data_inf_c/data_c_sim_master_model.sv +69 -0
- data/lib/axi/data_interface/data_inf_c/data_c_sim_slaver_model.sv +58 -0
- data/lib/axi/data_interface/data_inf_c/logic_sim_model.sv +64 -0
- data/lib/axi/techbench/tb_axi_stream_split_channel.rb +69 -0
- data/lib/axi/techbench/tb_axi_stream_split_channel.sv +149 -0
- data/lib/axi/techbench/tb_axis_split_channel_verb.rb +69 -0
- data/lib/axi/techbench/tb_axis_split_channel_verb.sv +125 -0
- data/lib/axi_tdl.rb +1 -0
- data/lib/axi_tdl/version.rb +1 -1
- data/lib/tdl/auto_script/autogensdl.rb +16 -5
- data/lib/tdl/axi4/axi4_interconnect_verb.rb +4 -2
- data/lib/tdl/basefunc.rb +1 -0
- data/lib/tdl/class_hdl/hdl_always_comb.rb +4 -3
- data/lib/tdl/class_hdl/hdl_always_ff.rb +49 -8
- data/lib/tdl/class_hdl/hdl_assign.rb +5 -3
- data/lib/tdl/class_hdl/hdl_block_ifelse.rb +11 -9
- data/lib/tdl/class_hdl/hdl_foreach.rb +2 -2
- data/lib/tdl/class_hdl/hdl_function.rb +4 -2
- data/lib/tdl/class_hdl/hdl_generate.rb +5 -4
- data/lib/tdl/class_hdl/hdl_initial.rb +11 -10
- data/lib/tdl/class_hdl/hdl_module_def.rb +18 -1
- data/lib/tdl/class_hdl/hdl_redefine_opertor.rb +35 -14
- data/lib/tdl/class_hdl/hdl_struct.rb +1 -1
- data/lib/tdl/class_hdl/hdl_verify.rb +1 -1
- data/lib/tdl/elements/originclass.rb +6 -1
- data/lib/tdl/elements/parameter.rb +1 -1
- data/lib/tdl/examples/10_random/exp_random.sv +3 -3
- data/lib/tdl/examples/11_test_unit/dve.tcl +155 -2
- data/lib/tdl/examples/11_test_unit/exp_test_unit.rb +9 -8
- data/lib/tdl/examples/11_test_unit/exp_test_unit.sv +1 -1
- data/lib/tdl/examples/11_test_unit/modules/sub_md0.rb +6 -3
- data/lib/tdl/examples/11_test_unit/modules/sub_md0.sv +5 -5
- data/lib/tdl/examples/11_test_unit/modules/sub_md1.rb +9 -4
- data/lib/tdl/examples/11_test_unit/modules/sub_md1.sv +5 -5
- data/lib/tdl/examples/11_test_unit/tb_exp_test_unit.sv +1 -3
- data/lib/tdl/examples/11_test_unit/tu0.sv +9 -9
- data/lib/tdl/examples/11_test_unit/tu1.sv +1 -1
- data/lib/tdl/examples/1_define_module/exmple_md.sv +12 -12
- data/lib/tdl/examples/2_hdl_class/tmp/always_comb_test.sv +60 -60
- data/lib/tdl/examples/2_hdl_class/tmp/always_ff_test.sv +2 -2
- data/lib/tdl/examples/2_hdl_class/tmp/case_test.sv +17 -17
- data/lib/tdl/examples/2_hdl_class/tmp/head_pkg_module.sv +9 -9
- data/lib/tdl/examples/2_hdl_class/tmp/simple_assign_test.sv +1 -1
- data/lib/tdl/examples/2_hdl_class/tmp/state_case_test.sv +10 -10
- data/lib/tdl/examples/2_hdl_class/tmp/test_foreach.sv +3 -3
- data/lib/tdl/examples/2_hdl_class/tmp/test_function.sv +7 -7
- data/lib/tdl/examples/2_hdl_class/tmp/test_initial_assert.sv +3 -3
- data/lib/tdl/examples/2_hdl_class/tmp/test_module.sv +2 -2
- data/lib/tdl/examples/2_hdl_class/tmp/test_module_var.sv +2 -2
- data/lib/tdl/examples/2_hdl_class/tmp/test_package.sv +4 -5
- data/lib/tdl/examples/2_hdl_class/tmp/test_package2.sv +4 -4
- data/lib/tdl/examples/2_hdl_class/tmp/test_struct_function.sv +2 -2
- data/lib/tdl/examples/2_hdl_class/tmp/test_vcs_string.sv +1 -1
- data/lib/tdl/examples/2_hdl_class/tmp/text_generate.sv +7 -7
- data/lib/tdl/examples/4_generate/test_generate.sv +11 -11
- data/lib/tdl/examples/5_logic_combin/test_logic_combin.sv +3 -3
- data/lib/tdl/examples/7_module_with_package/body_package.sv +3 -4
- data/lib/tdl/examples/7_module_with_package/example_pkg.sv +4 -4
- data/lib/tdl/examples/7_module_with_package/head_package.sv +3 -4
- data/lib/tdl/examples/8_top_module/tb_test_top.sv +1 -2
- data/lib/tdl/examples/9_itegration/tb_test_tttop.sv +2 -2
- data/lib/tdl/examples/9_itegration/test_tttop.sv +3 -3
- data/lib/tdl/exlib/axis_eth_ex.rb +95 -0
- data/lib/tdl/exlib/axis_verify.rb +264 -0
- data/lib/tdl/exlib/clock_reset_verify.rb +29 -0
- data/lib/tdl/exlib/dve_tcl.rb +30 -11
- data/lib/tdl/exlib/itegration.rb +15 -3
- data/lib/tdl/exlib/logic_verify.rb +88 -0
- data/lib/tdl/exlib/test_point.rb +96 -94
- data/lib/tdl/exlib/test_point.rb.bak +293 -0
- data/lib/tdl/rebuild_ele/ele_base.rb +1 -1
- data/lib/tdl/sdlmodule/sdlmodlule_path_db.rb +34 -0
- data/lib/tdl/sdlmodule/sdlmodule.rb +18 -14
- data/lib/tdl/sdlmodule/sdlmodule_draw.rb +81 -16
- data/lib/tdl/sdlmodule/test_unit_module.rb +272 -33
- data/lib/tdl/sdlmodule/test_unit_module.rb.bak +143 -0
- data/lib/tdl/sdlmodule/top_module.rb +53 -48
- data/lib/tdl/sdlmodule/top_module.rb.bak +547 -0
- data/lib/tdl/tdl.rb +19 -4
- metadata +36 -137
- data/Gemfile.lock +0 -28
- data/lib/axi/AXI_stream/axi_stream_split_channel.sv +0 -149
- data/lib/axi/AXI_stream/axis_head_cut_verc.sv +0 -242
- data/lib/axi/AXI_stream/axis_insert_copy.sv +0 -66
- data/lib/axi/AXI_stream/axis_pipe_sync_seam.sv +0 -48
- data/lib/axi/AXI_stream/axis_rom_contect_sim.sv +0 -113
- data/lib/axi/AXI_stream/axis_split_channel_verb.sv +0 -62
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97a6adaec566d23b4b76a1c7396bc9b03c5d9f3de0afa0f5a6caa5e923e4c80a
|
4
|
+
data.tar.gz: eb0d97cd60eb072a05341d39b983084ef6d601cad45af6d1205ad6162acd5b1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae7440f8c8eaacd212546c1284f1b167fc5d48dc6f160ea8373991c9a17c139621c93e829d6c3c4cb3df06b266bf1ba6ebc439a94ba5e246cca3f8aed9ca66d1
|
7
|
+
data.tar.gz: 9e9b7b861a12fb69f490ee1214975169b51582d277c19089124db252b148591c327e28639fa26c3b4720adc357b3716f0e5d7a6822cca5960e999586992365aa
|
@@ -0,0 +1,44 @@
|
|
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: ${RUBYGEMS_API_KEY}\n" > $HOME/.gem/credentials
|
39
|
+
gem build *.gemspec
|
40
|
+
gem push *.gem
|
41
|
+
env:
|
42
|
+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
43
|
+
RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
|
44
|
+
# RELEASE_COMMAND: rake release
|
@@ -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/.gitignore
CHANGED
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/README.EN.md
ADDED
@@ -0,0 +1,322 @@
|
|
1
|
+
|
2
|
+
# AxiTdl
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/axi_tdl.svg)](https://badge.fury.io/rb/axi_tdl)
|
4
|
+
[![Build Status](https://travis-ci.com/CookDarwin/axi_tdl.svg?branch=main)](https://travis-ci.com/CookDarwin/axi_tdl)
|
5
|
+
|
6
|
+
## Axi
|
7
|
+
  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.
|
8
|
+
|
9
|
+
  axi hdl path
|
10
|
+
```ruby
|
11
|
+
require 'axi_tdl'
|
12
|
+
AxiTdl::AXI_PATH
|
13
|
+
```
|
14
|
+
## Other
|
15
|
+
  It contain a simple interface that only define three signals, `valid`, `ready`, and `data`. I think it is useful for design.
|
16
|
+
|
17
|
+
## What is tdl?
|
18
|
+
  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.
|
19
|
+
|
20
|
+
## What tdl can do?
|
21
|
+
  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.
|
22
|
+
|
23
|
+
## Installation
|
24
|
+
|
25
|
+
Add this line to your application's Gemfile:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
gem 'axi_tdl'
|
29
|
+
```
|
30
|
+
|
31
|
+
And then execute:
|
32
|
+
|
33
|
+
$ bundle
|
34
|
+
|
35
|
+
Or install it yourself as:
|
36
|
+
|
37
|
+
$ gem install axi_tdl
|
38
|
+
|
39
|
+
## Code Example
|
40
|
+
|
41
|
+
### 1. define module
|
42
|
+
It will create a module of systemverilog that name is `test_module` in current dir.
|
43
|
+
```ruby
|
44
|
+
TdlBuild.test_module(__dir__) do
|
45
|
+
## Other code
|
46
|
+
end
|
47
|
+
```
|
48
|
+
the sv file look like this
|
49
|
+
```systemverilog
|
50
|
+
`timescale 1ns/1ps
|
51
|
+
module test_module(
|
52
|
+
);
|
53
|
+
endmodule
|
54
|
+
```
|
55
|
+
### 2. ports
|
56
|
+
```ruby
|
57
|
+
TdlBuild.test_module(__dir__) do
|
58
|
+
input.clock - 'clock'
|
59
|
+
input.reset('low') - 'rst_n'
|
60
|
+
input - 'd0'
|
61
|
+
input[32] - 'd32'
|
62
|
+
output[16] - 'o16'
|
63
|
+
output.logic[8] - 'o8'
|
64
|
+
output.logic - 'o1'
|
65
|
+
end
|
66
|
+
```
|
67
|
+
```systemverilog
|
68
|
+
module test_module (
|
69
|
+
input clock,
|
70
|
+
input rst_n,
|
71
|
+
input d0,
|
72
|
+
input [31:0] d32,
|
73
|
+
output [15:0] o16,
|
74
|
+
output logic[7:0] o8,
|
75
|
+
output logic o1
|
76
|
+
);
|
77
|
+
endmodule
|
78
|
+
```
|
79
|
+
|
80
|
+
## 3. interface
|
81
|
+
```ruby
|
82
|
+
TdlBuild.test_interface(__dir__) do
|
83
|
+
|
84
|
+
input.clock - 'clock'
|
85
|
+
input.reset('low') - 'rst_n'
|
86
|
+
input - 'd0'
|
87
|
+
input[32] - 'd32'
|
88
|
+
output[16] - 'o16'
|
89
|
+
output.logic[8] - 'o8'
|
90
|
+
output.logic - 'o1'
|
91
|
+
|
92
|
+
port.axis.slaver - 'axis_in'
|
93
|
+
port.axis.master - 'axis_out'
|
94
|
+
port.axis.mirror - 'axis_mirror'
|
95
|
+
|
96
|
+
port.data_c.master - 'intf_data_inf'
|
97
|
+
port.axi4.slaver - 'taxi4_inf'
|
98
|
+
|
99
|
+
end
|
100
|
+
```
|
101
|
+
```systemverilog
|
102
|
+
module test_module (
|
103
|
+
input clock,
|
104
|
+
input rst_n,
|
105
|
+
input d0,
|
106
|
+
input [31:0] d32,
|
107
|
+
output [15:0] o16,
|
108
|
+
output logic[7:0] o8,
|
109
|
+
output logic o1,
|
110
|
+
axi_stream_inf.slaver axis_in,
|
111
|
+
axi_stream_inf.master axis_out,
|
112
|
+
axi_stream_inf.mirror axis_mirror,
|
113
|
+
data_inf_c.master intf_data_inf,
|
114
|
+
axi_inf.slaver taxi4_inf
|
115
|
+
);
|
116
|
+
end
|
117
|
+
```
|
118
|
+
## 4. always assign
|
119
|
+
```ruby
|
120
|
+
TdlBuild.test_module(__dir__) do
|
121
|
+
input.clock - 'clock'
|
122
|
+
input.reset('low') - 'rst_n'
|
123
|
+
input - 'd0'
|
124
|
+
input[32] - 'd32'
|
125
|
+
output[16] - 'o16'
|
126
|
+
output.logic[8] - 'o8'
|
127
|
+
output.logic - 'o1'
|
128
|
+
|
129
|
+
port.axis.slaver - 'axis_in'
|
130
|
+
port.axis.master - 'axis_out'
|
131
|
+
port.axis.mirror - 'axis_mirror'
|
132
|
+
|
133
|
+
port.data_c.master - 'intf_data_inf'
|
134
|
+
port.axi4.slaver - 'taxi4_inf'
|
135
|
+
|
136
|
+
|
137
|
+
always_ff(posedge: clock,negedge: rst_n) do
|
138
|
+
IF ~rst_n do
|
139
|
+
o16 <= 0.A
|
140
|
+
end
|
141
|
+
ELSE do
|
142
|
+
IF d0 do
|
143
|
+
o16 <= 1.A
|
144
|
+
end
|
145
|
+
ELSE do
|
146
|
+
o16 <= o16 + 1.b1
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
always_comb do
|
152
|
+
o8 <= d32[7,0]
|
153
|
+
end
|
154
|
+
|
155
|
+
Assign do
|
156
|
+
o1 <= 1.b0
|
157
|
+
end
|
158
|
+
end
|
159
|
+
```
|
160
|
+
```systemverilog
|
161
|
+
module test_module (
|
162
|
+
input clock,
|
163
|
+
input rst_n,
|
164
|
+
input d0,
|
165
|
+
input [31:0] d32,
|
166
|
+
output [15:0] o16,
|
167
|
+
output logic[7:0] o8,
|
168
|
+
output logic o1,
|
169
|
+
axi_stream_inf.slaver axis_in,
|
170
|
+
axi_stream_inf.master axis_out,
|
171
|
+
axi_stream_inf.mirror axis_mirror,
|
172
|
+
data_inf_c.master intf_data_inf,
|
173
|
+
axi_inf.slaver taxi4_inf
|
174
|
+
);
|
175
|
+
|
176
|
+
always_ff@(posedge clock,negedge rst_n) begin
|
177
|
+
if(~rst_n)begin
|
178
|
+
o16 <= '0;
|
179
|
+
end
|
180
|
+
else begin
|
181
|
+
if(d0)begin
|
182
|
+
o16 <= '1;
|
183
|
+
end
|
184
|
+
else begin
|
185
|
+
o16 <= ( o16+1'b1);
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
always_comb begin
|
191
|
+
o8 = d32[7:0];
|
192
|
+
end
|
193
|
+
|
194
|
+
assign o1 = 1'b0;
|
195
|
+
|
196
|
+
endmodule
|
197
|
+
```
|
198
|
+
## 5. generate
|
199
|
+
```ruby
|
200
|
+
TdlBuild.test_generate(__dir__) do
|
201
|
+
parameter.NUM 8
|
202
|
+
input[8] - 'ain'
|
203
|
+
output[8] - 'bout'
|
204
|
+
|
205
|
+
input[param.NUM,6] - 'cin'
|
206
|
+
output[6,param.NUM] - 'dout'
|
207
|
+
|
208
|
+
input[param.NUM] - 'ein'
|
209
|
+
output[param.NUM] - 'fout'
|
210
|
+
|
211
|
+
generate(8) do |kk|
|
212
|
+
Assign do
|
213
|
+
bout[kk] <= ain[7-kk]
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
generate(param.NUM) do |cc|
|
218
|
+
IF cc < 4 do
|
219
|
+
Assign do
|
220
|
+
dout[cc] <= cin[cc]
|
221
|
+
end
|
222
|
+
end
|
223
|
+
ELSE do
|
224
|
+
Assign do
|
225
|
+
dout[cc] <= cin[cc] + cc
|
226
|
+
end
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
generate(param.NUM,6) do |ii,gg|
|
231
|
+
Assign do
|
232
|
+
fout[ii][gg] <= ein[gg][ii]
|
233
|
+
end
|
234
|
+
end
|
235
|
+
end
|
236
|
+
```
|
237
|
+
```systemverilog
|
238
|
+
module test_generate #(
|
239
|
+
parameter NUM = 8
|
240
|
+
)(
|
241
|
+
input [7:0] ain,
|
242
|
+
output [7:0] bout,
|
243
|
+
input [5:0] cin [NUM-1:0],
|
244
|
+
output [ NUM-1:0] dout [6-1:0],
|
245
|
+
input [ NUM-1:0] ein,
|
246
|
+
output [ NUM-1:0] fout
|
247
|
+
);
|
248
|
+
|
249
|
+
generate
|
250
|
+
for(genvar KK0=0;KK0 < 8;KK0++)begin
|
251
|
+
assign bout[ KK0] = ain[ 7-( KK0)];
|
252
|
+
end
|
253
|
+
endgenerate
|
254
|
+
|
255
|
+
generate
|
256
|
+
for(genvar KK0=0;KK0 < NUM;KK0++)begin
|
257
|
+
|
258
|
+
if( KK0<4)begin
|
259
|
+
assign dout[ KK0] = cin[ KK0];
|
260
|
+
end
|
261
|
+
else begin
|
262
|
+
assign dout[ KK0] = ( cin[ KK0]+( KK0));
|
263
|
+
end
|
264
|
+
end
|
265
|
+
endgenerate
|
266
|
+
|
267
|
+
generate
|
268
|
+
for(genvar KK0=0;KK0 < NUM;KK0++)begin
|
269
|
+
for(genvar KK1=0;KK1 < 6;KK1++)begin
|
270
|
+
assign fout[ KK0][ KK1] = ein[ KK1][ KK0];
|
271
|
+
end
|
272
|
+
end
|
273
|
+
endgenerate
|
274
|
+
|
275
|
+
endmodule
|
276
|
+
```
|
277
|
+
|
278
|
+
## 6. combin logic
|
279
|
+
```ruby
|
280
|
+
TdlBuild.test_logic_combin(__dir__) do
|
281
|
+
logic[7] - 'a0'
|
282
|
+
logic[5] - 'a1'
|
283
|
+
logic[9] - 'a2'
|
284
|
+
logic[9+5+7] - 'ca'
|
285
|
+
|
286
|
+
logic[2,8] - 'b0'
|
287
|
+
logic[16] - 'b1'
|
288
|
+
logic[32] - 'cb'
|
289
|
+
|
290
|
+
logic[1,8] - 'c0'
|
291
|
+
logic[3,8] - 'c1'
|
292
|
+
logic[2,16] - 'cc'
|
293
|
+
|
294
|
+
Assign do
|
295
|
+
ca <= logic_bind_(a0, a1, a2)
|
296
|
+
cb <= self.>>(b1, b0)
|
297
|
+
cc <= self.<<(c0, c1)
|
298
|
+
end
|
299
|
+
end
|
300
|
+
```
|
301
|
+
```systemverilog
|
302
|
+
module test_logic_combin ();
|
303
|
+
|
304
|
+
logic [7-1:0] a0 ;
|
305
|
+
logic [5-1:0] a1 ;
|
306
|
+
logic [9-1:0] a2 ;
|
307
|
+
logic [21-1:0] ca ;
|
308
|
+
logic [8-1:0] b0[2-1:0] ;
|
309
|
+
logic [16-1:0] b1 ;
|
310
|
+
logic [32-1:0] cb ;
|
311
|
+
logic [8-1:0] c0[1-1:0] ;
|
312
|
+
logic [8-1:0] c1[3-1:0] ;
|
313
|
+
logic [16-1:0] cc[2-1:0] ;
|
314
|
+
|
315
|
+
assign ca = {a0,a1,a2};
|
316
|
+
assign cb = {>>{b1,b0}};
|
317
|
+
assign cc = {<<{c0,c1}};
|
318
|
+
|
319
|
+
endmodule
|
320
|
+
```
|
321
|
+
|
322
|
+
|
data/README.md
CHANGED
@@ -1,53 +1,57 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# AxiTdl
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/axi_tdl.svg)](https://badge.fury.io/rb/axi_tdl)
|
3
|
+
[![Build Status](https://travis-ci.com/CookDarwin/axi_tdl.svg?branch=main)](https://travis-ci.com/CookDarwin/axi_tdl)
|
3
4
|
|
4
|
-
|
5
|
+
## Axi
|
6
|
+
  axi是一个 axi4 拓展库,它使用的是删减版的AXI4协议,使用systemverilog开发,除此外我还拓展了AXI4的一些信号。
|
7
|
+
|
8
|
+
  axi hdl 所在路径可以如下Ruby 脚本获取
|
5
9
|
```ruby
|
6
10
|
require 'axi_tdl'
|
7
11
|
AxiTdl::AXI_PATH
|
8
12
|
```
|
9
|
-
|
10
|
-
 &emsp
|
13
|
+
## 其他
|
14
|
+
  此库还包含一个简单的接口定义, 接口信号只有 `valid`, `ready`, 和 `data`. 对于一些轻量设计很有帮助。
|
11
15
|
|
12
|
-
##
|
13
|
-
  tdl
|
16
|
+
## tdl 是什么?
|
17
|
+
  tdl 是一种硬件构造语言, 和chisel类似, 但是更加有趣, 他是一种基于Ruby的DSL. 最终它会编译输出systemverilog。 tdl也是基于axi库做的设计。这两部分都包含这此gem包中。
|
14
18
|
|
15
|
-
##
|
16
|
-
 &emsp
|
19
|
+
## tdl 能做什么?
|
20
|
+
  使用tdl做设计开发, 语法类似systemverilog,这样更亲切。不止于此, tdl加入了大量的验证语法。tdl创建的初衷就是为了快速构建`逻辑系统`, 这就是tdl和其他硬件构造语言最大的区别。
|
17
21
|
|
18
|
-
##
|
22
|
+
## 安装
|
19
23
|
|
20
|
-
|
24
|
+
Gemfile中添加:
|
21
25
|
|
22
26
|
```ruby
|
23
27
|
gem 'axi_tdl'
|
24
28
|
```
|
25
29
|
|
26
|
-
|
30
|
+
然后执行:
|
27
31
|
|
28
32
|
$ bundle
|
29
33
|
|
30
|
-
|
34
|
+
或则通过gem命令安装:
|
31
35
|
|
32
36
|
$ gem install axi_tdl
|
33
37
|
|
34
|
-
##
|
38
|
+
## 代码示例
|
35
39
|
|
36
|
-
### 1.
|
37
|
-
|
40
|
+
### 1. 定义模块
|
41
|
+
在当前tdl所在的路径创建一个systemverilog模块文件,模块名为 `test_module`.
|
38
42
|
```ruby
|
39
43
|
TdlBuild.test_module(__dir__) do
|
40
44
|
## Other code
|
41
45
|
end
|
42
46
|
```
|
43
|
-
|
47
|
+
输出的systemverilog 文件如下:
|
44
48
|
```systemverilog
|
45
49
|
`timescale 1ns/1ps
|
46
50
|
module test_module(
|
47
51
|
);
|
48
52
|
endmodule
|
49
53
|
```
|
50
|
-
### 2.
|
54
|
+
### 2. 端口
|
51
55
|
```ruby
|
52
56
|
TdlBuild.test_module(__dir__) do
|
53
57
|
input.clock - 'clock'
|
@@ -72,7 +76,7 @@ module test_module (
|
|
72
76
|
endmodule
|
73
77
|
```
|
74
78
|
|
75
|
-
## 3.
|
79
|
+
## 3. 接口
|
76
80
|
```ruby
|
77
81
|
TdlBuild.test_interface(__dir__) do
|
78
82
|
|
@@ -270,7 +274,7 @@ endgenerate
|
|
270
274
|
endmodule
|
271
275
|
```
|
272
276
|
|
273
|
-
## 6.
|
277
|
+
## 6. 合并 logic
|
274
278
|
```ruby
|
275
279
|
TdlBuild.test_logic_combin(__dir__) do
|
276
280
|
logic[7] - 'a0'
|