axi_tdl 0.0.8 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/gem-push.yml +42 -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 +322 -0
  8. data/README.md +25 -20
  9. data/Rakefile +2 -6
  10. data/axi_tdl.gemspec +5 -5
  11. data/lib/axi/AXI4/axi4_dpram_cache.rb +1 -0
  12. data/lib/axi/AXI4/axi4_dpram_cache.sv +4 -4
  13. data/lib/axi/AXI4/axis_to_axi4_wr.rb +5 -0
  14. data/lib/axi/AXI4/axis_to_axi4_wr.sv +7 -7
  15. data/lib/axi/AXI4/packet_partition/axi4_partition_rd_verb.sv +1 -1
  16. data/lib/axi/AXI4/packet_partition/data_inf_partition.sv +2 -2
  17. data/lib/axi/AXI_stream/axi_stream_latency.sv +56 -0
  18. data/lib/axi/AXI_stream/axi_stream_split_channel.sv +20 -20
  19. data/lib/axi/AXI_stream/axis_head_cut_verc.rb +98 -42
  20. data/lib/axi/AXI_stream/axis_head_cut_verc.sv +36 -39
  21. data/lib/axi/AXI_stream/axis_insert_copy.sv +1 -1
  22. data/lib/axi/AXI_stream/axis_length_split_with_user.sv +87 -0
  23. data/lib/axi/AXI_stream/axis_pipe_sync_seam.rb +41 -0
  24. data/lib/axi/AXI_stream/axis_pipe_sync_seam.sv +48 -0
  25. data/lib/axi/AXI_stream/packet_fifo/axi_stream_packet_long_fifo.sv +37 -16
  26. data/lib/axi/AXI_stream/parse_big_field_table_A2.sv +3 -2
  27. data/lib/axi/data_interface/data_inf_c/data_c_pipe_force_vld_bind_data.sv +1 -1
  28. data/lib/axi/data_interface/data_inf_c/data_c_pipe_sync.sv +70 -0
  29. data/lib/axi/data_interface/data_inf_c/data_c_pipe_sync_seam.rb +49 -0
  30. data/lib/axi/data_interface/data_inf_c/data_c_pipe_sync_seam.sv +84 -0
  31. data/lib/axi_tdl.rb +12 -0
  32. data/lib/axi_tdl/version.rb +1 -1
  33. data/lib/tdl/SDL/axistream/axi_stream_packet_long_fifo_sdl.rb +1 -0
  34. data/lib/tdl/SDL/path_lib.rb +1 -1
  35. data/lib/tdl/SDL/vcs_axi4_comptable.rb +9 -0
  36. data/lib/tdl/SDL/vcs_axis_comptable.rb +17 -0
  37. data/lib/tdl/SDL/vcs_data_c_comptable.rb +9 -0
  38. data/lib/tdl/class_hdl/hdl_always_ff.rb +1 -1
  39. data/lib/tdl/class_hdl/hdl_redefine_opertor.rb +15 -3
  40. data/lib/tdl/examples/2_hdl_class/module_def.rb +2 -1
  41. data/lib/tdl/examples/2_hdl_class/test_inst_sugar.rb +3 -1
  42. data/lib/tdl/examples/2_hdl_class/tmp/always_ff_test.sv +1 -1
  43. data/lib/tdl/examples/2_hdl_class/tmp/test_function.sv +2 -2
  44. data/lib/tdl/sdlmodule/sdlmodule.rb +64 -0
  45. data/lib/tdl/sdlmodule/sdlmodule_draw.rb +2 -1
  46. data/lib/tdl/sdlmodule/top_module.rb +1 -0
  47. data/lib/tdl/tdl.rb +14 -2
  48. metadata +128 -28
  49. data/Gemfile.lock +0 -28
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
- require "bundler/gem_tasks"
1
+ # require "bundler/gem_tasks"
2
2
  require "rake/clean"
3
3
  require "rake/testtask"
4
4
  require "fileutils"
@@ -10,9 +10,5 @@ Rake::TestTask.new(:test) do |t|
10
10
  t.libs << "lib/tdl"
11
11
  t.pattern = "test/*_test.rb"
12
12
  # t.ruby_opts = ["-c"]
13
- t.verbose = true
13
+ # t.verbose = true
14
14
  end
