axi_tdl 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +1 -0
- data/lib/axi/AXI4/axi4_dpram_cache.rb +1 -0
- data/lib/axi/AXI4/axi4_dpram_cache.sv +4 -4
- data/lib/axi/AXI4/axis_to_axi4_wr.rb +5 -0
- data/lib/axi/AXI4/axis_to_axi4_wr.sv +7 -7
- data/lib/axi/AXI4/packet_partition/axi4_partition_rd_verb.sv +1 -1
- data/lib/axi/AXI4/packet_partition/data_inf_partition.sv +2 -2
- data/lib/axi/AXI_stream/axi_stream_latency.sv +56 -0
- data/lib/axi/AXI_stream/axi_stream_split_channel.sv +20 -20
- data/lib/axi/AXI_stream/axis_head_cut_verc.rb +98 -42
- data/lib/axi/AXI_stream/axis_head_cut_verc.sv +36 -39
- data/lib/axi/AXI_stream/axis_insert_copy.sv +1 -1
- data/lib/axi/AXI_stream/axis_length_split_with_user.sv +87 -0
- data/lib/axi/AXI_stream/axis_pipe_sync_seam.rb +41 -0
- data/lib/axi/AXI_stream/axis_pipe_sync_seam.sv +48 -0
- data/lib/axi/AXI_stream/packet_fifo/axi_stream_packet_long_fifo.sv +37 -16
- data/lib/axi/AXI_stream/parse_big_field_table_A2.sv +3 -2
- data/lib/axi/data_interface/data_inf_c/data_c_pipe_force_vld_bind_data.sv +1 -1
- data/lib/axi/data_interface/data_inf_c/data_c_pipe_sync.sv +70 -0
- data/lib/axi/data_interface/data_inf_c/data_c_pipe_sync_seam.rb +49 -0
- data/lib/axi/data_interface/data_inf_c/data_c_pipe_sync_seam.sv +84 -0
- data/lib/axi_tdl.rb +12 -0
- data/lib/axi_tdl/version.rb +1 -1
- data/lib/tdl/SDL/axistream/axi_stream_packet_long_fifo_sdl.rb +1 -0
- data/lib/tdl/SDL/path_lib.rb +1 -1
- data/lib/tdl/SDL/vcs_axi4_comptable.rb +9 -0
- data/lib/tdl/SDL/vcs_axis_comptable.rb +17 -0
- data/lib/tdl/SDL/vcs_data_c_comptable.rb +9 -0
- data/lib/tdl/class_hdl/hdl_redefine_opertor.rb +15 -3
- data/lib/tdl/examples/11_test_unit/tb_exp_test_unit.sv +1 -0
- data/lib/tdl/examples/2_hdl_class/module_def.rb +2 -1
- data/lib/tdl/examples/2_hdl_class/test_inst_sugar.rb +3 -1
- data/lib/tdl/examples/2_hdl_class/tmp/always_ff_test.sv +1 -1
- data/lib/tdl/examples/2_hdl_class/tmp/test_function.sv +2 -2
- data/lib/tdl/examples/8_top_module/tb_test_top.sv +1 -0
- data/lib/tdl/examples/9_itegration/tb_test_tttop.sv +0 -2
- data/lib/tdl/sdlmodule/sdlmodule.rb +64 -0
- data/lib/tdl/sdlmodule/sdlmodule_draw.rb +2 -1
- data/lib/tdl/sdlmodule/top_module.rb +1 -0
- data/lib/tdl/tdl.rb +13 -1
- metadata +113 -2
@@ -58,7 +58,7 @@ always_ff@(posedge clock,negedge rst_n) begin
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
else begin
|
61
|
-
insert_tri <= ( in_inf_valve.axis_tcnt>=( insert_seed-1'b1)&& in_inf_valve.axis_tvalid && in_inf_valve.axis_tready && ( in_inf_valve.axis_tcnt<( insert_seed+insert_len-
|
61
|
+
insert_tri <= ( in_inf_valve.axis_tcnt>=( insert_seed-1'b1)&& in_inf_valve.axis_tvalid && in_inf_valve.axis_tready && ( in_inf_valve.axis_tcnt<( ( insert_seed+insert_len)-1'b1))&& ~in_inf.axis_tlast);
|
62
62
|
end
|
63
63
|
end
|
64
64
|
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
/**********************************************
|
2
|
+
______________ ______________
|
3
|
+
______________ X ______________
|
4
|
+
______________ ______________
|
5
|
+
|
6
|
+
descript:
|
7
|
+
author : Cook.Darwin
|
8
|
+
Version: VERA.0.X 2018/1/25
|
9
|
+
use axis_user to detect last
|
10
|
+
creaded: 2017/5/19
|
11
|
+
madified:
|
12
|
+
***********************************************/
|
13
|
+
`timescale 1ns/1ps
|
14
|
+
(* axi_stream = "true" *)
|
15
|
+
module axis_length_split_with_user (
|
16
|
+
input [31:0] length, ////[0] mean 0 len
|
17
|
+
(* up_stream = "true" *)
|
18
|
+
axi_stream_inf.slaver axis_in,
|
19
|
+
(* down_stream = "true" *)
|
20
|
+
axi_stream_inf.master axis_out
|
21
|
+
);
|
22
|
+
|
23
|
+
wire clock,rst_n,clken;
|
24
|
+
|
25
|
+
assign clock = axis_in.aclk;
|
26
|
+
assign rst_n = axis_in.aresetn;
|
27
|
+
assign clken = axis_in.aclken;
|
28
|
+
|
29
|
+
axi_stream_inf #(.DSIZE(axis_in.DSIZE)) axis_pre (.aclk(clock),.aresetn(rst_n),.aclken(clken));
|
30
|
+
|
31
|
+
|
32
|
+
logic [31:0] cnt;
|
33
|
+
|
34
|
+
always@(posedge clock,negedge rst_n)
|
35
|
+
if(~rst_n) cnt <= '0;
|
36
|
+
else begin
|
37
|
+
if(axis_in.axis_tvalid && axis_in.axis_tready && axis_in.axis_tlast)
|
38
|
+
cnt <= '0;
|
39
|
+
else if(axis_in.axis_tvalid && axis_in.axis_tready && (cnt >= (length-1)))
|
40
|
+
cnt <= '0;
|
41
|
+
else if(axis_in.axis_tvalid && axis_in.axis_tready)
|
42
|
+
cnt <= cnt + 1'b1;
|
43
|
+
else cnt <= cnt;
|
44
|
+
end
|
45
|
+
|
46
|
+
logic new_last;
|
47
|
+
|
48
|
+
always@(posedge clock,negedge rst_n)
|
49
|
+
if(~rst_n) new_last <= 1'b0;
|
50
|
+
else begin
|
51
|
+
if(axis_in.axis_tvalid && axis_in.axis_tready && (new_last||axis_in.axis_tlast))
|
52
|
+
new_last <= 1'b0;
|
53
|
+
else if(axis_in.axis_tvalid && axis_in.axis_tready && cnt==(length-2))
|
54
|
+
new_last <= 1'b1;
|
55
|
+
else new_last <= new_last;
|
56
|
+
end
|
57
|
+
|
58
|
+
// logic mark_tail;
|
59
|
+
//
|
60
|
+
// always@(posedge clock,negedge rst_n)
|
61
|
+
// if(~rst_n) mark_tail <= 1'b0;
|
62
|
+
// else begin
|
63
|
+
// if(axis_in.axis_tvalid && axis_in.axis_tready && axis_in.axis_tlast)
|
64
|
+
// mark_tail <= 1'b0;
|
65
|
+
// else if(axis_in.axis_tvalid && axis_in.axis_tready && axis_in.axis_tcnt==(length-1))
|
66
|
+
// mark_tail <= 1'b1;
|
67
|
+
// else mark_tail <= mark_tail;
|
68
|
+
// end
|
69
|
+
|
70
|
+
assign axis_pre.axis_tvalid = axis_in.axis_tvalid;
|
71
|
+
assign axis_pre.axis_tdata = axis_in.axis_tdata;
|
72
|
+
assign axis_pre.axis_tlast = new_last || axis_in.axis_tlast;
|
73
|
+
assign axis_pre.axis_tkeep = axis_in.axis_tkeep;
|
74
|
+
// assign axis_pre.axis_tuser = axis_in.axis_tuser;
|
75
|
+
assign axis_pre.axis_tuser = axis_in.axis_tlast;
|
76
|
+
assign axis_in.axis_tready = axis_pre.axis_tready;
|
77
|
+
|
78
|
+
axis_connect_pipe axis_connect_pipe_inst(
|
79
|
+
/* axi_stream_inf.slaver */ .axis_in (axis_pre ),
|
80
|
+
/* axi_stream_inf.master */ .axis_out (axis_out )
|
81
|
+
);
|
82
|
+
|
83
|
+
int out_cnt;
|
84
|
+
|
85
|
+
assign out_cnt = axis_out.axis_tcnt;
|
86
|
+
|
87
|
+
endmodule
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require_sdl 'data_c_pipe_sync_seam.rb'
|
2
|
+
|
3
|
+
TdlBuild.axis_pipe_sync_seam(__dir__) do
|
4
|
+
parameter.LAT 4
|
5
|
+
parameter.DSIZE 32
|
6
|
+
## as like: hdl```
|
7
|
+
## assign in_datas[0] = in_inf.axis_tdata + 1;
|
8
|
+
## assign in_datas[1] = out_datas[0]+1;```
|
9
|
+
input[param.LAT,param.DSIZE] - 'in_datas'
|
10
|
+
output[param.LAT,param.DSIZE] - 'out_datas'
|
11
|
+
port.axis.slaver - 'in_inf'
|
12
|
+
port.axis.master - 'out_inf'
|
13
|
+
|
14
|
+
data_inf_c(clock: in_inf.aclk, reset: in_inf.aresetn, dsize: "in_inf.DSIZE+in_inf.KSIZE+1+in_inf.USIZE".to_nq) - 'data_in_inf'
|
15
|
+
data_in_inf.copy(name: 'data_out_inf')
|
16
|
+
|
17
|
+
data_c_pipe_sync_seam.data_c_pipe_sync_seam_inst do |h|
|
18
|
+
h.parameter.LAT param.LAT
|
19
|
+
h.parameter.DSIZE param.DSIZE
|
20
|
+
## as like: hdl```
|
21
|
+
## assign in_datas[0] = in_inf.data + 1;
|
22
|
+
## assign in_datas[1] = out_datas[0]+1;```
|
23
|
+
h.input[h.param.LAT,h.param.DSIZE].in_datas in_datas
|
24
|
+
h.output[h.param.LAT,h.param.DSIZE].out_datas out_datas
|
25
|
+
h.port.data_inf_c.slaver.in_inf data_in_inf
|
26
|
+
h.port.data_inf_c.master.out_inf data_out_inf
|
27
|
+
end
|
28
|
+
|
29
|
+
Assign do
|
30
|
+
data_in_inf.data <= self.>>(in_inf.axis_tuser, in_inf.axis_tkeep, in_inf.axis_tlast, in_inf.axis_tdata)
|
31
|
+
data_in_inf.valid <= in_inf.axis_tvalid
|
32
|
+
in_inf.axis_tready <= data_in_inf.ready
|
33
|
+
|
34
|
+
|
35
|
+
logic_bind_(out_inf.axis_tuser, out_inf.axis_tkeep, out_inf.axis_tlast, out_inf.axis_tdata) <= data_out_inf.data
|
36
|
+
out_inf.axis_tvalid <= data_out_inf.valid
|
37
|
+
data_out_inf.ready <= out_inf.axis_tready
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
@@ -0,0 +1,48 @@
|
|
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 axis_pipe_sync_seam #(
|
14
|
+
parameter LAT = 4,
|
15
|
+
parameter DSIZE = 32
|
16
|
+
)(
|
17
|
+
input [ DSIZE-1:0] in_datas [LAT-1:0],
|
18
|
+
output [ DSIZE-1:0] out_datas [LAT-1:0],
|
19
|
+
axi_stream_inf.slaver in_inf,
|
20
|
+
axi_stream_inf.master out_inf
|
21
|
+
);
|
22
|
+
|
23
|
+
//==========================================================================
|
24
|
+
//-------- define ----------------------------------------------------------
|
25
|
+
|
26
|
+
data_inf_c #(.DSIZE(in_inf.DSIZE+in_inf.KSIZE+1+in_inf.USIZE)) data_in_inf (.clock(in_inf.aclk),.rst_n(in_inf.aresetn)) ;
|
27
|
+
data_inf_c #(.DSIZE(in_inf.DSIZE+in_inf.KSIZE+1+in_inf.USIZE)) data_out_inf (.clock(in_inf.aclk),.rst_n(in_inf.aresetn)) ;
|
28
|
+
//==========================================================================
|
29
|
+
//-------- instance --------------------------------------------------------
|
30
|
+
data_c_pipe_sync_seam #(
|
31
|
+
.LAT (LAT ),
|
32
|
+
.DSIZE (DSIZE )
|
33
|
+
)data_c_pipe_sync_seam_inst(
|
34
|
+
/* input */.in_datas (in_datas ),
|
35
|
+
/* output */.out_datas (out_datas ),
|
36
|
+
/* data_inf_c.slaver */.in_inf (data_in_inf ),
|
37
|
+
/* data_inf_c.master */.out_inf (data_out_inf )
|
38
|
+
);
|
39
|
+
//==========================================================================
|
40
|
+
//-------- expression ------------------------------------------------------
|
41
|
+
assign data_in_inf.data = {>>{in_inf.axis_tuser,in_inf.axis_tkeep,in_inf.axis_tlast,in_inf.axis_tdata}};
|
42
|
+
assign data_in_inf.valid = in_inf.axis_tvalid;
|
43
|
+
assign in_inf.axis_tready = data_in_inf.ready;
|
44
|
+
assign {out_inf.axis_tuser,out_inf.axis_tkeep,out_inf.axis_tlast,out_inf.axis_tdata} = data_out_inf.data;
|
45
|
+
assign out_inf.axis_tvalid = data_out_inf.valid;
|
46
|
+
assign data_out_inf.ready = out_inf.axis_tready;
|
47
|
+
|
48
|
+
endmodule
|
@@ -12,7 +12,8 @@ madified:
|
|
12
12
|
(* axi_stream = "true" *)
|
13
13
|
module axi_stream_packet_long_fifo #(
|
14
14
|
parameter DEPTH = 2, //2-4
|
15
|
-
parameter BYTE_DEPTH = 8096
|
15
|
+
parameter BYTE_DEPTH = 8096,
|
16
|
+
parameter USE_KEEP = "OFF"
|
16
17
|
)(
|
17
18
|
(* up_stream = "true" *)
|
18
19
|
axi_stream_inf.slaver axis_in,
|
@@ -27,21 +28,41 @@ logic data_fifo_full;
|
|
27
28
|
logic data_fifo_empty;
|
28
29
|
logic [axis_in.DSIZE-1:0] stream_fifo_data;
|
29
30
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
)
|
34
|
-
|
35
|
-
|
36
|
-
/* input */ .
|
37
|
-
/* input */ .
|
38
|
-
/* input
|
39
|
-
/* input */ .
|
40
|
-
/* input
|
41
|
-
/*
|
42
|
-
/*
|
43
|
-
/* output
|
44
|
-
)
|
31
|
+
generate
|
32
|
+
if(USE_KEEP=="OFF" || USE_KEEP=="FALSE")begin
|
33
|
+
fifo_36kb_long #(
|
34
|
+
.DSIZE (axis_out.DSIZE ),
|
35
|
+
.DEPTH (BYTE_DEPTH )
|
36
|
+
)fifo_36kb_long_inst(
|
37
|
+
/* input */ .wr_clk (axis_in.aclk ),
|
38
|
+
/* input */ .wr_rst (~axis_in.aresetn ),
|
39
|
+
/* input */ .rd_clk (axis_out.aclk ),
|
40
|
+
/* input */ .rd_rst (~axis_out.aresetn ),
|
41
|
+
/* input [DSIZE-1:0] */ .din (axis_in.axis_tdata ),
|
42
|
+
/* input */ .wr_en ((axis_in.axis_tvalid && !data_fifo_full && axis_in.axis_tready) ),
|
43
|
+
/* input */ .rd_en ((axis_out.axis_tvalid && !data_fifo_empty && axis_out.axis_tready) ),
|
44
|
+
/* output [DSIZE-1:0] */ .dout (axis_out.axis_tdata ),
|
45
|
+
/* output */ .full (data_fifo_full ),
|
46
|
+
/* output */ .empty (data_fifo_empty )
|
47
|
+
);
|
48
|
+
end else begin
|
49
|
+
fifo_36kb_long #(
|
50
|
+
.DSIZE (axis_out.DSIZE+axis_out.KSIZE ),
|
51
|
+
.DEPTH (BYTE_DEPTH )
|
52
|
+
)fifo_36kb_long_inst(
|
53
|
+
/* input */ .wr_clk (axis_in.aclk ),
|
54
|
+
/* input */ .wr_rst (~axis_in.aresetn ),
|
55
|
+
/* input */ .rd_clk (axis_out.aclk ),
|
56
|
+
/* input */ .rd_rst (~axis_out.aresetn ),
|
57
|
+
/* input [DSIZE-1:0] */ .din ({axis_in.axis_tkeep, axis_in.axis_tdata} ),
|
58
|
+
/* input */ .wr_en ((axis_in.axis_tvalid && !data_fifo_full && axis_in.axis_tready) ),
|
59
|
+
/* input */ .rd_en ((axis_out.axis_tvalid && !data_fifo_empty && axis_out.axis_tready) ),
|
60
|
+
/* output [DSIZE-1:0] */ .dout ({axis_out.axis_tkeep, axis_out.axis_tdata} ),
|
61
|
+
/* output */ .full (data_fifo_full ),
|
62
|
+
/* output */ .empty (data_fifo_empty )
|
63
|
+
);
|
64
|
+
end
|
65
|
+
endgenerate
|
45
66
|
|
46
67
|
// assign axis_out.axis_tdata = axis_out.axis_tvalid? stream_fifo_data : '0;
|
47
68
|
//---<< NATIVE FIFO IP >>------------------------------
|
@@ -16,10 +16,11 @@ module parse_big_field_table_A2 #(
|
|
16
16
|
parameter DSIZE = 8,
|
17
17
|
parameter FIELD_LEN = 16*8, //MAX 16*8
|
18
18
|
parameter FIELD_NAME = "Big Filed",
|
19
|
-
parameter TRY_PARSE = "OFF"
|
19
|
+
parameter TRY_PARSE = "OFF",
|
20
|
+
parameter TMP_START = 0
|
20
21
|
)(
|
21
22
|
input enable,
|
22
|
-
output[
|
23
|
+
output[TMP_START:DSIZE*FIELD_LEN-1] value,
|
23
24
|
output logic out_valid,
|
24
25
|
axi_stream_inf.slaver cm_tb_s,
|
25
26
|
axi_stream_inf.master cm_tb_m,
|
@@ -15,7 +15,7 @@ module data_c_pipe_force_vld_bind_data #(
|
|
15
15
|
parameter HEAD_MODE = "ON", // data in master.head
|
16
16
|
parameter SYNC = "master"
|
17
17
|
)(
|
18
|
-
input [DSIZE-1:0] data, //sync master
|
18
|
+
input [DSIZE-1:0] data, //sync master, need bypass
|
19
19
|
data_inf_c.slaver slaver,
|
20
20
|
data_inf_c.master master
|
21
21
|
);
|
@@ -0,0 +1,70 @@
|
|
1
|
+
/**********************************************
|
2
|
+
_______________________________________
|
3
|
+
___________ Cook Darwin __________
|
4
|
+
_______________________________________
|
5
|
+
descript: covert A to B
|
6
|
+
author : Cook.Darwin
|
7
|
+
Version: VERA.0.0
|
8
|
+
creaded:
|
9
|
+
madified:
|
10
|
+
***********************************************/
|
11
|
+
`timescale 1ns/1ps
|
12
|
+
(* data_inf_c = "true" *)
|
13
|
+
module data_c_pipe_sync #(
|
14
|
+
parameter DSIZE = 32
|
15
|
+
|
16
|
+
)(
|
17
|
+
input [DSIZE-1:0] in_data, // as like: hdl``` assign in_data = in_inf.data + 1;
|
18
|
+
output logic [DSIZE-1:0] out_data,
|
19
|
+
data_inf_c.slaver in_inf,
|
20
|
+
data_inf_c.master out_inf
|
21
|
+
);
|
22
|
+
|
23
|
+
initial begin
|
24
|
+
assert(in_inf.DSIZE == out_inf.DSIZE)
|
25
|
+
else begin
|
26
|
+
$error("in_inf DSIZE<%0d> != out_inf DSIZE<%0d>",in_inf.DSIZE,out_inf.DSIZE);
|
27
|
+
$stop;
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
logic clock;
|
32
|
+
logic rst_n;
|
33
|
+
|
34
|
+
assign clock = in_inf.clock;
|
35
|
+
assign rst_n = in_inf.rst_n;
|
36
|
+
|
37
|
+
always@(posedge clock,negedge rst_n)
|
38
|
+
if(~rst_n) out_inf.valid <= 1'b0;
|
39
|
+
else begin
|
40
|
+
if(in_inf.valid && in_inf.ready)
|
41
|
+
out_inf.valid <= 1'b1;
|
42
|
+
else if(out_inf.valid && out_inf.ready)
|
43
|
+
out_inf.valid <= 1'b0;
|
44
|
+
else out_inf.valid <= out_inf.valid;
|
45
|
+
end
|
46
|
+
|
47
|
+
assign in_inf.ready = !out_inf.valid || out_inf.ready;
|
48
|
+
|
49
|
+
// logic[in_inf.DSIZE-1:0] master_origin_data;
|
50
|
+
|
51
|
+
|
52
|
+
always@(posedge clock,negedge rst_n)
|
53
|
+
if(~rst_n)begin
|
54
|
+
out_inf.data <= '0;
|
55
|
+
out_data <= '0;
|
56
|
+
end else begin
|
57
|
+
if(in_inf.valid && in_inf.ready)begin
|
58
|
+
out_data <= in_data;
|
59
|
+
out_inf.data <= in_inf.data;
|
60
|
+
end else if(out_inf.valid && out_inf.ready)begin
|
61
|
+
out_inf.data <= '0;
|
62
|
+
out_data <= '0;
|
63
|
+
end else begin
|
64
|
+
out_inf.data <= out_inf.data;
|
65
|
+
out_data <= out_data;
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
|
70
|
+
endmodule
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require_hdl 'data_c_pipe_sync.sv'
|
2
|
+
|
3
|
+
TdlBuild.data_c_pipe_sync_seam(__dir__) do
|
4
|
+
parameter.LAT 4
|
5
|
+
parameter.DSIZE 32
|
6
|
+
## as like: hdl```
|
7
|
+
## assign in_datas[0] = in_inf.data + 1;
|
8
|
+
## assign in_datas[1] = out_datas[0]+1;```
|
9
|
+
input[param.LAT,param.DSIZE] - 'in_datas'
|
10
|
+
output[param.LAT,param.DSIZE] - 'out_datas'
|
11
|
+
port.data_inf_c.slaver - 'in_inf'
|
12
|
+
port.data_inf_c.master - 'out_inf'
|
13
|
+
|
14
|
+
same_clock_domain(in_inf, out_inf)
|
15
|
+
|
16
|
+
in_inf.copy(name: 'in_inf_array', dimension: [param.LAT])
|
17
|
+
out_inf.copy(name: 'out_inf_array', dimension: [param.LAT])
|
18
|
+
|
19
|
+
generate(param.LAT) do |kk|
|
20
|
+
data_c_pipe_sync.data_c_pipe_sync_inst do |h|
|
21
|
+
h.parameter.DSIZE param.DSIZE
|
22
|
+
h.input['DSIZE'].in_data in_datas[kk] ##// as like: hdl``` assign in_data = in_inf.data + 1;
|
23
|
+
h.output['DSIZE'].out_data out_datas[kk]
|
24
|
+
h.port.data_inf_c.slaver.in_inf in_inf_array[kk]
|
25
|
+
h.port.data_inf_c.master.out_inf out_inf_array[kk]
|
26
|
+
end
|
27
|
+
|
28
|
+
IF kk != 0 do
|
29
|
+
Assign do
|
30
|
+
in_inf_array[kk].valid <= out_inf_array[kk-1].valid
|
31
|
+
in_inf_array[kk].data <= out_inf_array[kk-1].data
|
32
|
+
out_inf_array[kk-1].ready <= in_inf_array[kk].ready
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
Assign do
|
38
|
+
in_inf_array[0].valid <= in_inf.valid
|
39
|
+
in_inf_array[0].data <= in_inf.data
|
40
|
+
in_inf.ready <= in_inf_array[0].ready
|
41
|
+
end
|
42
|
+
|
43
|
+
Assign do
|
44
|
+
out_inf.data <= out_inf_array[param.LAT-1].data
|
45
|
+
out_inf.valid <= out_inf_array[param.LAT-1].valid
|
46
|
+
out_inf_array[param.LAT-1].ready <= out_inf.ready
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
@@ -0,0 +1,84 @@
|
|
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 data_c_pipe_sync_seam #(
|
14
|
+
parameter LAT = 4,
|
15
|
+
parameter DSIZE = 32
|
16
|
+
)(
|
17
|
+
input [ DSIZE-1:0] in_datas [LAT-1:0],
|
18
|
+
output [ DSIZE-1:0] out_datas [LAT-1:0],
|
19
|
+
data_inf_c.slaver in_inf,
|
20
|
+
data_inf_c.master out_inf
|
21
|
+
);
|
22
|
+
|
23
|
+
//==========================================================================
|
24
|
+
//-------- define ----------------------------------------------------------
|
25
|
+
|
26
|
+
data_inf_c #(.DSIZE(in_inf.DSIZE)) in_inf_array[LAT-1:0] (.clock(in_inf.clock),.rst_n(in_inf.rst_n)) ;
|
27
|
+
data_inf_c #(.DSIZE(out_inf.DSIZE)) out_inf_array[LAT-1:0] (.clock(out_inf.clock),.rst_n(out_inf.rst_n)) ;
|
28
|
+
//==========================================================================
|
29
|
+
//-------- instance --------------------------------------------------------
|
30
|
+
|
31
|
+
//==========================================================================
|
32
|
+
//-------- expression ------------------------------------------------------
|
33
|
+
generate
|
34
|
+
for(genvar KK0=0;KK0 < LAT;KK0++)begin
|
35
|
+
data_c_pipe_sync #(
|
36
|
+
.DSIZE (DSIZE )
|
37
|
+
)data_c_pipe_sync_inst(
|
38
|
+
/* input */.in_data (in_datas[ KK0] ),
|
39
|
+
/* output */.out_data (out_datas[ KK0] ),
|
40
|
+
/* data_inf_c.slaver */.in_inf (in_inf_array[ KK0] ),
|
41
|
+
/* data_inf_c.master */.out_inf (out_inf_array[ KK0] )
|
42
|
+
);
|
43
|
+
if( KK0!=0)begin
|
44
|
+
assign in_inf_array[ KK0].valid = out_inf_array[ KK0-1].valid;
|
45
|
+
assign in_inf_array[ KK0].data = out_inf_array[ KK0-1].data;
|
46
|
+
assign out_inf_array[ KK0-1].ready = in_inf_array[ KK0].ready;
|
47
|
+
end end
|
48
|
+
endgenerate
|
49
|
+
//-------- CLOCKs Total 2 ----------------------
|
50
|
+
//--->> CheckClock <<----------------
|
51
|
+
logic cc_done_10,cc_same_10;
|
52
|
+
integer cc_afreq_10,cc_bfreq_10;
|
53
|
+
ClockSameDomain CheckPClock_inst_10(
|
54
|
+
/* input */ .aclk (in_inf.clock ),
|
55
|
+
/* input */ .bclk (out_inf.clock ),
|
56
|
+
/* output logic */ .done (cc_done_10),
|
57
|
+
/* output logic */ .same (cc_same_10),
|
58
|
+
/* output integer */ .aFreqK (cc_afreq_10),
|
59
|
+
/* output integer */ .bFreqK (cc_bfreq_10)
|
60
|
+
);
|
61
|
+
|
62
|
+
initial begin
|
63
|
+
wait(cc_done_10);
|
64
|
+
assert(cc_same_10)
|
65
|
+
else begin
|
66
|
+
$error("--- Error : `data_c_pipe_sync_seam` clock is not same, in_inf.clock< %0f M> != out_inf.clock<%0f M>",1000000.0/cc_afreq_10, 1000000.0/cc_bfreq_10);
|
67
|
+
repeat(10)begin
|
68
|
+
@(posedge in_inf.clock);
|
69
|
+
end
|
70
|
+
$stop;
|
71
|
+
end
|
72
|
+
end
|
73
|
+
//---<< CheckClock >>----------------
|
74
|
+
|
75
|
+
//======== CLOCKs Total 2 ======================
|
76
|
+
assign in_inf_array[0].valid = in_inf.valid;
|
77
|
+
assign in_inf_array[0].data = in_inf.data;
|
78
|
+
assign in_inf.ready = in_inf_array[0].ready;
|
79
|
+
|
80
|
+
assign out_inf.data = out_inf_array[ LAT-1].data;
|
81
|
+
assign out_inf.valid = out_inf_array[ LAT-1].valid;
|
82
|
+
assign out_inf_array[ LAT-1].ready = out_inf.ready;
|
83
|
+
|
84
|
+
endmodule
|