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.
- 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 +7 -2
- data/README.md +6 -2
- data/Rakefile +2 -6
- data/axi_tdl.gemspec +3 -4
- 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 +1 -1
- 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/clock_manage/itgt_module_clock_manage.rb +13 -0
- data/lib/tdl/examples/9_itegration/clock_manage/test_clock_bb.sv +34 -0
- data/lib/tdl/examples/9_itegration/tb_test_top.sv +2 -2
- data/lib/tdl/examples/9_itegration/tb_test_tttop.sv +1 -1
- data/lib/tdl/examples/9_itegration/tb_test_tttop_sim.sv +38 -0
- data/lib/tdl/examples/9_itegration/test_top.sv +4 -4
- data/lib/tdl/examples/9_itegration/test_tttop.sv +4 -4
- data/lib/tdl/examples/9_itegration/test_tttop_sim.sv +9 -0
- data/lib/tdl/examples/9_itegration/top.rb +1 -0
- 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/itegration_verb.rb +166 -129
- 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 +278 -33
- data/lib/tdl/sdlmodule/test_unit_module.rb.bak +143 -0
- data/lib/tdl/sdlmodule/top_module.rb +62 -58
- data/lib/tdl/sdlmodule/top_module.rb.bak +547 -0
- data/lib/tdl/tdl.rb +18 -3
- metadata +35 -134
- 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,58 @@
|
|
1
|
+
/**********************************************
|
2
|
+
_______________________________________
|
3
|
+
___________ Cook Darwin __________
|
4
|
+
_______________________________________
|
5
|
+
descript:
|
6
|
+
author : Cook.Darwin
|
7
|
+
Version: VERA.0.0
|
8
|
+
created: xxxx.xx.xx
|
9
|
+
madified:
|
10
|
+
***********************************************/
|
11
|
+
`timescale 1ns/1ps
|
12
|
+
module data_c_sim_slaver_model #(
|
13
|
+
parameter RAM_DEPTH = 10000
|
14
|
+
)(
|
15
|
+
input load_trigger,
|
16
|
+
input [31:0] total_length,
|
17
|
+
input[512*8-1:0] mem_file,
|
18
|
+
data_inf_c.slaver in_inf
|
19
|
+
);
|
20
|
+
|
21
|
+
int total_length_lock;
|
22
|
+
|
23
|
+
logic [0:0] BRAM [RAM_DEPTH-1:0];
|
24
|
+
|
25
|
+
initial begin
|
26
|
+
#(1ns);
|
27
|
+
total_length_lock = RAM_DEPTH;
|
28
|
+
$readmemh(mem_file, BRAM, 0, RAM_DEPTH-1);
|
29
|
+
end
|
30
|
+
|
31
|
+
always@(posedge load_trigger)begin
|
32
|
+
total_length_lock = total_length;
|
33
|
+
$readmemh(mem_file, BRAM, 0, RAM_DEPTH-1);
|
34
|
+
end
|
35
|
+
|
36
|
+
int index;
|
37
|
+
initial begin
|
38
|
+
index = 0;
|
39
|
+
end
|
40
|
+
|
41
|
+
always@(posedge out_inf.clock) begin
|
42
|
+
if(~out_inf.rst_n) index <= 0;
|
43
|
+
else begin
|
44
|
+
if(out_inf.ready) begin
|
45
|
+
if(index >= total_length_lock-1)begin
|
46
|
+
index <= 0;
|
47
|
+
end else begin
|
48
|
+
index <= index + 1;
|
49
|
+
end
|
50
|
+
end else begin
|
51
|
+
index <= index;
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
assign out_inf.ready = BRAM[index];
|
57
|
+
|
58
|
+
endmodule
|
@@ -0,0 +1,64 @@
|
|
1
|
+
/**********************************************
|
2
|
+
_______________________________________
|
3
|
+
___________ Cook Darwin __________
|
4
|
+
_______________________________________
|
5
|
+
descript:
|
6
|
+
author : Cook.Darwin
|
7
|
+
Version: VERA.0.0
|
8
|
+
creaded: XXXX.XX.XX
|
9
|
+
madified:
|
10
|
+
***********************************************/
|
11
|
+
`timescale 1ns/1ps
|
12
|
+
module logic_sim_model #(
|
13
|
+
parameter LOOP = "TRUE",
|
14
|
+
parameter DSIZE = 32,
|
15
|
+
parameter RAM_DEPTH = 10000
|
16
|
+
)(
|
17
|
+
input next_at_negedge_of,
|
18
|
+
input next_at_posedge_of,
|
19
|
+
input load_trigger,
|
20
|
+
input [31:0] total_length,
|
21
|
+
input[512*8-1:0] mem_file,
|
22
|
+
output[DSIZE-1:0] data
|
23
|
+
);
|
24
|
+
|
25
|
+
|
26
|
+
logic [DSIZE+1-1:0] BRAM [RAM_DEPTH-1:0];
|
27
|
+
int total_length_lock;
|
28
|
+
int index;
|
29
|
+
|
30
|
+
initial begin
|
31
|
+
#(1ns);
|
32
|
+
total_length_lock = RAM_DEPTH;
|
33
|
+
$readmemh(mem_file, BRAM, 0, RAM_DEPTH-1);
|
34
|
+
end
|
35
|
+
|
36
|
+
always@(posedge load_trigger)begin
|
37
|
+
total_length_lock = total_length;
|
38
|
+
index = 0;
|
39
|
+
$readmemh(mem_file, BRAM, 0, RAM_DEPTH-1);
|
40
|
+
end
|
41
|
+
|
42
|
+
logic init_lock;
|
43
|
+
initial begin
|
44
|
+
index = 0;
|
45
|
+
init_lock = 1'b0;
|
46
|
+
#(100ns);
|
47
|
+
init_lock = 1'b1;
|
48
|
+
end
|
49
|
+
|
50
|
+
always@(negedge next_at_negedge_of,posedge next_at_posedge_of) begin
|
51
|
+
if(index >= total_length_lock-1)begin
|
52
|
+
if(LOOP=="TRUE" || LOOP=="ON")begin
|
53
|
+
index <= 0;
|
54
|
+
end else begin
|
55
|
+
index <= total_length_lock-1;
|
56
|
+
end
|
57
|
+
end else begin
|
58
|
+
index <= index + init_lock;
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
assign data = BRAM[index];
|
63
|
+
|
64
|
+
endmodule
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'axi_tdl'
|
2
|
+
require_sdl 'axi_stream_split_channel.rb'
|
3
|
+
|
4
|
+
TdlBuild.tb_axi_stream_split_channel(__dir__) do
|
5
|
+
|
6
|
+
logic.clock(100) - 'clock'
|
7
|
+
logic.reset('low') - 'rst_n'
|
8
|
+
|
9
|
+
clock.to_sim_source
|
10
|
+
rst_n.to_sim_source(200) # keep 200ns when initial
|
11
|
+
|
12
|
+
axi_stream_inf(clock: clock, reset: rst_n, dsize:8) - 'origin_inf'
|
13
|
+
origin_inf.copy(name: 'first_inf')
|
14
|
+
origin_inf.copy(name: 'end_inf')
|
15
|
+
|
16
|
+
axi_stream_split_channel.axis_split_channel_inst do |h|
|
17
|
+
h.input[16].split_len logic[16].split_len # 1:need 1 size ; split len must large than 2
|
18
|
+
h.port.axis.slaver.origin_inf origin_inf
|
19
|
+
h.port.axis.master.first_inf first_inf
|
20
|
+
h.port.axis.master.end_inf end_inf
|
21
|
+
end
|
22
|
+
|
23
|
+
origin_param = {
|
24
|
+
split_len: [3,4,5,6],
|
25
|
+
length: [16,32,24,50,12],
|
26
|
+
gap_len: [3,0,1,0,5],
|
27
|
+
data: [(0..100)],
|
28
|
+
vld_perc: [50,100,30,80]
|
29
|
+
}
|
30
|
+
|
31
|
+
split_len.to_sim_source_coe(
|
32
|
+
data: origin_param[:split_len] * ( (origin_param[:length].size/ origin_param[:split_len].size + 1)),
|
33
|
+
posedge: nil ,
|
34
|
+
negedge: origin_inf.vld_rdy_last
|
35
|
+
)
|
36
|
+
|
37
|
+
origin_inf.to_simple_sim_master_coe(
|
38
|
+
length: origin_param[:length],
|
39
|
+
gap_len: origin_param[:gap_len],
|
40
|
+
data: origin_param[:data],
|
41
|
+
vld_perc: origin_param[:vld_perc]
|
42
|
+
)
|
43
|
+
|
44
|
+
first_inf.to_simple_sim_slaver([50,100,30])
|
45
|
+
end_inf.to_simple_sim_slaver([100,50,100])
|
46
|
+
|
47
|
+
|
48
|
+
## 验证输出
|
49
|
+
fcollect = []
|
50
|
+
ecollect = []
|
51
|
+
origin_param[:length].each_index do |index|
|
52
|
+
_data = origin_param[:data][index] || origin_param[:data][0]
|
53
|
+
_data = _data.to_a[0,origin_param[:length][index]]
|
54
|
+
|
55
|
+
insert_seed = origin_param[:split_len][index] || origin_param[:split_len][0]
|
56
|
+
|
57
|
+
# _data.insert(insert_seed,_data[insert_seed])
|
58
|
+
|
59
|
+
fcollect += _data[0,insert_seed]
|
60
|
+
fcollect[fcollect.size-1] = fcollect.last + 256
|
61
|
+
ecollect += _data[insert_seed, _data.size-insert_seed]
|
62
|
+
ecollect[ecollect.size-1] = ecollect.last + 256
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
first_inf.simple_verify_by_coe(AxiTdl::Verification::CoeArray.new(fcollect).coe)
|
67
|
+
end_inf.simple_verify_by_coe(AxiTdl::Verification::CoeArray.new(ecollect).coe)
|
68
|
+
|
69
|
+
end
|
@@ -0,0 +1,149 @@
|
|
1
|
+
/**********************************************
|
2
|
+
_______________________________________
|
3
|
+
___________ Cook Darwin __________
|
4
|
+
_______________________________________
|
5
|
+
descript:
|
6
|
+
author : Cook.Darwin
|
7
|
+
Version: VERA.0.0
|
8
|
+
created: xxxx.xx.xx
|
9
|
+
madified:
|
10
|
+
***********************************************/
|
11
|
+
`timescale 1ns/1ps
|
12
|
+
|
13
|
+
module tb_axi_stream_split_channel ();
|
14
|
+
//==========================================================================
|
15
|
+
//-------- define ----------------------------------------------------------
|
16
|
+
logic clock;
|
17
|
+
logic rst_n;
|
18
|
+
logic [16-1:0] split_len ;
|
19
|
+
logic [32-1:0] first_inf_rdy_percetage_index ;
|
20
|
+
logic [32-1:0] first_inf_rdy_percetage[3-1:0] ;
|
21
|
+
logic [32-1:0] end_inf_rdy_percetage_index ;
|
22
|
+
logic [32-1:0] end_inf_rdy_percetage[3-1:0] ;
|
23
|
+
axi_stream_inf #(.DSIZE(8),.USIZE(1)) origin_inf (.aclk(clock),.aresetn(rst_n),.aclken(1'b1)) ;
|
24
|
+
axi_stream_inf #(.DSIZE(8),.USIZE(1)) first_inf (.aclk(clock),.aresetn(rst_n),.aclken(1'b1)) ;
|
25
|
+
axi_stream_inf #(.DSIZE(8),.USIZE(1)) end_inf (.aclk(clock),.aresetn(rst_n),.aclken(1'b1)) ;
|
26
|
+
//==========================================================================
|
27
|
+
//-------- instance --------------------------------------------------------
|
28
|
+
axi_stream_split_channel axis_split_channel_inst(
|
29
|
+
/* input */.split_len (split_len ),
|
30
|
+
/* axi_stream_inf.slaver */.origin_inf (origin_inf ),
|
31
|
+
/* axi_stream_inf.master */.first_inf (first_inf ),
|
32
|
+
/* axi_stream_inf.master */.end_inf (end_inf )
|
33
|
+
);
|
34
|
+
logic_sim_model #(
|
35
|
+
.LOOP ("TRUE" ),
|
36
|
+
.DSIZE (16 ),
|
37
|
+
.RAM_DEPTH (8 )
|
38
|
+
)split_len_sim_model_inst(
|
39
|
+
/* input */.next_at_negedge_of (origin_inf.axis_tvalid && origin_inf.axis_tready && origin_inf.axis_tlast ),
|
40
|
+
/* input */.next_at_posedge_of (1'b0 ),
|
41
|
+
/* input */.load_trigger (1'b0 ),
|
42
|
+
/* input */.total_length (8 ),
|
43
|
+
/* input */.mem_file ("/var/lib/gems/2.5.0/gems/axi_tdl-0.0.10/lib/tdl/auto_script/tmp/split_len_R1712.coe" ),
|
44
|
+
/* output */.data (split_len )
|
45
|
+
);
|
46
|
+
axis_sim_master_model #(
|
47
|
+
.LOOP ("TRUE" ),
|
48
|
+
.RAM_DEPTH (246 )
|
49
|
+
)sim_model_inst_origin_inf(
|
50
|
+
/* input */.load_trigger (1'b0 ),
|
51
|
+
/* input */.total_length (246 ),
|
52
|
+
/* input */.mem_file ("/var/lib/gems/2.5.0/gems/axi_tdl-0.0.10/lib/tdl/auto_script/tmp/origin_inf_R560.coe" ),
|
53
|
+
/* axi_stream_inf.master */.out_inf (origin_inf )
|
54
|
+
);
|
55
|
+
axis_sim_verify_by_coe #(
|
56
|
+
.RAM_DEPTH (21 ),
|
57
|
+
.VERIFY_KEEP ("OFF" ),
|
58
|
+
.VERIFY_USER ("OFF" )
|
59
|
+
)axis_sim_verify_by_coe_inst_first_inf(
|
60
|
+
/* input */.load_trigger (1'b0 ),
|
61
|
+
/* input */.total_length (21 ),
|
62
|
+
/* input */.mem_file ("/var/lib/gems/2.5.0/gems/axi_tdl-0.0.10/lib/tdl/auto_script/tmp/first_inf_R1297.coe" ),
|
63
|
+
/* axi_stream_inf.mirror */.mirror_inf (first_inf )
|
64
|
+
);
|
65
|
+
axis_sim_verify_by_coe #(
|
66
|
+
.RAM_DEPTH (113 ),
|
67
|
+
.VERIFY_KEEP ("OFF" ),
|
68
|
+
.VERIFY_USER ("OFF" )
|
69
|
+
)axis_sim_verify_by_coe_inst_end_inf(
|
70
|
+
/* input */.load_trigger (1'b0 ),
|
71
|
+
/* input */.total_length (113 ),
|
72
|
+
/* input */.mem_file ("/var/lib/gems/2.5.0/gems/axi_tdl-0.0.10/lib/tdl/auto_script/tmp/end_inf_R1464.coe" ),
|
73
|
+
/* axi_stream_inf.mirror */.mirror_inf (end_inf )
|
74
|
+
);
|
75
|
+
//==========================================================================
|
76
|
+
//-------- expression ------------------------------------------------------
|
77
|
+
initial begin
|
78
|
+
clock = 1'b0;
|
79
|
+
#(100ns);
|
80
|
+
forever begin #(5.0ns);clock = ~clock;end;
|
81
|
+
end
|
82
|
+
|
83
|
+
initial begin
|
84
|
+
rst_n = 1'b0;
|
85
|
+
#(200ns);
|
86
|
+
rst_n = ~rst_n;
|
87
|
+
end
|
88
|
+
|
89
|
+
initial begin
|
90
|
+
first_inf_rdy_percetage_index = 0;
|
91
|
+
first_inf_rdy_percetage[0] = 50;
|
92
|
+
first_inf_rdy_percetage[1] = 100;
|
93
|
+
first_inf_rdy_percetage[2] = 30;
|
94
|
+
end
|
95
|
+
|
96
|
+
always@(posedge clock) begin
|
97
|
+
if(first_inf.axis_tvalid && first_inf.axis_tready && first_inf.axis_tlast)begin
|
98
|
+
if( first_inf_rdy_percetage_index>=( 3-1))begin
|
99
|
+
first_inf_rdy_percetage_index <= 0;
|
100
|
+
end
|
101
|
+
else begin
|
102
|
+
first_inf_rdy_percetage_index <= ( first_inf_rdy_percetage_index+1'b1);
|
103
|
+
end
|
104
|
+
end
|
105
|
+
else begin
|
106
|
+
first_inf_rdy_percetage_index <= first_inf_rdy_percetage_index;
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
always@(posedge clock) begin
|
111
|
+
if(~rst_n)begin
|
112
|
+
first_inf.axis_tready <= 1'b0;
|
113
|
+
end
|
114
|
+
else begin
|
115
|
+
first_inf.axis_tready <= ($urandom_range(0,99) <= first_inf_rdy_percetage[first_inf_rdy_percetage_index]);
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
initial begin
|
120
|
+
end_inf_rdy_percetage_index = 0;
|
121
|
+
end_inf_rdy_percetage[0] = 100;
|
122
|
+
end_inf_rdy_percetage[1] = 50;
|
123
|
+
end_inf_rdy_percetage[2] = 100;
|
124
|
+
end
|
125
|
+
|
126
|
+
always@(posedge clock) begin
|
127
|
+
if(end_inf.axis_tvalid && end_inf.axis_tready && end_inf.axis_tlast)begin
|
128
|
+
if( end_inf_rdy_percetage_index>=( 3-1))begin
|
129
|
+
end_inf_rdy_percetage_index <= 0;
|
130
|
+
end
|
131
|
+
else begin
|
132
|
+
end_inf_rdy_percetage_index <= ( end_inf_rdy_percetage_index+1'b1);
|
133
|
+
end
|
134
|
+
end
|
135
|
+
else begin
|
136
|
+
end_inf_rdy_percetage_index <= end_inf_rdy_percetage_index;
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
always@(posedge clock) begin
|
141
|
+
if(~rst_n)begin
|
142
|
+
end_inf.axis_tready <= 1'b0;
|
143
|
+
end
|
144
|
+
else begin
|
145
|
+
end_inf.axis_tready <= ($urandom_range(0,99) <= end_inf_rdy_percetage[end_inf_rdy_percetage_index]);
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
endmodule
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'axi_tdl'
|
2
|
+
require_sdl 'axis_split_channel_verb.rb'
|
3
|
+
|
4
|
+
TdlBuild.tb_axis_split_channel_verb(__dir__) do
|
5
|
+
|
6
|
+
logic.clock(100) - 'clock'
|
7
|
+
logic.reset('low') - 'rst_n'
|
8
|
+
|
9
|
+
clock.to_sim_source
|
10
|
+
rst_n.to_sim_source(200) # keep 200ns when initial
|
11
|
+
|
12
|
+
axi_stream_inf(clock: clock, reset: rst_n, dsize:8) - 'origin_inf'
|
13
|
+
origin_inf.copy(name: 'first_inf')
|
14
|
+
origin_inf.copy(name: 'end_inf')
|
15
|
+
|
16
|
+
axis_split_channel_verb.axis_split_channel_verb_inst do |h|
|
17
|
+
h.input[16].split_len logic[16].split_len # 1:need 1 size ; split len must large than 2
|
18
|
+
h.port.axis.slaver.origin_inf origin_inf
|
19
|
+
h.port.axis.master.first_inf first_inf
|
20
|
+
h.port.axis.master.end_inf end_inf
|
21
|
+
end
|
22
|
+
|
23
|
+
origin_param = {
|
24
|
+
split_len: [3,4,5,6],
|
25
|
+
length: [16,32,24,50,12],
|
26
|
+
gap_len: [3,0,1,0,5],
|
27
|
+
data: [(0..100)],
|
28
|
+
vld_perc: [50,100,30,80]
|
29
|
+
}
|
30
|
+
|
31
|
+
split_len.to_sim_source_coe(
|
32
|
+
data: origin_param[:split_len],
|
33
|
+
posedge: nil ,
|
34
|
+
negedge: origin_inf.vld_rdy_last
|
35
|
+
)
|
36
|
+
|
37
|
+
origin_inf.to_simple_sim_master_coe(
|
38
|
+
length: origin_param[:length],
|
39
|
+
gap_len: origin_param[:gap_len],
|
40
|
+
data: origin_param[:data],
|
41
|
+
vld_perc: origin_param[:vld_perc]
|
42
|
+
)
|
43
|
+
|
44
|
+
first_inf.to_simple_sim_slaver([100,50])
|
45
|
+
end_inf.to_simple_sim_slaver(50)
|
46
|
+
|
47
|
+
|
48
|
+
## 验证输出
|
49
|
+
fcollect = []
|
50
|
+
ecollect = []
|
51
|
+
origin_param[:length].each_index do |index|
|
52
|
+
_data = origin_param[:data][index] || origin_param[:data][0]
|
53
|
+
_data = _data.to_a[0,origin_param[:length][index]]
|
54
|
+
|
55
|
+
insert_seed = origin_param[:split_len][index] || origin_param[:split_len][0]
|
56
|
+
|
57
|
+
# _data.insert(insert_seed,_data[insert_seed])
|
58
|
+
|
59
|
+
fcollect += _data[0,insert_seed]
|
60
|
+
fcollect[fcollect.size-1] = fcollect.last + 256
|
61
|
+
ecollect += _data[insert_seed-1, _data.size-insert_seed+1]
|
62
|
+
ecollect[ecollect.size-1] = ecollect.last + 256
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
first_inf.simple_verify_by_coe(AxiTdl::Verification::CoeArray.new(fcollect).coe)
|
67
|
+
end_inf.simple_verify_by_coe(AxiTdl::Verification::CoeArray.new(ecollect).coe)
|
68
|
+
|
69
|
+
end
|
@@ -0,0 +1,125 @@
|
|
1
|
+
/**********************************************
|
2
|
+
_______________________________________
|
3
|
+
___________ Cook Darwin __________
|
4
|
+
_______________________________________
|
5
|
+
descript:
|
6
|
+
author : Cook.Darwin
|
7
|
+
Version: VERA.0.0
|
8
|
+
created: xxxx.xx.xx
|
9
|
+
madified:
|
10
|
+
***********************************************/
|
11
|
+
`timescale 1ns/1ps
|
12
|
+
|
13
|
+
module tb_axis_split_channel_verb ();
|
14
|
+
//==========================================================================
|
15
|
+
//-------- define ----------------------------------------------------------
|
16
|
+
logic clock;
|
17
|
+
logic rst_n;
|
18
|
+
logic [16-1:0] split_len ;
|
19
|
+
logic [32-1:0] first_inf_rdy_percetage_index ;
|
20
|
+
logic [32-1:0] first_inf_rdy_percetage[2-1:0] ;
|
21
|
+
axi_stream_inf #(.DSIZE(8),.USIZE(1)) origin_inf (.aclk(clock),.aresetn(rst_n),.aclken(1'b1)) ;
|
22
|
+
axi_stream_inf #(.DSIZE(8),.USIZE(1)) first_inf (.aclk(clock),.aresetn(rst_n),.aclken(1'b1)) ;
|
23
|
+
axi_stream_inf #(.DSIZE(8),.USIZE(1)) end_inf (.aclk(clock),.aresetn(rst_n),.aclken(1'b1)) ;
|
24
|
+
//==========================================================================
|
25
|
+
//-------- instance --------------------------------------------------------
|
26
|
+
axis_split_channel_verb axis_split_channel_verb_inst(
|
27
|
+
/* input */.split_len (split_len ),
|
28
|
+
/* axi_stream_inf.slaver */.origin_inf (origin_inf ),
|
29
|
+
/* axi_stream_inf.master */.first_inf (first_inf ),
|
30
|
+
/* axi_stream_inf.master */.end_inf (end_inf )
|
31
|
+
);
|
32
|
+
logic_sim_model #(
|
33
|
+
.LOOP ("TRUE" ),
|
34
|
+
.DSIZE (16 ),
|
35
|
+
.RAM_DEPTH (4 )
|
36
|
+
)split_len_sim_model_inst(
|
37
|
+
/* input */.next_at_negedge_of (origin_inf.axis_tvalid && origin_inf.axis_tready && origin_inf.axis_tlast ),
|
38
|
+
/* input */.next_at_posedge_of (1'b0 ),
|
39
|
+
/* input */.load_trigger (1'b0 ),
|
40
|
+
/* input */.total_length (4 ),
|
41
|
+
/* input */.mem_file ("/var/lib/gems/2.5.0/gems/axi_tdl-0.0.10/lib/tdl/auto_script/tmp/split_len_R372.coe" ),
|
42
|
+
/* output */.data (split_len )
|
43
|
+
);
|
44
|
+
axis_sim_master_model #(
|
45
|
+
.LOOP ("TRUE" ),
|
46
|
+
.RAM_DEPTH (246 )
|
47
|
+
)sim_model_inst_origin_inf(
|
48
|
+
/* input */.load_trigger (1'b0 ),
|
49
|
+
/* input */.total_length (246 ),
|
50
|
+
/* input */.mem_file ("/var/lib/gems/2.5.0/gems/axi_tdl-0.0.10/lib/tdl/auto_script/tmp/origin_inf_R994.coe" ),
|
51
|
+
/* axi_stream_inf.master */.out_inf (origin_inf )
|
52
|
+
);
|
53
|
+
axis_sim_verify_by_coe #(
|
54
|
+
.RAM_DEPTH (21 ),
|
55
|
+
.VERIFY_KEEP ("OFF" ),
|
56
|
+
.VERIFY_USER ("OFF" )
|
57
|
+
)axis_sim_verify_by_coe_inst_first_inf(
|
58
|
+
/* input */.load_trigger (1'b0 ),
|
59
|
+
/* input */.total_length (21 ),
|
60
|
+
/* input */.mem_file ("/var/lib/gems/2.5.0/gems/axi_tdl-0.0.10/lib/tdl/auto_script/tmp/first_inf_R285.coe" ),
|
61
|
+
/* axi_stream_inf.mirror */.mirror_inf (first_inf )
|
62
|
+
);
|
63
|
+
axis_sim_verify_by_coe #(
|
64
|
+
.RAM_DEPTH (118 ),
|
65
|
+
.VERIFY_KEEP ("OFF" ),
|
66
|
+
.VERIFY_USER ("OFF" )
|
67
|
+
)axis_sim_verify_by_coe_inst_end_inf(
|
68
|
+
/* input */.load_trigger (1'b0 ),
|
69
|
+
/* input */.total_length (118 ),
|
70
|
+
/* input */.mem_file ("/var/lib/gems/2.5.0/gems/axi_tdl-0.0.10/lib/tdl/auto_script/tmp/end_inf_R1971.coe" ),
|
71
|
+
/* axi_stream_inf.mirror */.mirror_inf (end_inf )
|
72
|
+
);
|
73
|
+
//==========================================================================
|
74
|
+
//-------- expression ------------------------------------------------------
|
75
|
+
initial begin
|
76
|
+
clock = 1'b0;
|
77
|
+
#(100ns);
|
78
|
+
forever begin #(5.0ns);clock = ~clock;end;
|
79
|
+
end
|
80
|
+
|
81
|
+
initial begin
|
82
|
+
rst_n = 1'b0;
|
83
|
+
#(200ns);
|
84
|
+
rst_n = ~rst_n;
|
85
|
+
end
|
86
|
+
|
87
|
+
initial begin
|
88
|
+
first_inf_rdy_percetage_index = 0;
|
89
|
+
first_inf_rdy_percetage[0] = 100;
|
90
|
+
first_inf_rdy_percetage[1] = 50;
|
91
|
+
end
|
92
|
+
|
93
|
+
always@(posedge clock) begin
|
94
|
+
if(first_inf.axis_tvalid && first_inf.axis_tready && first_inf.axis_tlast)begin
|
95
|
+
if( first_inf_rdy_percetage_index>=( 2-1))begin
|
96
|
+
first_inf_rdy_percetage_index <= 0;
|
97
|
+
end
|
98
|
+
else begin
|
99
|
+
first_inf_rdy_percetage_index <= ( first_inf_rdy_percetage_index+1'b1);
|
100
|
+
end
|
101
|
+
end
|
102
|
+
else begin
|
103
|
+
first_inf_rdy_percetage_index <= first_inf_rdy_percetage_index;
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
always@(posedge clock) begin
|
108
|
+
if(~rst_n)begin
|
109
|
+
first_inf.axis_tready <= 1'b0;
|
110
|
+
end
|
111
|
+
else begin
|
112
|
+
first_inf.axis_tready <= ($urandom_range(0,99) <= first_inf_rdy_percetage[first_inf_rdy_percetage_index]);
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
always@(posedge clock) begin
|
117
|
+
if(~rst_n)begin
|
118
|
+
end_inf.axis_tready <= 1'b0;
|
119
|
+
end
|
120
|
+
else begin
|
121
|
+
end_inf.axis_tready <= ($urandom_range(0,99) <= 50);
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
endmodule
|