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
data/lib/axi_tdl.rb CHANGED
@@ -20,6 +20,7 @@ add_to_tdl_paths File.expand_path(File.join(__dir__, "axi/common_fifo"))
20
20
  add_to_tdl_paths File.expand_path(File.join(__dir__, "axi/common"))
21
21
  add_to_tdl_paths File.expand_path(File.join(__dir__, "axi/data_interface"))
22
22
  add_to_tdl_paths File.expand_path(File.join(__dir__, "axi/data_interface/data_inf_c"))
23
+ add_to_tdl_paths File.expand_path(File.join(__dir__, "axi/techbench"))
23
24
 
24
25
  ## base require
25
26
  require_hdl 'axis_master_empty.sv'
@@ -1,3 +1,3 @@
1
1
  module AxiTdl
2
- VERSION = "0.0.10"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -232,10 +232,21 @@ class AutoGenSdl
232
232
  end
233
233
 
234
234
  def gen_file
235
- @autof = File.open(@autof_name,"w") do |f|
236
- f.puts gen_head
237
- f.puts gen_content
238
- # f.puts "sm.origin_sv = true"
235
+ unless File.exist?(@autof_name)
236
+ @autof = File.open(@autof_name,"w") do |f|
237
+ f.print gen_head
238
+ f.print gen_content
239
+ # f.puts "sm.origin_sv = true"
240
+ end
241
+ else
242
+ _old_str = File.open(@autof_name).read
243
+ _new_str = gen_head+gen_content
244
+ if _old_str != _new_str
245
+ @autof = File.open(@autof_name,"w") do |f|
246
+ f.print _new_str
247
+ # f.puts "sm.origin_sv = true"
248
+ end
249
+ end
239
250
  end
240
251
  end
241
252
 
@@ -255,7 +266,7 @@ self.path = File.expand_path(__FILE__)
255
266
  end
256
267
 
257
268
  def gen_content
258
- (@param_port_inst+@signals_ports_inst+@inf_ports_inst + ["end"]).join("\n")
269
+ (@param_port_inst+@signals_ports_inst+@inf_ports_inst + ["end\n\n"]).join("\n")
259
270
  end
260
271
 
261
272
 
@@ -218,16 +218,18 @@ class Axi4
218
218
  else
219
219
  mode_str = "ONLY_READ_to_BOTH"
220
220
  end
221
+ require_hdl 'axi4_direct_B1.sv'
221
222
  # Axi4.axi4_direct_a1(mode:mode_str,slaver:lo,master:"#{sub_name}[#{index}]",belong_to_module:belong_to_module)
222
223
  belong_to_module.Instance('axi4_direct_B1',"axi4_direct_a1_long_to_wide_#{sub_name}_#{globle_random_name_flag()}") do |h|
223
224
  # h.param.MODE mode_str #//ONLY_READ to BOTH,ONLY_WRITE to BOTH,BOTH to BOTH,BOTH to ONLY_READ,BOTH to ONLY_WRITE
224
- h.slaver lo
225
- h.master "#{sub_name}[#{index}]".to_nq
225
+ h.slaver_inf lo
226
+ h.master_inf "#{sub_name}[#{index}]".to_nq
226
227
  end
227
228
 
228
229
  else
229
230
  los = short_only.pop
230
231
  @_long_slim_to_wide.delete los
232
+ require_hdl 'axi4_combin_wr_rd_batch.sv'
231
233
  if wr_lg
232
234
  # Axi4.axi4_combin_wr_rd_batch(wr_slaver:lo,rd_slaver:los,master:"#{sub_name}[#{index}]",belong_to_module:belong_to_module)
233
235
  belong_to_module.Instance(:axi4_combin_wr_rd_batch,"axi4_combin_wr_rd_batch_inst_#{sub_name}") do |h|
data/lib/tdl/basefunc.rb CHANGED
@@ -264,6 +264,7 @@ class Integer
264
264
  def clog2
265
265
  b = Math.log2(self)
266
266
  c = b.ceil
267
+ return c
267
268
  end
268
269
 
269
270
  end
