axi_tdl 0.0.15 → 0.0.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/gem-push.yml +4 -2
  3. data/axi_tdl.gemspec +0 -1
  4. data/lib/axi/AXI4/axi4_direct_B1.sv +23 -23
  5. data/lib/axi/AXI4/axi4_dpram_cache.sv +33 -33
  6. data/lib/axi/AXI4/axis_to_axi4_wr.rb +1 -0
  7. data/lib/axi/AXI4/axis_to_axi4_wr.sv +20 -20
  8. data/lib/axi/AXI4/packet_partition/axi4_partition_rd_verb.sv +32 -32
  9. data/lib/axi/AXI4/packet_partition/data_inf_partition.rb +2 -0
  10. data/lib/axi/AXI4/packet_partition/data_inf_partition.sv +71 -71
  11. data/lib/axi/AXI4/wide_axis_to_axi4_wr.rb +2 -1
  12. data/lib/axi/AXI4/wide_axis_to_axi4_wr.sv +23 -23
  13. data/lib/axi/AXI_stream/axi_stream_split_channel.rb +7 -1
  14. data/lib/axi/AXI_stream/axis_head_cut_verb.sv +6 -2
  15. data/lib/axi/AXI_stream/axis_insert_copy.rb +18 -4
  16. data/lib/axi/AXI_stream/axis_sim_master_model.rb +28 -0
  17. data/lib/axi/AXI_stream/axis_sim_slaver_model.rb +26 -0
  18. data/lib/axi/AXI_stream/axis_sim_verify_by_coe.sv +101 -0
  19. data/lib/axi/AXI_stream/axis_split_channel_verb.rb +2 -0
  20. data/lib/axi/common/common_ram_sim_wrapper.sv +9 -9
  21. data/lib/axi/common/common_ram_wrapper.sv +12 -12
  22. data/lib/axi/data_interface/data_inf_c/data_c_pipe_sync_seam.sv +26 -26
  23. data/lib/axi/data_interface/data_inf_c/data_c_sim_master_model.sv +69 -0
  24. data/lib/axi/data_interface/data_inf_c/data_c_sim_slaver_model.sv +58 -0
  25. data/lib/axi/data_interface/data_inf_c/logic_sim_model.sv +64 -0
  26. data/lib/axi/techbench/tb_axi_stream_split_channel.rb +69 -0
  27. data/lib/axi/techbench/tb_axi_stream_split_channel.sv +149 -0
  28. data/lib/axi/techbench/tb_axis_split_channel_verb.rb +69 -0
  29. data/lib/axi/techbench/tb_axis_split_channel_verb.sv +125 -0
  30. data/lib/axi_tdl.rb +1 -0
  31. data/lib/axi_tdl/version.rb +1 -1
  32. data/lib/tdl/auto_script/autogensdl.rb +16 -5
  33. data/lib/tdl/axi4/axi4_interconnect_verb.rb +4 -2
  34. data/lib/tdl/basefunc.rb +1 -0
  35. data/lib/tdl/class_hdl/hdl_always_comb.rb +4 -3
  36. data/lib/tdl/class_hdl/hdl_always_ff.rb +48 -7
  37. data/lib/tdl/class_hdl/hdl_assign.rb +5 -3
  38. data/lib/tdl/class_hdl/hdl_block_ifelse.rb +11 -9
  39. data/lib/tdl/class_hdl/hdl_foreach.rb +2 -2
  40. data/lib/tdl/class_hdl/hdl_function.rb +4 -2
  41. data/lib/tdl/class_hdl/hdl_generate.rb +5 -4
  42. data/lib/tdl/class_hdl/hdl_initial.rb +11 -10
  43. data/lib/tdl/class_hdl/hdl_module_def.rb +18 -1
  44. data/lib/tdl/class_hdl/hdl_redefine_opertor.rb +35 -14
  45. data/lib/tdl/class_hdl/hdl_struct.rb +1 -1
  46. data/lib/tdl/class_hdl/hdl_verify.rb +1 -1
  47. data/lib/tdl/elements/originclass.rb +6 -1
  48. data/lib/tdl/elements/parameter.rb +1 -1
  49. data/lib/tdl/examples/10_random/exp_random.sv +3 -3
  50. data/lib/tdl/examples/11_test_unit/dve.tcl +155 -2
  51. data/lib/tdl/examples/11_test_unit/exp_test_unit.rb +9 -8
  52. data/lib/tdl/examples/11_test_unit/exp_test_unit.sv +1 -1
  53. data/lib/tdl/examples/11_test_unit/modules/sub_md0.rb +6 -3
  54. data/lib/tdl/examples/11_test_unit/modules/sub_md0.sv +5 -5
  55. data/lib/tdl/examples/11_test_unit/modules/sub_md1.rb +9 -4
  56. data/lib/tdl/examples/11_test_unit/modules/sub_md1.sv +5 -5
  57. data/lib/tdl/examples/11_test_unit/tb_exp_test_unit.sv +1 -2
  58. data/lib/tdl/examples/11_test_unit/tu0.sv +9 -9
  59. data/lib/tdl/examples/11_test_unit/tu1.sv +1 -1
  60. data/lib/tdl/examples/1_define_module/exmple_md.sv +12 -12
  61. data/lib/tdl/examples/2_hdl_class/tmp/always_comb_test.sv +60 -60
  62. data/lib/tdl/examples/2_hdl_class/tmp/always_ff_test.sv +2 -2
  63. data/lib/tdl/examples/2_hdl_class/tmp/case_test.sv +17 -17
  64. data/lib/tdl/examples/2_hdl_class/tmp/head_pkg_module.sv +9 -9
  65. data/lib/tdl/examples/2_hdl_class/tmp/simple_assign_test.sv +1 -1
  66. data/lib/tdl/examples/2_hdl_class/tmp/state_case_test.sv +10 -10
  67. data/lib/tdl/examples/2_hdl_class/tmp/test_foreach.sv +3 -3
  68. data/lib/tdl/examples/2_hdl_class/tmp/test_function.sv +7 -7
  69. data/lib/tdl/examples/2_hdl_class/tmp/test_initial_assert.sv +3 -3
  70. data/lib/tdl/examples/2_hdl_class/tmp/test_module.sv +2 -2
  71. data/lib/tdl/examples/2_hdl_class/tmp/test_module_var.sv +2 -2
  72. data/lib/tdl/examples/2_hdl_class/tmp/test_package.sv +4 -5
  73. data/lib/tdl/examples/2_hdl_class/tmp/test_package2.sv +4 -4
  74. data/lib/tdl/examples/2_hdl_class/tmp/test_struct_function.sv +2 -2
  75. data/lib/tdl/examples/2_hdl_class/tmp/test_vcs_string.sv +1 -1
  76. data/lib/tdl/examples/2_hdl_class/tmp/text_generate.sv +7 -7
  77. data/lib/tdl/examples/4_generate/test_generate.sv +11 -11
  78. data/lib/tdl/examples/5_logic_combin/test_logic_combin.sv +3 -3
  79. data/lib/tdl/examples/7_module_with_package/body_package.sv +3 -4
  80. data/lib/tdl/examples/7_module_with_package/example_pkg.sv +4 -4
  81. data/lib/tdl/examples/7_module_with_package/head_package.sv +3 -4
  82. data/lib/tdl/examples/8_top_module/tb_test_top.sv +1 -1
  83. data/lib/tdl/examples/9_itegration/tb_test_tttop.sv +2 -4
  84. data/lib/tdl/examples/9_itegration/test_tttop.sv +3 -3
  85. data/lib/tdl/exlib/axis_eth_ex.rb +95 -0
  86. data/lib/tdl/exlib/axis_verify.rb +264 -0
  87. data/lib/tdl/exlib/clock_reset_verify.rb +29 -0
  88. data/lib/tdl/exlib/dve_tcl.rb +30 -11
  89. data/lib/tdl/exlib/itegration.rb +15 -3
  90. data/lib/tdl/exlib/logic_verify.rb +88 -0
  91. data/lib/tdl/exlib/test_point.rb +96 -94
  92. data/lib/tdl/exlib/test_point.rb.bak +293 -0
  93. data/lib/tdl/rebuild_ele/ele_base.rb +1 -1
  94. data/lib/tdl/sdlmodule/sdlmodlule_path_db.rb +34 -0
  95. data/lib/tdl/sdlmodule/sdlmodule.rb +18 -14
  96. data/lib/tdl/sdlmodule/sdlmodule_draw.rb +81 -16
  97. data/lib/tdl/sdlmodule/test_unit_module.rb +272 -33
  98. data/lib/tdl/sdlmodule/test_unit_module.rb.bak +143 -0
  99. data/lib/tdl/sdlmodule/top_module.rb +53 -48
  100. data/lib/tdl/sdlmodule/top_module.rb.bak +547 -0
  101. data/lib/tdl/tdl.rb +18 -3
  102. metadata +21 -111
  103. data/lib/axi/AXI_stream/axi_stream_split_channel.sv +0 -149
  104. data/lib/axi/AXI_stream/axis_head_cut_verc.sv +0 -242
  105. data/lib/axi/AXI_stream/axis_insert_copy.sv +0 -66
  106. data/lib/axi/AXI_stream/axis_pipe_sync_seam.sv +0 -48
  107. data/lib/axi/AXI_stream/axis_rom_contect_sim.sv +0 -113
  108. data/lib/axi/AXI_stream/axis_split_channel_verb.sv +0 -62
