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.
Files changed (175) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/gem-push.yml +4 -2
  3. data/.gitignore +3 -1
  4. data/README.EN.md +7 -2
  5. data/README.md +6 -2
  6. data/Rakefile +8 -1
  7. data/axi_tdl.gemspec +1 -2
  8. data/lib/axi/AXI4/axi4_direct_A1.sv +1 -1
  9. data/lib/axi/AXI4/axi4_direct_B1.sv +23 -23
  10. data/lib/axi/AXI4/axi4_direct_verc.sv +54 -54
  11. data/lib/axi/AXI4/axi4_dpram_cache.sv +34 -34
  12. data/lib/axi/AXI4/axis_to_axi4_wr.rb +1 -0
  13. data/lib/axi/AXI4/axis_to_axi4_wr.sv +24 -24
  14. data/lib/axi/AXI4/odata_pool_axi4_A3.sv +7 -0
  15. data/lib/axi/AXI4/packet_partition/axi4_partition_rd_verb.sv +33 -33
  16. data/lib/axi/AXI4/packet_partition/data_inf_partition.rb +2 -0
  17. data/lib/axi/AXI4/packet_partition/data_inf_partition.sv +72 -72
  18. data/lib/axi/AXI4/wide_axis_to_axi4_wr.rb +2 -1
  19. data/lib/axi/AXI4/wide_axis_to_axi4_wr.sv +21 -21
  20. data/lib/axi/AXI_stream/axi_stream_split_channel.rb +7 -1
  21. data/lib/axi/AXI_stream/axi_stream_split_channel.sv +45 -40
  22. data/lib/axi/AXI_stream/axis_head_cut_verb.sv +6 -2
  23. data/lib/axi/AXI_stream/axis_head_cut_verc.sv +30 -30
  24. data/lib/axi/AXI_stream/axis_insert_copy.rb +18 -4
  25. data/lib/axi/AXI_stream/axis_insert_copy.sv +29 -16
  26. data/lib/axi/AXI_stream/axis_pipe_sync_seam.sv +9 -9
  27. data/lib/axi/AXI_stream/axis_rom_contect_sim.sv +38 -38
  28. data/lib/axi/AXI_stream/axis_sim_master_model.rb +30 -0
  29. data/lib/axi/AXI_stream/axis_sim_master_model.sv +46 -0
  30. data/lib/axi/AXI_stream/axis_sim_slaver_model.rb +26 -0
  31. data/lib/axi/AXI_stream/axis_sim_verify_by_coe.sv +101 -0
  32. data/lib/axi/AXI_stream/axis_split_channel_verb.rb +2 -0
  33. data/lib/axi/AXI_stream/axis_split_channel_verb.sv +4 -4
  34. data/lib/axi/common/common_ram_sim_wrapper.sv +10 -10
  35. data/lib/axi/common/common_ram_wrapper.sv +13 -13
  36. data/lib/axi/data_interface/data_inf_c/data_c_pipe_sync_seam.sv +27 -27
  37. data/lib/axi/data_interface/data_inf_c/data_c_sim_master_model.sv +72 -0
  38. data/lib/axi/data_interface/data_inf_c/data_c_sim_slaver_model.sv +58 -0
  39. data/lib/axi/data_interface/data_inf_c/logic_sim_model.sv +64 -0
  40. data/lib/axi/platform_ip/fifo_36kb_long.sv +1 -1
  41. data/lib/axi/techbench/tb_axi_stream_split_channel.rb +69 -0
  42. data/lib/axi/techbench/tb_axi_stream_split_channel.sv +150 -0
  43. data/lib/axi/techbench/tb_axis_split_channel_verb.rb +69 -0
  44. data/lib/axi/techbench/tb_axis_split_channel_verb.sv +125 -0
  45. data/lib/axi_tdl.rb +1 -0
  46. data/lib/axi_tdl/version.rb +1 -1
  47. data/lib/public_atom_module/CheckPClock.sv +53 -0
  48. data/lib/public_atom_module/LICENSE.md +674 -0
  49. data/lib/public_atom_module/altera_xilinx_always_block_sw.rb +57 -0
  50. data/lib/public_atom_module/bits_decode.sv +71 -0
  51. data/lib/public_atom_module/bits_decode_verb.sv +71 -0
  52. data/lib/public_atom_module/bits_decode_verb_sdl.rb +24 -0
  53. data/lib/public_atom_module/broaden.v +43 -0
  54. data/lib/public_atom_module/broaden_and_cross_clk.v +47 -0
  55. data/lib/public_atom_module/ceiling.v +39 -0
  56. data/lib/public_atom_module/ceiling_A1.v +42 -0
  57. data/lib/public_atom_module/clock_rst.sv +64 -0
  58. data/lib/public_atom_module/cross_clk_sync.v +37 -0
  59. data/lib/public_atom_module/edge_generator.v +50 -0
  60. data/lib/public_atom_module/flooring.v +36 -0
  61. data/lib/public_atom_module/latch_data.v +30 -0
  62. data/lib/public_atom_module/latency.v +48 -0
  63. data/lib/public_atom_module/latency_dynamic.v +83 -0
  64. data/lib/public_atom_module/latency_long.v +84 -0
  65. data/lib/public_atom_module/latency_verb.v +52 -0
  66. data/lib/public_atom_module/once_event.sv +65 -0
  67. data/lib/public_atom_module/pipe_reg.v +93 -0
  68. data/lib/public_atom_module/pipe_reg_2write_ports.v +84 -0
  69. data/lib/public_atom_module/sim/clock_rst_verb.sv +54 -0
  70. data/lib/public_atom_module/sim/latency_long_tb.sv +49 -0
  71. data/lib/public_atom_module/sim/latency_long_tb.sv.bak +49 -0
  72. data/lib/tdl/Logic/logic_edge.rb +1 -1
  73. data/lib/tdl/auto_script/autogensdl.rb +16 -5
  74. data/lib/tdl/axi4/axi4_interconnect_verb.rb +49 -10
  75. data/lib/tdl/basefunc.rb +1 -0
  76. data/lib/tdl/class_hdl/hdl_always_comb.rb +8 -4
  77. data/lib/tdl/class_hdl/hdl_always_ff.rb +49 -8
  78. data/lib/tdl/class_hdl/hdl_assign.rb +12 -4
  79. data/lib/tdl/class_hdl/hdl_block_ifelse.rb +18 -16
  80. data/lib/tdl/class_hdl/hdl_foreach.rb +4 -4
  81. data/lib/tdl/class_hdl/hdl_function.rb +8 -6
  82. data/lib/tdl/class_hdl/hdl_generate.rb +9 -5
  83. data/lib/tdl/class_hdl/hdl_initial.rb +36 -13
  84. data/lib/tdl/class_hdl/hdl_module_def.rb +27 -7
  85. data/lib/tdl/class_hdl/hdl_package.rb +45 -0
  86. data/lib/tdl/class_hdl/hdl_redefine_opertor.rb +117 -24
  87. data/lib/tdl/class_hdl/hdl_struct.rb +3 -3
  88. data/lib/tdl/class_hdl/hdl_verify.rb +1 -1
  89. data/lib/tdl/elements/Reset.rb +5 -9
  90. data/lib/tdl/elements/clock.rb +5 -9
  91. data/lib/tdl/elements/data_inf.rb +0 -17
  92. data/lib/tdl/elements/logic.rb +9 -31
  93. data/lib/tdl/elements/mail_box.rb +6 -1
  94. data/lib/tdl/elements/originclass.rb +23 -48
  95. data/lib/tdl/elements/parameter.rb +6 -7
  96. data/lib/tdl/examples/10_random/exp_random.sv +3 -3
  97. data/lib/tdl/examples/11_test_unit/dve.tcl +6 -0
  98. data/lib/tdl/examples/11_test_unit/exp_test_unit.rb +9 -8
  99. data/lib/tdl/examples/11_test_unit/exp_test_unit.sv +1 -1
  100. data/lib/tdl/examples/11_test_unit/exp_test_unit_sim.sv +9 -0
  101. data/lib/tdl/examples/11_test_unit/modules/sub_md0.rb +6 -3
  102. data/lib/tdl/examples/11_test_unit/modules/sub_md0.sv +5 -5
  103. data/lib/tdl/examples/11_test_unit/modules/sub_md1.rb +9 -4
  104. data/lib/tdl/examples/11_test_unit/modules/sub_md1.sv +5 -5
  105. data/lib/tdl/examples/11_test_unit/tb_exp_test_unit.sv +1 -2
  106. data/lib/tdl/examples/11_test_unit/tb_exp_test_unit_sim.sv +42 -0
  107. data/lib/tdl/examples/11_test_unit/tu0.sv +9 -9
  108. data/lib/tdl/examples/11_test_unit/tu1.sv +1 -1
  109. data/lib/tdl/examples/1_define_module/exmple_md.sv +13 -13
  110. data/lib/tdl/examples/2_hdl_class/tmp/always_comb_test.sv +60 -60
  111. data/lib/tdl/examples/2_hdl_class/tmp/always_ff_test.sv +2 -2
  112. data/lib/tdl/examples/2_hdl_class/tmp/case_test.sv +17 -17
  113. data/lib/tdl/examples/2_hdl_class/tmp/head_pkg_module.sv +9 -9
  114. data/lib/tdl/examples/2_hdl_class/tmp/module_instance_test.sv +1 -1
  115. data/lib/tdl/examples/2_hdl_class/tmp/simple_assign_test.sv +1 -1
  116. data/lib/tdl/examples/2_hdl_class/tmp/state_case_test.sv +10 -10
  117. data/lib/tdl/examples/2_hdl_class/tmp/test_foreach.sv +3 -3
  118. data/lib/tdl/examples/2_hdl_class/tmp/test_function.sv +7 -7
  119. data/lib/tdl/examples/2_hdl_class/tmp/test_initial_assert.sv +3 -3
  120. data/lib/tdl/examples/2_hdl_class/tmp/test_inst_sugar.sv +1 -1
  121. data/lib/tdl/examples/2_hdl_class/tmp/test_module.sv +3 -3
  122. data/lib/tdl/examples/2_hdl_class/tmp/test_module_port.sv +1 -1
  123. data/lib/tdl/examples/2_hdl_class/tmp/test_module_var.sv +1 -1
  124. data/lib/tdl/examples/2_hdl_class/tmp/test_package.sv +2 -2
  125. data/lib/tdl/examples/2_hdl_class/tmp/test_package2.sv +4 -4
  126. data/lib/tdl/examples/2_hdl_class/tmp/test_struct_function.sv +2 -2
  127. data/lib/tdl/examples/2_hdl_class/tmp/test_vcs_string.sv +1 -1
  128. data/lib/tdl/examples/2_hdl_class/tmp/text_generate.sv +7 -7
  129. data/lib/tdl/examples/3_hdl_sdl_instance/main_md.sv +1 -1
  130. data/lib/tdl/examples/3_hdl_sdl_instance/sdl_md.sv +1 -1
  131. data/lib/tdl/examples/4_generate/test_generate.sv +11 -11
  132. data/lib/tdl/examples/5_logic_combin/test_logic_combin.sv +3 -3
  133. data/lib/tdl/examples/6_module_with_interface/inf_collect.sv +1 -1
  134. data/lib/tdl/examples/7_module_with_package/body_package.sv +1 -1
  135. data/lib/tdl/examples/7_module_with_package/example_pkg.sv +5 -5
  136. data/lib/tdl/examples/7_module_with_package/head_package.sv +1 -1
  137. data/lib/tdl/examples/8_top_module/tb_test_top.sv +1 -2
  138. data/lib/tdl/examples/8_top_module/tb_test_top_sim.sv +29 -0
  139. data/lib/tdl/examples/8_top_module/test_top.sv +1 -1
  140. data/lib/tdl/examples/8_top_module/test_top_sim.sv +9 -0
  141. data/lib/tdl/examples/9_itegration/clock_manage/itgt_module_clock_manage.rb +13 -0
  142. data/lib/tdl/examples/9_itegration/clock_manage/test_clock_bb.sv +34 -0
  143. data/lib/tdl/examples/9_itegration/tb_test_top.sv +2 -2
  144. data/lib/tdl/examples/9_itegration/tb_test_tttop.sv +4 -2
  145. data/lib/tdl/examples/9_itegration/tb_test_tttop_sim.sv +39 -0
  146. data/lib/tdl/examples/9_itegration/test_top.sv +4 -4
  147. data/lib/tdl/examples/9_itegration/test_tttop.sv +4 -4
  148. data/lib/tdl/examples/9_itegration/test_tttop_sim.sv +9 -0
  149. data/lib/tdl/examples/9_itegration/top.rb +1 -0
  150. data/lib/tdl/exlib/axis_eth_ex.rb +95 -0
  151. data/lib/tdl/exlib/axis_verify.rb +265 -0
  152. data/lib/tdl/exlib/clock_reset_verify.rb +29 -0
  153. data/lib/tdl/exlib/dve_tcl.rb +30 -11
  154. data/lib/tdl/exlib/itegration.rb +15 -3
  155. data/lib/tdl/exlib/itegration_verb.rb +167 -130
  156. data/lib/tdl/exlib/logic_verify.rb +88 -0
  157. data/lib/tdl/exlib/test_point.rb +96 -94
  158. data/lib/tdl/exlib/test_point.rb.bak +293 -0
  159. data/lib/tdl/rebuild_ele/ele_base.rb +9 -9
  160. data/lib/tdl/sdlmodule/sdlmodlule_path_db.rb +34 -0
  161. data/lib/tdl/sdlmodule/sdlmodule.rb +79 -65
  162. data/lib/tdl/sdlmodule/sdlmodule_arraychain.rb +1 -1
  163. data/lib/tdl/sdlmodule/sdlmodule_draw.rb +81 -16
  164. data/lib/tdl/sdlmodule/sdlmodule_instance.rb +3 -0
  165. data/lib/tdl/sdlmodule/sdlmodule_port_define.rb +6 -6
  166. data/lib/tdl/sdlmodule/sdlmodule_varible.rb +6 -6
  167. data/lib/tdl/sdlmodule/test_unit_module.rb +283 -33
  168. data/lib/tdl/sdlmodule/test_unit_module.rb.bak +143 -0
  169. data/lib/tdl/sdlmodule/top_module.rb +62 -58
  170. data/lib/tdl/sdlmodule/top_module.rb.bak +547 -0
  171. data/lib/tdl/tdl.rb +18 -3
  172. data/lib/tdl/tdlerror/tdlerror.rb +1 -1
  173. metadata +54 -121
  174. data/CODE_OF_CONDUCT.md +0 -74
  175. data/lib/axi/AXI_stream/axis_length_split_writh_user.sv +0 -87
