Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Truncation of usage_o port in fifo_v3 when parameter DEPTH is a power of 2 #69

Open
WRoenninger opened this issue Feb 21, 2020 · 2 comments
Milestone

Comments

@WRoenninger
Copy link
Collaborator

The usage_o port of fifo_v3 has currently a width of $clog(DEPTH).
This causes the pointer to wrap around to all zeros, if the FIFO has a power of 2 DEPTH and is full. This is an issue for the following exapmle:

localparam int unsigned Depth     = 32'd16;
localparam logic [3:0]  Threshold = 4'hF;
logic [3:0] usage;
if (usage > threshold) begin
  /* do something */
end

This if statement would not trigger in this case.
This could be resolved by assigning the whole status_cnt_q to the usage_o port instead of the truncated one as is currently the case.

The workaround I am using currently is prepending the full_o signal to the ussage_o, however this causes jumps in this new usage pointer value when the FIFO is not configured to a power of 2 DEPTH.

@zarubaf
Copy link
Contributor

zarubaf commented Feb 21, 2020

Good catch and thanks for reporting. We should probably fix this in a fifo_v4 or a breaking change (major version bump) in the common cells repo (which is unfortunately anyway required near term).

@zarubaf zarubaf added this to the v2.0 milestone Feb 22, 2020
@Juan-Gg
Copy link

Juan-Gg commented Jun 20, 2024

Came across this today. Was thinking about the same workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants