axi_tdl 0.0.10 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/gem-push.yml +44 -0
  3. data/.github/workflows/ruby.yml +35 -0
  4. data/.gitignore +3 -1
  5. data/.travis.yml +9 -0
  6. data/Gemfile +4 -0
  7. data/README.EN.md +7 -2
  8. data/README.md +6 -2
  9. data/Rakefile +2 -6
  10. data/axi_tdl.gemspec +3 -4
  11. data/lib/axi/AXI4/axi4_direct_B1.sv +23 -23
  12. data/lib/axi/AXI4/axi4_dpram_cache.sv +33 -33
  13. data/lib/axi/AXI4/axis_to_axi4_wr.rb +1 -0
  14. data/lib/axi/AXI4/axis_to_axi4_wr.sv +20 -20
  15. data/lib/axi/AXI4/packet_partition/axi4_partition_rd_verb.sv +32 -32
  16. data/lib/axi/AXI4/packet_partition/data_inf_partition.rb +2 -0
  17. data/lib/axi/AXI4/packet_partition/data_inf_partition.sv +71 -71
  18. data/lib/axi/AXI4/wide_axis_to_axi4_wr.rb +2 -1
  19. data/lib/axi/AXI4/wide_axis_to_axi4_wr.sv +23 -23
  20. data/lib/axi/AXI_stream/axi_stream_split_channel.rb +7 -1
  21. data/lib/axi/AXI_stream/axis_head_cut_verb.sv +6 -2
  22. data/lib/axi/AXI_stream/axis_insert_copy.rb +18 -4
  23. data/lib/axi/AXI_stream/axis_sim_master_model.rb +28 -0
  24. data/lib/axi/AXI_stream/axis_sim_slaver_model.rb +26 -0
  25. data/lib/axi/AXI_stream/axis_sim_verify_by_coe.sv +101 -0
  26. data/lib/axi/AXI_stream/axis_split_channel_verb.rb +2 -0
  27. data/lib/axi/common/common_ram_sim_wrapper.sv +9 -9
  28. data/lib/axi/common/common_ram_wrapper.sv +12 -12
  29. data/lib/axi/data_interface/data_inf_c/data_c_pipe_sync_seam.sv +26 -26
  30. data/lib/axi/data_interface/data_inf_c/data_c_sim_master_model.sv +69 -0
  31. data/lib/axi/data_interface/data_inf_c/data_c_sim_slaver_model.sv +58 -0
  32. data/lib/axi/data_interface/data_inf_c/logic_sim_model.sv +64 -0
  33. data/lib/axi/techbench/tb_axi_stream_split_channel.rb +69 -0
  34. data/lib/axi/techbench/tb_axi_stream_split_channel.sv +149 -0
  35. data/lib/axi/techbench/tb_axis_split_channel_verb.rb +69 -0
  36. data/lib/axi/techbench/tb_axis_split_channel_verb.sv +125 -0
  37. data/lib/axi_tdl.rb +1 -0
  38. data/lib/axi_tdl/version.rb +1 -1
  39. data/lib/tdl/auto_script/autogensdl.rb +16 -5
  40. data/lib/tdl/axi4/axi4_interconnect_verb.rb +4 -2
  41. data/lib/tdl/basefunc.rb +1 -0
  42. data/lib/tdl/class_hdl/hdl_always_comb.rb +4 -3
  43. data/lib/tdl/class_hdl/hdl_always_ff.rb +49 -8
  44. data/lib/tdl/class_hdl/hdl_assign.rb +5 -3
  45. data/lib/tdl/class_hdl/hdl_block_ifelse.rb +11 -9
  46. data/lib/tdl/class_hdl/hdl_foreach.rb +2 -2
  47. data/lib/tdl/class_hdl/hdl_function.rb +4 -2
  48. data/lib/tdl/class_hdl/hdl_generate.rb +5 -4
  49. data/lib/tdl/class_hdl/hdl_initial.rb +11 -10
  50. data/lib/tdl/class_hdl/hdl_module_def.rb +18 -1
  51. data/lib/tdl/class_hdl/hdl_redefine_opertor.rb +35 -14
  52. data/lib/tdl/class_hdl/hdl_struct.rb +1 -1
  53. data/lib/tdl/class_hdl/hdl_verify.rb +1 -1
  54. data/lib/tdl/elements/originclass.rb +6 -1
  55. data/lib/tdl/elements/parameter.rb +1 -1
  56. data/lib/tdl/examples/10_random/exp_random.sv +3 -3
  57. data/lib/tdl/examples/11_test_unit/dve.tcl +155 -2
  58. data/lib/tdl/examples/11_test_unit/exp_test_unit.rb +9 -8
  59. data/lib/tdl/examples/11_test_unit/exp_test_unit.sv +1 -1
  60. data/lib/tdl/examples/11_test_unit/modules/sub_md0.rb +6 -3
  61. data/lib/tdl/examples/11_test_unit/modules/sub_md0.sv +5 -5
  62. data/lib/tdl/examples/11_test_unit/modules/sub_md1.rb +9 -4
  63. data/lib/tdl/examples/11_test_unit/modules/sub_md1.sv +5 -5
  64. data/lib/tdl/examples/11_test_unit/tb_exp_test_unit.sv +1 -3
  65. data/lib/tdl/examples/11_test_unit/tu0.sv +9 -9
  66. data/lib/tdl/examples/11_test_unit/tu1.sv +1 -1
  67. data/lib/tdl/examples/1_define_module/exmple_md.sv +12 -12
  68. data/lib/tdl/examples/2_hdl_class/tmp/always_comb_test.sv +60 -60
  69. data/lib/tdl/examples/2_hdl_class/tmp/always_ff_test.sv +2 -2
  70. data/lib/tdl/examples/2_hdl_class/tmp/case_test.sv +17 -17
  71. data/lib/tdl/examples/2_hdl_class/tmp/head_pkg_module.sv +9 -9
  72. data/lib/tdl/examples/2_hdl_class/tmp/simple_assign_test.sv +1 -1
  73. data/lib/tdl/examples/2_hdl_class/tmp/state_case_test.sv +10 -10
  74. data/lib/tdl/examples/2_hdl_class/tmp/test_foreach.sv +3 -3
  75. data/lib/tdl/examples/2_hdl_class/tmp/test_function.sv +7 -7
  76. data/lib/tdl/examples/2_hdl_class/tmp/test_initial_assert.sv +3 -3
  77. data/lib/tdl/examples/2_hdl_class/tmp/test_module.sv +2 -2
  78. data/lib/tdl/examples/2_hdl_class/tmp/test_module_var.sv +1 -1
  79. data/lib/tdl/examples/2_hdl_class/tmp/test_package.sv +4 -5
  80. data/lib/tdl/examples/2_hdl_class/tmp/test_package2.sv +4 -4
  81. data/lib/tdl/examples/2_hdl_class/tmp/test_struct_function.sv +2 -2
  82. data/lib/tdl/examples/2_hdl_class/tmp/test_vcs_string.sv +1 -1
  83. data/lib/tdl/examples/2_hdl_class/tmp/text_generate.sv +7 -7
  84. data/lib/tdl/examples/4_generate/test_generate.sv +11 -11
  85. data/lib/tdl/examples/5_logic_combin/test_logic_combin.sv +3 -3
  86. data/lib/tdl/examples/7_module_with_package/body_package.sv +3 -4
  87. data/lib/tdl/examples/7_module_with_package/example_pkg.sv +4 -4
  88. data/lib/tdl/examples/7_module_with_package/head_package.sv +3 -4
  89. data/lib/tdl/examples/8_top_module/tb_test_top.sv +1 -2
  90. data/lib/tdl/examples/9_itegration/clock_manage/itgt_module_clock_manage.rb +13 -0
  91. data/lib/tdl/examples/9_itegration/clock_manage/test_clock_bb.sv +34 -0
  92. data/lib/tdl/examples/9_itegration/tb_test_top.sv +2 -2
  93. data/lib/tdl/examples/9_itegration/tb_test_tttop.sv +1 -1
  94. data/lib/tdl/examples/9_itegration/tb_test_tttop_sim.sv +38 -0
  95. data/lib/tdl/examples/9_itegration/test_top.sv +4 -4
  96. data/lib/tdl/examples/9_itegration/test_tttop.sv +4 -4
  97. data/lib/tdl/examples/9_itegration/test_tttop_sim.sv +9 -0
  98. data/lib/tdl/examples/9_itegration/top.rb +1 -0
  99. data/lib/tdl/exlib/axis_eth_ex.rb +95 -0
  100. data/lib/tdl/exlib/axis_verify.rb +264 -0
  101. data/lib/tdl/exlib/clock_reset_verify.rb +29 -0
  102. data/lib/tdl/exlib/dve_tcl.rb +30 -11
  103. data/lib/tdl/exlib/itegration.rb +15 -3
  104. data/lib/tdl/exlib/itegration_verb.rb +166 -129
  105. data/lib/tdl/exlib/logic_verify.rb +88 -0
  106. data/lib/tdl/exlib/test_point.rb +96 -94
  107. data/lib/tdl/exlib/test_point.rb.bak +293 -0
  108. data/lib/tdl/rebuild_ele/ele_base.rb +1 -1
  109. data/lib/tdl/sdlmodule/sdlmodlule_path_db.rb +34 -0
  110. data/lib/tdl/sdlmodule/sdlmodule.rb +18 -14
  111. data/lib/tdl/sdlmodule/sdlmodule_draw.rb +81 -16
  112. data/lib/tdl/sdlmodule/test_unit_module.rb +278 -33
  113. data/lib/tdl/sdlmodule/test_unit_module.rb.bak +143 -0
  114. data/lib/tdl/sdlmodule/top_module.rb +62 -58
  115. data/lib/tdl/sdlmodule/top_module.rb.bak +547 -0
  116. data/lib/tdl/tdl.rb +18 -3
  117. metadata +35 -134
  118. data/Gemfile.lock +0 -28
  119. data/lib/axi/AXI_stream/axi_stream_split_channel.sv +0 -149
  120. data/lib/axi/AXI_stream/axis_head_cut_verc.sv +0 -242
  121. data/lib/axi/AXI_stream/axis_insert_copy.sv +0 -66
  122. data/lib/axi/AXI_stream/axis_pipe_sync_seam.sv +0 -48
  123. data/lib/axi/AXI_stream/axis_rom_contect_sim.sv +0 -113
  124. data/lib/axi/AXI_stream/axis_split_channel_verb.sv +0 -62