@@ -13,25 +13,25 @@ class DefXp
13
13
  end
14
14
 
15
15
  def logic(name:"tmp",dsize:1,port:false,default:nil,msb_high:true,dimension:[],type:"logic",&block)
16
- lg = Logic.new(name:name,dsize:dsize,port:port,default:default,msb_high:msb_high,dimension:dimension,type:type)
16
+ lg = Logic.new(name:name,dsize:dsize,port:port,default:default,msb_high:msb_high,dimension:dimension,type:type, belong_to_module: @sdlmodule)
17
17
  var_common(lg,&block)
18
18
  add_method_to_itgt(name,lg)
19
19
  end
20
20
 
21
21
  def clock(name:"",freqM:100,dsize:1,&block)
22
- a = Clock.new(name:name,freqM:freqM,dsize:dsize)
22
+ a = Clock.new(name:name,freqM:freqM,dsize:dsize, belong_to_module: @sdlmodule)
23
23
  var_common(a,&block)
24
24
  add_method_to_itgt(name,a)
25
25
  end
26
26
 
27
27
  def reset(name:"",active:"low",dsize:1,&block)
28
- a = Reset.new(name:name,active:active,dsize:dsize)
28
+ a = Reset.new(name:name,active:active,dsize:dsize, belong_to_module: @sdlmodule)
29
29
  var_common(a,&block)
