This repository has been archived by the owner on Nov 5, 2024. It is now read-only.
Fix FL_PIPE REM signal width when DATA_WIDTH is 0 or 8 #5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
FL_PIPE has some unexpected behavior with low DATA_WIDTH values:
For 32 and 16 bits this works correctly. For 8 bits, (1 downto 0) makes no sense, since FL has just one byte that is always valid – it does not need a 2-bit REM. It does not need REM at all. When DATA_WIDTH = 0, the result depends on how systhesis evaluates log2(0); in Vivado it evaluates to 0, so the result is again (1 downto 0).
This proposed fix replaces the bogus ranges for 8 and 0 data widths with null range (-1 downto 0), so that, when not needed, the REM signal becomes zero width and is simply left unused. The REM_WIDTH function previously used to compensate for the weird REM port behavior is replaced by a constant. Unnecessary includes of non-standard numeric packages are also removed.
While Vivado happily ignores null-range signals, I'm not 100% sure if it is acceptable in other toolchains like Modelsim or Quartus. So you may want to test it and consider a different solution if it causes any problems. I suppose that only applies to the DATA_WIDTH = 8 case, since when data width is zero, there are already null ranges in the data ports.