axi_tdl 0.1.0 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +7 -0
- data/lib/axi/AXI4/axi4_direct_A1.sv +1 -1
- data/lib/axi/AXI4/axi4_direct_verc.sv +54 -54
- data/lib/axi/AXI4/axi4_dpram_cache.rb +1 -0
- data/lib/axi/AXI4/axi4_dpram_cache.sv +10 -10
- data/lib/axi/AXI4/axi4_rd_burst_track.sv +2 -1
- data/lib/axi/AXI4/axi4_wr_burst_track.sv +2 -1
- data/lib/axi/AXI4/axis_to_axi4_wr.sv +9 -9
- data/lib/axi/AXI4/odata_pool_axi4_A3.sv +7 -0
- data/lib/axi/AXI4/packet_partition/axi4_partition_rd_verb.sv +5 -5
- data/lib/axi/AXI4/packet_partition/data_inf_partition.rb +8 -4
- data/lib/axi/AXI4/packet_partition/data_inf_partition.sv +6 -6
- data/lib/axi/AXI4/wide_axis_to_axi4_wr.sv +12 -12
- data/lib/axi/AXI_stream/axi_stream_split_channel.sv +154 -0
- data/lib/axi/AXI_stream/axis_head_cut_verc.sv +242 -0
- data/lib/axi/AXI_stream/axis_insert_copy.sv +79 -0
- data/lib/axi/AXI_stream/axis_pipe_sync_seam.sv +48 -0
- data/lib/axi/AXI_stream/axis_rom_contect_sim.sv +113 -0
- data/lib/axi/AXI_stream/axis_sim_master_model.rb +2 -0
- data/lib/axi/AXI_stream/axis_sim_master_model.sv +46 -0
- data/lib/axi/AXI_stream/axis_split_channel_verb.sv +62 -0
- data/lib/axi/AXI_stream/data_width/axis_width_convert_verb.sv +50 -0
- data/lib/axi/AXI_stream/packet_fifo/axi_stream_packet_long_fifo.sv +2 -0
- data/lib/axi/AXI_stream/parse_big_field_table_verb.sv +5 -3
- data/lib/axi/common/common_ram_sim_wrapper.sv +1 -1
- data/lib/axi/common/common_ram_wrapper.sv +1 -1
- data/lib/axi/common/test_write_mem.sv +1 -1
- data/lib/axi/data_interface/data_inf_c/data_c_pipe_sync_seam.sv +13 -13
- data/lib/axi/data_interface/data_inf_c/data_c_sim_master_model.sv +14 -11
- data/lib/axi/platform_ip/fifo_36kb_long.sv +1 -1
- data/lib/axi/platform_ip/long_fifo_verb.sv +1 -1
- data/lib/axi/platform_ip/wide_fifo.sv +1 -1
- data/lib/axi/platform_ip/xilinx_fifo_verb.sv +1 -1
- data/lib/axi/platform_ip/xilinx_fifo_verc.sv +2 -1
- data/lib/axi/techbench/tb_axi_stream_split_channel.rb +2 -1
- data/lib/axi/techbench/tb_axi_stream_split_channel.sv +46 -45
- data/lib/axi_tdl.rb +31 -1
- 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/clock_rst_verc.sv +69 -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/public_atom_module/sim_system_pkg.sv +4 -0
- data/lib/public_atom_module/synth_system_pkg.sv +4 -0
- data/lib/tdl/Logic/logic_edge.rb +1 -1
- data/lib/tdl/auto_script/autogensdl.rb +2 -3
- data/lib/tdl/auto_script/import_hdl.rb +40 -5
- data/lib/tdl/axi4/axi4_interconnect_verb.rb +47 -10
- data/lib/tdl/class_hdl/hdl_always_comb.rb +4 -1
- data/lib/tdl/class_hdl/hdl_always_ff.rb +3 -3
- data/lib/tdl/class_hdl/hdl_assign.rb +7 -1
- data/lib/tdl/class_hdl/hdl_block_ifelse.rb +7 -7
- data/lib/tdl/class_hdl/hdl_foreach.rb +2 -2
- data/lib/tdl/class_hdl/hdl_function.rb +4 -4
- data/lib/tdl/class_hdl/hdl_generate.rb +5 -2
- data/lib/tdl/class_hdl/hdl_initial.rb +25 -3
- data/lib/tdl/class_hdl/hdl_module_def.rb +9 -6
- data/lib/tdl/class_hdl/hdl_package.rb +45 -0
- data/lib/tdl/class_hdl/hdl_redefine_opertor.rb +99 -27
- data/lib/tdl/class_hdl/hdl_struct.rb +2 -2
- 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 +17 -47
- data/lib/tdl/elements/parameter.rb +5 -6
- data/lib/tdl/examples/11_test_unit/dve.tcl +6 -153
- data/lib/tdl/examples/11_test_unit/exp_test_unit.sv +2 -2
- data/lib/tdl/examples/11_test_unit/exp_test_unit_sim.sv +9 -0
- data/lib/tdl/examples/11_test_unit/modules/sub_md0.sv +2 -2
- data/lib/tdl/examples/11_test_unit/modules/sub_md1.sv +2 -2
- data/lib/tdl/examples/11_test_unit/tb_exp_test_unit.sv +1 -1
- data/lib/tdl/examples/11_test_unit/tb_exp_test_unit_sim.sv +41 -0
- data/lib/tdl/examples/11_test_unit/tu0.sv +2 -1
- data/lib/tdl/examples/1_define_module/exmple_md.sv +1 -1
- data/lib/tdl/examples/2_hdl_class/tmp/always_comb_test.sv +3 -3
- data/lib/tdl/examples/2_hdl_class/tmp/always_ff_test.sv +3 -3
- data/lib/tdl/examples/2_hdl_class/tmp/case_test.sv +3 -3
- 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 +3 -3
- data/lib/tdl/examples/2_hdl_class/tmp/state_case_test.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 +2 -2
- data/lib/tdl/examples/2_hdl_class/tmp/test_module_var.sv +7 -7
- data/lib/tdl/examples/2_hdl_class/tmp/test_package.sv +4 -3
- data/lib/tdl/examples/2_hdl_class/tmp/test_vcs_string.sv +1 -1
- data/lib/tdl/examples/3_hdl_sdl_instance/main_md.sv +2 -2
- data/lib/tdl/examples/3_hdl_sdl_instance/sdl_md.sv +1 -1
- data/lib/tdl/examples/6_module_with_interface/example_interface.sv +8 -8
- data/lib/tdl/examples/6_module_with_interface/inf_collect.sv +9 -9
- data/lib/tdl/examples/7_module_with_package/body_package.sv +4 -3
- data/lib/tdl/examples/7_module_with_package/example_pkg.sv +1 -1
- data/lib/tdl/examples/7_module_with_package/head_package.sv +4 -3
- data/lib/tdl/examples/8_top_module/dve.tcl +6 -0
- data/lib/tdl/examples/8_top_module/tb_test_top.sv +1 -1
- 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/test_clock_bb.sv +2 -1
- data/lib/tdl/examples/9_itegration/dve.tcl +155 -2
- data/lib/tdl/examples/9_itegration/tb_test_tttop.sv +1 -1
- data/lib/tdl/examples/9_itegration/tb_test_tttop_sim.sv +1 -1
- data/lib/tdl/examples/9_itegration/test_tttop.sv +7 -38
- data/lib/tdl/examples/9_itegration/test_tttop_sim.sv +38 -7
- data/lib/tdl/exlib/axis_verify.rb +4 -3
- data/lib/tdl/exlib/constraints_verb.rb +1 -0
- data/lib/tdl/exlib/itegration_verb.rb +47 -41
- data/lib/tdl/rebuild_ele/ele_base.rb +15 -10
- data/lib/tdl/sdlmodule/sdlmodule.rb +117 -51
- data/lib/tdl/sdlmodule/sdlmodule_arraychain.rb +1 -1
- data/lib/tdl/sdlmodule/sdlmodule_draw.rb +2 -2
- 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 +6 -0
- data/lib/tdl/sdlmodule/top_module.rb +4 -0
- data/lib/tdl/tdl.rb +1 -11
- data/lib/tdl/tdlerror/tdlerror.rb +1 -1
- metadata +43 -5
- data/CODE_OF_CONDUCT.md +0 -74
- data/lib/axi/AXI_stream/axis_length_split_writh_user.sv +0 -87
@@ -1,40 +1,9 @@
|
|
1
|
-
/**********************************************
|
2
|
-
_______________________________________
|
3
|
-
___________ Cook Darwin __________
|
4
|
-
_______________________________________
|
5
|
-
descript:
|
6
|
-
author : Cook.Darwin
|
7
|
-
Version: VERA.0.0
|
8
|
-
created: 2021-03-21 10:19:00 +0800
|
9
|
-
madified:
|
10
|
-
***********************************************/
|
11
|
-
`timescale 1ns/1ps
|
12
|
-
|
13
|
-
module test_tttop (
|
14
|
-
input global_sys_clk
|
15
|
-
);
|
16
|
-
|
17
|
-
//==========================================================================
|
18
|
-
//-------- define ----------------------------------------------------------
|
19
|
-
logic clock_100M;
|
20
|
-
logic rstn_100M;
|
21
|
-
axi_stream_inf #(.DSIZE(16),.USIZE(1)) x_origin_inf (.aclk(clock_100M),.aresetn(rstn_100M),.aclken(1'b1)) ;
|
22
|
-
//==========================================================================
|
23
|
-
//-------- instance --------------------------------------------------------
|
24
|
-
simple_clock simple_clock_inst(
|
25
|
-
/* input clock */.sys_clk (global_sys_clk ),
|
26
|
-
/* output clock */.clock (clock_100M ),
|
27
|
-
/* output reset */.rst_n (rstn_100M )
|
28
|
-
);
|
29
|
-
a_test_md a_test_md_inst(
|
30
|
-
/* input clock */.clock (clock_100M ),
|
31
|
-
/* input reset */.rst (~rstn_100M ),
|
32
|
-
/* axi_stream_inf.master */.origin_inf (x_origin_inf )
|
33
|
-
);
|
34
|
-
//==========================================================================
|
35
|
-
//-------- expression ------------------------------------------------------
|
36
|
-
assign x_origin_inf.axis_tvalid = 1'b0;
|
37
|
-
assign x_origin_inf.axis_tdata = '0;
|
38
|
-
assign x_origin_inf.axis_tlast = 1'b0;
|
39
1
|
|
2
|
+
`timescale 1ns/1ps
|
3
|
+
module test_tttop();
|
4
|
+
initial begin
|
5
|
+
#(1us);
|
6
|
+
$warning("Check TopModule.sim,please!!!");
|
7
|
+
$stop;
|
8
|
+
end
|
40
9
|
endmodule
|
@@ -1,9 +1,40 @@
|
|
1
|
-
|
1
|
+
/**********************************************
|
2
|
+
_______________________________________
|
3
|
+
___________ Cook Darwin __________
|
4
|
+
_______________________________________
|
5
|
+
descript:
|
6
|
+
author : Cook.Darwin
|
7
|
+
Version: VERA.0.0
|
8
|
+
created: 2021-05-30 12:21:54 +0800
|
9
|
+
madified:
|
10
|
+
***********************************************/
|
2
11
|
`timescale 1ns/1ps
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
12
|
+
|
13
|
+
module test_tttop_sim (
|
14
|
+
input global_sys_clk
|
15
|
+
);
|
16
|
+
|
17
|
+
//==========================================================================
|
18
|
+
//-------- define ----------------------------------------------------------
|
19
|
+
logic clock_100M;
|
20
|
+
logic rstn_100M;
|
21
|
+
axi_stream_inf #(.DSIZE(16),.FreqM(100),.USIZE(1)) x_origin_inf (.aclk(clock_100M),.aresetn(rstn_100M),.aclken(1'b1)) ;
|
22
|
+
//==========================================================================
|
23
|
+
//-------- instance --------------------------------------------------------
|
24
|
+
simple_clock simple_clock_inst(
|
25
|
+
/* input clock */.sys_clk (global_sys_clk ),
|
26
|
+
/* output clock */.clock (clock_100M ),
|
27
|
+
/* output reset */.rst_n (rstn_100M )
|
28
|
+
);
|
29
|
+
a_test_md a_test_md_inst(
|
30
|
+
/* input clock */.clock (clock_100M ),
|
31
|
+
/* input reset */.rst (~rstn_100M ),
|
32
|
+
/* axi_stream_inf.master */.origin_inf (x_origin_inf )
|
33
|
+
);
|
34
|
+
//==========================================================================
|
35
|
+
//-------- expression ------------------------------------------------------
|
36
|
+
assign x_origin_inf.axis_tvalid = 1'b0;
|
37
|
+
assign x_origin_inf.axis_tdata = '0;
|
38
|
+
assign x_origin_inf.axis_tlast = 1'b0;
|
39
|
+
|
9
40
|
endmodule
|
@@ -128,9 +128,9 @@ end
|
|
128
128
|
|
129
129
|
class AxiStream
|
130
130
|
|
131
|
-
def to_simple_sim_master_coe(length: [10,200], gap_len: [0,10], data: [ (0...100) ] , vld_perc: [50, 100], loop_coe: true)
|
131
|
+
def to_simple_sim_master_coe(enable: 1.b1, length: [10,200], gap_len: [0,10], data: [ (0...100) ] , vld_perc: [50, 100], loop_coe: true)
|
132
132
|
# raise TdlError.new "file cant be empty" unless file
|
133
|
-
file = File.join(AxiTdl::TDL_PATH,"./auto_script/tmp/","#{self.name}_#{globle_random_name_flag}.coe")
|
133
|
+
file = File.join(AxiTdl::TDL_PATH,"./auto_script/tmp/","coe_#{self.name}_#{globle_random_name_flag}.coe")
|
134
134
|
_sps = nil
|
135
135
|
ClassHDL::AssignDefOpertor.with_rollback_opertors(:old) do
|
136
136
|
require_sdl 'axis_sim_master_model.rb'
|
@@ -144,11 +144,12 @@ class AxiStream
|
|
144
144
|
_sps
|
145
145
|
end
|
146
146
|
|
147
|
-
@belong_to_module.instance_exec(self,file,loop_coe) do |_self,file,loop_coe|
|
147
|
+
@belong_to_module.instance_exec(self,file,loop_coe,enable) do |_self,file,loop_coe,_enable|
|
148
148
|
|
149
149
|
Instance(:axis_sim_master_model,"sim_model_inst_#{_self.name}") do |h|
|
150
150
|
h.param.LOOP (loop_coe ? "TRUE" : "FALSE")
|
151
151
|
h.param.RAM_DEPTH File.open(File.expand_path(file)).readlines.size
|
152
|
+
h.input.enable _enable
|
152
153
|
h.input.load_trigger 1.b0
|
153
154
|
h.input[32].total_length h.param.RAM_DEPTH
|
154
155
|
h.input[512*8].mem_file File.expand_path(file) # {axis_tvalid, axis_tuser, axis_tkeep, axis_tlast, axis_tdata}
|
@@ -41,6 +41,7 @@ class ConstraintsVerb
|
|
41
41
|
pulltype = ([pulltype] * pin_name.size ) unless pulltype.is_a? Array
|
42
42
|
drive = ([drive] * pin_name.size ) unless drive.is_a? Array
|
43
43
|
|
44
|
+
pin_name = ((pin_name.is_a?(Array) && pin_name) || [pin_name] )
|
44
45
|
pin_name.each_index do |index|
|
45
46
|
@package_pin_and_IOSTANDARD << [port_name[index],pin_name[index].to_s.upcase,iostandard[index].to_s.upcase,pulltype[index].to_s,drive[index].to_s]
|
46
47
|
|
@@ -493,7 +493,7 @@ class ItegrationVerb
|
|
493
493
|
def self.test_unit_inst(&filter_block)
|
494
494
|
# blocks = self.instance_variable_get("@_inst_test_unit_blocks_")
|
495
495
|
# blocks = instance_variable_get("@_inst_test_unit_blocks_") || []
|
496
|
-
blocks = @@_inst_test_unit_blocks_
|
496
|
+
blocks = @@_inst_test_unit_blocks_ || []
|
497
497
|
return unless blocks
|
498
498
|
return if blocks.empty?
|
499
499
|
return unless TopModule.sim
|
@@ -671,39 +671,42 @@ class ItegrationVerb
|
|
671
671
|
end
|
672
672
|
end
|
673
673
|
## 先从 已经加入的隐性itgt搜索
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
674
|
+
## 去除隐性引入
|
675
|
+
unless TopModule.itgt_implicit_reject
|
676
|
+
@top_module.implicit_itgt_collect.each do |i|
|
677
|
+
explort_attrs = i.class.get_itgt_var('itegration_explort_collect')
|
678
|
+
if ((explort_attrs & container_attrs).sort == container_attrs.sort && i.flag_match(flag_attrs))
|
679
|
+
# puts "Itgt Good"
|
680
|
+
mark = true
|
681
|
+
unless self.respond_to? e
|
682
|
+
define_singleton_method(e) do
|
683
|
+
## 如果从其他模块调用则出发 dynac_active
|
684
|
+
ItegrationVerbAgent.new(i)
|
685
|
+
end
|
686
|
+
i.link_eval
|
687
|
+
i.child_inst_itgt << self
|
683
688
|
end
|
684
|
-
|
685
|
-
i.child_inst_itgt << self
|
689
|
+
break
|
686
690
|
end
|
687
|
-
break
|
688
691
|
end
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
692
|
+
next if mark ## 找到了 就处理下一个Link
|
693
|
+
## 如果没有找到 再从 ItegrationVerb children里面找到比加入
|
694
|
+
@@child.each do |c|
|
695
|
+
explort_attrs = c.get_itgt_var('itegration_explort_collect')
|
696
|
+
# puts explort_attrs
|
697
|
+
if ((explort_attrs & container_attrs).sort == container_attrs.sort && c.flag_match(flag_attrs))
|
698
|
+
# puts "Child Good"
|
699
|
+
isp = @top_module.add_itegration(c.to_s,nickname:'implicit',implicit:true)
|
700
|
+
@top_module.implicit_itgt_collect << isp
|
701
|
+
## 如果是隐性添加,先不要加入pin_map
|
702
|
+
define_singleton_method(e) do
|
703
|
+
ItegrationVerbAgent.new(isp)
|
704
|
+
end
|
705
|
+
isp.link_eval
|
706
|
+
isp.child_inst_itgt << self
|
707
|
+
mark = true
|
708
|
+
break
|
702
709
|
end
|
703
|
-
isp.link_eval
|
704
|
-
isp.child_inst_itgt << self
|
705
|
-
mark = true
|
706
|
-
break
|
707
710
|
end
|
708
711
|
end
|
709
712
|
|
@@ -736,18 +739,21 @@ class ItegrationVerb
|
|
736
739
|
next if mark ## 找到了 就处理下一个Link
|
737
740
|
##
|
738
741
|
## 如果没有找到 再从 ItegrationVerb children里面找到比加入
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
742
|
+
## 去除隐性引入
|
743
|
+
unless TopModule.itgt_implicit_reject
|
744
|
+
@@child.each do |c|
|
745
|
+
explort_attrs = c.get_itgt_var('itegration_explort_collect')
|
746
|
+
if (explort_attrs & container_attrs).sort == container_attrs.sort
|
747
|
+
isp = @top_module.add_itegration(c.to_s,nickname:'implicit',implicit:true)
|
748
|
+
@top_module.implicit_itgt_collect << isp
|
749
|
+
## 如果是隐性添加,先不要加入pin_map
|
745
750
|
|
746
|
-
|
747
|
-
|
751
|
+
define_singleton_method(e) do
|
752
|
+
ItegrationVerbAgent.new(isp)
|
753
|
+
end
|
754
|
+
mark = true
|
755
|
+
break
|
748
756
|
end
|
749
|
-
mark = true
|
750
|
-
break
|
751
757
|
end
|
752
758
|
end
|
753
759
|
|
@@ -770,7 +776,7 @@ class ItegrationVerb
|
|
770
776
|
end
|
771
777
|
|
772
778
|
## 添加测试用例
|
773
|
-
|
779
|
+
@@_inst_test_unit_blocks_ = []
|
774
780
|
def self.def_test_unit(name,path,&block)
|
775
781
|
# @@_inst_test_unit_blocks_ = instance_variable_get("@_inst_test_unit_blocks_")
|
776
782
|
@@_inst_test_unit_blocks_ ||= []
|
@@ -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)
|
@@ -432,11 +432,16 @@ module TdlSpace
|
|
432
432
|
vv = rel || v[1]
|
433
433
|
# vv = self.send(k) || v[1]
|
434
434
|
## 不例化 FreqM,FreqM只是为了SDL兼容
|
435
|
-
if vv && k.to_s != 'freqM'
|
435
|
+
# if vv && k.to_s != 'freqM'
|
436
|
+
if vv
|
436
437
|
if vv.instance_of?(String)
|
437
438
|
str << ".#{v[0]}(\"#{vv}\")"
|
438
439
|
else
|
439
|
-
|
440
|
+
if k.to_s == 'freqM'
|
441
|
+
str << ".#{v[0]}(#{(respond_to?(:clock) && self.clock.is_a?(Clock) && self.clock.freqM ) || vv})"
|
442
|
+
else
|
443
|
+
str << ".#{v[0]}(#{vv})"
|
444
|
+
end
|
440
445
|
end
|
441
446
|
end
|
442
447
|
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)
|
@@ -127,16 +127,6 @@ class SdlModule
|
|
127
127
|
@@allmodule << self
|
128
128
|
@module_name = name
|
129
129
|
@real_sv_path = File.join(@out_sv_path,"#{@module_name}.sv") if @out_sv_path
|
130
|
-
# @port_clocks = []
|
131
|
-
# @port_resets = []
|
132
|
-
# @port_params = []
|
133
|
-
# @port_logics = []
|
134
|
-
# @port_datainfs = []
|
135
|
-
# @port_datainf_c_s = []
|
136
|
-
# @port_videoinfs = []
|
137
|
-
# @port_axisinfs = []
|
138
|
-
# @port_axi4infs = []
|
139
|
-
# @port_axilinfs = []
|
140
130
|
|
141
131
|
@port_clocks = Hash.new
|
142
132
|
@port_resets = Hash.new
|
@@ -164,52 +154,16 @@ class SdlModule
|
|
164
154
|
# self.instance_variable_set("#{head_str}_NC",tmp)
|
165
155
|
end
|
166
156
|
create_ghost
|
167
|
-
|
168
|
-
# @Logic_collect = []
|
169
|
-
# @Logic_inst = []
|
170
|
-
# @Logic_draw = []
|
171
|
-
#
|
172
|
-
# @Clock_collect = []
|
173
|
-
# @Clock_inst = []
|
174
|
-
# @Clock_draw = []
|
175
|
-
#
|
176
|
-
# @Reset_collect = []
|
177
|
-
# @Reset_inst = []
|
178
|
-
# @Reset_draw = []
|
179
|
-
#
|
180
|
-
# @Parameter_collect = []
|
181
|
-
# @Parameter_inst = []
|
182
|
-
# @Parameter_draw = []
|
183
|
-
#
|
184
|
-
# @DataInf_collect = []
|
185
|
-
# @DataInf_inst = []
|
186
|
-
# @DataInf_draw = []
|
187
|
-
#
|
188
|
-
# @DataInf_C_collect = []
|
189
|
-
# @DataInf_C_inst = []
|
190
|
-
# @DataInf_C_draw = []
|
191
|
-
#
|
192
|
-
# @AxiStream_collect = []
|
193
|
-
# @AxiStream_inst = []
|
194
|
-
# @AxiStream_draw = []
|
195
|
-
#
|
196
|
-
# @AxiLite_collect = []
|
197
|
-
# @AxiLite_inst = []
|
198
|
-
# @AxiLite_draw = []
|
199
|
-
#
|
200
|
-
# @VideoInf_collect = []
|
201
|
-
# @VideoInf_inst = []
|
202
|
-
# @VideoInf_draw = []
|
203
|
-
#
|
204
|
-
# @Axi4_collect = []
|
205
|
-
# @Axi4_inst = []
|
206
|
-
# @Axi4_draw = []
|
157
|
+
|
207
158
|
if block_given?
|
208
159
|
yield(self)
|
209
160
|
end
|
210
161
|
|
211
162
|
@instanced_and_parent_module ||= Hash.new
|
212
163
|
@instance_and_children_module ||= Hash.new
|
164
|
+
|
165
|
+
## 记录当前模块被例化的 具体对象
|
166
|
+
@instances =[]
|
213
167
|
end
|
214
168
|
|
215
169
|
public
|
@@ -473,3 +427,115 @@ class SdlModule
|
|
473
427
|
end
|
474
428
|
end
|
475
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
|
486
|
+
|
487
|
+
## 迭代 本模块及本模块的子模块
|
488
|
+
class SdlModule
|
489
|
+
|
490
|
+
def all_ref_sdlmodules(&block)
|
491
|
+
sdlms = instance_and_children_module.values.uniq
|
492
|
+
sdlms = sdlms.map do |e|
|
493
|
+
if e.instance_and_children_module.any?
|
494
|
+
e.all_ref_sdlmodules(&block)
|
495
|
+
else
|
496
|
+
e
|
497
|
+
end
|
498
|
+
end
|
499
|
+
sdlms = sdlms.unshift(self)
|
500
|
+
sdlms = sdlms.flatten
|
501
|
+
sdlms.map(&block)
|
502
|
+
end
|
503
|
+
|
504
|
+
end
|
505
|
+
|
506
|
+
### 有时候 sdlmodule 引用的是 HDL文件,为了能够 正常引用到 需要特殊处理
|
507
|
+
class SdlModule
|
508
|
+
def contain_hdl(*hdl_names)
|
509
|
+
__contain_hdl__(false,*hdl_names)
|
510
|
+
end
|
511
|
+
|
512
|
+
def __contain_hdl__(recreate,*hdl_names)
|
513
|
+
hdl_names = hdl_names.map do |e|
|
514
|
+
|
515
|
+
if e.include?("/") || e.include?("\\")
|
516
|
+
e
|
517
|
+
else
|
518
|
+
|
519
|
+
ee = find_first_hdl_path(e)
|
520
|
+
if recreate && !ee
|
521
|
+
raise TdlError.new("Cant find #{e} in tdl_paths")
|
522
|
+
end
|
523
|
+
ee || e
|
524
|
+
end
|
525
|
+
end
|
526
|
+
unless recreate
|
527
|
+
@__contain_hdl__ ||= []
|
528
|
+
@__contain_hdl__ += hdl_names
|
529
|
+
else
|
530
|
+
@__contain_hdl__ = hdl_names
|
531
|
+
end
|
532
|
+
@__contain_hdl__.uniq!
|
533
|
+
@__contain_hdl__
|
534
|
+
end
|
535
|
+
|
536
|
+
def require_hdl(*hdl_path)
|
537
|
+
hdl_path.each do |hp|
|
538
|
+
__require_hdl__(hp,self)
|
539
|
+
end
|
540
|
+
end
|
541
|
+
end
|