@@ -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
@@ -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
@@ -341,23 +342,26 @@ class SdlModule
341
342
  ## 例化模块
342
343
 
343
344
  def method_missing(method,*args,&block)
345
+ rel = nil
346
+ ClassHDL::AssignDefOpertor.with_rollback_opertors(:old) do
347
+ @@_method_missing_sub_methds ||= []
348
+
349
+ @@_method_missing_sub_methds.each do |me|
350
+ rel = self.send(me,method,*args,&block)
351
+ if rel
352
+ rel
353
+ end
354
+ end
344
355
 
345
- @@_method_missing_sub_methds ||= []
346
-
347
- @@_method_missing_sub_methds.each do |me|
348
- rel = self.send(me,method,*args,&block)
356
+ ## 最后才调用阴性例化模块
357
+ rel = implicit_inst_module_method_missing(method,*args,&block)
349
358
  if rel
350
- return rel
359
+ rel
360
+ else
361
+ super
351
362
  end
352
363
  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
364
+ return rel
361
365
  end
362
366
  end
363
367
 
@@ -468,4 +472,4 @@ class SdlModule
468
472
  puts (fstr % [_indexs[xi], _names[xi], _paths[xi]])
469
473
  end
470
474
  end
471
- end
475
+ end
@@ -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
- # unless GlobalParam.sim
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.gsub(/\/\*.*?\*\//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.puts build_module(ex_param:ex_param,ex_port:ex_port,ex_up_code:ex_up_code,ex_down_code:ex_down_code)
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
- # else
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
- # @out_sv_path ||= File.dirname(File.expand_path(__FILE__))
68
- return if (@origin_sv || @dont_gen_sv)
69
- pre_inst_stack_call
70
- @out_sv_path ||= '..\..\tdl\test_sdlmodule'
71
- # unless GlobalParam.sim
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
- return build_module(ex_param:ex_param,ex_port:ex_port,ex_up_code:ex_up_code,ex_down_code:ex_down_code)
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"
@@ -1,9 +1,208 @@
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
+ dve_tcl_hash = {}
47
+ track_signals_hash.each do |flag, base_ele_bhash|
48
+ base_elms = []
49
+ intf_elms = []
50
+ intf_elms_name = []
51
+ base_ele_bhash.each do |ele, sub_filter_block|
52
+ _ref_paths = ele.path_refs(&@__track_filter_block__)
53
+
54
+ if sub_filter_block
55
+ _ref_paths = _ref_paths.select do |e|
56
+ sub_filter_block.call(e)
57
+ end
58
+ end
59
+
60
+ if _ref_paths.size == 1
61
+ # rels[0]
62
+ elsif _ref_paths.size == 0
63
+ raise TdlError.new "#{ele.to_s} Cant find root ref"
64
+ else
65
+ raise TdlError.new "#{ele.to_s} Find multi root refs \n#{_ref_paths.join("\n")}\n"
66
+ end
67
+
68
+
69
+ if ele.is_a?(BaseElm) || ele.is_a?(ClassHDL::EnumStruct) || ele.is_a?(ClassHDL::StructVar)
70
+ base_elms << _ref_paths[0].sub("$root.","Sim:")
71
+ elsif ele.is_a? TdlSpace::TdlBaseInterface
72
+ if ele.modport_type
73
+ base_elms << _ref_paths[0].sub("$root.","Sim:")
74
+ else
75
+ intf_elms << _ref_paths[0].sub("$root.","Sim:")
76
+ intf_elms_name << ele.inst_name
77
+ end
78
+ end
79
+
80
+
81
+ end
82
+
83
+ dve_tcl_hash[flag] = [base_elms, intf_elms,intf_elms_name]
84
+
85
+ end
86
+
87
+ add_ss = []
88
+ add_list = []
89
+ add_bar = []
90
+ dve_tcl_hash.each do |flag, ary|
91
+ add_ss << TdlSpace.dev_signals_to_tcl(flag: "#{module_name}_#{flag}", signals: ary[0] )
92
+
93
+ add_list << TdlSpace.gui_list_add_group(flag: "Group2_#{module_name}_#{flag}")
94
+
95
+ ary[1].each_index do |index|
96
+ add_ss << TdlSpace.dev_interface_to_tcl(flag: "#{module_name}_#{flag}", iname: ary[2][index] ,signals: [ ary[1][index] ])
97
+ add_list << TdlSpace.gui_list_add_group(flag: "#{module_name}_#{flag}|#{ary[2][index]}")
98
+ end
99
+
100
+ add_bar << TdlSpace.gui_list_set_insertion_bar(flag: "#{module_name}_#{flag}")
101
+ end
102
+
103
+ # TdlSpace.dve_tcl_temp(add_ss.join("\n"), add_list.join("\n"), add_bar.join("\n") )
104
+
105
+ return [add_ss.join("\n"), add_list.join("\n"), add_bar.join("\n")]
106
+
107
+ end
108
+
109
+ def self.gen_dev_wave_tcl(filepath=nil)
110
+ ctcl_ss,ctcl_list,ctcl_bar = [],[],[]
111
+ self.tracked_by_dve.each do |sdlm,filter_block|
112
+ tcl_ss,tcl_list,tcl_bar = sdlm.gen_dev_wave_tcl
113
+
114
+ ctcl_ss << tcl_ss
115
+ ctcl_list << tcl_list
116
+ ctcl_bar << tcl_bar
117
+ end
118
+
119
+ rel = TdlSpace.dve_tcl_temp(ctcl_ss.join("\n"), ctcl_list.join("\n"), ctcl_bar.join("\n") )
120
+ if filepath
121
+ File.open(filepath,'w') do |f|
122
+ f.puts rel
123
+ end
124
+ end
125
+ rel
126
+ end
127
+
128
+
129
+
130
+ def self.echo_tracked_by_dve
131
+ # Flag module root_path
132
+ # rels = {}
133
+ flags = []
134
+ _modules = []
135
+ _root_path = []
136
+ _signals = []
137
+ _max_name = 'module_name'.size
138
+ _max_flag = 'FLAG'.size
139
+ _max_signal = 'SIGNAL'.size
140
+ self.tracked_by_dve.each do |sdlm, filter_block|
141
+ __track_signals_hash__ = sdlm.track_signals_hash || Hash.new
142
+ __track_signals_hash__.each do |flag, sub_hash|
143
+
144
+ sub_hash.each do |ele, sub_filter_block|
145
+ _root_refs = ele.path_refs(&filter_block)
146
+ if sub_filter_block
147
+ _root_refs.select! do |e| sub_filter_block.call(e) end
148
+ end
149
+
150
+ if _root_refs.size == 1
151
+ # rels[0]
152
+ elsif _root_refs.size == 0
153
+ raise TdlError.new "#{ele.to_s} Cant find root ref"
154
+ else
155
+ raise TdlError.new "#{ele.to_s} Find multi root refs \n#{_root_refs.join("\n")}\n"
156
+ end
157
+
158
+ flags << flag.to_s
159
+ _modules << sdlm.module_name
160
+ if sdlm.module_name.size > _max_name
161
+ _max_name = sdlm.module_name.size
162
+ end
163
+ if flag.to_s.size > _max_flag
164
+ _max_flag = flag.to_s.size
165
+ end
166
+ # _root_path << _root_refs[0]
167
+ _root_path << File.expand_path(ele.belong_to_module.real_sv_path)
168
+
169
+ _signals << ele.to_s
170
+ if ele.to_s.size > _max_signal
171
+ _max_signal = ele.to_s.size
172
+ end
173
+ end
174
+ end
175
+ end
176
+
177
+ collect = ["[%s] %-#{_max_flag}s %#{_max_name+4}s %-#{_max_signal}s %s" % ['index', 'FLAG', 'MODULE-NAME', 'SIGNAL', 'belong_to_module']]
178
+ flags.each_index do |index|
179
+ collect << "[%5d] %-#{_max_flag}s %#{_max_name+4}s %-#{_max_signal}s %s" % [index+1, flags[index], _modules[index], _signals[index], _root_path[index]]
180
+ end
181
+
182
+ collect.join("\n")
183
+ end
184
+ end
185
+
186
+ module AxiTdl
187
+ module TestUnitTrack # included AxiTdl::SdlModuleActiveBaseElm
188
+ def tracked_by_dve(flag= :default,&filter_block)
189
+ self.belong_to_module.tracked_by_dve
190
+ self.belong_to_module.add_to_dve_wave(flag: flag, base_ele: self, &filter_block)
191
+ end
192
+ end
193
+ end
194
+
195
+ module AxiTdl
196
+ class SdlModuleActiveBaseElm
197
+ include AxiTdl::TestUnitTrack
198
+ end
199
+ end
200
+
201
+ class TestUnitModule < SdlModule ##TestUnitModule 是在编译完 TopModule TB后才会运行
3
202
 
4
203
  def initialize(name: "tdlmodule",out_sv_path: nil)
5
204
  super(name: name,out_sv_path: out_sv_path)
6
- @dve_wave_signals = []
205
+ # @dve_wave_signals = []
7
206
  end
8
207
 
9
208
  def test_unit_init(&block)
@@ -11,21 +210,77 @@ class TestUnitModule < SdlModule
11
210
  to_down_pass <= 1.b0
12
211
  initial_exec("wait(from_up_pass)")
13
212
  initial_exec("$root.#{TopModule.current.techbench.module_name}.test_unit_region = \"#{module_name}\"")
14
- block.call
213
+ block.call ## collect __root_ref_eles__ at here
15
214
  to_down_pass <= 1.b1
16
215
  end
17
216
  end
18
217
 
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
218
+ def add_root_ref_ele(*eles)
219
+ @__root_ref_eles__ ||= []
220
+ @__root_ref_eles__ += eles
221
+ @__root_ref_eles__.uniq!
222
+ end
223
+
224
+ def root_ref_eles
225
+ @__root_ref_eles__ || []
226
+ end
227
+
228
+ def be_instanced_by_sim
229
+ @@__be_instanced_by_sim__ ||= []
230
+ @@__be_instanced_by_sim__ << self
231
+ end
232
+
233
+ def self.be_instanced_by_sim
234
+ @@__be_instanced_by_sim__ || []
235
+ end
236
+
237
+ def self.echo_be_instanced_by_sim
238
+ @@__be_instanced_by_sim__ ||= []
239
+
240
+ _module_name = []
241
+ _ref_module_name = []
242
+ _signal_name = []
243
+ _ref_module_path = []
244
+
245
+ _max_module_name = 'test_module'.size
246
+ _max_signal_name = 'SIGNAL'.size
247
+ _max_ref = 'REF_MODULE'.size
248
+ @@__be_instanced_by_sim__.each do |tm|
249
+ __root_ref_eles__ = tm.root_ref_eles
250
+
251
+ __root_ref_eles__.each do |ele|
252
+ _module_name << tm.module_name
253
+ _ref_module_name << ele.belong_to_module.module_name
254
+ _signal_name << ele.to_s
255
+ _ref_module_path << File.expand_path(ele.belong_to_module.real_sv_path)
256
+
257
+ if tm.module_name.size > _max_module_name
258
+ _max_module_name = tm.module_name.size
259
+ end
260
+
261
+ if ele.belong_to_module.module_name.size > _max_ref
262
+ _max_ref = ele.belong_to_module.module_name.size
263
+ end
264
+
265
+ if ele.to_s.size > _max_signal_name
266
+ _max_signal_name = ele.to_s.size
267
+ end
268
+ end
269
+ end
270
+
271
+ collect = ["[%5s] %-#{_max_module_name}s %#{_max_ref}s %-#{_max_signal_name}s %s" % ['index', 'TEST-MODULE','REF-MODULE','SIGNAL', 'REF-MODULE-PATH'] ]
272
+
273
+ _module_name.each_index do |index|
274
+ 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]]
275
+ end
276
+
277
+ collect.join("\n")
278
+ end
279
+
280
+
281
+ def self.gen_dve_tcl(filepath)
282
+
283
+
29
284
  end