15
-
16
- task :old do
17
- exec 'ruby -I"lib:test" -I"/home/wmy367/.rvm/gems/ruby-2.6.3/gems/rake-10.5.0/lib" "/home/wmy367/.rvm/gems/ruby-2.6.3/gems/rake-10.5.0/lib/rake/rake_test_loader.rb" "test/*_test.rb" '
18
- end
data/axi_tdl.gemspec CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Cook.Darwin"]
10
10
  spec.email = ["cook_darwin@hotmail.com"]
11
11
 
12
- spec.summary = %q{Axi is a light weight axi library. Tdl is a hardware Construction language}
13
- spec.description = %q{tdl is a hardware Construction language, it like chisel, but more intresting. It is a DSL and base on ruby. Finally, it convert to systemverilog. }
12
+ spec.summary = %q{Axi 是一个轻量级的AXI4库. Tdl 是一种硬件构造语言}
13
+ spec.description = %q{tdl 是一种硬件构造语言, chisel类似, 但是更加有趣, 他是一种基于Ruby的DSL. 最终它会编译输出systemverilog }
14
14
  spec.homepage = "https://www.github.com/CookDarwin/axi_tdl"
15
15
  # spec.homepage = "https://rubygems.org/gems/axi_tdl"
16
16
  spec.license = "LGPL-2.1"
@@ -35,9 +35,9 @@ Gem::Specification.new do |spec|
35
35
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
36
36
  spec.require_paths = ["lib"]
37
37
 
38
- spec.add_development_dependency "bundler", "~> 1.16"
38
+ # spec.add_development_dependency "bundler", "~> 1.16"
39
39
  spec.add_development_dependency "rake", "~> 10.0"
40
40
  # spec.add_development_dependency "rspec"
41
- spec.add_development_dependency "pry"
42
- spec.add_development_dependency "minitest"
41
+ spec.add_development_dependency "pry","~> 0.11"
42
+ spec.add_development_dependency "minitest","~> 5.10"
43
43
  end
@@ -3,6 +3,7 @@ require_hdl File.join(__dir__,'full_axi4_to_axis_partition_wr_rd.sv')
3
3
  require_sdl 'common_ram_wrapper.rb'
4
4
 
5
5
  require_hdl File.join(__dir__,"./full_axi4_to_axis.sv")
6
+ require_hdl 'data_inf_c_planer_A1.sv'
6
7
 
7
8
  TdlBuild.axi4_dpram_cache(__dir__) do
8
9
  parameter.INIT_FILE ''
@@ -80,14 +80,14 @@ initial begin
80
80
  end
81
81
 
82
82
  assign a_axis_inf.axis_tready = a_axis_inf.axis_tdata[ a_inf.ASIZE+a_inf.DSIZE+1-1] || (a_datac_rd_inf.ready && !a_axis_inf.axis_tdata[ a_inf.ASIZE+a_inf.DSIZE+1-1]);
83
- assign a_datac_rd_inf.data = {a_axis_inf.axis_tlast,a_axis_inf.axis_tdata[ a_inf.ASIZE+a_inf.DSIZE+1-1- 1: a_inf.ASIZE+a_inf.DSIZE+1-a_inf.ASIZE- 1]};
83
+ assign a_datac_rd_inf.data = {a_axis_inf.axis_tlast,a_axis_inf.axis_tdata[ ( a_inf.ASIZE+a_inf.DSIZE+1-1)-1: ( a_inf.ASIZE+a_inf.DSIZE+1-a_inf.ASIZE)-1]};
84
84
  assign a_datac_rd_inf.valid = a_axis_inf.axis_tvalid && !a_axis_inf.axis_tdata[ a_inf.ASIZE+a_inf.DSIZE+1-1];
85
85
 
86
86
  assign a_axis_rd_inf.axis_tvalid = a_datac_rd_rel_inf.valid;
87
87
  assign a_axis_rd_inf.axis_tdata = a_datac_rd_rel_inf.data[ a_inf.DSIZE-1:0];
88
88
  assign a_axis_rd_inf.axis_tlast = a_datac_rd_rel_inf.data[ a_inf.ASIZE+a_inf.DSIZE+1-1];
89
89
  assign a_datac_rd_rel_inf.ready = a_axis_rd_inf.axis_tready;
