Skip to content

Commit 262c6a0

Browse files
committed
changed parameter name
1 parent 0857a08 commit 262c6a0

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

lambdalib/ramlib/rtl/la_asyncfifo.v

+6-5
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
module la_asyncfifo #(
2424
parameter DW = 32, // Memory width
2525
parameter DEPTH = 4, // FIFO depth
26-
parameter ALMOST_FULL_LEVEL = DEPTH-1, // FIFO depth
26+
parameter ALMOSTFULL = 0, // FIFO depth
2727
parameter NS = 1, // Number of power supplies
2828
parameter CTRLW = 1, // width of asic ctrl interface
2929
parameter TESTW = 1, // width of asic teset interface
@@ -53,6 +53,7 @@ module la_asyncfifo #(
5353

5454
// local params
5555
localparam AW = (DEPTH == 1) ? 1 : $clog2(DEPTH);
56+
localparam AFULLFINAL = (ALMOSTFULL != 0) ? ALMOSTFULL : DEPTH - 1;
5657

5758
// local wires
5859
reg [AW:0] wr_grayptr;
@@ -84,7 +85,7 @@ module la_asyncfifo #(
8485
wr_binptr[AW:0] <= 'b0;
8586
wr_grayptr[AW:0] <= 'b0;
8687
end else begin
87-
wr_binptr_mem[AW:0] <= (wr_binptr_mem_nxt[AW:0] == DEPTH) ? 'b0 : wr_binptr_mem_nxt[AW:0];
88+
wr_binptr_mem[AW:0] <= (wr_binptr_mem_nxt[AW:0] == DEPTH[AW:0]) ? 'b0 : wr_binptr_mem_nxt[AW:0];
8889
wr_binptr[AW:0] <= wr_binptr_nxt[AW:0];
8990
wr_grayptr[AW:0] <= wr_grayptr_nxt[AW:0];
9091
end
@@ -116,13 +117,13 @@ module la_asyncfifo #(
116117
if (~wr_nreset) wr_full <= 1'b0;
117118
else
118119
wr_full <= (wr_chaosfull & wr_chaosmode) |
119-
(fifo_used + {{AW{1'b0}}, (wr_en && ~wr_full)}) == DEPTH;
120+
(fifo_used + {{AW{1'b0}}, (wr_en && ~wr_full)}) == DEPTH[AW:0];
120121

121122
always @(posedge wr_clk or negedge wr_nreset)
122123
if (~wr_nreset) wr_almost_full <= 1'b0;
123124
else
124125
wr_almost_full <=
125-
(fifo_used + {{AW{1'b0}}, (wr_en && ~wr_full)}) > (ALMOST_FULL_LEVEL-1);
126+
(fifo_used + {{AW{1'b0}}, (wr_en && ~wr_full)}) > (AFULLFINAL[AW:0]-1);
126127

127128
// Write --> Read clock synchronizer
128129
for (i = 0; i < (AW + 1); i = i + 1) begin
@@ -144,7 +145,7 @@ module la_asyncfifo #(
144145
rd_binptr[AW:0] <= 'b0;
145146
rd_grayptr[AW:0] <= 'b0;
146147
end else begin
147-
rd_binptr_mem[AW:0] <= (rd_binptr_mem_nxt[AW:0] == DEPTH) ? 'b0 : rd_binptr_mem_nxt[AW:0];
148+
rd_binptr_mem[AW:0] <= (rd_binptr_mem_nxt[AW:0] == DEPTH[AW:0]) ? 'b0 : rd_binptr_mem_nxt[AW:0];
148149
rd_binptr[AW:0] <= rd_binptr_nxt[AW:0];
149150
rd_grayptr[AW:0] <= rd_grayptr_nxt[AW:0];
150151
end

lambdalib/ramlib/tests/tb_la_asyncfifo.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ async def test_almost_full(dut):
6060
await Timer(wr_clk_period_ns * random.random(), "ns", round_mode="round")
6161
await cocotb.start(Clock(dut.rd_clk, rd_clk_period_ns, units="ns").start())
6262

63-
almost_full_level = int(dut.ALMOST_FULL_LEVEL.value)
63+
almost_full_level = int(dut.AFULLFINAL.value)
6464

6565
await ClockCycles(dut.wr_clk, 3)
6666

@@ -150,8 +150,6 @@ async def fifo_rd_wr_test(
150150
units="ns"
151151
) for _ in range(0, 2)]
152152

153-
utils.get_sim_steps(Decimal("8.104"), "ns")
154-
155153
# Factory to automatically generate a set of tests based on the different permutations
156154
# of the provided test arguments
157155
tf = TestFactory(fifo_rd_wr_test)

0 commit comments

Comments
 (0)