axi_tdl 0.0.12 → 0.1.3
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 +4 -2
- data/.gitignore +3 -1
- data/README.EN.md +7 -2
- data/README.md +6 -2
- data/Rakefile +8 -1
- data/axi_tdl.gemspec +1 -2
- data/lib/axi/AXI4/axi4_direct_A1.sv +1 -1
- data/lib/axi/AXI4/axi4_direct_B1.sv +23 -23
- data/lib/axi/AXI4/axi4_direct_verc.sv +54 -54
- data/lib/axi/AXI4/axi4_dpram_cache.sv +34 -34
- data/lib/axi/AXI4/axis_to_axi4_wr.rb +1 -0
- data/lib/axi/AXI4/axis_to_axi4_wr.sv +24 -24
- data/lib/axi/AXI4/odata_pool_axi4_A3.sv +7 -0
- data/lib/axi/AXI4/packet_partition/axi4_partition_rd_verb.sv +33 -33
- data/lib/axi/AXI4/packet_partition/data_inf_partition.rb +2 -0
- data/lib/axi/AXI4/packet_partition/data_inf_partition.sv +72 -72
- data/lib/axi/AXI4/wide_axis_to_axi4_wr.rb +2 -1
- data/lib/axi/AXI4/wide_axis_to_axi4_wr.sv +21 -21
- data/lib/axi/AXI_stream/axi_stream_split_channel.rb +7 -1
- data/lib/axi/AXI_stream/axi_stream_split_channel.sv +45 -40
- data/lib/axi/AXI_stream/axis_head_cut_verb.sv +6 -2
- data/lib/axi/AXI_stream/axis_head_cut_verc.sv +30 -30
- data/lib/axi/AXI_stream/axis_insert_copy.rb +18 -4
- data/lib/axi/AXI_stream/axis_insert_copy.sv +29 -16
- data/lib/axi/AXI_stream/axis_pipe_sync_seam.sv +9 -9
- data/lib/axi/AXI_stream/axis_rom_contect_sim.sv +38 -38
- data/lib/axi/AXI_stream/axis_sim_master_model.rb +30 -0
- data/lib/axi/AXI_stream/axis_sim_master_model.sv +46 -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/AXI_stream/axis_split_channel_verb.sv +4 -4
- data/lib/axi/common/common_ram_sim_wrapper.sv +10 -10
- data/lib/axi/common/common_ram_wrapper.sv +13 -13
- data/lib/axi/data_interface/data_inf_c/data_c_pipe_sync_seam.sv +27 -27
- data/lib/axi/data_interface/data_inf_c/data_c_sim_master_model.sv +72 -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/platform_ip/fifo_36kb_long.sv +1 -1
- data/lib/axi/techbench/tb_axi_stream_split_channel.rb +69 -0
- data/lib/axi/techbench/tb_axi_stream_split_channel.sv +150 -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/public_atom_module/CheckPClock.sv +53 -0
- data/lib/public_atom_module/LICENSE.md +674 -0
- data/lib/public_atom_module/altera_xilinx_always_block_sw.rb +57 -0
- data/lib/public_atom_module/bits_decode.sv +71 -0
- data/lib/public_atom_module/bits_decode_verb.sv +71 -0
- data/lib/public_atom_module/bits_decode_verb_sdl.rb +24 -0
- data/lib/public_atom_module/broaden.v +43 -0
- data/lib/public_atom_module/broaden_and_cross_clk.v +47 -0
- data/lib/public_atom_module/ceiling.v +39 -0
- data/lib/public_atom_module/ceiling_A1.v +42 -0
- data/lib/public_atom_module/clock_rst.sv +64 -0
- data/lib/public_atom_module/cross_clk_sync.v +37 -0
- data/lib/public_atom_module/edge_generator.v +50 -0
- data/lib/public_atom_module/flooring.v +36 -0
- data/lib/public_atom_module/latch_data.v +30 -0
- data/lib/public_atom_module/latency.v +48 -0
- data/lib/public_atom_module/latency_dynamic.v +83 -0
- data/lib/public_atom_module/latency_long.v +84 -0
- data/lib/public_atom_module/latency_verb.v +52 -0
- data/lib/public_atom_module/once_event.sv +65 -0
- data/lib/public_atom_module/pipe_reg.v +93 -0
- data/lib/public_atom_module/pipe_reg_2write_ports.v +84 -0
- data/lib/public_atom_module/sim/clock_rst_verb.sv +54 -0
- data/lib/public_atom_module/sim/latency_long_tb.sv +49 -0
- data/lib/public_atom_module/sim/latency_long_tb.sv.bak +49 -0
- data/lib/tdl/Logic/logic_edge.rb +1 -1
- data/lib/tdl/auto_script/autogensdl.rb +16 -5
- data/lib/tdl/axi4/axi4_interconnect_verb.rb +49 -10
- data/lib/tdl/basefunc.rb +1 -0
- data/lib/tdl/class_hdl/hdl_always_comb.rb +8 -4
- data/lib/tdl/class_hdl/hdl_always_ff.rb +49 -8
- data/lib/tdl/class_hdl/hdl_assign.rb +12 -4
- data/lib/tdl/class_hdl/hdl_block_ifelse.rb +18 -16
- data/lib/tdl/class_hdl/hdl_foreach.rb +4 -4
- data/lib/tdl/class_hdl/hdl_function.rb +8 -6
- data/lib/tdl/class_hdl/hdl_generate.rb +9 -5
- data/lib/tdl/class_hdl/hdl_initial.rb +36 -13
- data/lib/tdl/class_hdl/hdl_module_def.rb +27 -7
- data/lib/tdl/class_hdl/hdl_package.rb +45 -0
- data/lib/tdl/class_hdl/hdl_redefine_opertor.rb +117 -24
- data/lib/tdl/class_hdl/hdl_struct.rb +3 -3
- data/lib/tdl/class_hdl/hdl_verify.rb +1 -1
- data/lib/tdl/elements/Reset.rb +5 -9
- data/lib/tdl/elements/clock.rb +5 -9
- data/lib/tdl/elements/data_inf.rb +0 -17
- data/lib/tdl/elements/logic.rb +9 -31
- data/lib/tdl/elements/mail_box.rb +6 -1
- data/lib/tdl/elements/originclass.rb +23 -48
- data/lib/tdl/elements/parameter.rb +6 -7
- data/lib/tdl/examples/10_random/exp_random.sv +3 -3
- data/lib/tdl/examples/11_test_unit/dve.tcl +6 -0
- 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/exp_test_unit_sim.sv +9 -0
- 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 -2
- data/lib/tdl/examples/11_test_unit/tb_exp_test_unit_sim.sv +42 -0
- 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 +13 -13
- 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/module_instance_test.sv +1 -1
- 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_inst_sugar.sv +1 -1
- data/lib/tdl/examples/2_hdl_class/tmp/test_module.sv +3 -3
- data/lib/tdl/examples/2_hdl_class/tmp/test_module_port.sv +1 -1
- data/lib/tdl/examples/2_hdl_class/tmp/test_module_var.sv +1 -1
- data/lib/tdl/examples/2_hdl_class/tmp/test_package.sv +2 -2
- 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/3_hdl_sdl_instance/main_md.sv +1 -1
- data/lib/tdl/examples/3_hdl_sdl_instance/sdl_md.sv +1 -1
- 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/6_module_with_interface/inf_collect.sv +1 -1
- data/lib/tdl/examples/7_module_with_package/body_package.sv +1 -1
- data/lib/tdl/examples/7_module_with_package/example_pkg.sv +5 -5
- data/lib/tdl/examples/7_module_with_package/head_package.sv +1 -1
- data/lib/tdl/examples/8_top_module/tb_test_top.sv +1 -2
- data/lib/tdl/examples/8_top_module/tb_test_top_sim.sv +29 -0
- data/lib/tdl/examples/8_top_module/test_top.sv +1 -1
- data/lib/tdl/examples/8_top_module/test_top_sim.sv +9 -0
- data/lib/tdl/examples/9_itegration/clock_manage/itgt_module_clock_manage.rb +13 -0
- data/lib/tdl/examples/9_itegration/clock_manage/test_clock_bb.sv +34 -0
- data/lib/tdl/examples/9_itegration/tb_test_top.sv +2 -2
- data/lib/tdl/examples/9_itegration/tb_test_tttop.sv +4 -2
- data/lib/tdl/examples/9_itegration/tb_test_tttop_sim.sv +39 -0
- data/lib/tdl/examples/9_itegration/test_top.sv +4 -4
- data/lib/tdl/examples/9_itegration/test_tttop.sv +4 -4
- data/lib/tdl/examples/9_itegration/test_tttop_sim.sv +9 -0
- data/lib/tdl/examples/9_itegration/top.rb +1 -0
- data/lib/tdl/exlib/axis_eth_ex.rb +95 -0
- data/lib/tdl/exlib/axis_verify.rb +265 -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/itegration_verb.rb +167 -130
- 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 +9 -9
- data/lib/tdl/sdlmodule/sdlmodlule_path_db.rb +34 -0
- data/lib/tdl/sdlmodule/sdlmodule.rb +79 -65
- data/lib/tdl/sdlmodule/sdlmodule_arraychain.rb +1 -1
- data/lib/tdl/sdlmodule/sdlmodule_draw.rb +81 -16
- data/lib/tdl/sdlmodule/sdlmodule_instance.rb +3 -0
- data/lib/tdl/sdlmodule/sdlmodule_port_define.rb +6 -6
- data/lib/tdl/sdlmodule/sdlmodule_varible.rb +6 -6
- data/lib/tdl/sdlmodule/test_unit_module.rb +283 -33
- data/lib/tdl/sdlmodule/test_unit_module.rb.bak +143 -0
- data/lib/tdl/sdlmodule/top_module.rb +62 -58
- data/lib/tdl/sdlmodule/top_module.rb.bak +547 -0
- data/lib/tdl/tdl.rb +18 -3
- data/lib/tdl/tdlerror/tdlerror.rb +1 -1
- metadata +54 -121
- data/CODE_OF_CONDUCT.md +0 -74
- data/lib/axi/AXI_stream/axis_length_split_writh_user.sv +0 -87
@@ -128,7 +128,7 @@ module TdlSpace
|
|
128
128
|
define_method(tdl_key) do
|
129
129
|
rel = self.instance_variable_get("@_#{tdl_key}_")
|
130
130
|
unless rel
|
131
|
-
"#{inst_name}.#{hdl_key}".to_nq
|
131
|
+
TdlSpace::ArrayChain.create(obj: "#{inst_name}.#{hdl_key}".to_nq, belong_to_module: belong_to_module)
|
132
132
|
else
|
133
133
|
rel
|
134
134
|
end
|
@@ -152,9 +152,9 @@ module TdlSpace
|
|
152
152
|
define_method('clock') do
|
153
153
|
rel = self.instance_variable_get("@_#{tdl_key}_")
|
154
154
|
if !dimension || dimension.empty?
|
155
|
-
rel || TdlSpace::ArrayChain.
|
155
|
+
rel || TdlSpace::ArrayChain.create(obj:"#{self.inst_name}.#{hdl_key}", belong_to_module: belong_to_module)
|
156
156
|
else
|
157
|
-
rel || TdlSpace::ArrayChain.
|
157
|
+
rel || TdlSpace::ArrayChain.create(obj:"#{self.inst_name}[0].#{hdl_key}", belong_to_module: belong_to_module)
|
158
158
|
end
|
159
159
|
end
|
160
160
|
|
@@ -171,7 +171,7 @@ module TdlSpace
|
|
171
171
|
self.class_exec(tdl_key) do |tdl_key|
|
172
172
|
define_method('reset') do
|
173
173
|
rel = self.instance_variable_get("@_#{tdl_key}_")
|
174
|
-
rel || TdlSpace::ArrayChain.
|
174
|
+
rel || TdlSpace::ArrayChain.create(obj:"#{self.inst_name}.#{hdl_key}", belong_to_module: belong_to_module)
|
175
175
|
end
|
176
176
|
|
177
177
|
define_method("reset=") do |arg|
|
@@ -200,7 +200,7 @@ module TdlSpace
|
|
200
200
|
self.class_exec(tdl_key) do |tdl_key|
|
201
201
|
define_method(tdl_key) do
|
202
202
|
rel = self.instance_variable_get("@_#{tdl_key}_") || default_value
|
203
|
-
rel || TdlSpace::ArrayChain.
|
203
|
+
rel || TdlSpace::ArrayChain.create(obj:"#{self.inst_name}.#{hdl_key}", belong_to_module: belong_to_module)
|
204
204
|
end
|
205
205
|
|
206
206
|
define_method("#{tdl_key}=") do |arg|
|
@@ -215,7 +215,7 @@ module TdlSpace
|
|
215
215
|
_io_map(e,e,nil,'sdata',nil)
|
216
216
|
self.class_exec(e) do |e|
|
217
217
|
define_method(e) do
|
218
|
-
TdlSpace::ArrayChain.
|
218
|
+
TdlSpace::ArrayChain.create(obj:"#{self.inst_name}.#{e}", belong_to_module: belong_to_module)
|
219
219
|
end
|
220
220
|
end
|
221
221
|
end
|
@@ -225,7 +225,7 @@ module TdlSpace
|
|
225
225
|
_io_map(name,name,nil,'pdata',dimension)
|
226
226
|
self.class_exec(name) do |e|
|
227
227
|
define_method(e) do
|
228
|
-
TdlSpace::ArrayChain.
|
228
|
+
TdlSpace::ArrayChain.create(obj:"#{self.inst_name}.#{e}", belong_to_module: belong_to_module)
|
229
229
|
end
|
230
230
|
end
|
231
231
|
end
|
@@ -374,7 +374,7 @@ module TdlSpace
|
|
374
374
|
e.slaver = true
|
375
375
|
end
|
376
376
|
end
|
377
|
-
TdlSpace::ArrayChain.
|
377
|
+
TdlSpace::ArrayChain.create(obj: self,lchain: a, belong_to_module: belong_to_module)
|
378
378
|
end
|
379
379
|
|
380
380
|
def instance(exp_len: nil)
|
@@ -537,7 +537,7 @@ module TdlSpace
|
|
537
537
|
end
|
538
538
|
|
539
539
|
module TdlSpace
|
540
|
-
class TdlBaseInterface
|
540
|
+
class TdlBaseInterface < AxiTdl::SdlModuleActiveBaseElm
|
541
541
|
extend VarElemenAttr
|
542
542
|
include VarElemenCore
|
543
543
|
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'sqlite3'
|
2
|
+
module AxiTdl
|
3
|
+
|
4
|
+
module SdlmodulePathDB
|
5
|
+
DB_PATH = File.join(__dir__, "../auto_script/tmp/sdlmodule_path_map.db" )
|
6
|
+
TARGET = SQLite3::Database.new DB_PATH
|
7
|
+
|
8
|
+
def self.ceate_sdlmoule_path_table
|
9
|
+
|
10
|
+
tabel = nil
|
11
|
+
TARGET.execute("SELECT count(*) FROM sqlite_master WHERE type='table' AND name='sdlmoule_mtime_path';") do |row|
|
12
|
+
tabel_exist = row
|
13
|
+
break
|
14
|
+
end
|
15
|
+
|
16
|
+
# Create a table
|
17
|
+
unless table
|
18
|
+
rows = TARGET.execute <<-SQL
|
19
|
+
create table sdlmoule_mtime_path (
|
20
|
+
name varchar(128),
|
21
|
+
path varchar(1024),
|
22
|
+
grade varchar(5),
|
23
|
+
blog varchar(50)
|
24
|
+
);
|
25
|
+
SQL
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
@@ -74,7 +74,7 @@ class SdlModule
|
|
74
74
|
if e.is_a? String
|
75
75
|
next
|
76
76
|
end
|
77
|
-
tmp = e.new(name:"#{head}_NC")
|
77
|
+
tmp = e.new(name:"#{head}_NC",belong_to_module: self)
|
78
78
|
tmp.belong_to_module = self
|
79
79
|
tmp.ghost = true
|
80
80
|
instance_variable_set("@#{head}_NC",tmp)
|
@@ -116,6 +116,7 @@ class SdlModule
|
|
116
116
|
attr_accessor :dont_gen_sv,:target_class
|
117
117
|
## 模块头部添加package引入
|
118
118
|
attr_accessor :head_import_packages
|
119
|
+
attr_accessor :instanced_and_parent_module
|
119
120
|
|
120
121
|
def initialize(name: "tdlmodule",out_sv_path: nil)
|
121
122
|
# $new_m = self
|
@@ -126,16 +127,6 @@ class SdlModule
|
|
126
127
|
@@allmodule << self
|
127
128
|
@module_name = name
|
128
129
|
@real_sv_path = File.join(@out_sv_path,"#{@module_name}.sv") if @out_sv_path
|
129
|
-
# @port_clocks = []
|
130
|
-
# @port_resets = []
|
131
|
-
# @port_params = []
|
132
|
-
# @port_logics = []
|
133
|
-
# @port_datainfs = []
|
134
|
-
# @port_datainf_c_s = []
|
135
|
-
# @port_videoinfs = []
|
136
|
-
# @port_axisinfs = []
|
137
|
-
# @port_axi4infs = []
|
138
|
-
# @port_axilinfs = []
|
139
130
|
|
140
131
|
@port_clocks = Hash.new
|
141
132
|
@port_resets = Hash.new
|
@@ -163,52 +154,16 @@ class SdlModule
|
|
163
154
|
# self.instance_variable_set("#{head_str}_NC",tmp)
|
164
155
|
end
|
165
156
|
create_ghost
|
166
|
-
|
167
|
-
# @Logic_collect = []
|
168
|
-
# @Logic_inst = []
|
169
|
-
# @Logic_draw = []
|
170
|
-
#
|
171
|
-
# @Clock_collect = []
|
172
|
-
# @Clock_inst = []
|
173
|
-
# @Clock_draw = []
|
174
|
-
#
|
175
|
-
# @Reset_collect = []
|
176
|
-
# @Reset_inst = []
|
177
|
-
# @Reset_draw = []
|
178
|
-
#
|
179
|
-
# @Parameter_collect = []
|
180
|
-
# @Parameter_inst = []
|
181
|
-
# @Parameter_draw = []
|
182
|
-
#
|
183
|
-
# @DataInf_collect = []
|
184
|
-
# @DataInf_inst = []
|
185
|
-
# @DataInf_draw = []
|
186
|
-
#
|
187
|
-
# @DataInf_C_collect = []
|
188
|
-
# @DataInf_C_inst = []
|
189
|
-
# @DataInf_C_draw = []
|
190
|
-
#
|
191
|
-
# @AxiStream_collect = []
|
192
|
-
# @AxiStream_inst = []
|
193
|
-
# @AxiStream_draw = []
|
194
|
-
#
|
195
|
-
# @AxiLite_collect = []
|
196
|
-
# @AxiLite_inst = []
|
197
|
-
# @AxiLite_draw = []
|
198
|
-
#
|
199
|
-
# @VideoInf_collect = []
|
200
|
-
# @VideoInf_inst = []
|
201
|
-
# @VideoInf_draw = []
|
202
|
-
#
|
203
|
-
# @Axi4_collect = []
|
204
|
-
# @Axi4_inst = []
|
205
|
-
# @Axi4_draw = []
|
157
|
+
|
206
158
|
if block_given?
|
207
159
|
yield(self)
|
208
160
|
end
|
209
161
|
|
210
162
|
@instanced_and_parent_module ||= Hash.new
|
211
163
|
@instance_and_children_module ||= Hash.new
|
164
|
+
|
165
|
+
## 记录当前模块被例化的 具体对象
|
166
|
+
@instances =[]
|
212
167
|
end
|
213
168
|
|
214
169
|
public
|
@@ -341,23 +296,26 @@ class SdlModule
|
|
341
296
|
## 例化模块
|
342
297
|
|
343
298
|
def method_missing(method,*args,&block)
|
299
|
+
rel = nil
|
300
|
+
ClassHDL::AssignDefOpertor.with_rollback_opertors(:old) do
|
301
|
+
@@_method_missing_sub_methds ||= []
|
302
|
+
|
303
|
+
@@_method_missing_sub_methds.each do |me|
|
304
|
+
rel = self.send(me,method,*args,&block)
|
305
|
+
if rel
|
306
|
+
rel
|
307
|
+
end
|
308
|
+
end
|
344
309
|
|
345
|
-
|
346
|
-
|
347
|
-
@@_method_missing_sub_methds.each do |me|
|
348
|
-
rel = self.send(me,method,*args,&block)
|
310
|
+
## 最后才调用阴性例化模块
|
311
|
+
rel = implicit_inst_module_method_missing(method,*args,&block)
|
349
312
|
if rel
|
350
|
-
|
313
|
+
rel
|
314
|
+
else
|
315
|
+
super
|
351
316
|
end
|
352
317
|
end
|
353
|
-
|
354
|
-
## 最后才调用阴性例化模块
|
355
|
-
rel = implicit_inst_module_method_missing(method,*args,&block)
|
356
|
-
if rel
|
357
|
-
return rel
|
358
|
-
else
|
359
|
-
super
|
360
|
-
end
|
318
|
+
return rel
|
361
319
|
end
|
362
320
|
end
|
363
321
|
|
@@ -468,4 +426,60 @@ class SdlModule
|
|
468
426
|
puts (fstr % [_indexs[xi], _names[xi], _paths[xi]])
|
469
427
|
end
|
470
428
|
end
|
471
|
-
end
|
429
|
+
end
|
430
|
+
|
431
|
+
class SdlModule
|
432
|
+
|
433
|
+
## 获取信号的绝对路径
|
434
|
+
def path_refs(&block)
|
435
|
+
collects = []
|
436
|
+
if self != TopModule.current.techbench
|
437
|
+
@instances.each do |it|
|
438
|
+
it.origin.parents_inst_tree do |tree|
|
439
|
+
ll = ["$root"]
|
440
|
+
rt = tree.reverse
|
441
|
+
rt.each_index do |index|
|
442
|
+
if rt[index].respond_to? :module_name
|
443
|
+
ll << rt[index].module_name
|
444
|
+
else
|
445
|
+
ll << rt[index].inst_name
|
446
|
+
end
|
447
|
+
end
|
448
|
+
# ll << it.inst_name
|
449
|
+
new_name = ll.join('.').to_nq
|
450
|
+
if block_given?
|
451
|
+
if yield(new_name)
|
452
|
+
collects << new_name
|
453
|
+
end
|
454
|
+
else
|
455
|
+
collects << new_name
|
456
|
+
end
|
457
|
+
end
|
458
|
+
end
|
459
|
+
else
|
460
|
+
collects = ["$root.#{self.module_name}".to_nq]
|
461
|
+
end
|
462
|
+
collects
|
463
|
+
end
|
464
|
+
|
465
|
+
## 定义获取 信号的绝对路径
|
466
|
+
def root_ref(&block)
|
467
|
+
ClassHDL::AssignDefOpertor.with_rollback_opertors(:old) do
|
468
|
+
rels = path_refs(&block)
|
469
|
+
if block_given?
|
470
|
+
sst = "block given"
|
471
|
+
else
|
472
|
+
sst = "no block"
|
473
|
+
end
|
474
|
+
|
475
|
+
if rels.size == 1
|
476
|
+
rels[0]
|
477
|
+
elsif rels.size == 0
|
478
|
+
raise TdlError.new "#{module_name} Cant find root ref {#{sst}}"
|
479
|
+
else
|
480
|
+
raise TdlError.new "#{module_name} Find multi root refs {#{sst}} \n#{rels.join("\n")}\n"
|
481
|
+
end
|
482
|
+
end
|
483
|
+
end
|
484
|
+
|
485
|
+
end
|
@@ -88,7 +88,7 @@ module TdlSpace
|
|
88
88
|
dimension = []
|
89
89
|
end
|
90
90
|
name = to_inp(name)
|
91
|
-
belong_to_module.Def.logic(name: name,dsize: @chain.last || 1,dimension: dimension,type: @type || 'logic')
|
91
|
+
rel = belong_to_module.Def.logic(name: name,dsize: @chain.last || 1,dimension: dimension,type: @type || 'logic')
|
92
92
|
end
|
93
93
|
|
94
94
|
def wire
|
@@ -51,28 +51,34 @@ class SdlModule
|
|
51
51
|
return if (@origin_sv || @dont_gen_sv)
|
52
52
|
pre_inst_stack_call
|
53
53
|
@out_sv_path ||= '..\..\tdl\test_sdlmodule'
|
54
|
-
#
|
54
|
+
if File.exist?(File.join(@out_sv_path,"#{module_name}.sv"))
|
55
|
+
old_str = File.open(File.join(@out_sv_path,"#{module_name}.sv")).read.sub(/\/\*.*?\*\//m,"").gsub(/\/\/.*/,"").sub(/^`timescale .*/,"").strip
|
56
|
+
|
57
|
+
|
58
|
+
head_str,body_str = build_module_verb(ex_param:ex_param,ex_port:ex_port,ex_up_code:ex_up_code,ex_down_code:ex_down_code)
|
59
|
+
new_str = head_str+body_str
|
60
|
+
if body_str.gsub(/\/\*.*?\*\//m,"").gsub(/\/\/.*/,"").strip != old_str
|
61
|
+
File.open(File.join(@out_sv_path,"#{module_name}.sv"),"w") do |f|
|
62
|
+
f.print new_str
|
63
|
+
end
|
64
|
+
end
|
65
|
+
else
|
55
66
|
File.open(File.join(@out_sv_path,"#{module_name}.sv"),"w") do |f|
|
56
|
-
f.
|
67
|
+
f.print build_module_verb(ex_param:ex_param,ex_port:ex_port,ex_up_code:ex_up_code,ex_down_code:ex_down_code).join("")
|
57
68
|
end
|
58
|
-
|
59
|
-
# Tdl.Puts "+INFO+ It generate SIM top File"
|
60
|
-
# File.open(File.join(out_sv_path,"#{module_name}_sim.sv"),"w") do |f|
|
61
|
-
# f.puts build_module(ex_param:ex_param,ex_port:ex_port,ex_up_code:ex_up_code,ex_down_code:ex_down_code)
|
62
|
-
# end
|
63
|
-
# end
|
69
|
+
end
|
64
70
|
end
|
65
71
|
|
66
|
-
def gen_sv_module_text
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
+
# def gen_sv_module_text
|
73
|
+
# # @out_sv_path ||= File.dirname(File.expand_path(__FILE__))
|
74
|
+
# return if (@origin_sv || @dont_gen_sv)
|
75
|
+
# pre_inst_stack_call
|
76
|
+
# @out_sv_path ||= '..\..\tdl\test_sdlmodule'
|
77
|
+
# # unless GlobalParam.sim
|
72
78
|
|
73
|
-
|
79
|
+
# return build_module(ex_param:ex_param,ex_port:ex_port,ex_up_code:ex_up_code,ex_down_code:ex_down_code)
|
74
80
|
|
75
|
-
end
|
81
|
+
# end
|
76
82
|
|
77
83
|
def build_module(ex_param:"",ex_port:"",ex_up_code:"",ex_down_code:"")
|
78
84
|
# Tdl.Puts pagination(module_name)
|
@@ -124,6 +130,58 @@ class SdlModule
|
|
124
130
|
return str
|
125
131
|
end
|
126
132
|
|
133
|
+
def build_module_verb(ex_param:"",ex_port:"",ex_up_code:"",ex_down_code:"") #return [ head, body]
|
134
|
+
# Tdl.Puts pagination(module_name)
|
135
|
+
Tdl.Build_SdlModule_Puts(module_name)
|
136
|
+
|
137
|
+
ex_param = ex_param.to_s unless ex_param
|
138
|
+
ex_port = ex_port.to_s unless ex_port
|
139
|
+
ex_up_code = ex_up_code.to_s unless ex_up_code
|
140
|
+
ex_down_code = ex_down_code.to_s unless ex_down_code
|
141
|
+
|
142
|
+
# gen_auto_method # auto generate class method for interface
|
143
|
+
# draw = Tdl.inst + Tdl.draw
|
144
|
+
|
145
|
+
instance_draw_str = instance_draw # It must run before vars_define_inst,because some signals define when inst
|
146
|
+
vars_exec_inst_str = vars_exec_inst # It must run before vars_define_inst,because some signals define when vars exec
|
147
|
+
|
148
|
+
post_str = post_inst_stack_call()
|
149
|
+
|
150
|
+
unless post_str.strip.empty?
|
151
|
+
post_str = pagination("ROOT REF") + post_str
|
152
|
+
end
|
153
|
+
|
154
|
+
draw = pagination("define") + vars_define_inst + pagination("instance") + instance_draw_str + pagination("expression") + vars_exec_inst_str + post_str
|
155
|
+
|
156
|
+
unless ex_up_code.empty?
|
157
|
+
ex_up_code = "\n//------>> EX CODE <<-------------------\n" + ex_up_code + "//------<< EX CODE >>-------------------\n"
|
158
|
+
end
|
159
|
+
|
160
|
+
unless ex_down_code.empty?
|
161
|
+
ex_down_code = "//------>> EX CODE <<-------------------\n" + ex_down_code + "//------<< EX CODE >>-------------------\n"
|
162
|
+
end
|
163
|
+
|
164
|
+
# str = module_head+"module #{@module_name}" + build_params(ex_param) + build_ports(ex_port) + ex_up_code + gen_lite_str() + draw + ex_down_code + "\nendmodule\n"
|
165
|
+
# unless GlobalParam.sim
|
166
|
+
module_name_str = @module_name
|
167
|
+
# else
|
168
|
+
# module_name_str = @module_name+"_sim"
|
169
|
+
# end
|
170
|
+
unless head_import_packages
|
171
|
+
str = "module #{module_name_str}" + build_params(ex_param) + build_ports(ex_port) + ex_up_code + draw + ex_down_code + "\nendmodule\n" + add_sub_module_file_paths
|
172
|
+
else
|
173
|
+
head_import_pkgs_str = head_import_packages.map{|e| "import #{e}::*;" }.join('')
|
174
|
+
str = "module #{module_name_str} #{head_import_pkgs_str}" + build_params(ex_param) + build_ports(ex_port) + ex_up_code + draw + ex_down_code + "\nendmodule\n" + add_sub_module_file_paths
|
175
|
+
end
|
176
|
+
|
177
|
+
create_vivado_tcl if @create_tcl
|
178
|
+
create_constraints_file if @create_sdc
|
179
|
+
|
180
|
+
# return str
|
181
|
+
return [module_head_verb, str]
|
182
|
+
end
|
183
|
+
|
184
|
+
|
127
185
|
private
|
128
186
|
|
129
187
|
def old_module_head
|
@@ -149,6 +207,13 @@ madified:
|
|
149
207
|
}
|
150
208
|
end
|
151
209
|
|
210
|
+
def module_head_verb
|
211
|
+
%Q{#{$__sdlmodule_head_logo__.sub(/created:.*/, "created: #{Time.now()}")}
|
212
|
+
#{macro_def}
|
213
|
+
#{head_class}
|
214
|
+
}
|
215
|
+
end
|
216
|
+
|
152
217
|
def head_class
|
153
218
|
case(@target_class.to_s)
|
154
219
|
when "AxiStream"
|
@@ -448,6 +448,9 @@ class SdlModule
|
|
448
448
|
# @ports = (@port_clocks + @port_resets + @port_logics + @port_datainfs + @port_datainf_c_s + @port_videoinfs + @port_axisinfs + @port_axi4infs + @port_axilinfs)
|
449
449
|
@instance_cnt ||= 0
|
450
450
|
inst_p = SdlInst.new(origin:self,name:name)
|
451
|
+
|
452
|
+
@instances ||= []
|
453
|
+
@instances << inst_p
|
451
454
|
|
452
455
|
@port_params.each do |k,v|
|
453
456
|
inst_p.inst_param_hash[k.to_s] = nil
|
@@ -65,7 +65,7 @@ class SdlModule
|
|
65
65
|
if value.is_a? Float
|
66
66
|
type = :real
|
67
67
|
end
|
68
|
-
tmp = Parameter.new(name:name.to_s,value:value,port:true,type:type,show:show)
|
68
|
+
tmp = Parameter.new(name:name.to_s,value:value,port:true,type:type,show:show, belong_to_module: self)
|
69
69
|
add_to_new_module("@port_params",tmp)
|
70
70
|
add_method_to_itgt(name,tmp)
|
71
71
|
tmp
|
@@ -87,7 +87,7 @@ class SdlModule
|
|
87
87
|
# tmp
|
88
88
|
# end
|
89
89
|
ClassHDL::AssignDefOpertor.with_rollback_opertors(:old) do
|
90
|
-
tmp = Logic.new(name:name,dsize:dsize,port:"input",dimension:dimension)
|
90
|
+
tmp = Logic.new(name:name,dsize:dsize,port:"input",dimension:dimension, belong_to_module: self)
|
91
91
|
add_to_new_module("@port_logics",tmp)
|
92
92
|
add_method_to_itgt(name,tmp)
|
93
93
|
tmp
|
@@ -109,7 +109,7 @@ class SdlModule
|
|
109
109
|
# tmp
|
110
110
|
# end
|
111
111
|
ClassHDL::AssignDefOpertor.with_rollback_opertors(:old) do
|
112
|
-
tmp = Logic.new(name:name,dsize:dsize,port:"output",dimension:dimension,type: 'logic')
|
112
|
+
tmp = Logic.new(name:name,dsize:dsize,port:"output",dimension:dimension,type: 'logic', belong_to_module: self)
|
113
113
|
add_to_new_module("@port_logics",tmp)
|
114
114
|
|
115
115
|
if block_given?
|
@@ -136,7 +136,7 @@ class SdlModule
|
|
136
136
|
# tmp
|
137
137
|
# end
|
138
138
|
ClassHDL::AssignDefOpertor.with_rollback_opertors(:old) do
|
139
|
-
tmp = Logic.new(name:name,dsize:dsize,port:"inout",dimension:dimension,type: '' )
|
139
|
+
tmp = Logic.new(name:name,dsize:dsize,port:"inout",dimension:dimension,type: '' , belong_to_module: self)
|
140
140
|
add_to_new_module("@port_logics",tmp)
|
141
141
|
|
142
142
|
if block_given?
|
@@ -150,7 +150,7 @@ class SdlModule
|
|
150
150
|
def Clock(name,freqM:100,port: :input,pin:[],iostd:[],dsize:1,pin_prop:nil)
|
151
151
|
port_name_chk(name)
|
152
152
|
pin,iostd = parse_pin_prop(pin_prop) if pin_prop
|
153
|
-
a = Clock.new(name:name,freqM:freqM,port:port,dsize:dsize)
|
153
|
+
a = Clock.new(name:name,freqM:freqM,port:port,dsize:dsize, belong_to_module: self)
|
154
154
|
add_to_new_module("@port_clocks",a)
|
155
155
|
|
156
156
|
if block_given?
|
@@ -164,7 +164,7 @@ class SdlModule
|
|
164
164
|
def Reset(name,port: :input,active:"low",pin:[],iostd:[],dsize:1,pin_prop:nil)
|
165
165
|
port_name_chk(name)
|
166
166
|
pin,iostd = parse_pin_prop(pin_prop) if pin_prop
|
167
|
-
a = Reset.new(name:name,active:active.to_s.downcase,port:port,dsize:dsize)
|
167
|
+
a = Reset.new(name:name,active:active.to_s.downcase,port:port,dsize:dsize, belong_to_module: self)
|
168
168
|
add_to_new_module("@port_resets",a)
|
169
169
|
# define_method(name){ a }
|
170
170
|
add_method_to_itgt(name,a)
|