@@ -0,0 +1,69 @@
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_master_model #(
13
+ parameter LOOP = "TRUE",
14
+ parameter RAM_DEPTH = 10000
15
+ )(
16
+ input load_trigger,
17
+ input [31:0] total_length,
18
+ input[512*8-1:0] mem_file,
19
+ data_inf_c.master out_inf
20
+ );
21
+
22
+
23
+ logic [out_inf.DSIZE+1-1:0] BRAM [RAM_DEPTH-1:0];
24
+ int total_length_lock;
25
+ initial begin
26
+ #(5ns);
27
+ total_length_lock = RAM_DEPTH;
28
+ $display(" -- Load File %0s",mem_file);
29
+ $readmemh(mem_file, BRAM, 0, RAM_DEPTH-1);
30
+ end
31
+
32
+ always@(posedge load_trigger)begin
33
+ total_length_lock = total_length;
34
+ $display(" -- Load File %0s",mem_file);
35
+ $readmemh(mem_file, BRAM, 0, RAM_DEPTH-1);
36
+ end
37
+
38
+ int index;
39
+ logic disable_coe;
40
+ initial begin
41
+ index = 0;
42
+ disable_coe = 1'b0;
43
+ end
44
+
45
+
46
+ always@(posedge out_inf.clock) begin
47
+ if(~out_inf.rst_n) index <= 0;
48
+ else begin
49
+ if(out_inf.ready) begin
50
+ if(index >= total_length_lock-1)begin
51
+ if(LOOP == "TRUE" || LOOP == "ON")begin
52
+ index <= 0;
53
+ end else begin
54
+ index <= total_length_lock-1;
55
+ disable_coe <= 1'b1;
56
+ end
57
+ end else begin
58
+ index <= index + 1;
59
+ end
60
+ end else begin
61
+ index <= index;
62
+ end
63
+ end
64
+ end
65
+
66
+ assign out_inf.data = BRAM[index][out_inf.DSIZE-1:0];
67
+ assign out_inf.valid = BRAM[index][out_inf.DSIZE] && ~disable_coe;
68
+
69
+ endmodule
@@ -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