fixed l2/l3 caches related bugs
This commit is contained in:
@@ -30,11 +30,13 @@ module VX_fifo_queue #(
|
||||
head_r <= 0;
|
||||
size_r <= 0;
|
||||
end else begin
|
||||
if (push && !pop) begin
|
||||
assert(!full);
|
||||
size_r <= 1;
|
||||
end else if (pop && !push) begin
|
||||
assert(!empty);
|
||||
assert(!push || !full);
|
||||
assert(!pop || !empty);
|
||||
if (push) begin
|
||||
if (!pop) begin
|
||||
size_r <= 1;
|
||||
end
|
||||
end else if (pop) begin
|
||||
size_r <= 0;
|
||||
end
|
||||
if (push) begin
|
||||
@@ -62,13 +64,14 @@ module VX_fifo_queue #(
|
||||
end else begin
|
||||
assert(!push || !full);
|
||||
assert(!pop || !empty);
|
||||
if (push && !pop) begin
|
||||
empty_r <= 0;
|
||||
if (used_r == ADDRW'(SIZE-1)) begin
|
||||
full_r <= 1;
|
||||
if (push) begin
|
||||
if (!pop) begin
|
||||
empty_r <= 0;
|
||||
if (used_r == ADDRW'(SIZE-1)) begin
|
||||
full_r <= 1;
|
||||
end
|
||||
end
|
||||
end
|
||||
if (pop && !push) begin
|
||||
end else if (pop) begin
|
||||
full_r <= 0;
|
||||
if (used_r == ADDRW'(1)) begin
|
||||
empty_r <= 1;
|
||||
|
||||
35
hw/rtl/libs/VX_pending_size.v
Normal file
35
hw/rtl/libs/VX_pending_size.v
Normal file
@@ -0,0 +1,35 @@
|
||||
`include "VX_platform.vh"
|
||||
|
||||
module VX_pending_size #(
|
||||
parameter SIZE = 1
|
||||
) (
|
||||
input wire clk,
|
||||
input wire reset,
|
||||
input wire push,
|
||||
input wire pop,
|
||||
output wire full
|
||||
);
|
||||
localparam ADDRW = $clog2(SIZE);
|
||||
|
||||
reg [ADDRW-1:0] size_r;
|
||||
reg full_r;
|
||||
|
||||
always @(posedge clk) begin
|
||||
if (reset) begin
|
||||
size_r <= 0;
|
||||
full_r <= 0;
|
||||
end else begin
|
||||
assert(!push || !full);
|
||||
if (push) begin
|
||||
if (!pop && (used_r == ADDRW'(SIZE-1)))
|
||||
full_r <= 1;
|
||||
end else if (pop) begin
|
||||
full_r <= 0;
|
||||
end
|
||||
size_r <= size_r + ADDRW'($signed(2'(push && !pop) - 2'(pop && !push)));
|
||||
end
|
||||
end
|
||||
|
||||
assign full = full_r;
|
||||
|
||||
endmodule
|
||||
Reference in New Issue
Block a user