30
30
  add_method_to_itgt(name,a)
31
31
  end
32
32
 
33
33
  def parameter(name:"P",value:100,local:false,type:nil,&block)
34
- a = Parameter.new(name:name,value:value,local:local,port:false,show:true,type:type)
34
+ a = Parameter.new(name:name,value:value,local:local,port:false,show:true,type:type, belong_to_module: @sdlmodule)
35
35
  var_common(a,&block)
36
36
  add_method_to_itgt(name,a)
37
37
  end
@@ -77,12 +77,12 @@ class DefXp
77
77
  # end
78
78
 
79
79
  def mailbox(name:'mbox',depth:100,&block)
80
- a = MailBox.new(name:name,depth:depth)
80
+ a = MailBox.new(name:name,depth:depth, belong_to_module: @sdlmodule)
81
81
  var_common(a,&block)
82
82
  end
83
83
 
84
84
  def debuglogic(name:"tmp",dsize:1,port:false,default:nil,msb_high:true,dimension:[],type:"logic",&block)
85
- lg = DebugLogic.new(name:name,dsize:dsize,port:port,default:default,msb_high:msb_high,dimension:dimension,type:type)
85
+ lg = DebugLogic.new(name:name,dsize:dsize,port:port,default:default,msb_high:msb_high,dimension:dimension,type:type, belong_to_module: @sdlmodule)
86
86
  var_common(lg,&block)