@@ -3,9 +3,10 @@ module ClassHDL
3
3
 
4
4
  class HDLAlwaysCombBlock
5
5
  attr_accessor :opertor_chains
6
-
7
- def initialize
6
+ attr_reader :belong_to_module
7
+ def initialize(belong_to_module)
8
8
  @opertor_chains = []
9
+ @belong_to_module = belong_to_module
9
10
  end
10
11
 
11
12
  def instance
@@ -28,7 +29,7 @@ module ClassHDL
28
29
  end
29
30
 
30
31
  def self.AlwaysComb(sdl_m,&block)
31
- ClassHDL::AssignDefOpertor.with_new_assign_block(ClassHDL::HDLAlwaysCombBlock.new) do |ab|
32
+ ClassHDL::AssignDefOpertor.with_new_assign_block(ClassHDL::HDLAlwaysCombBlock.new(sdl_m)) do |ab|
32
33
  AssignDefOpertor.with_rollback_opertors(:new,&block)
33
34
  # return ClassHDL::AssignDefOpertor.curr_assign_block
34
35
  AssignDefOpertor.with_rollback_opertors(:old) do
@@ -30,14 +30,14 @@ module ClassHDL
30
30
  class ClassNegedge < ClassEdge
31
31
  end
32
32
 
33
-
34
- class HDLAlwaysFFBlock
33
+ class HDLAlwaysBlock
35
34
  attr_accessor :opertor_chains,:posedges,:negedges
36
-
37
- def initialize
35
+ attr_reader :belong_to_module
36
+ def initialize(belong_to_module)
38
37
  @opertor_chains = []
39
38
  @posedges = []
40
39
  @negedges = []
40
+ @belong_to_module = belong_to_module
41
41
  end
42
42
 
43
43
  def edge_instance(flag='posedge',edges=[])
@@ -50,6 +50,32 @@ module ClassHDL
50
50
  return es.map{|e| "#{flag} #{e.to_s}"}
51
51
  end
52
52
 
53
+ def instance
54
+ str = []
55
+
56
+ pose_str = edge_instance('posedge',@posedges)
57
+ nege_str = edge_instance('negedge',@negedges)
58
+ pose_str.concat nege_str
59
+
60
+ str.push "always@(#{pose_str.join(",")}) begin "
61
+ opertor_chains.each do |op|
62
+ unless op.is_a? OpertorChain
63
+ str.push op.instance(:always_ff).gsub(/^./){ |m| " #{m}"}
64
+ else
65
+ unless op.slaver
66
+ rel_str = ClassHDL.compact_op_ch(op.instance(:always_ff))
67
+ str.push " #{rel_str};"
68
+ end
69
+ end
70
+
71
+ end
72
+ str.push "end\n"
73
+ str.join("\n")
74
+ end
75
+ end
76
+
77
+ class HDLAlwaysFFBlock < HDLAlwaysBlock
78
+
53
79
  def instance
54
80
  str = []
55
81
 
@@ -74,8 +100,21 @@ module ClassHDL
74
100
  end
75
101
  end
76
102
 
103
+ def self.Always(sdl_m: nil,posedge: [],negedge: [],&block)
104
+ ClassHDL::AssignDefOpertor.with_new_assign_block(ClassHDL::HDLAlwaysBlock.new(sdl_m)) do |ab|
105
+ ab.posedges = posedge
106
+ ab.negedges = negedge
107
+
108
+ AssignDefOpertor.with_rollback_opertors(:new,&block)
109
+ # return ClassHDL::AssignDefOpertor.curr_assign_block
110
+ AssignDefOpertor.with_rollback_opertors(:old) do
111
+ sdl_m.Logic_draw.push ab.instance
112
+ end
113
+ end
114
+ end
115
+
77
116
  def self.AlwaysFF(sdl_m: nil,posedge: [],negedge: [],&block)
78
- ClassHDL::AssignDefOpertor.with_new_assign_block(ClassHDL::HDLAlwaysFFBlock.new) do |ab|
117
+ ClassHDL::AssignDefOpertor.with_new_assign_block(ClassHDL::HDLAlwaysFFBlock.new(sdl_m)) do |ab|
79
118
  ab.posedges = posedge