90
- assign xram_inf.addra = a_axis_inf.axis_tdata[ a_inf.ASIZE+a_inf.DSIZE+1-1- 1: a_inf.ASIZE+a_inf.DSIZE+1-a_inf.ASIZE- 1];
90
+ assign xram_inf.addra = a_axis_inf.axis_tdata[ ( a_inf.ASIZE+a_inf.DSIZE+1-1)-1: ( a_inf.ASIZE+a_inf.DSIZE+1-a_inf.ASIZE)-1];
91
91
  assign xram_inf.dia = a_axis_inf.axis_tdata[ a_inf.DSIZE-1:0];
92
92
  assign xram_inf.wea = {xram_inf.MSIZE{a_axis_inf.axis_tdata[ a_inf.ASIZE+a_inf.DSIZE+1-1]}};
93
93
  assign xram_inf.ena = 1'b1;
@@ -95,14 +95,14 @@ assign xram_inf.clka = a_inf.axi_aclk;
95
95
  assign xram_inf.rsta = ~a_inf.axi_aresetn;
96
96
 
97
97
  assign b_axis_inf.axis_tready = b_axis_inf.axis_tdata[ b_inf.ASIZE+b_inf.DSIZE+1-1] || (b_datac_rd_inf.ready && !b_axis_inf.axis_tdata[ b_inf.ASIZE+b_inf.DSIZE+1-1]);
98
- assign b_datac_rd_inf.data = {b_axis_inf.axis_tlast,b_axis_inf.axis_tdata[ b_inf.ASIZE+b_inf.DSIZE+1-1- 1: b_inf.ASIZE+b_inf.DSIZE+1-b_inf.ASIZE- 1]};
98
+ assign b_datac_rd_inf.data = {b_axis_inf.axis_tlast,b_axis_inf.axis_tdata[ ( b_inf.ASIZE+b_inf.DSIZE+1-1)-1: ( b_inf.ASIZE+b_inf.DSIZE+1-b_inf.ASIZE)-1]};
99
99
  assign b_datac_rd_inf.valid = b_axis_inf.axis_tvalid && !b_axis_inf.axis_tdata[ b_inf.ASIZE+b_inf.DSIZE+1-1];
100
100
 
101
101
  assign b_axis_rd_inf.axis_tvalid = b_datac_rd_rel_inf.valid;
102
102
  assign b_axis_rd_inf.axis_tdata = b_datac_rd_rel_inf.data[ b_inf.DSIZE-1:0];
103
103
  assign b_axis_rd_inf.axis_tlast = b_datac_rd_rel_inf.data[ b_inf.ASIZE+b_inf.DSIZE+1-1];
104
104
  assign b_datac_rd_rel_inf.ready = b_axis_rd_inf.axis_tready;
105
- assign xram_inf.addrb = b_axis_inf.axis_tdata[ b_inf.ASIZE+b_inf.DSIZE+1-1- 1: b_inf.ASIZE+b_inf.DSIZE+1-b_inf.ASIZE- 1];
105
+ assign xram_inf.addrb = b_axis_inf.axis_tdata[ ( b_inf.ASIZE+b_inf.DSIZE+1-1)-1: ( b_inf.ASIZE+b_inf.DSIZE+1-b_inf.ASIZE)-1];
106
106
  assign xram_inf.dib = b_axis_inf.axis_tdata[ b_inf.DSIZE-1:0];
107
107
  assign xram_inf.web = {xram_inf.MSIZE{b_axis_inf.axis_tdata[ b_inf.ASIZE+b_inf.DSIZE+1-1]}};
108
108
  assign xram_inf.enb = 1'b1;
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## raise TdlError.new("The module have be abandon\n Path:[#{__dir__}]\n Name:[#{__FILE__}]")
4
4
 
5
+ require_hdl 'axis_length_split_with_addr.sv'
6
+ require_hdl 'axi_stream_long_fifo.sv'
7
+ require_hdl 'axi4_wr_auxiliary_gen_without_resp.sv'
8
+ require_hdl 'axis_valve_with_pipe.sv'
9
+
5
10
  new_m = SdlModule.new(name:File.basename(__FILE__,".rb"),out_sv_path:__dir__)
6
11
 
7
12
  # Parameter :ADDR_STEP,1.0