87
87
  add_method_to_itgt(name,lg)
88
88
  end
@@ -1,9 +1,213 @@
1
- class TestUnitModule < SdlModule
2
- attr_accessor :dve_wave_signals
1
+ class SdlModule
2
+ # attr_accessor :dve_wave_signals
3
+
4
+ def tracked_by_dve(flag:nil, &filter_block) ## 被dve track
5
+ @@__tracked_by_dve_hash__ ||= Hash.new
6
+ # if @@__tracked_by_dve_hash__.has_key?(self)
7
+ # raise TdlError.new(" `#{module_name}` Cant be tracked again!!!")
8
+ # end
9
+ @@__tracked_by_dve_hash__[self] = filter_block
10
+ @__track_filter_block__ = filter_block
11
+ @__dve_track_flag__ = flag
12
+ end
13
+
14
+ def self.tracked_by_dve ## 收集添加有 dve track 的模块
15
+ @@__tracked_by_dve_hash__ ||= Hash.new ## key:sdlmodule, value:filter_block
16
+ end
17
+
18
+ def add_to_dve_wave(flag: :default,base_ele: nil,&block)
19
+ @__track_signals_hash__ ||=Hash.new
20
+ @__track_signals_hash__[flag] ||= Hash.new
21
+
22
+ if @__track_signals_hash__[flag].has_key?(base_ele)
23
+ raise TdlError.new(" `#{module_name}.#{base_ele.to_s}` Cant be tracked again!!!")
24
+ end
25
+
26
+ @__track_signals_hash__[flag][base_ele] = block
27
+
28
+ unless base_ele.is_a?(AxiTdl::SdlModuleActiveBaseElm)
29
+ raise TdlError.new(" `#{base_ele.to_s}<class #{base_ele.class}>` is not AxiTdl::SdlModuleActiveBaseElm !!! ")
30
+ end
31
+ end
32
+
33
+ def track_signals_hash
34
+ @__track_signals_hash__ ||=Hash.new
35
+
36
+ unless @__dve_track_flag__
37
+ @__track_signals_hash__
38
+ else
39
+ rel = {}
40
+ rel[@__dve_track_flag__] = @__track_signals_hash__[@__dve_track_flag__]
41
+ rel
42
+ end
43
+ end
44
+
45
+ def gen_dev_wave_tcl ## 返回一个[]
46
+ return ['','',''] unless TopModule.sim
47
+
48
+ dve_tcl_hash = {}
49
+ track_signals_hash.each do |flag, base_ele_bhash|
50
+ base_elms = []
51
+ intf_elms = []
52
+ intf_elms_name = []
53
+ base_ele_bhash.each do |ele, sub_filter_block|
54
+ _ref_paths = ele.path_refs(&@__track_filter_block__)
55
+ _ref_paths.uniq!
56
+
57
+ if sub_filter_block
58
+ _ref_paths = _ref_paths.select do |e|
59
+ sub_filter_block.call(e)
60
+ end
61
+ end
62
+
63
+ if _ref_paths.size == 1
64
+ # rels[0]
65
+ elsif _ref_paths.size == 0
66
+ raise TdlError.new "#{ele.to_s} Cant find root ref"
67
+ else
68
+ raise TdlError.new "#{ele.to_s} Find multi root refs \n#{_ref_paths.join("\n")}\n"
69
+ end
70
+
71
+
72
+ if ele.is_a?(BaseElm) || ele.is_a?(ClassHDL::EnumStruct) || ele.is_a?(ClassHDL::StructVar)
73
+ base_elms << _ref_paths[0].sub("$root.","Sim:")
74
+ elsif ele.is_a? TdlSpace::TdlBaseInterface
75
+ if ele.modport_type
76
+ base_elms << _ref_paths[0].sub("$root.","Sim:")
77
+ else
78
+ intf_elms << _ref_paths[0].sub("$root.","Sim:")
79
+ intf_elms_name << ele.inst_name
80
+ end
81
+ end
82
+
83
+
84
+ end
85
+
86
+ dve_tcl_hash[flag] = [base_elms, intf_elms,intf_elms_name]
87
+
88
+ end
89
+
90
+ add_ss = []
91
+ add_list = []
92
+ add_bar = []
93
+ dve_tcl_hash.each do |flag, ary|
94
+ add_ss << TdlSpace.dev_signals_to_tcl(flag: "#{module_name}_#{flag}", signals: ary[0] )
95
+
96
+ add_list << TdlSpace.gui_list_add_group(flag: "Group2_#{module_name}_#{flag}")
97
+
98
+ ary[1].each_index do |index|
99
+ add_ss << TdlSpace.dev_interface_to_tcl(flag: "#{module_name}_#{flag}", iname: ary[2][index] ,signals: [ ary[1][index] ])
100
+ add_list << TdlSpace.gui_list_add_group(flag: "#{module_name}_#{flag}|#{ary[2][index]}")
101
+ end
102
+
103
+ add_bar << TdlSpace.gui_list_set_insertion_bar(flag: "#{module_name}_#{flag}")
104
+ end
105
+
106
+ # TdlSpace.dve_tcl_temp(add_ss.join("\n"), add_list.join("\n"), add_bar.join("\n") )
107
+
108
+ return [add_ss.join("\n"), add_list.join("\n"), add_bar.join("\n")]
109
+
110
+ end
111
+
112
+ def self.gen_dev_wave_tcl(filepath=nil)
113
+ ctcl_ss,ctcl_list,ctcl_bar = [],[],[]
114
+ self.tracked_by_dve.each do |sdlm,filter_block|
115
+ tcl_ss,tcl_list,tcl_bar = sdlm.gen_dev_wave_tcl
116
+
117
+ ctcl_ss << tcl_ss
118
+ ctcl_list << tcl_list
119
+ ctcl_bar << tcl_bar
120
+ end
121
+
122
+ rel = TdlSpace.dve_tcl_temp(ctcl_ss.join("\n"), ctcl_list.join("\n"), ctcl_bar.join("\n") )
123
+ if filepath
124
+ File.open(filepath,'w') do |f|
125
+ f.puts rel
126
+ end
127
+ end
128
+ rel
129
+ end
130
+
131
+
132
+
133
+ def self.echo_tracked_by_dve
134
+ # Flag module root_path
135
+ # rels = {}
136
+ flags = []
137
+ _modules = []
138
+ _root_path = []
139
+ _signals = []
140
+ _max_name = 'module_name'.size
141
+ _max_flag = 'FLAG'.size
142
+ _max_signal = 'SIGNAL'.size
143
+ self.tracked_by_dve.each do |sdlm, filter_block|
144
+ __track_signals_hash__ = sdlm.track_signals_hash || Hash.new
145
+ __track_signals_hash__.each do |flag, sub_hash|
146
+
147
+ sub_hash.each do |ele, sub_filter_block|
148
+ _root_refs = ele.path_refs(&filter_block)
149
+ _root_refs.uniq!
150
+
151
+ if sub_filter_block
152
+ _root_refs.select! do |e| sub_filter_block.call(e) end
153
+ end
154
+
155
+ if _root_refs.size == 1
156
+ # rels[0]
157
+ elsif _root_refs.size == 0
158
+ raise TdlError.new "#{ele.to_s} Cant find root ref"
159
+ else
160
+ raise TdlError.new "#{ele.to_s} Find multi root refs \n#{_root_refs.join("\n")}\n"
161
+ end
162
+
163
+ flags << flag.to_s
164
+ _modules << sdlm.module_name
165
+ if sdlm.module_name.size > _max_name
166
+ _max_name = sdlm.module_name.size
167
+ end
168
+ if flag.to_s.size > _max_flag
169
+ _max_flag = flag.to_s.size
170
+ end
171
+ # _root_path << _root_refs[0]
172
+ _root_path << File.expand_path(ele.belong_to_module.real_sv_path)
173
+
174
+ _signals << ele.to_s
175
+ if ele.to_s.size > _max_signal
176
+ _max_signal = ele.to_s.size
177
+ end
178
+ end
179
+ end
180
+ end
181
+
182
+ collect = ["[%s] %-#{_max_flag}s %#{_max_name+4}s %-#{_max_signal}s %s" % ['index', 'FLAG', 'MODULE-NAME', 'SIGNAL', 'belong_to_module']]
183
+ flags.each_index do |index|
184
+ collect << "[%5d] %-#{_max_flag}s %#{_max_name+4}s %-#{_max_signal}s %s" % [index+1, flags[index], _modules[index], _signals[index], _root_path[index]]
185
+ end
186
+
187
+ collect.join("\n")
188
+ end
189
+ end
190
+
191
+ module AxiTdl
192
+ module TestUnitTrack # included AxiTdl::SdlModuleActiveBaseElm
193
+ def tracked_by_dve(flag= :default,&filter_block)
194
+ self.belong_to_module.tracked_by_dve
195
+ self.belong_to_module.add_to_dve_wave(flag: flag, base_ele: self, &filter_block)
196
+ end
197
+ end
198
+ end
199
+
200
+ module AxiTdl
201
+ class SdlModuleActiveBaseElm
202
+ include AxiTdl::TestUnitTrack
203
+ end
204
+ end
205
+
206
+ class TestUnitModule < SdlModule ##TestUnitModule 是在编译完 TopModule TB后才会运行
3
207
 