80
119
  ab.negedges = negedge
81
120
 
@@ -116,7 +155,7 @@ module ClassHDL
116
155
  end
117
156
 
118
157
  def self.AlwaysSIM(sdl_m: nil,posedge: [],negedge: [],&block)
119
- ClassHDL::AssignDefOpertor.with_new_assign_block(ClassHDL::HDLAlwaysSIMBlock.new) do |ab|
158
+ ClassHDL::AssignDefOpertor.with_new_assign_block(ClassHDL::HDLAlwaysSIMBlock.new(sdl_m)) do |ab|
120
159
  ab.posedges = posedge
121
160
  ab.negedges = negedge
122
161
 
@@ -144,16 +183,18 @@ class SdlModule
144
183
  end
145
184
 
146
185
  def Always(posedge: nil,negedge: nil,&block)
147
- ClassHDL::AlwaysFF(sdl_m: self,posedge: posedge,negedge: negedge,&block)
186
+ ClassHDL::Always(sdl_m: self,posedge: posedge,negedge: negedge,&block)
148
187
  end
149
188
 
189
+ alias_method :always, :Always
190
+
150
191
  def Always_ff(posedge: nil,negedge: nil,&block)
151
192
  ClassHDL::AlwaysFF(sdl_m: self,posedge: posedge,negedge: negedge,&block)
152
193
  end
153
194
 
154
195
  def always_ff(*args,&block)
155
196
  if args[0].is_a? Hash
156
- return Always(args[0],&block)
197
+ return Always(**args[0],&block)
157
198
  end
158
199
  posedge_list = []
159
200
  negedge_list = []
@@ -3,9 +3,11 @@ module ClassHDL
3
3
 
4
4
  class HDLAssignBlock
5
5
  attr_accessor :opertor_chains
6
-
7
- def initialize
6
+ attr_reader :belong_to_module
7
+
8
+ def initialize(belong_to_module)
8
9
  @opertor_chains = []
10
+ @belong_to_module = belong_to_module
9
11
  end
10
12
 
11
13
  def instance
@@ -29,7 +31,7 @@ module ClassHDL
29
31
 
30
32
  def self.Assign(sdl_m,&block)
31
33
  # ClassHDL::AssignDefOpertor.curr_assign_block = ClassHDL::HDLAssignBlock.new
32
- ClassHDL::AssignDefOpertor.with_new_assign_block(ClassHDL::HDLAssignBlock.new) do |ab|
34
+ ClassHDL::AssignDefOpertor.with_new_assign_block(ClassHDL::HDLAssignBlock.new(sdl_m)) do |ab|
33
35
  AssignDefOpertor.with_rollback_opertors(:new,&block)
34
36
  # return ClassHDL::AssignDefOpertor.curr_assign_block
35
37
  AssignDefOpertor.with_rollback_opertors(:old) do
@@ -2,9 +2,11 @@ module ClassHDL
2
2
 
3
3
  class BlockIF
4
4
  attr_accessor :cond,:opertor_chains,:slaver
5
- def initialize
5
+ attr_reader :belong_to_module
6
+ def initialize(belong_to_module)
6
7
  @opertor_chains = []
7
8
  @cond = nil
9
+ @belong_to_module = belong_to_module
8
10
  end
9
11
 
10
12
  def instance(as_type= :cond)
@@ -180,7 +182,7 @@ module ClassHDL
180
182
  end
181
183
 
182
184
  module ClassHDL
183
- class EnumStruct
185
+ class EnumStruct < AxiTdl::SdlModuleActiveBaseElm
184
186
  # attr_accessor :sdl_m
185
187
  attr_accessor :belong_to_module
186
188
  def initialize(sdl_m,*args)
@@ -238,7 +240,7 @@ end
238
240
  class SdlModule
239
241
 
240
242
  def IF(cond,&block)
241
- new_op = ClassHDL::BlockIF.new
243
+ new_op = ClassHDL::BlockIF.new(self)
242
244
  # if ClassHDL::AssignDefOpertor.curr_assign_block.is_a? ClassHDL::BlockIF
