mirror of
https://github.com/corundum/corundum.git
synced 2025-01-16 08:12:53 +08:00
Rewrite full/empty logic
This commit is contained in:
parent
b7ed61b242
commit
c9950d56ae
@ -186,17 +186,12 @@ reg m_axis_tvalid_reg = 1'b0, m_axis_tvalid_next;
|
|||||||
|
|
||||||
// full when first TWO MSBs do NOT match, but rest matches
|
// full when first TWO MSBs do NOT match, but rest matches
|
||||||
// (gray code equivalent of first MSB different but rest same)
|
// (gray code equivalent of first MSB different but rest same)
|
||||||
wire full = ((wr_ptr_gray_reg[ADDR_WIDTH] != rd_ptr_gray_sync2_reg[ADDR_WIDTH]) &&
|
wire full = wr_ptr_gray_reg == (rd_ptr_gray_sync2_reg ^ {2'b11, {ADDR_WIDTH-1{1'b0}}});
|
||||||
(wr_ptr_gray_reg[ADDR_WIDTH-1] != rd_ptr_gray_sync2_reg[ADDR_WIDTH-1]) &&
|
wire full_cur = wr_ptr_cur_gray_reg == (rd_ptr_gray_sync2_reg ^ {2'b11, {ADDR_WIDTH-1{1'b0}}});
|
||||||
(wr_ptr_gray_reg[ADDR_WIDTH-2:0] == rd_ptr_gray_sync2_reg[ADDR_WIDTH-2:0]));
|
|
||||||
wire full_cur = ((wr_ptr_cur_gray_reg[ADDR_WIDTH] != rd_ptr_gray_sync2_reg[ADDR_WIDTH]) &&
|
|
||||||
(wr_ptr_cur_gray_reg[ADDR_WIDTH-1] != rd_ptr_gray_sync2_reg[ADDR_WIDTH-1]) &&
|
|
||||||
(wr_ptr_cur_gray_reg[ADDR_WIDTH-2:0] == rd_ptr_gray_sync2_reg[ADDR_WIDTH-2:0]));
|
|
||||||
// empty when pointers match exactly
|
// empty when pointers match exactly
|
||||||
wire empty = rd_ptr_gray_reg == (FRAME_FIFO ? wr_ptr_gray_sync1_reg : wr_ptr_gray_sync2_reg);
|
wire empty = rd_ptr_gray_reg == (FRAME_FIFO ? wr_ptr_gray_sync1_reg : wr_ptr_gray_sync2_reg);
|
||||||
// overflow within packet
|
// overflow within packet
|
||||||
wire full_wr = ((wr_ptr_reg[ADDR_WIDTH] != wr_ptr_cur_reg[ADDR_WIDTH]) &&
|
wire full_wr = wr_ptr_reg == (wr_ptr_cur_reg ^ {1'b1, {ADDR_WIDTH{1'b0}}});
|
||||||
(wr_ptr_reg[ADDR_WIDTH-1:0] == wr_ptr_cur_reg[ADDR_WIDTH-1:0]));
|
|
||||||
|
|
||||||
// control signals
|
// control signals
|
||||||
reg write;
|
reg write;
|
||||||
|
@ -154,15 +154,12 @@ reg [WIDTH-1:0] m_axis_reg;
|
|||||||
reg m_axis_tvalid_reg = 1'b0, m_axis_tvalid_next;
|
reg m_axis_tvalid_reg = 1'b0, m_axis_tvalid_next;
|
||||||
|
|
||||||
// full when first MSB different but rest same
|
// full when first MSB different but rest same
|
||||||
wire full = ((wr_ptr_reg[ADDR_WIDTH] != rd_ptr_reg[ADDR_WIDTH]) &&
|
wire full = wr_ptr_reg == (rd_ptr_reg ^ {1'b1, {ADDR_WIDTH{1'b0}}});
|
||||||
(wr_ptr_reg[ADDR_WIDTH-1:0] == rd_ptr_reg[ADDR_WIDTH-1:0]));
|
wire full_cur = wr_ptr_cur_reg == (rd_ptr_reg ^ {1'b1, {ADDR_WIDTH{1'b0}}});
|
||||||
wire full_cur = ((wr_ptr_cur_reg[ADDR_WIDTH] != rd_ptr_reg[ADDR_WIDTH]) &&
|
|
||||||
(wr_ptr_cur_reg[ADDR_WIDTH-1:0] == rd_ptr_reg[ADDR_WIDTH-1:0]));
|
|
||||||
// empty when pointers match exactly
|
// empty when pointers match exactly
|
||||||
wire empty = wr_ptr_reg == rd_ptr_reg;
|
wire empty = wr_ptr_reg == rd_ptr_reg;
|
||||||
// overflow within packet
|
// overflow within packet
|
||||||
wire full_wr = ((wr_ptr_reg[ADDR_WIDTH] != wr_ptr_cur_reg[ADDR_WIDTH]) &&
|
wire full_wr = wr_ptr_reg == (wr_ptr_cur_reg ^ {1'b1, {ADDR_WIDTH{1'b0}}});
|
||||||
(wr_ptr_reg[ADDR_WIDTH-1:0] == wr_ptr_cur_reg[ADDR_WIDTH-1:0]));
|
|
||||||
|
|
||||||
// control signals
|
// control signals
|
||||||
reg write;
|
reg write;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user