4
208
  def initialize(name: "tdlmodule",out_sv_path: nil)
5
209
  super(name: name,out_sv_path: out_sv_path)
6
- @dve_wave_signals = []
210
+ # @dve_wave_signals = []
7
211
  end
8
212
 
9
213
  def test_unit_init(&block)
@@ -11,21 +215,77 @@ class TestUnitModule < SdlModule
11
215
  to_down_pass <= 1.b0
12
216
  initial_exec("wait(from_up_pass)")
13
217
  initial_exec("$root.#{TopModule.current.techbench.module_name}.test_unit_region = \"#{module_name}\"")
14
- block.call
218
+ block.call ## collect __root_ref_eles__ at here
15
219
  to_down_pass <= 1.b1
16
220
  end
17
221
  end
18
222
 
19
- def add_to_dve_wave(tp,&block)
20
- # @dve_wave_signals ||= []
21
- # tps.each do |e|
22
- # # dve_wave_signals << e.root_ref.sub("$root.","Sim:")
23
- # @dve_wave_signals << e
24
- # end
25
- #
26
- @dve_wave_signals << tp
27
- tp.tp_instance.filter_block = block if block_given?
28
- @dve_wave_signals
223
+ def add_root_ref_ele(*eles)
224
+ @__root_ref_eles__ ||= []
225
+ @__root_ref_eles__ += eles
226
+ @__root_ref_eles__.uniq!
227
+ end
228
+
229
+ def root_ref_eles
230
+ @__root_ref_eles__ || []
231
+ end
232
+
233
+ def be_instanced_by_sim
234
+ @@__be_instanced_by_sim__ ||= []
235
+ @@__be_instanced_by_sim__ << self
236
+ end
237
+
238
+ def self.be_instanced_by_sim
239
+ @@__be_instanced_by_sim__ || []
240
+ end
241
+
242
+ def self.echo_be_instanced_by_sim
243
+ @@__be_instanced_by_sim__ ||= []
244
+
245
+ _module_name = []
246
+ _ref_module_name = []
247
+ _signal_name = []
248
+ _ref_module_path = []
249
+
250
+ _max_module_name = 'test_module'.size
251
+ _max_signal_name = 'SIGNAL'.size
252
+ _max_ref = 'REF_MODULE'.size
253
+ @@__be_instanced_by_sim__.each do |tm|
254
+ __root_ref_eles__ = tm.root_ref_eles
255
+
256
+ __root_ref_eles__.each do |ele|
257
+ _module_name << tm.module_name
258
+ _ref_module_name << ele.belong_to_module.module_name
259
+ _signal_name << ele.to_s
260
+ _ref_module_path << File.expand_path(ele.belong_to_module.real_sv_path)
261
+
262
+ if tm.module_name.size > _max_module_name
263
+ _max_module_name = tm.module_name.size
264
+ end
265
+
266
+ if ele.belong_to_module.module_name.size > _max_ref
267
+ _max_ref = ele.belong_to_module.module_name.size
268
+ end
269
+
270
+ if ele.to_s.size > _max_signal_name
271
+ _max_signal_name = ele.to_s.size
272
+ end
273
+ end
274
+ end
275
+
276
+ collect = ["[%5s] %-#{_max_module_name}s %#{_max_ref}s %-#{_max_signal_name}s %s" % ['index', 'TEST-MODULE','REF-MODULE','SIGNAL', 'REF-MODULE-PATH'] ]
277
+
278
+ _module_name.each_index do |index|
279
+ collect << "[%5d] %-#{_max_module_name}s %#{_max_ref}s %-#{_max_signal_name}s %s" % [index+1, _module_name[index], _ref_module_name[index], _signal_name[index], _ref_module_path[index]]
280
+ end
281
+
282
+ collect.join("\n")
283
+ end
284
+
285
+
286
+ def self.gen_dve_tcl(filepath)
287
+
288
+
29
289
  end