243
245
  # new_op.slaver = true
244
246
  # end
@@ -255,7 +257,7 @@ class SdlModule
255
257
  end
256
258
 
257
259
  def ELSIF(cond,&block)
258
- new_op = ClassHDL::BlockELSIF.new
260
+ new_op = ClassHDL::BlockELSIF.new(self)
259
261
  # if ClassHDL::AssignDefOpertor.curr_assign_block.is_a? ClassHDL::BlockIF
260
262
  # new_op.slaver = true
261
263
  # end
@@ -272,7 +274,7 @@ class SdlModule
272
274
  end
273
275
 
274
276
  def ELSE(&block)
275
- new_op = ClassHDL::BlockELSE.new
277
+ new_op = ClassHDL::BlockELSE.new(self)
276
278
  # if ClassHDL::AssignDefOpertor.curr_assign_block.is_a? ClassHDL::BlockIF
277
279
  # new_op.slaver = true
278
280
  # end
@@ -284,7 +286,7 @@ class SdlModule
284
286
  end
285
287
 
286
288
  def CASE(cond,&block)
287
- new_op = ClassHDL::BlockCASE.new
289
+ new_op = ClassHDL::BlockCASE.new(self)
288
290
  # if ClassHDL::AssignDefOpertor.curr_assign_block.is_a? ClassHDL::BlockIF
289
291
  # new_op.slaver = true
290
292
  # end
@@ -301,7 +303,7 @@ class SdlModule
301
303
  end
302
304
 
303
305
  def CASEX(cond,&block)
304
- new_op = ClassHDL::BlockCASEX.new
306
+ new_op = ClassHDL::BlockCASEX.new(self)
305
307
  # if ClassHDL::AssignDefOpertor.curr_assign_block.is_a? ClassHDL::BlockIF
306
308
  # new_op.slaver = true
307
309
  # end
@@ -318,7 +320,7 @@ class SdlModule
318
320
  end
319
321
 
320
322
  def WHEN(*cond,&block)
321
- new_op = ClassHDL::BlockCASEWHEN.new
323
+ new_op = ClassHDL::BlockCASEWHEN.new(self)
322
324
 
323
325
  ClassHDL::AssignDefOpertor.with_new_assign_block(new_op) do |ab|
324
326
  if cond.is_a? ClassHDL::OpertorChain
@@ -333,7 +335,7 @@ class SdlModule
333
335
  end
334
336
 
335
337
  def DEFAULT(&block)
336
- new_op = ClassHDL::BlockCASEDEFAULT.new
338
+ new_op = ClassHDL::BlockCASEDEFAULT.new(self)
337
339
 
338
340
  ClassHDL::AssignDefOpertor.with_new_assign_block(new_op) do |ab|
339
341
  block.call
@@ -55,7 +55,7 @@ class SdlModule
55
55
  ClassHDL::AssignDefOpertor.with_normal_opertor do
56
56
  @@__foreach_index_cnt__ += 1
57
57
  end
58
- new_op = ClassHDL::BlockFOREACH.new
58
+ new_op = ClassHDL::BlockFOREACH.new(self)
59
59
 
60
60
  ClassHDL::AssignDefOpertor.with_new_opertor do
61
61
  ClassHDL::AssignDefOpertor.with_new_assign_block(new_op) do |ab|
@@ -81,7 +81,7 @@ class SdlModule
81
81
  ClassHDL::AssignDefOpertor.with_normal_opertor do
82
82
  @@__for_index_cnt__ += 1
83
83
  end
84
- new_op = ClassHDL::BlockFOR.new
84
+ new_op = ClassHDL::BlockFOR.new(self)
85
85
 
86
86
  ClassHDL::AssignDefOpertor.with_new_opertor do
87
87
  ClassHDL::AssignDefOpertor.with_new_assign_block(new_op) do |ab|
@@ -57,12 +57,14 @@ module ClassHDL
57
57
  attr_accessor :opertor_chains,:name
58
58
  attr_accessor :open_ivoke
59
59
  attr_reader :return_type
