mirror of
https://github.com/corundum/corundum.git
synced 2025-01-16 08:12:53 +08:00
merged changes in axis
This commit is contained in:
commit
9ef08c9d5d
@ -109,17 +109,17 @@ parameter SEGMENT_KEEP_WIDTH = KEEP_WIDTH / SEGMENT_COUNT;
|
|||||||
// bus width assertions
|
// bus width assertions
|
||||||
initial begin
|
initial begin
|
||||||
if (S_DATA_WORD_SIZE * S_KEEP_WIDTH_INT != S_DATA_WIDTH) begin
|
if (S_DATA_WORD_SIZE * S_KEEP_WIDTH_INT != S_DATA_WIDTH) begin
|
||||||
$error("Error: input data width not evenly divisble");
|
$error("Error: input data width not evenly divisble (instance %m)");
|
||||||
$finish;
|
$finish;
|
||||||
end
|
end
|
||||||
|
|
||||||
if (M_DATA_WORD_SIZE * M_KEEP_WIDTH_INT != M_DATA_WIDTH) begin
|
if (M_DATA_WORD_SIZE * M_KEEP_WIDTH_INT != M_DATA_WIDTH) begin
|
||||||
$error("Error: output data width not evenly divisble");
|
$error("Error: output data width not evenly divisble (instance %m)");
|
||||||
$finish;
|
$finish;
|
||||||
end
|
end
|
||||||
|
|
||||||
if (S_DATA_WORD_SIZE != M_DATA_WORD_SIZE) begin
|
if (S_DATA_WORD_SIZE != M_DATA_WORD_SIZE) begin
|
||||||
$error("Error: word size mismatch");
|
$error("Error: word size mismatch (instance %m)");
|
||||||
$finish;
|
$finish;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -120,22 +120,22 @@ parameter ADDR_WIDTH = (KEEP_ENABLE && KEEP_WIDTH > 1) ? $clog2(DEPTH/KEEP_WIDTH
|
|||||||
// check configuration
|
// check configuration
|
||||||
initial begin
|
initial begin
|
||||||
if (FRAME_FIFO && !LAST_ENABLE) begin
|
if (FRAME_FIFO && !LAST_ENABLE) begin
|
||||||
$error("Error: FRAME_FIFO set requires LAST_ENABLE set");
|
$error("Error: FRAME_FIFO set requires LAST_ENABLE set (instance %m)");
|
||||||
$finish;
|
$finish;
|
||||||
end
|
end
|
||||||
|
|
||||||
if (DROP_BAD_FRAME && !FRAME_FIFO) begin
|
if (DROP_BAD_FRAME && !FRAME_FIFO) begin
|
||||||
$error("Error: DROP_BAD_FRAME set requires FRAME_FIFO set");
|
$error("Error: DROP_BAD_FRAME set requires FRAME_FIFO set (instance %m)");
|
||||||
$finish;
|
$finish;
|
||||||
end
|
end
|
||||||
|
|
||||||
if (DROP_WHEN_FULL && !FRAME_FIFO) begin
|
if (DROP_WHEN_FULL && !FRAME_FIFO) begin
|
||||||
$error("Error: DROP_WHEN_FULL set requires FRAME_FIFO set");
|
$error("Error: DROP_WHEN_FULL set requires FRAME_FIFO set (instance %m)");
|
||||||
$finish;
|
$finish;
|
||||||
end
|
end
|
||||||
|
|
||||||
if (DROP_BAD_FRAME && (USER_BAD_FRAME_MASK & {USER_WIDTH{1'b1}}) == 0) begin
|
if (DROP_BAD_FRAME && (USER_BAD_FRAME_MASK & {USER_WIDTH{1'b1}}) == 0) begin
|
||||||
$error("Error: Invalid USER_BAD_FRAME_MASK value");
|
$error("Error: Invalid USER_BAD_FRAME_MASK value (instance %m)");
|
||||||
$finish;
|
$finish;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -280,7 +280,7 @@ end
|
|||||||
always @* begin
|
always @* begin
|
||||||
write = 1'b0;
|
write = 1'b0;
|
||||||
|
|
||||||
drop_frame_next = 1'b0;
|
drop_frame_next = drop_frame_reg;
|
||||||
overflow_next = 1'b0;
|
overflow_next = 1'b0;
|
||||||
bad_frame_next = 1'b0;
|
bad_frame_next = 1'b0;
|
||||||
good_frame_next = 1'b0;
|
good_frame_next = 1'b0;
|
||||||
|
@ -133,17 +133,17 @@ parameter KEEP_WIDTH = EXPAND_BUS ? M_KEEP_WIDTH_INT : S_KEEP_WIDTH_INT;
|
|||||||
// bus width assertions
|
// bus width assertions
|
||||||
initial begin
|
initial begin
|
||||||
if (S_DATA_WORD_SIZE * S_KEEP_WIDTH_INT != S_DATA_WIDTH) begin
|
if (S_DATA_WORD_SIZE * S_KEEP_WIDTH_INT != S_DATA_WIDTH) begin
|
||||||
$error("Error: input data width not evenly divisble");
|
$error("Error: input data width not evenly divisble (instance %m)");
|
||||||
$finish;
|
$finish;
|
||||||
end
|
end
|
||||||
|
|
||||||
if (M_DATA_WORD_SIZE * M_KEEP_WIDTH_INT != M_DATA_WIDTH) begin
|
if (M_DATA_WORD_SIZE * M_KEEP_WIDTH_INT != M_DATA_WIDTH) begin
|
||||||
$error("Error: output data width not evenly divisble");
|
$error("Error: output data width not evenly divisble (instance %m)");
|
||||||
$finish;
|
$finish;
|
||||||
end
|
end
|
||||||
|
|
||||||
if (S_DATA_WORD_SIZE != M_DATA_WORD_SIZE) begin
|
if (S_DATA_WORD_SIZE != M_DATA_WORD_SIZE) begin
|
||||||
$error("Error: word size mismatch");
|
$error("Error: word size mismatch (instance %m)");
|
||||||
$finish;
|
$finish;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -86,8 +86,6 @@ wire m_axis_tready_int_early;
|
|||||||
|
|
||||||
reg s_axis_tready_mask;
|
reg s_axis_tready_mask;
|
||||||
|
|
||||||
assign s_axis_tready = code_fifo_in_tready && data_fifo_in_tready && s_axis_tready_mask;
|
|
||||||
|
|
||||||
reg [7:0] code_fifo_in_tdata;
|
reg [7:0] code_fifo_in_tdata;
|
||||||
reg code_fifo_in_tvalid;
|
reg code_fifo_in_tvalid;
|
||||||
reg code_fifo_in_tlast;
|
reg code_fifo_in_tlast;
|
||||||
@ -100,6 +98,8 @@ wire code_fifo_out_tlast;
|
|||||||
wire code_fifo_out_tuser;
|
wire code_fifo_out_tuser;
|
||||||
reg code_fifo_out_tready;
|
reg code_fifo_out_tready;
|
||||||
|
|
||||||
|
assign s_axis_tready = code_fifo_in_tready && data_fifo_in_tready && s_axis_tready_mask;
|
||||||
|
|
||||||
axis_fifo #(
|
axis_fifo #(
|
||||||
.DEPTH(256),
|
.DEPTH(256),
|
||||||
.DATA_WIDTH(8),
|
.DATA_WIDTH(8),
|
||||||
|
@ -113,22 +113,22 @@ parameter ADDR_WIDTH = (KEEP_ENABLE && KEEP_WIDTH > 1) ? $clog2(DEPTH/KEEP_WIDTH
|
|||||||
// check configuration
|
// check configuration
|
||||||
initial begin
|
initial begin
|
||||||
if (FRAME_FIFO && !LAST_ENABLE) begin
|
if (FRAME_FIFO && !LAST_ENABLE) begin
|
||||||
$error("Error: FRAME_FIFO set requires LAST_ENABLE set");
|
$error("Error: FRAME_FIFO set requires LAST_ENABLE set (instance %m)");
|
||||||
$finish;
|
$finish;
|
||||||
end
|
end
|
||||||
|
|
||||||
if (DROP_BAD_FRAME && !FRAME_FIFO) begin
|
if (DROP_BAD_FRAME && !FRAME_FIFO) begin
|
||||||
$error("Error: DROP_BAD_FRAME set requires FRAME_FIFO set");
|
$error("Error: DROP_BAD_FRAME set requires FRAME_FIFO set (instance %m)");
|
||||||
$finish;
|
$finish;
|
||||||
end
|
end
|
||||||
|
|
||||||
if (DROP_WHEN_FULL && !FRAME_FIFO) begin
|
if (DROP_WHEN_FULL && !FRAME_FIFO) begin
|
||||||
$error("Error: DROP_WHEN_FULL set requires FRAME_FIFO set");
|
$error("Error: DROP_WHEN_FULL set requires FRAME_FIFO set (instance %m)");
|
||||||
$finish;
|
$finish;
|
||||||
end
|
end
|
||||||
|
|
||||||
if (DROP_BAD_FRAME && (USER_BAD_FRAME_MASK & {USER_WIDTH{1'b1}}) == 0) begin
|
if (DROP_BAD_FRAME && (USER_BAD_FRAME_MASK & {USER_WIDTH{1'b1}}) == 0) begin
|
||||||
$error("Error: Invalid USER_BAD_FRAME_MASK value");
|
$error("Error: Invalid USER_BAD_FRAME_MASK value (instance %m)");
|
||||||
$finish;
|
$finish;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -204,7 +204,7 @@ assign status_good_frame = good_frame_reg;
|
|||||||
always @* begin
|
always @* begin
|
||||||
write = 1'b0;
|
write = 1'b0;
|
||||||
|
|
||||||
drop_frame_next = 1'b0;
|
drop_frame_next = drop_frame_reg;
|
||||||
overflow_next = 1'b0;
|
overflow_next = 1'b0;
|
||||||
bad_frame_next = 1'b0;
|
bad_frame_next = 1'b0;
|
||||||
good_frame_next = 1'b0;
|
good_frame_next = 1'b0;
|
||||||
|
@ -129,17 +129,17 @@ parameter KEEP_WIDTH = EXPAND_BUS ? M_KEEP_WIDTH_INT : S_KEEP_WIDTH_INT;
|
|||||||
// bus width assertions
|
// bus width assertions
|
||||||
initial begin
|
initial begin
|
||||||
if (S_DATA_WORD_SIZE * S_KEEP_WIDTH_INT != S_DATA_WIDTH) begin
|
if (S_DATA_WORD_SIZE * S_KEEP_WIDTH_INT != S_DATA_WIDTH) begin
|
||||||
$error("Error: input data width not evenly divisble");
|
$error("Error: input data width not evenly divisble (instance %m)");
|
||||||
$finish;
|
$finish;
|
||||||
end
|
end
|
||||||
|
|
||||||
if (M_DATA_WORD_SIZE * M_KEEP_WIDTH_INT != M_DATA_WIDTH) begin
|
if (M_DATA_WORD_SIZE * M_KEEP_WIDTH_INT != M_DATA_WIDTH) begin
|
||||||
$error("Error: output data width not evenly divisble");
|
$error("Error: output data width not evenly divisble (instance %m)");
|
||||||
$finish;
|
$finish;
|
||||||
end
|
end
|
||||||
|
|
||||||
if (S_DATA_WORD_SIZE != M_DATA_WORD_SIZE) begin
|
if (S_DATA_WORD_SIZE != M_DATA_WORD_SIZE) begin
|
||||||
$error("Error: word size mismatch");
|
$error("Error: word size mismatch (instance %m)");
|
||||||
$finish;
|
$finish;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -102,7 +102,7 @@ localparam DATA_WORD_WIDTH = DATA_WIDTH / KEEP_WIDTH;
|
|||||||
// bus width assertions
|
// bus width assertions
|
||||||
initial begin
|
initial begin
|
||||||
if (DATA_WORD_WIDTH * KEEP_WIDTH != DATA_WIDTH) begin
|
if (DATA_WORD_WIDTH * KEEP_WIDTH != DATA_WIDTH) begin
|
||||||
$error("Error: data width not evenly divisble");
|
$error("Error: data width not evenly divisble (instance %m)");
|
||||||
$finish;
|
$finish;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -55,7 +55,7 @@ module axis_switch #
|
|||||||
// Output interface routing base tdest selection
|
// Output interface routing base tdest selection
|
||||||
// Concatenate M_COUNT DEST_WIDTH sized constants
|
// Concatenate M_COUNT DEST_WIDTH sized constants
|
||||||
// Port selected if M_BASE <= tdest <= M_TOP
|
// Port selected if M_BASE <= tdest <= M_TOP
|
||||||
// set to zero for default routing with tdest as port index
|
// set to zero for default routing with tdest MSBs as port index
|
||||||
parameter M_BASE = 0,
|
parameter M_BASE = 0,
|
||||||
// Output interface routing top tdest selection
|
// Output interface routing top tdest selection
|
||||||
// Concatenate M_COUNT DEST_WIDTH sized constants
|
// Concatenate M_COUNT DEST_WIDTH sized constants
|
||||||
@ -112,8 +112,8 @@ integer i, j;
|
|||||||
|
|
||||||
// check configuration
|
// check configuration
|
||||||
initial begin
|
initial begin
|
||||||
if (2**DEST_WIDTH < CL_M_COUNT) begin
|
if (DEST_WIDTH < CL_M_COUNT) begin
|
||||||
$error("Error: DEST_WIDTH too small for port count");
|
$error("Error: DEST_WIDTH too small for port count (instance %m)");
|
||||||
$finish;
|
$finish;
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ initial begin
|
|||||||
if (M_BASE[i*DEST_WIDTH +: DEST_WIDTH] == M_BASE[j*DEST_WIDTH +: DEST_WIDTH]) begin
|
if (M_BASE[i*DEST_WIDTH +: DEST_WIDTH] == M_BASE[j*DEST_WIDTH +: DEST_WIDTH]) begin
|
||||||
$display("%d: %08x", i, M_BASE[i*DEST_WIDTH +: DEST_WIDTH]);
|
$display("%d: %08x", i, M_BASE[i*DEST_WIDTH +: DEST_WIDTH]);
|
||||||
$display("%d: %08x", j, M_BASE[j*DEST_WIDTH +: DEST_WIDTH]);
|
$display("%d: %08x", j, M_BASE[j*DEST_WIDTH +: DEST_WIDTH]);
|
||||||
$error("Error: ranges overlap");
|
$error("Error: ranges overlap (instance %m)");
|
||||||
$finish;
|
$finish;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -134,7 +134,7 @@ initial begin
|
|||||||
end else begin
|
end else begin
|
||||||
for (i = 0; i < M_COUNT; i = i + 1) begin
|
for (i = 0; i < M_COUNT; i = i + 1) begin
|
||||||
if (M_BASE[i*DEST_WIDTH +: DEST_WIDTH] > M_TOP[i*DEST_WIDTH +: DEST_WIDTH]) begin
|
if (M_BASE[i*DEST_WIDTH +: DEST_WIDTH] > M_TOP[i*DEST_WIDTH +: DEST_WIDTH]) begin
|
||||||
$error("Error: invalid range");
|
$error("Error: invalid range (instance %m)");
|
||||||
$finish;
|
$finish;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -144,7 +144,7 @@ initial begin
|
|||||||
if (M_BASE[i*DEST_WIDTH +: DEST_WIDTH] <= M_TOP[j*DEST_WIDTH +: DEST_WIDTH] && M_BASE[j*DEST_WIDTH +: DEST_WIDTH] <= M_TOP[i*DEST_WIDTH +: DEST_WIDTH]) begin
|
if (M_BASE[i*DEST_WIDTH +: DEST_WIDTH] <= M_TOP[j*DEST_WIDTH +: DEST_WIDTH] && M_BASE[j*DEST_WIDTH +: DEST_WIDTH] <= M_TOP[i*DEST_WIDTH +: DEST_WIDTH]) begin
|
||||||
$display("%d: %08x-%08x", i, M_BASE[i*DEST_WIDTH +: DEST_WIDTH], M_TOP[i*DEST_WIDTH +: DEST_WIDTH]);
|
$display("%d: %08x-%08x", i, M_BASE[i*DEST_WIDTH +: DEST_WIDTH], M_TOP[i*DEST_WIDTH +: DEST_WIDTH]);
|
||||||
$display("%d: %08x-%08x", j, M_BASE[j*DEST_WIDTH +: DEST_WIDTH], M_TOP[j*DEST_WIDTH +: DEST_WIDTH]);
|
$display("%d: %08x-%08x", j, M_BASE[j*DEST_WIDTH +: DEST_WIDTH], M_TOP[j*DEST_WIDTH +: DEST_WIDTH]);
|
||||||
$error("Error: ranges overlap");
|
$error("Error: ranges overlap (instance %m)");
|
||||||
$finish;
|
$finish;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -188,8 +188,8 @@ generate
|
|||||||
drop_next = 1'b1;
|
drop_next = 1'b1;
|
||||||
for (k = 0; k < M_COUNT; k = k + 1) begin
|
for (k = 0; k < M_COUNT; k = k + 1) begin
|
||||||
if (M_BASE == 0) begin
|
if (M_BASE == 0) begin
|
||||||
// M_BASE is zero, route with tdest as port index
|
// M_BASE is zero, route with $clog2(M_COUNT) MSBs of tdest as port index
|
||||||
if (int_s_axis_tdest[m*DEST_WIDTH +: DEST_WIDTH] == k && (M_CONNECT & (1 << (m+k*S_COUNT)))) begin
|
if (int_s_axis_tdest[m*DEST_WIDTH+(DEST_WIDTH-CL_M_COUNT) +: CL_M_COUNT] == k && (M_CONNECT & (1 << (m+k*S_COUNT)))) begin
|
||||||
select_next = k;
|
select_next = k;
|
||||||
select_valid_next = 1'b1;
|
select_valid_next = 1'b1;
|
||||||
drop_next = 1'b0;
|
drop_next = 1'b0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user