@@ -56,7 +56,7 @@ logic stream_en;
56
56
  axi_stream_inf #(.DSIZE(axis_in.DSIZE),.USIZE(1)) split_out (.aclk(axis_in.aclk),.aresetn(axis_in.aresetn),.aclken(1'b1)) ;
57
57
  axi_stream_inf #(.DSIZE(axis_in.DSIZE),.USIZE(1)) long_fifo_axis_out (.aclk(axi_wr.axi_aclk),.aresetn(axi_wr.axi_aresetn),.aclken(1'b1)) ;
58
58
  axi_stream_inf #(.DSIZE(axi_wr.IDSIZE + axi_wr.ASIZE + axi_wr.LSIZE),.USIZE(1)) id_add_len_in (.aclk(axi_wr.axi_aclk),.aresetn(axi_wr.axi_aresetn),.aclken(1'b1)) ;
59
- axi_inf #(.DSIZE(axi_wr.DSIZE),.IDSIZE(axi_wr.IDSIZE),.ASIZE(axi_wr.ASIZE),.LSIZE(axi_wr.LSIZE),.MODE(axi_wr.MODE),.ADDR_STEP(axi_wr.ADDR_STEP)) axi_wr_vcs_cp_R442 (.axi_aclk(axi_wr.axi_aclk),.axi_aresetn(axi_wr.axi_aresetn)) ;
59
+ axi_inf #(.DSIZE(axi_wr.DSIZE),.IDSIZE(axi_wr.IDSIZE),.ASIZE(axi_wr.ASIZE),.LSIZE(axi_wr.LSIZE),.MODE(axi_wr.MODE),.ADDR_STEP(axi_wr.ADDR_STEP)) axi_wr_vcs_cp_R1264 (.axi_aclk(axi_wr.axi_aclk),.axi_aresetn(axi_wr.axi_aresetn)) ;
60
60
  axi_stream_inf #(.DSIZE(axis_in.DSIZE),.USIZE(1)) pipe_axis (.aclk(axi_wr.axi_aclk),.aresetn(axi_wr.axi_aresetn),.aclken(1'b1)) ;
61
61
  //==========================================================================
62
62
  //-------- instance --------------------------------------------------------
@@ -92,16 +92,16 @@ independent_clock_fifo #(
92
92
  /* output */.full (fifo_full )
93
93
  );
94
94
  axi4_wr_auxiliary_gen_without_resp axi4_wr_auxiliary_gen_without_resp_inst(
95
- /* output */.stream_en (stream_en ),
96
- /* axi_stream_inf.slaver */.id_add_len_in (id_add_len_in ),
97
- /* axi_inf.master_wr_aux_no_resp */.axi_wr_aux (axi_wr_vcs_cp_R442 )
95
+ /* output */.stream_en (stream_en ),
96
+ /* axi_stream_inf.slaver */.id_add_len_in (id_add_len_in ),
97
+ /* axi_inf.master_wr_aux_no_resp */.axi_wr_aux (axi_wr_vcs_cp_R1264 )
98
98
  );
99
99
  vcs_axi4_comptable #(
100
100
  .ORIGIN ("master_wr_aux_no_resp" ),
101
101
  .TO ("master_wr" )
102
- )vcs_axi4_comptable_axi_wr_aux_R1813_axi_wr_inst(
103
- /* input */.origin (axi_wr_vcs_cp_R442 ),
104
- /* output */.to (axi_wr )
102
+ )vcs_axi4_comptable_axi_wr_aux_R858_axi_wr_inst(
103
+ /* input */.origin (axi_wr_vcs_cp_R1264 ),
104
+ /* output */.to (axi_wr )
105
105
  );
106
106
  axis_valve_with_pipe #(
107
107
  .MODE ("BOTH" )
@@ -86,7 +86,7 @@ always_ff@(posedge clock,negedge rst_n) begin
86
86
  wait_last_inf.ready <= 1'b0;
87
87
  end
88
88
  else begin
89
- wait_last_inf.ready <= ( long_inf.axi_rvalid&long_inf.axi_rready& long_inf.axi_rlast);
89
+ wait_last_inf.ready <= ( ( long_inf.axi_rvalid&long_inf.axi_rready)&long_inf.axi_rlast);
90
90
  end
91
91
  end
92
92
 
@@ -31,7 +31,7 @@ logic one_long_stream;
31
31
  logic fifo_wr;