60
+ attr_reader :belong_to_module
60
61
 
61
- def initialize(name,return_type,*argvs)
62
+ def initialize(belong_to_module,name,return_type,*argvs)
62
63
  @opertor_chains = []
63
64
  @name = name
64
65
  @argvs = argvs
65
66
  @return_type = return_type
67
+ @belong_to_module = belong_to_module
66
68
  end
67
69
 
68
70
  def inst_port
@@ -117,7 +119,7 @@ module ClassHDL
117
119
 
118
120
  def self.Function(sdl_m,name,return_type,*argvs,&block)
119
121
  define_func_block_method(sdl_m,*argvs)
120
- func_inst = ClassHDL::HDLFunction.new(name,return_type,*argvs)
122
+ func_inst = ClassHDL::HDLFunction.new(sdl_m,name,return_type,*argvs)
121
123
  ## 给 sdl module 定义函数方法
122
124
  sdl_m.define_singleton_method(name) do |*fargvs|
123
125
  # new_op = OpertorChain.new
@@ -3,9 +3,10 @@ module ClassHDL
3
3
  class HDLAssignGenerateBlock
4
4
 
5
5
  attr_accessor :opertor_chains
6
-
7
- def initialize
6
+ attr_reader :belong_to_module
7
+ def initialize(belong_to_module)
8
8
  @opertor_chains = []
9
+ @belong_to_module = belong_to_module
9
10
  end
10
11
 
11
12
  def instance
@@ -160,11 +161,11 @@ class SdlModule
160
161
  add_children_modules(inst_obj:inst_obj ,module_poit: tmp_sm)
161
162
 
162
163
  args.each_index do |e|
163
- new_op = ClassHDL::OpertorChain.new
164
+ new_op = ClassHDL::OpertorChain.new(nil, self)
164
165
  new_op.tree.push(["KK#{e}".to_nq])
165
166
  kk_args << new_op
166
167
  end
167
- ClassHDL::AssignDefOpertor.with_new_assign_block(ClassHDL::HDLAssignGenerateBlock.new ) do
168
+ ClassHDL::AssignDefOpertor.with_new_assign_block(ClassHDL::HDLAssignGenerateBlock.new(self) ) do
168
169
  ClassHDL::AssignDefOpertor.with_rollback_opertors(:new) do
169
170
  tmp_sm.instance_exec(*kk_args,&block)
170
171
  end
@@ -3,9 +3,10 @@ module ClassHDL
3
3
 
4
4
  class HDLInitialBlock
5
5
  attr_accessor :opertor_chains
6
-
7
- def initialize
6
+ attr_reader :belong_to_module
7
+ def initialize(belong_to_module)
8
8
  @opertor_chains = []
9
+ @belong_to_module = belong_to_module
9
10
  end
10
11
 
11
12
  def instance(block_name=nil)
@@ -28,7 +29,7 @@ module ClassHDL
28
29
  end
29
30
 
30
31
  def self.Initial(sdl_m,block_name=nil,&block)
31
- ClassHDL::AssignDefOpertor.with_new_assign_block(ClassHDL::HDLInitialBlock.new) do |ab|
32
+ ClassHDL::AssignDefOpertor.with_new_assign_block(ClassHDL::HDLInitialBlock.new(sdl_m)) do |ab|
32
33
  AssignDefOpertor.with_rollback_opertors(:new,&block)
33
34
  # return ClassHDL::AssignDefOpertor.curr_assign_block
34
35
  AssignDefOpertor.with_rollback_opertors(:old) do
@@ -82,7 +83,7 @@ class SdlModule
82
83
  return assert_old(cond,argv_str=formats,&block)
83
84
  end
84
85
 
85
- new_op = ClassHDL::BlocAssertIF.new
86
+ new_op = ClassHDL::BlocAssertIF.new(self)
86
87
  ClassHDL::AssignDefOpertor.with_new_assign_block(new_op) do |ab|
87
88
  if cond.is_a? ClassHDL::OpertorChain
88
89
  cond.slaver = true
@@ -102,7 +103,7 @@ class SdlModule
102
103
  end
103
104
 
