axi_tdl 0.0.9 → 0.0.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/gem-push.yml +44 -0
- data/.github/workflows/ruby.yml +35 -0
- data/.gitignore +3 -1
- data/.travis.yml +9 -0
- data/Gemfile +4 -0
- data/README.EN.md +322 -0
- data/README.md +24 -20
- data/Rakefile +2 -6
- data/axi_tdl.gemspec +5 -6
- data/lib/axi/AXI4/axi4_direct_B1.sv +23 -23
- data/lib/axi/AXI4/axi4_dpram_cache.sv +33 -33
- data/lib/axi/AXI4/axis_to_axi4_wr.rb +1 -0
- data/lib/axi/AXI4/axis_to_axi4_wr.sv +20 -20
- data/lib/axi/AXI4/packet_partition/axi4_partition_rd_verb.sv +32 -32
- data/lib/axi/AXI4/packet_partition/data_inf_partition.rb +2 -0
- data/lib/axi/AXI4/packet_partition/data_inf_partition.sv +71 -71
- data/lib/axi/AXI4/wide_axis_to_axi4_wr.rb +2 -1
- data/lib/axi/AXI4/wide_axis_to_axi4_wr.sv +23 -23
- data/lib/axi/AXI_stream/axi_stream_split_channel.rb +7 -1
- data/lib/axi/AXI_stream/axis_head_cut_verb.sv +6 -2
- data/lib/axi/AXI_stream/axis_insert_copy.rb +18 -4
- data/lib/axi/AXI_stream/axis_sim_master_model.rb +28 -0
- data/lib/axi/AXI_stream/axis_sim_slaver_model.rb +26 -0
- data/lib/axi/AXI_stream/axis_sim_verify_by_coe.sv +101 -0
- data/lib/axi/AXI_stream/axis_split_channel_verb.rb +2 -0
- data/lib/axi/common/common_ram_sim_wrapper.sv +9 -9
- data/lib/axi/common/common_ram_wrapper.sv +12 -12
- data/lib/axi/data_interface/data_inf_c/data_c_pipe_sync_seam.sv +26 -26
- data/lib/axi/data_interface/data_inf_c/data_c_sim_master_model.sv +69 -0
- data/lib/axi/data_interface/data_inf_c/data_c_sim_slaver_model.sv +58 -0
- data/lib/axi/data_interface/data_inf_c/logic_sim_model.sv +64 -0
- data/lib/axi/techbench/tb_axi_stream_split_channel.rb +69 -0
- data/lib/axi/techbench/tb_axi_stream_split_channel.sv +149 -0
- data/lib/axi/techbench/tb_axis_split_channel_verb.rb +69 -0
- data/lib/axi/techbench/tb_axis_split_channel_verb.sv +125 -0
- data/lib/axi_tdl.rb +1 -0
- data/lib/axi_tdl/version.rb +1 -1
- data/lib/tdl/auto_script/autogensdl.rb +16 -5
- data/lib/tdl/axi4/axi4_interconnect_verb.rb +4 -2
- data/lib/tdl/basefunc.rb +1 -0
- data/lib/tdl/class_hdl/hdl_always_comb.rb +4 -3
- data/lib/tdl/class_hdl/hdl_always_ff.rb +49 -8
- data/lib/tdl/class_hdl/hdl_assign.rb +5 -3
- data/lib/tdl/class_hdl/hdl_block_ifelse.rb +11 -9
- data/lib/tdl/class_hdl/hdl_foreach.rb +2 -2
- data/lib/tdl/class_hdl/hdl_function.rb +4 -2
- data/lib/tdl/class_hdl/hdl_generate.rb +5 -4
- data/lib/tdl/class_hdl/hdl_initial.rb +11 -10
- data/lib/tdl/class_hdl/hdl_module_def.rb +18 -1
- data/lib/tdl/class_hdl/hdl_redefine_opertor.rb +35 -14
- data/lib/tdl/class_hdl/hdl_struct.rb +1 -1
- data/lib/tdl/class_hdl/hdl_verify.rb +1 -1
- data/lib/tdl/elements/originclass.rb +6 -1
- data/lib/tdl/elements/parameter.rb +1 -1
- data/lib/tdl/examples/10_random/exp_random.sv +3 -3
- data/lib/tdl/examples/11_test_unit/dve.tcl +155 -2
- data/lib/tdl/examples/11_test_unit/exp_test_unit.rb +9 -8
- data/lib/tdl/examples/11_test_unit/exp_test_unit.sv +1 -1
- data/lib/tdl/examples/11_test_unit/modules/sub_md0.rb +6 -3
- data/lib/tdl/examples/11_test_unit/modules/sub_md0.sv +5 -5
- data/lib/tdl/examples/11_test_unit/modules/sub_md1.rb +9 -4
- data/lib/tdl/examples/11_test_unit/modules/sub_md1.sv +5 -5
- data/lib/tdl/examples/11_test_unit/tb_exp_test_unit.sv +1 -3
- data/lib/tdl/examples/11_test_unit/tu0.sv +9 -9
- data/lib/tdl/examples/11_test_unit/tu1.sv +1 -1
- data/lib/tdl/examples/1_define_module/exmple_md.sv +12 -12
- data/lib/tdl/examples/2_hdl_class/tmp/always_comb_test.sv +60 -60
- data/lib/tdl/examples/2_hdl_class/tmp/always_ff_test.sv +2 -2
- data/lib/tdl/examples/2_hdl_class/tmp/case_test.sv +17 -17
- data/lib/tdl/examples/2_hdl_class/tmp/head_pkg_module.sv +9 -9
- data/lib/tdl/examples/2_hdl_class/tmp/simple_assign_test.sv +1 -1
- data/lib/tdl/examples/2_hdl_class/tmp/state_case_test.sv +10 -10
- data/lib/tdl/examples/2_hdl_class/tmp/test_foreach.sv +3 -3
- data/lib/tdl/examples/2_hdl_class/tmp/test_function.sv +7 -7
- data/lib/tdl/examples/2_hdl_class/tmp/test_initial_assert.sv +3 -3
- data/lib/tdl/examples/2_hdl_class/tmp/test_module.sv +2 -2
- data/lib/tdl/examples/2_hdl_class/tmp/test_module_var.sv +2 -2
- data/lib/tdl/examples/2_hdl_class/tmp/test_package.sv +4 -5
- data/lib/tdl/examples/2_hdl_class/tmp/test_package2.sv +4 -4
- data/lib/tdl/examples/2_hdl_class/tmp/test_struct_function.sv +2 -2
- data/lib/tdl/examples/2_hdl_class/tmp/test_vcs_string.sv +1 -1
- data/lib/tdl/examples/2_hdl_class/tmp/text_generate.sv +7 -7
- data/lib/tdl/examples/4_generate/test_generate.sv +11 -11
- data/lib/tdl/examples/5_logic_combin/test_logic_combin.sv +3 -3
- data/lib/tdl/examples/7_module_with_package/body_package.sv +3 -4
- data/lib/tdl/examples/7_module_with_package/example_pkg.sv +4 -4
- data/lib/tdl/examples/7_module_with_package/head_package.sv +3 -4
- data/lib/tdl/examples/8_top_module/tb_test_top.sv +1 -2
- data/lib/tdl/examples/9_itegration/tb_test_tttop.sv +2 -2
- data/lib/tdl/examples/9_itegration/test_tttop.sv +3 -3
- data/lib/tdl/exlib/axis_eth_ex.rb +95 -0
- data/lib/tdl/exlib/axis_verify.rb +264 -0
- data/lib/tdl/exlib/clock_reset_verify.rb +29 -0
- data/lib/tdl/exlib/dve_tcl.rb +30 -11
- data/lib/tdl/exlib/itegration.rb +15 -3
- data/lib/tdl/exlib/logic_verify.rb +88 -0
- data/lib/tdl/exlib/test_point.rb +96 -94
- data/lib/tdl/exlib/test_point.rb.bak +293 -0
- data/lib/tdl/rebuild_ele/ele_base.rb +1 -1
- data/lib/tdl/sdlmodule/sdlmodlule_path_db.rb +34 -0
- data/lib/tdl/sdlmodule/sdlmodule.rb +18 -14
- data/lib/tdl/sdlmodule/sdlmodule_draw.rb +81 -16
- data/lib/tdl/sdlmodule/test_unit_module.rb +272 -33
- data/lib/tdl/sdlmodule/test_unit_module.rb.bak +143 -0
- data/lib/tdl/sdlmodule/top_module.rb +53 -48
- data/lib/tdl/sdlmodule/top_module.rb.bak +547 -0
- data/lib/tdl/tdl.rb +19 -4
- metadata +36 -137
- data/Gemfile.lock +0 -28
- data/lib/axi/AXI_stream/axi_stream_split_channel.sv +0 -149
- data/lib/axi/AXI_stream/axis_head_cut_verc.sv +0 -242
- data/lib/axi/AXI_stream/axis_insert_copy.sv +0 -66
- data/lib/axi/AXI_stream/axis_pipe_sync_seam.sv +0 -48
- data/lib/axi/AXI_stream/axis_rom_contect_sim.sv +0 -113
- data/lib/axi/AXI_stream/axis_split_channel_verb.sv +0 -62
@@ -0,0 +1,95 @@
|
|
1
|
+
|
2
|
+
module AxiTdl
|
3
|
+
class EthernetStreamDefAtom
|
4
|
+
|
5
|
+
def initialize(belong_to_module: nil, stream: nil, start: 0, length: 32)
|
6
|
+
@belong_to_module = belong_to_module
|
7
|
+
@stream = stream
|
8
|
+
@start = start
|
9
|
+
@length = length
|
10
|
+
end
|
11
|
+
|
12
|
+
def -(str)
|
13
|
+
@stream.x_all_bits_slice(name: str.to_s ,start: @start, length: @length)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class AxiStream
|
19
|
+
|
20
|
+
## 转到 网络流
|
21
|
+
def to_eth(esize=8) # SIZE:8 ,64, 32
|
22
|
+
@__ethernet_type__ = esize
|
23
|
+
end
|
24
|
+
|
25
|
+
## 截取流数据段
|
26
|
+
def all_bits_slice(start: 8*4,length:32)
|
27
|
+
return AxiTdl::EthernetStreamDefAtom.new(belong_to_module: @belong_to_module, stream: self, start: start, length: length)
|
28
|
+
end
|
29
|
+
|
30
|
+
def x_all_bits_slice(name: "slice_#{globle_random_name_flag()}", start: 8*4,length:32)
|
31
|
+
raise TdlError.new("#{name} is not ethernet stream, before used it must be call to_eth") unless @__ethernet_type__
|
32
|
+
# @belong_to_module.logic[length] - name
|
33
|
+
@belong_to_module.instance_exec(self,name,start,length,@__ethernet_type__) do |_targget_axis, _name, _start, _length, _ethernet_type|
|
34
|
+
logic[_length] - _name
|
35
|
+
_end = _start + _length -1
|
36
|
+
|
37
|
+
## 如果选的区域在一个Clock里面
|
38
|
+
if _start / _ethernet_type == (_end) / _ethernet_type
|
39
|
+
_target_cnt = _start/_ethernet_type
|
40
|
+
|
41
|
+
always_ff(posedge: _targget_axis.aclk, negedge: _targget_axis.aresetn) do
|
42
|
+
IF ~_targget_axis.aresetn do
|
43
|
+
signal(_name) <= 0.A
|
44
|
+
end
|
45
|
+
ELSE do
|
46
|
+
IF _targget_axis.vld_rdy do
|
47
|
+
IF (_targget_axis.axis_tcnt[15,0] == "16'd#{_target_cnt}".to_nq) do
|
48
|
+
signal(_name) <= _targget_axis.axis_tdata[rubyOP{_ethernet_type - _start%_ethernet_type - 1}, rubyOP{_ethernet_type - _end%_ethernet_type - 1}, ]
|
49
|
+
end
|
50
|
+
ELSE do
|
51
|
+
signal(_name) <= signal(_name)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
ELSE do
|
55
|
+
signal(_name) <= signal(_name)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
## 如果夸Clock
|
62
|
+
if _start / _ethernet_type != (_end) / _ethernet_type
|
63
|
+
_slice_range = ( (_start / _ethernet_type)..(_end) / _ethernet_type ).to_a
|
64
|
+
|
65
|
+
always_ff(posedge: _targget_axis.aclk, negedge: _targget_axis.aresetn) do
|
66
|
+
IF ~_targget_axis.aresetn do
|
67
|
+
signal(_name) <= 0.A
|
68
|
+
end
|
69
|
+
ELSE do
|
70
|
+
IF _targget_axis.vld_rdy do
|
71
|
+
_slice_range.each do |e|
|
72
|
+
IF (_targget_axis.axis_tcnt[15,0] == "16'd#{e}".to_nq) do
|
73
|
+
##第一个
|
74
|
+
if ClassHDL::AssignDefOpertor.with_rollback_opertors(:old,&(proc { e == _slice_range.first}) )
|
75
|
+
signal(_name)[rubyOP{_length-1}, rubyOP{_length - (_ethernet_type - _start%_ethernet_type)}] <= _targget_axis.axis_tdata[rubyOP{_ethernet_type - _start%_ethernet_type-1}, 0]
|
76
|
+
## 最后一个
|
77
|
+
elsif ClassHDL::AssignDefOpertor.with_rollback_opertors(:old,&(proc { e == _slice_range.last}) )
|
78
|
+
signal(_name)[rubyOP{_end%_ethernet_type},0] <= _targget_axis.axis_tdata[rubyOP{_ethernet_type-1}, rubyOP{_ethernet_type-_end%_ethernet_type-1}]
|
79
|
+
else
|
80
|
+
signal(_name)[rubyOP{(_end - e*_ethernet_type)}, rubyOP{(_end - e*_ethernet_type - _ethernet_type+1)}] <= _targget_axis.axis_tdata
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
ELSE do
|
86
|
+
signal(_name) <= signal(_name)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
92
|
+
end
|
93
|
+
@belong_to_module.signal(name)
|
94
|
+
end
|
95
|
+
end
|
@@ -0,0 +1,264 @@
|
|
1
|
+
|
2
|
+
module AxiTdl
|
3
|
+
|
4
|
+
module AxisVerify
|
5
|
+
|
6
|
+
class Iteration
|
7
|
+
|
8
|
+
# attr_accessor :axis_tlast, :axis_tuser, :axis_tkeep, :axis_tdata
|
9
|
+
def initialize(length: 1024, data: [0], vld_perc: 50,user:[0], keep:[1] , rand_seed: 0 ,dsize: 8, usize: 1)
|
10
|
+
@axis_tdata = data.to_a * (length / data.size + 1)
|
11
|
+
@axis_tuser = user.to_a * (length / user.size + 1)
|
12
|
+
@axis_tkeep = keep.to_a * (length / keep.size + 1)
|
13
|
+
@vld_perc = vld_perc / 100.0
|
14
|
+
@length = length
|
15
|
+
@prng = Random.new( rand_seed )
|
16
|
+
@dsize = dsize
|
17
|
+
@usize = usize
|
18
|
+
@ksize = @dsize / 8 + (@dsize%8==0 ? 0 : 1)
|
19
|
+
|
20
|
+
raise TdlError.new("valid percetage cant be zero") if vld_perc==0
|
21
|
+
end
|
22
|
+
|
23
|
+
# def each(&block)
|
24
|
+
# # yield(axis_tlast, axis_tuser, axis_tkeep, axis_tdata)
|
25
|
+
# # @length.each do |index|
|
26
|
+
# # yield(axis_tlast, axis_tuser, axis_tkeep, axis_tdata)
|
27
|
+
# # end
|
28
|
+
# index = 0
|
29
|
+
# while true
|
30
|
+
|
31
|
+
# # @length -= 1
|
32
|
+
# # @length = axis_tcnt
|
33
|
+
# # yield(@length, axis_tvalid, axis_tlast, axis_tuser, axis_tkeep, axis_tdata)
|
34
|
+
|
35
|
+
# yield(index, (@vld_perc > @prng.rand ? 1 : 0), @axis_tuser[index], @axis_tkeep[index], (@length==0 ? 1 : 0), @axis_tdata[index])
|
36
|
+
|
37
|
+
# if @length <= index + 1
|
38
|
+
# break
|
39
|
+
# end
|
40
|
+
# index += 1
|
41
|
+
# end
|
42
|
+
# end
|
43
|
+
|
44
|
+
def to_a
|
45
|
+
collect = []
|
46
|
+
index = 0
|
47
|
+
10000.times do
|
48
|
+
|
49
|
+
vld = (@vld_perc > @prng.rand ? 1 : 0)
|
50
|
+
|
51
|
+
collect << [ index, vld , @axis_tuser[index], @axis_tkeep[index], (@length==(index+vld) ? 1 : 0), @axis_tdata[index] ]
|
52
|
+
|
53
|
+
if @length <= index + vld
|
54
|
+
break
|
55
|
+
end
|
56
|
+
|
57
|
+
index += vld
|
58
|
+
end
|
59
|
+
|
60
|
+
collect
|
61
|
+
end
|
62
|
+
|
63
|
+
def stream_context
|
64
|
+
collect = []
|
65
|
+
to_a.each do |axis_tcnt, axis_tvalid, axis_tuser, axis_tkeep, axis_tlast, axis_tdata|
|
66
|
+
u0 = axis_tdata % (2**@dsize)
|
67
|
+
u3 = axis_tlast << (@dsize)
|
68
|
+
u1 = (axis_tkeep % (2**@ksize)) << (@dsize + 1)
|
69
|
+
u2 = (axis_tuser % (2**@usize)) << (@dsize + @ksize + 1)
|
70
|
+
u4 = axis_tvalid << (@dsize + @ksize + @usize + 1)
|
71
|
+
collect << (u0+u1+u2+u3+u4)
|
72
|
+
end
|
73
|
+
|
74
|
+
collect.map do |e|
|
75
|
+
"%0#{(@dsize + @ksize + @usize + 1 + 1)/4 + ( ((@dsize + @ksize + @usize + 1 + 1)%4 == 0) ? 0 : 1 )}x"%e
|
76
|
+
end
|
77
|
+
# collect
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
class SimpleStreams
|
82
|
+
attr_accessor :streams
|
83
|
+
def initialize(length: [10,200], gap_len: [0,10], data: [ (0...100) ] * 10 , vld_perc: [50, 100], dsize: 8)
|
84
|
+
max_len = [length.size, gap_len.size, data.size , vld_perc.size ].max
|
85
|
+
@lengths = length.to_a * (max_len / length.size + 1 )
|
86
|
+
@gap_lens = gap_len.to_a * (max_len / gap_len.size + 1 )
|
87
|
+
@datas = data.to_a * (max_len / data.size + 1 )
|
88
|
+
@vld_percs = vld_perc.to_a * (max_len / vld_perc.size + 1 )
|
89
|
+
|
90
|
+
@dsize = dsize
|
91
|
+
@max_len = max_len
|
92
|
+
@streams = []
|
93
|
+
gen_itr
|
94
|
+
end
|
95
|
+
|
96
|
+
def gen_itr
|
97
|
+
@max_len.times do |index|
|
98
|
+
itr = Iteration.new(length: @lengths[index], data: @datas[index], vld_perc: @vld_percs[index],user:[0], keep:[1] , rand_seed: index ,dsize: @dsize, usize: 1)
|
99
|
+
streams << itr
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def coe
|
104
|
+
collect = []
|
105
|
+
@max_len.times do |index|
|
106
|
+
## add grap
|
107
|
+
if @gap_lens[index] != 0
|
108
|
+
collect += ["0"]*@gap_lens[index]
|
109
|
+
end
|
110
|
+
itr = @streams[index]
|
111
|
+
collect += itr.stream_context
|
112
|
+
end
|
113
|
+
|
114
|
+
mmp = []
|
115
|
+
collect.each_index do |index|
|
116
|
+
mmp << "@%04x #{collect[index]}\n"%index
|
117
|
+
end
|
118
|
+
|
119
|
+
mmp.join("")
|
120
|
+
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
end
|
125
|
+
|
126
|
+
end
|
127
|
+
|
128
|
+
|
129
|
+
class AxiStream
|
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)
|
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")
|
134
|
+
_sps = nil
|
135
|
+
ClassHDL::AssignDefOpertor.with_rollback_opertors(:old) do
|
136
|
+
require_sdl 'axis_sim_master_model.rb'
|
137
|
+
File.open(file,'w') do |f|
|
138
|
+
_sps = AxiTdl::AxisVerify::SimpleStreams.new(length: length, gap_len: gap_len, data: data , vld_perc: vld_perc)
|
139
|
+
f.print _sps.coe
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
self.define_singleton_method(:verification) do
|
144
|
+
_sps
|
145
|
+
end
|
146
|
+
|
147
|
+
@belong_to_module.instance_exec(self,file,loop_coe) do |_self,file,loop_coe|
|
148
|
+
|
149
|
+
Instance(:axis_sim_master_model,"sim_model_inst_#{_self.name}") do |h|
|
150
|
+
h.param.LOOP (loop_coe ? "TRUE" : "FALSE")
|
151
|
+
h.param.RAM_DEPTH File.open(File.expand_path(file)).readlines.size
|
152
|
+
h.input.load_trigger 1.b0
|
153
|
+
h.input[32].total_length h.param.RAM_DEPTH
|
154
|
+
h.input[512*8].mem_file File.expand_path(file) # {axis_tvalid, axis_tuser, axis_tkeep, axis_tlast, axis_tdata}
|
155
|
+
h.port.axis.master.out_inf _self
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
end
|
160
|
+
|
161
|
+
def to_simple_sim_slaver(rdy_percetage=50,loop_rdy=true)
|
162
|
+
unless rdy_percetage.is_a?(Array)
|
163
|
+
@belong_to_module.instance_exec(self) do |_self|
|
164
|
+
|
165
|
+
always_ff(posedge: _self.aclk) do
|
166
|
+
IF ~_self.aresetn do
|
167
|
+
_self.axis_tready <= 1.b0
|
168
|
+
end
|
169
|
+
ELSE do
|
170
|
+
_self.axis_tready <= rdy_percetage.precent_true
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
174
|
+
else
|
175
|
+
@belong_to_module.instance_exec(self,rdy_percetage,loop_rdy) do |_self,rdy_percetage,loop_rdy|
|
176
|
+
|
177
|
+
__xx = logic[32] - "#{_self.name}_rdy_percetage_index"
|
178
|
+
__rr = logic[rdy_percetage.size, 32] - "#{_self.name}_rdy_percetage"
|
179
|
+
Initial do
|
180
|
+
__xx <= 0
|
181
|
+
rdy_percetage.each_index do |index|
|
182
|
+
__rr[index] <= rdy_percetage[index]
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
Always(posedge: _self.aclk) do
|
187
|
+
IF _self.vld_rdy_last do
|
188
|
+
IF __xx >= (rdy_percetage.size - 1 ) do
|
189
|
+
if loop_rdy
|
190
|
+
__xx <= 0
|
191
|
+
else
|
192
|
+
__xx <= __xx
|
193
|
+
__rr[__xx] = 0
|
194
|
+
end
|
195
|
+
end
|
196
|
+
ELSE do
|
197
|
+
__xx <= __xx + 1.b1
|
198
|
+
end
|
199
|
+
end
|
200
|
+
ELSE do
|
201
|
+
__xx <= __xx
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
always_ff(posedge: _self.aclk) do
|
206
|
+
IF ~_self.aresetn do
|
207
|
+
_self.axis_tready <= 1.b0
|
208
|
+
end
|
209
|
+
ELSE do
|
210
|
+
_self.axis_tready <= "($urandom_range(0,99) <= #{__rr[__xx]})".to_nq
|
211
|
+
end
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
def simple_verify_by_coe(file)
|
218
|
+
unless File.file?(file)
|
219
|
+
if file.is_a?(String)
|
220
|
+
wfile = File.join(AxiTdl::TDL_PATH,"./auto_script/tmp/","#{self.name}_#{globle_random_name_flag}.coe")
|
221
|
+
File.open(wfile,'w') do |f|
|
222
|
+
f.puts file
|
223
|
+
end
|
224
|
+
file = wfile
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
require_hdl 'axis_sim_verify_by_coe.sv'
|
229
|
+
|
230
|
+
@belong_to_module.instance_exec(self,File.open(file).readlines.size,file) do |_self,_ram_depth,_file|
|
231
|
+
|
232
|
+
Instance(:axis_sim_verify_by_coe, "axis_sim_verify_by_coe_inst_#{_self.name}") do |h|#(
|
233
|
+
h.param.RAM_DEPTH _ram_depth
|
234
|
+
h.param.VERIFY_KEEP "OFF"
|
235
|
+
h.param.VERIFY_USER "OFF"
|
236
|
+
h.input.load_trigger 1.b0
|
237
|
+
h.input[32].total_length _ram_depth
|
238
|
+
h.input[4096].mem_file File.expand_path(_file)
|
239
|
+
h.port.axis.mirror.mirror_inf _self
|
240
|
+
end
|
241
|
+
end
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
## Extand Array
|
246
|
+
module AxiTdl
|
247
|
+
module Verification
|
248
|
+
class CoeArray < Array
|
249
|
+
|
250
|
+
def initialize(obj_array=nil)
|
251
|
+
super obj_array
|
252
|
+
end
|
253
|
+
|
254
|
+
def coe
|
255
|
+
xcollect = []
|
256
|
+
self.each_index do |index|
|
257
|
+
xcollect << "@#{index.to_s(16)} #{self[index].to_s(16)}\n"
|
258
|
+
end
|
259
|
+
xcollect.join("")
|
260
|
+
end
|
261
|
+
|
262
|
+
end
|
263
|
+
end
|
264
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
|
2
|
+
class Clock
|
3
|
+
|
4
|
+
def to_sim_source
|
5
|
+
|
6
|
+
@belong_to_module.instance_exec(self) do |_self|
|
7
|
+
Initial do
|
8
|
+
_self <= 1.b0
|
9
|
+
initial_exec("#(100ns)")
|
10
|
+
initial_exec("forever begin #(#{1000.0/_self.freqM/2}ns);#{_self} = ~#{_self};end")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class Reset
|
17
|
+
def to_sim_source(ns=100)
|
18
|
+
|
19
|
+
@belong_to_module.instance_exec(self,ns) do |_self,ns|
|
20
|
+
_xxx = (_self.active == 'low') ? 1.b0 : 1.b1
|
21
|
+
|
22
|
+
Initial do
|
23
|
+
_self <= _xxx
|
24
|
+
initial_exec("#(#{ns}ns)")
|
25
|
+
_self <= ~_self
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/tdl/exlib/dve_tcl.rb
CHANGED
@@ -67,10 +67,10 @@ gui_show_grid -id ${Wave.3} -enable false
|
|
67
67
|
}
|
68
68
|
end
|
69
69
|
|
70
|
-
def self.dev_signals_to_tcl(flag: gname ,signals: [])
|
70
|
+
def self.dev_signals_to_tcl(flag: gname ,signals: [], group_name: nil )
|
71
71
|
sst = %Q{
|
72
72
|
## -------------- #{flag} -------------------------
|
73
|
-
set _wave_session_group_#{flag} #{flag}
|
73
|
+
set _wave_session_group_#{flag} #{group_name || flag}
|
74
74
|
# set _wave_session_group_#{flag} [gui_sg_generate_new_name -seed #{flag}]
|
75
75
|
if {[gui_sg_is_group -name "$_wave_session_group_#{flag}"]} {
|
76
76
|
set _wave_session_group_#{flag} [gui_sg_generate_new_name]
|
@@ -109,7 +109,7 @@ gui_sg_addsignal -group "$_wave_session_group_#{flag}_#{iname}" { #{signals.map{
|
|
109
109
|
"gui_list_set_insertion_bar -id ${Wave.3} -group ${Group2_#{flag}} -position in"
|
110
110
|
end
|
111
111
|
|
112
|
-
def self.gen_dev_wave_tcl(khash) # {group_name : [*signal]}
|
112
|
+
def self.gen_dev_wave_tcl(khash) # {group_name<sdlmodule instance name> : [*signal]}
|
113
113
|
add_ss = []
|
114
114
|
add_list = []
|
115
115
|
add_bar = []
|
@@ -128,21 +128,41 @@ gui_sg_addsignal -group "$_wave_session_group_#{flag}_#{iname}" { #{signals.map{
|
|
128
128
|
end
|
129
129
|
end
|
130
130
|
signals = base_elms.map do |e|
|
131
|
-
|
132
|
-
|
131
|
+
# if e.respond_to? :tp_instance
|
132
|
+
# if e.tp_instance.filter_block
|
133
|
+
# e.root_ref(&e.tp_instance.filter_block).sub("$root.","Sim:")
|
134
|
+
# else
|
135
|
+
# e.root_ref.sub("$root.","Sim:")
|
136
|
+
# end
|
137
|
+
# else
|
138
|
+
# e.root_ref.sub("$root.","Sim:")
|
139
|
+
# end
|
140
|
+
xb = e.instance_variable_get("@dve_wave_filter_block")
|
141
|
+
if xb
|
142
|
+
e.root_ref(&xb).sub("$root.","Sim:")
|
133
143
|
else
|
134
|
-
e.root_ref
|
144
|
+
e.root_ref.sub("$root.","Sim:")
|
135
145
|
end
|
136
146
|
end
|
137
147
|
|
138
148
|
add_ss << dev_signals_to_tcl(flag: k, signals: signals )
|
139
149
|
|
140
150
|
intf_elms.each do |e|
|
141
|
-
|
142
|
-
unless e.tp_instance.filter_block
|
143
|
-
|
151
|
+
# if e.respond_to? :tp_instance
|
152
|
+
# unless e.tp_instance.filter_block
|
153
|
+
# signalx = e.root_ref.sub("$root.","Sim:")
|
154
|
+
# else
|
155
|
+
# signalx = e.root_ref(&e.tp_instance.filter_block).sub("$root.","Sim:")
|
156
|
+
# end
|
157
|
+
# else
|
158
|
+
# signalx = e.root_ref.sub("$root.","Sim:")
|
159
|
+
# end
|
160
|
+
xb = e.instance_variable_get("@dve_wave_filter_block")
|
161
|
+
|
162
|
+
if xb
|
163
|
+
signalx = e.root_ref(&xb).sub("$root.","Sim:")
|
144
164
|
else
|
145
|
-
signalx = e.root_ref
|
165
|
+
signalx = e.root_ref.sub("$root.","Sim:")
|
146
166
|
end
|
147
167
|
|
148
168
|
add_ss << dev_interface_to_tcl(flag: k, iname: e.inst_name ,signals: [ signalx ])
|
@@ -158,5 +178,4 @@ gui_sg_addsignal -group "$_wave_session_group_#{flag}_#{iname}" { #{signals.map{
|
|
158
178
|
dve_tcl_temp(add_ss.join("\n"), add_list.join("\n"), add_bar.join("\n") )
|
159
179
|
|
160
180
|
end
|
161
|
-
|
162
181
|
end
|