32
32
  logic [ IDSIZE+4-1:0] curr_id ;
33
33
  logic [LSIZE-1:0] curr_length ;
34
- logic [ data_in.DSIZE-IDSIZE- LSIZE-1:0] curr_addr ;
34
+ logic [ ( data_in.DSIZE-IDSIZE)-LSIZE-1:0] curr_addr ;
35
35
  logic [LSIZE-1:0] wr_length ;
36
36
  (* MARK_DEBUG="true" *)(* dont_touch="true" *)logic fifo_full;
37
37
  (* MARK_DEBUG="true" *)(* dont_touch="true" *)logic fifo_empty;
@@ -68,7 +68,7 @@ typedef enum {
68
68
  } SE_STATE_ps;
69
69
  SE_STATE_ps CSTATE_ps,NSTATE_ps;
70
70
  initial begin
71
- assert( data_in.DSIZE+4== data_out.DSIZE)else begin
71
+ assert( ( data_in.DSIZE+4)==data_out.DSIZE)else begin
72
72
  $error("data_in.DSIZE<%d> != data_out.DSIZE<%d>",data_in.DSIZE,data_out.DSIZE);
73
73
  $stop;
74
74
  end
@@ -0,0 +1,56 @@
1
+ /**********************************************
2
+ _______________________________________
3
+ ___________ Cook Darwin __________
4
+ _______________________________________
5
+ descript: base on planer
6
+ author : Cook.Darwin
7
+ Version: VERA.0.0
8
+ creaded:
9
+ madified:
10
+ ***********************************************/
11
+ `timescale 1ns/1ps
12
+ `include "define_macro.sv"
13
+ module axi_stream_latency #(
14
+ parameter LAT = 3
15
+ )(
16
+ input reset,
17
+ axi_stream_inf.slaver axis_in,
18
+ axi_stream_inf.master axis_out
19
+ );
20
+
21
+ data_inf_c #(.DSIZE(axis_in.DSIZE + 1 + axis_in.KSIZE + axis_in.USIZE)) data_slaver (.clock(axis_in.aclk), .rst_n(axis_in.aresetn) );
22
+ data_inf_c #(.DSIZE(axis_in.DSIZE + 1 + axis_in.KSIZE + axis_in.USIZE + 1)) data_master (.clock(axis_in.aclk), .rst_n(axis_in.aresetn) );
23
+
24
+
25
+ data_inf_c_planer_A1 #(
26
+ .LAT (LAT ),
27
+ .DSIZE (1 ),
28
+ .HEAD ("ON" )
29
+ )data_inf_c_planer_A1_inst(
30
+ /* input */ .reset (reset ),
31
+ /* input [DSIZE-1:0] */ .pack_data (1'b0 ),
32
+ /* data_inf_c.slaver */ .slaver (data_slaver ),
33
+ /* data_inf_c.master */ .master (data_master )///HEAD=="ON" : {pack_data,slaver.data} or /HEAD=="OFF" : {slaver.data,pack_data}
34
+ );
35
+
36
+ assign data_slaver.data = {axis_in.axis_tuser, axis_in.axis_tkeep, axis_in.axis_tlast, axis_in.axis_tdata};
37
+ assign data_slaver.valid = axis_in.axis_tvalid;
38
+ assign axis_in.axis_tready = data_slaver.ready;
39
+
40
+ // axis_to_data_inf #(
41
+ // .CONTAIN_LAST ("ON")
42
+ // )axis_to_data_inf_inst(
43
+ // /* axi_stream_inf.slaver */ .axis_in (axis_in ),
44
+ // /* data_inf_c.master */ .data_out_inf (data_slaver )
45
+ // );
46
+
47
+ // data_c_to_axis_full data_c_to_axis_full_inst(
48
+ // /* data_inf_c.slaver */ .data_in_inf (data_master ),
49
+ // /* axi_stream_inf.master */ .axis_out (axis_out )
50
+ // );
51
+
52
+ assign {axis_out.axis_tuser, axis_out.axis_tkeep, axis_out.axis_tlast, axis_out.axis_tdata} = data_master.data[data_master.DSIZE-2:0];
53
+ assign axis_out.axis_tvalid = data_master.valid;
54
+ assign data_master.ready = axis_out.axis_tready;
55
+
56
+ endmodule
@@ -55,22 +55,22 @@ axis_direct axis_direct_end_inf_inst0 (
55
55
  );
56
56
  //-------- CLOCKs Total 3 ----------------------
57
57
  //--->> CheckClock <<----------------
58
- logic cc_done_7,cc_same_7;
59
- integer cc_afreq_7,cc_bfreq_7;
60
- ClockSameDomain CheckPClock_inst_7(
58
+ logic cc_done_8,cc_same_8;
59
+ integer cc_afreq_8,cc_bfreq_8;
60
+ ClockSameDomain CheckPClock_inst_8(
61
61
  /* input */ .aclk (origin_inf.aclk ),
62
62
  /* input */ .bclk (first_inf.aclk ),
63
- /* output logic */ .done (cc_done_7),
64
- /* output logic */ .same (cc_same_7),
65
- /* output integer */ .aFreqK (cc_afreq_7),
66
- /* output integer */ .bFreqK (cc_bfreq_7)
63
+ /* output logic */ .done (cc_done_8),
64
+ /* output logic */ .same (cc_same_8),
65
+ /* output integer */ .aFreqK (cc_afreq_8),
66
+ /* output integer */ .bFreqK (cc_bfreq_8)
67
67
  );
68
68
 
69
69
  initial begin
70
- wait(cc_done_7);
71
- assert(cc_same_7)
70
+ wait(cc_done_8);
71
+ assert(cc_same_8)
72
72
  else begin
73
- $error("--- Error : `axi_stream_split_channel` clock is not same, origin_inf.aclk< %0f M> != first_inf.aclk<%0f M>",1000000.0/cc_afreq_7, 1000000.0/cc_bfreq_7);
73
+ $error("--- Error : `axi_stream_split_channel` clock is not same, origin_inf.aclk< %0f M> != first_inf.aclk<%0f M>",1000000.0/cc_afreq_8, 1000000.0/cc_bfreq_8);
74
74
  repeat(10)begin
75
75
  @(posedge origin_inf.aclk);
76
76
  end
@@ -80,22 +80,22 @@ end
80
80
  //---<< CheckClock >>----------------
81
81
 
82
82
  //--->> CheckClock <<----------------
83
- logic cc_done_8,cc_same_8;
84
- integer cc_afreq_8,cc_bfreq_8;
85
- ClockSameDomain CheckPClock_inst_8(
83
+ logic cc_done_9,cc_same_9;
84
+ integer cc_afreq_9,cc_bfreq_9;
85
+ ClockSameDomain CheckPClock_inst_9(
86
86
  /* input */ .aclk (origin_inf.aclk ),
87
87
  /* input */ .bclk (end_inf.aclk ),
88
- /* output logic */ .done (cc_done_8),
89
- /* output logic */ .same (cc_same_8),
90
- /* output integer */ .aFreqK (cc_afreq_8),
91
- /* output integer */ .bFreqK (cc_bfreq_8)
88
+ /* output logic */ .done (cc_done_9),
89
+ /* output logic */ .same (cc_same_9),
90
+ /* output integer */ .aFreqK (cc_afreq_9),
91
+ /* output integer */ .bFreqK (cc_bfreq_9)
92
92
  );
93
93
 
94
94
  initial begin
95
- wait(cc_done_8);
96
- assert(cc_same_8)
95
+ wait(cc_done_9);
96
+ assert(cc_same_9)
97
97
  else begin
98
- $error("--- Error : `axi_stream_split_channel` clock is not same, origin_inf.aclk< %0f M> != end_inf.aclk<%0f M>",1000000.0/cc_afreq_8, 1000000.0/cc_bfreq_8);
98
+ $error("--- Error : `axi_stream_split_channel` clock is not same, origin_inf.aclk< %0f M> != end_inf.aclk<%0f M>",1000000.0/cc_afreq_9, 1000000.0/cc_bfreq_9);
99
99
  repeat(10)begin
100
100
  @(posedge origin_inf.aclk);
101
101
  end
@@ -1,5 +1,7 @@
1
1
  ## VERC 非整数型剪切,使用 right shift
2
2
  require_hdl 'axis_connect_pipe_right_shift_verb.sv'
3
+ # require_hdl 'axi_stream_latency.sv'
4
+ require_sdl 'axis_pipe_sync_seam.rb'
3
5
 
4
6
  TdlBuild.axis_head_cut_verc(__dir__) do
5
7
  parameter.BYTE_BITS 8
@@ -16,30 +18,61 @@ TdlBuild.axis_head_cut_verc(__dir__) do
16
18
 
17
19
  origin_inf.clock_reset_taps('clock', 'rst_n')
18
20
 
19
- axis_slaver_pipe_A1.axis_slaver_pipe_A1_inst do |h| #(
20
- h.param.DEPTH 3
21
- h.port.axis.slaver.axis_in origin_inf
22
- h.port.axis.master.axis_out origin_inf.copy(name: 'origin_inf_post')
23
- end
21
+ # axis_slaver_pipe_A1.axis_slaver_pipe_A1_inst do |h| #(
22
+ # h.param.DEPTH 3
23
+ # h.port.axis.slaver.axis_in origin_inf
24
+ # h.port.axis.master.axis_out origin_inf.copy(name: 'origin_inf_post')
25
+ # end
26
+
27
+ # axi_stream_latency.axi_stream_latency_inst do |h| #(
28
+ # h.parameter.LAT 3
29
+ # h.input.reset 1.b0
30
+ # h.port.axis.slaver.axis_in origin_inf
31
+ # h.port.axis.master.axis_out origin_inf.copy(name: 'origin_inf_post')
32
+ # end
33
+
34
+ axis_pipe_sync_seam.axis_pipe_sync_seam_inst do |h|
35
+ h.parameter.LAT 3
36
+ h.parameter.DSIZE 10+4+4
37
+ ## as like: hdl```
38
+ ## assign in_datas[0] = in_inf.data + 1;
39
+ ## assign in_datas[1] = out_datas[0]+1;```
40
+ h.input[h.param.LAT,h.param.DSIZE].in_datas logic[3,18].origin_sync_info
41
+ h.output[h.param.LAT,h.param.DSIZE].out_datas logic[3,18].origin_sync_info_out
42
+ h.port.axis.slaver.in_inf origin_inf
43
+ h.port.axis.master.out_inf origin_inf.copy(name: 'origin_inf_post')
44
+ end
24
45
 
25
46
  ## 解析编码
47
+ ## IN_DATA<0> IN_DATA<1> IN_DATA<2>
48
+ ###[11:8] bytes_x_tmp bytes_x_sub_nDx route_addr_P
49
+ ###[7 :4] bytes bytes_x_tmp_Q ???
50
+ ###[3 :0] bytes bytes_Q ??
51
+
52
+ ## OUT_DATA<0> OUT_DATA<1> IN_DATA<1>
53
+ ###[11:8] bytes_x_tmp_Q bytes_x_sub_nDx_Q route_addr
54
+ ###[7 :4] bytes_Q bytes_x_tmp_QQ ???
55
+ ###[3 :0] bytes_Q bytes_QQ ??
56
+
57
+ ## IN_DATA<0> IN_DATA<1> OUT<0> IN_DATA<2> OUT<1> OUT<2>
58
+ ## |- bytes ------- | bytes_Q ---------- | bytes_QQ
59
+ ## |> {bytes_x} -- | bytes_x ---------- | bytes_x_Q
60
+ ## |> {bytes_x_sub_nDx} | bytes_x_sub_nDx
61
+ ## |> {route_addr}-------- | route_addr
62
+
63
+ logic[10] - 'bytes_Q'
64
+ logic[10] - 'bytes_QQ'
26
65
  logic[4] - 'bytes_x'
27
66
  logic[4] - 'bytes_x_Q'
28
67
  logic[4] - 'bytes_x_tmp'
29
68
  logic[4] - 'bytes_x_sub_nDx'
69
+ logic[4] - 'bytes_x_sub_nDx_tmp'
30
70
  logic[2] - 'route_addr'
71
+ logic[2] - 'route_addr_tmp'
72
+ # logic - 'route_addr_vld'
31
73
 
32
- logic[4] - 'bytes_y'
33
- logic[10] - 'tmp_loop'
34
-
35
- # genvar - 'cc'
36
74
 
37
75
  always_comb() do
38
- # FOREACH(tmp_loop) do |ii|
39
- # IF bytes < "#{param.DX}*(10-#{ii})".to_nq do
40
- # bytes_x_tmp <= (10-1-ii)
41
- # end
42
- # end
43
76
  bytes_x_tmp <= 0.A
44
77
  FOR(start: 0,stop: 10) do |ii|
45
78
  IF bytes < "#{param.DX}*(10-#{ii})".to_nq do
@@ -48,39 +81,62 @@ TdlBuild.axis_head_cut_verc(__dir__) do
48
81
  end
49
82
  end
50
83
 
51
- always_ff(posedge.clock ,negedge.rst_n) do
52
- IF ~rst_n do
53
- bytes_x <= 0.A
54
- bytes_x_Q <= 0.A
55
- bytes_x_sub_nDx <= 0.A
56
- end
57
- ELSE do
58
- bytes_x <= bytes_x_tmp
59
- bytes_x_Q <= bytes_x
60
- bytes_x_sub_nDx <= bytes - bytes_x*param.DX
61
- end
84
+ Assign do
85
+ ## --------IN<0>--
86
+ origin_sync_info[0] <= logic_bind_(bytes_x_tmp, bytes_x_tmp , bytes)
87
+ ## ===============
88
+ ## --------OUT<0>
89
+ logic_bind_(bytes_x, bytes_Q) <= logic_bind_(origin_sync_info_out[0][13,10], origin_sync_info_out[0][9,0])
90
+ ## ==============
91
+ ## --------IN<1>
92
+ bytes_x_sub_nDx_tmp <= bytes_Q - bytes_x*param.DX
93
+ origin_sync_info[1] <= logic_bind_(bytes_x_sub_nDx_tmp, bytes_x, bytes_Q)
94
+ ## ==============
95
+ ## --------OUT<1>
96
+ logic_bind_(bytes_x_sub_nDx, bytes_x_Q,bytes_QQ) <= logic_bind_(origin_sync_info_out[1][17,14],origin_sync_info_out[1][13,10], origin_sync_info_out[1][9,0])
97
+ ## ==============
98
+ ## --------IN<2>
99
+ origin_sync_info[2] <= logic_bind_(10.d0, route_addr_tmp)
100
+ ## ==============
101
+ ## --------OUT<2>
102
+ route_addr <= origin_sync_info_out[2][1,0]
103
+ ## ==============
62
104
  end
63
-
64
- always_ff(posedge.clock, negedge.rst_n) do
65
- IF ~rst_n do
66
- route_addr <= 0.A
105
+ always_comb do
106
+ IF bytes_QQ == 0.A do
107
+ route_addr_tmp <= 2.d0
67
108
  end
68
- ELSE do
69
- IF bytes == 0.A do
70
- route_addr <= 2.d0
71
- end
72
- ELSIF bytes_x == 0.A do
73
- route_addr <= 2.d2
74
- end
75
- ELSIF bytes_x_sub_nDx == 0.A do
76
- route_addr <= 2.d1
77
- end
78
- ELSE do
79
- route_addr <= 2.d1
80
- end
109
+ ELSIF bytes_x_Q == 0.A do
110
+ route_addr_tmp <= 2.d2
111
+ end
112
+ ELSIF bytes_x_sub_nDx == 0.A do
113
+ route_addr_tmp <= 2.d1
81
114
  end
115
+ ELSE do
116
+ route_addr_tmp <= 2.d1
117
+ end
82
118
  end
83
119
 
120
+ # always_ff(posedge.clock ,negedge.rst_n) do
121
+ # IF ~rst_n do
122
+ # bytes_x <= 0.A
123
+ # bytes_x_Q <= 0.A
124
+ # bytes_x_sub_nDx <= 0.A
125
+ # bytes_x_vld <= 1.b0
126
+ # bytes_Q <= 0.A
127
+ # bytes_QQ <= 0.A
128
+ # end
129
+ # ELSE do
130
+ # bytes_Q <= bytes
131
+ # bytes_QQ <= bytes_Q
132
+
133
+ # bytes_x <= bytes_x_tmp
134
+ # bytes_x_Q <= bytes_x
135
+
136
+ # bytes_x_sub_nDx <= bytes_Q - bytes_x*param.DX
137
+ # bytes_x_vld <= origin_inf.vld_rdy
138
+ # end
139
+ # end
84
140
 
85
141
  axi_stream_interconnect_S2M.axi_stream_interconnect_S2M_inst do |h| #(
86
142
  h.param.NUM 3