30
290
  end
31
291
 
@@ -56,23 +316,6 @@ class TdlTestUnit < TdlBuild
56
316
  sdlm
57
317
  end
58
318
 
59
- # def self.collect_unit(tu)
60
- # @@__collect_units__ ||= []
61
- # @@__collect_units__ << tu
62
- # end
63
-
64
- # def self.echo_units
65
- # @@__collect_units__ ||= []
66
- # index = 1
67
-
68
- # rels = []
69
- # @@__collect_units__.each do |ue|
70
- # rels << " [#{index}] #{ue.origin.module_name}"
71
- # index += 1
72
- # end
73
- # rels.join("\n")
74
- # end
75
-
76
319
  end
77
320
 
78
321
  class TopModule
@@ -87,6 +330,12 @@ class TopModule
87
330
  def _exec_add_test_unit
88
331
  @_test_unit_collect_ ||= []
89
332
  args = @_test_unit_collect_
333
+ ## 例化需要的itgt test unit
334
+ # ItegrationVerb.test_unit_inst
335
+ ItegrationVerb.test_unit_inst do |name|
336
+ args.include? name.to_s
337
+ end
338
+
90
339
  self.techbench.instance_exec(args) do |args|
91
340
  index = 0
92
341
  last_index = 0
@@ -109,11 +358,12 @@ class TopModule
109
358
  h.output.logic.to_down_pass (nqq ? unit_pass_d : unit_pass_d[index])
