Ensure Memory that has a port with async_read=True is actually implemented as distributed ram #105
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.
Sometimes, when declaring a large memory with async_read=True, it gets placed in BRAM anyway. Most notably, when instantiating a large SyncFIFO. This is because the read address comes directly from a register, so it gets interpreted as the address register of a BRAM in write_first mode.
However, correct behavior of SyncFIFO depends on the address collision behavior of DRAM. The 'undefined' behavior of Xilinx BRAM in write_first mode is, in practice, the wrong behavior.
Since this unexpected size-dependent change of behavior is most likely undesirable in many cases where the user asks for an asynchronous read port, this patch adds a "ram_style = distributed" attribute to any memory that has one, to force it to be implemented in DRAM.
Unfortunately, "ram_style = distributed" is a Xilinx-only attribute, so as is this patch breaks Altera compatibility. There is currently nothing that specifies the platform in this context (and I'm not using platform in the first place), so this needs some big-picture rethinking of how to specify and hand down "is this for altera or xilinx" from verilog.convert().