30
285
  end
31
286
 
@@ -56,23 +311,6 @@ class TdlTestUnit < TdlBuild
56
311
  sdlm
57
312
  end
58
313
 
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
314
  end
77
315
 
78
316
  class TopModule
@@ -87,6 +325,12 @@ class TopModule
87
325
  def _exec_add_test_unit
88
326
  @_test_unit_collect_ ||= []
89
327
  args = @_test_unit_collect_
328
+ ## 例化需要的itgt test unit
329
+ # ItegrationVerb.test_unit_inst
330
+ ItegrationVerb.test_unit_inst do |name|
331
+ args.include? name.to_s
332
+ end
333
+
90
334
  self.techbench.instance_exec(args) do |args|
91
335
  index = 0
92
336
  last_index = 0
@@ -109,11 +353,12 @@ class TopModule
109
353
  h.output.logic.to_down_pass (nqq ? unit_pass_d : unit_pass_d[index])
110
354
  end
111
355
 
356
+ tu_inst.origin.be_instanced_by_sim
112
357
  # TdlTestUnit.collect_unit tu_inst
113
- TopModule.current.test_unit.collect_unit tu_inst
358
+ # TopModule.current.test_unit.collect_unit tu_inst
114
359
 
115
360
  ## 添加dve wave 信号
116
- TopModule.current.test_unit.dve_wave(name: _inst_name_, signals: tu_inst.origin.dve_wave_signals )
361
+ # TopModule.current.test_unit.dve_wave(name: _inst_name_, signals: tu_inst.origin.dve_wave_signals )
117
362
 
118
363
  if index == 0
119
364
  Assign do