110
359
  end
111
360
 
361
+ tu_inst.origin.be_instanced_by_sim
112
362
  # TdlTestUnit.collect_unit tu_inst
113
- TopModule.current.test_unit.collect_unit tu_inst
363
+ # TopModule.current.test_unit.collect_unit tu_inst
114
364
 
115
365
  ## 添加dve wave 信号
116
- TopModule.current.test_unit.dve_wave(name: _inst_name_, signals: tu_inst.origin.dve_wave_signals )
366
+ # TopModule.current.test_unit.dve_wave(name: _inst_name_, signals: tu_inst.origin.dve_wave_signals )
117
367
 
118
368
  if index == 0
119
369
  Assign do
@@ -0,0 +1,143 @@
1
+ class TestUnitModule < SdlModule
2
+ attr_accessor :dve_wave_signals
3
+
4
+ def initialize(name: "tdlmodule",out_sv_path: nil)
5
+ super(name: name,out_sv_path: out_sv_path)
6
+ @dve_wave_signals = []
7
+ end
8
+
9
+ def test_unit_init(&block)
10
+ Initial do
11
+ to_down_pass <= 1.b0
12
+ initial_exec("wait(from_up_pass)")
13
+ initial_exec("$root.#{TopModule.current.techbench.module_name}.test_unit_region = \"#{module_name}\"")
14
+ block.call
15
+ to_down_pass <= 1.b1
16
+ end
17
+ end
18
+
19
+ def add_to_dve_wave(tp,&block)
20
+ # @dve_wave_signals ||= []
21
+ # tps.each do |e|
22
+ # # dve_wave_signals << e.root_ref.sub("$root.","Sim:")
23
+ # @dve_wave_signals << e
24
+ # end
25
+ #
26
+ @dve_wave_signals << tp
27
+ tp.tp_instance.filter_block = block if block_given?
28
+ # unless tp.is_a?(AxiTdl::SdlModuleActiveBaseElm)
29
+ # raise TdlError.new(" `#{tp.to_s}` is not AxiTdl::SdlModuleActiveBaseElm !!! ")
30
+ # end
31
+ # tp.instance_variable_set("@dve_wave_filter_block", block)
32
+
33
+ @dve_wave_signals
34
+ end
35
+ end
36
+
37
+ class TdlTestUnit < TdlBuild
38
+ # return ClassHDL::AnonyModule.new
39
+ def self.method_missing(method,*args,&block)
40
+
41
+ sdlm = TestUnitModule.new(name: method,out_sv_path: args[0])
42
+
43
+ si = sdlm.input - "from_up_pass"
44
+ so = sdlm.output.logic - "to_down_pass"
45
+
46
+ @@package_names ||= []
47
+ sdlm.head_import_packages = []
48
+ sdlm.head_import_packages += @@package_names
49
+
50
+ @@package_names.each do |e|
51
+ sdlm.require_package(e,false) if e
52
+ end
53
+ @@package_names = []
54
+ sdlm.instance_exec(&block)
55
+
56
+ if args[0] && File.exist?(args[0])
57
+ sdlm.gen_sv_module
58
+ else
59
+ sdlm.origin_sv = true
60
+ end
61
+ sdlm
62
+ end
63
+
64
+ # def self.collect_unit(tu)
65
+ # @@__collect_units__ ||= []
66
+ # @@__collect_units__ << tu
67
+ # end
68
+
69
+ # def self.echo_units
70
+ # @@__collect_units__ ||= []
71
+ # index = 1
72
+
73
+ # rels = []
74
+ # @@__collect_units__.each do |ue|
75
+ # rels << " [#{index}] #{ue.origin.module_name}"
76
+ # index += 1
77
+ # end
78
+ # rels.join("\n")
79
+ # end
80
+
81
+ end
82
+
83
+ class TopModule
84
+ public
85
+ def add_test_unit(*args)
86
+ @_test_unit_collect_ ||= []
87
+ @_test_unit_collect_ = @_test_unit_collect_ + args
88
+ end
89
+
90
+ private
91
+
92
+ def _exec_add_test_unit
93
+ @_test_unit_collect_ ||= []
94
+ args = @_test_unit_collect_
95
+ self.techbench.instance_exec(args) do |args|
96
+ index = 0
97
+ last_index = 0
98
+ logic.string - 'test_unit_region'
99
+ logic[args.size] - 'unit_pass_u'
100
+ logic[args.size] - 'unit_pass_d'
101
+
102
+ nqq = args.size <= 1
103
+ args.each do |tu|
104
+ if tu.is_a? SdlModule
105
+ _inst_name_ = tu.module_name
106
+ else
107
+ _inst_name_ = tu.to_s
108
+ end
109
+
110
+ # puts _inst_name_
111
+ # puts SdlModule.call_module(_inst_name_).class
112
+ tu_inst = Instance(_inst_name_,"test_unit_#{index}") do |h|
113
+ h.input.from_up_pass (nqq ? unit_pass_u : unit_pass_u[index])
114
+ h.output.logic.to_down_pass (nqq ? unit_pass_d : unit_pass_d[index])
115
+ end
116
+
117
+ # TdlTestUnit.collect_unit tu_inst
118
+ TopModule.current.test_unit.collect_unit tu_inst
119
+
120
+ ## 添加dve wave 信号
121
+ TopModule.current.test_unit.dve_wave(name: _inst_name_, signals: tu_inst.origin.dve_wave_signals )
122
+
123
+ if index == 0
124
+ Assign do
125
+ unless nqq
126
+ unit_pass_u[index] <= 1.b1
127
+ else
128
+ unit_pass_u <= 1.b1
129
+ end
130
+ end
131
+ else
132
+
133
+ Assign do
134
+ unit_pass_u[index] <= unit_pass_d[last_index]
135
+ end
136
+ end
137
+ last_index = index
138
+ index += 1
139
+ end
140
+ end
141
+ end
142
+
143
+ end