104
105
  def assert_old(cond,argv_str=nil,&block)
105
- new_op = ClassHDL::BlocAssertIF.new
106
+ new_op = ClassHDL::BlocAssertIF.new(self)
106
107
  # if ClassHDL::AssignDefOpertor.curr_assign_block.is_a? ClassHDL::BlockIF
107
108
  # new_op.slaver = true
108
109
  # end
@@ -130,17 +131,17 @@ class SdlModule
130
131
  end
131
132
 
132
133
  def assert_error(argv_str)
133
- ClassHDL::AssignDefOpertor.curr_assign_block.opertor_chains.push(ClassHDL::OpertorChain.new(["$error(\"#{argv_str}\")".to_nq]))
134
- ClassHDL::AssignDefOpertor.curr_assign_block.opertor_chains.push(ClassHDL::OpertorChain.new(["$stop".to_nq]))
134
+ ClassHDL::AssignDefOpertor.curr_assign_block.opertor_chains.push(ClassHDL::OpertorChain.new(["$error(\"#{argv_str}\")".to_nq], self))
135
+ ClassHDL::AssignDefOpertor.curr_assign_block.opertor_chains.push(ClassHDL::OpertorChain.new(["$stop".to_nq], self))
135
136
  end
136
137
 
137
138
  def assert_format_error(formats=[],args=[])
138
- ClassHDL::AssignDefOpertor.curr_assign_block.opertor_chains.push(ClassHDL::OpertorChain.new(["$error(\"#{formats.join(' ')}\",#{args.map{|s| s.to_s}.join(',')})".to_nq]))
139
- ClassHDL::AssignDefOpertor.curr_assign_block.opertor_chains.push(ClassHDL::OpertorChain.new(["$stop".to_nq]))
139
+ ClassHDL::AssignDefOpertor.curr_assign_block.opertor_chains.push(ClassHDL::OpertorChain.new(["$error(\"#{formats.join(' ')}\",#{args.map{|s| s.to_s}.join(',')})".to_nq], self))
140
+ ClassHDL::AssignDefOpertor.curr_assign_block.opertor_chains.push(ClassHDL::OpertorChain.new(["$stop".to_nq], self))
140
141
  end
141
142
 
142
143
  def initial_exec(str)
143
- ClassHDL::AssignDefOpertor.curr_assign_block.opertor_chains.push(ClassHDL::OpertorChain.new([str.to_s.to_nq]))
144
+ ClassHDL::AssignDefOpertor.curr_assign_block.opertor_chains.push(ClassHDL::OpertorChain.new([str.to_s.to_nq], self))
144
145
  end
145
146
 
146
147
  alias_method :always_sim_exec, :initial_exec
@@ -70,6 +70,9 @@ module ClassHDL
70
70
  def initialize(name,sdlm)
71
71
  @name = name
72
72
  @sdlm = sdlm
73
+ unless SdlModule.exist_module?(@name)
74
+ raise TdlError.new("Cant find module `#{name}` !!!")
75
+ end
73
76
  end
74
77
 
75
78
  def inst(dname,&block)
@@ -95,9 +98,23 @@ module ClassHDL
95
98
  # else
96
99
  # @sdlm.Instance(@name,dname.to_s,&block)
97
100
  # end
101
+ rel = nil
98
102
  AssignDefOpertor.with_rollback_opertors(:old) do
99
- inst(dname,&block)
103
+ if block_given?
104
+ rel = inst(dname,&block)
105
+ else
106
+ ## 当没有block 判断 sdlm是否相应方法
107
+ # if @sdlm.has_signal?(dname)
108
+ # if SdlModule.call_module(@name).has_signal?(dname)
109
+ if SdlModule.call_module(@name).respond_to?(dname)
110
+ rel = SdlModule.call_module(@name).signal(dname)
111
+ else
112
+ # super
113
+ raise TdlError.new( "Cant find signal `#{dname}` in module `#{@name}` path: #{SdlModule.call_module(@name).real_sv_path } !!!" )
114
+ end
115
+ end
100
116
  end
117
+ return rel
101
118
  end
102
119
 
103
120
  end