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

support for memories with N read-only ports + 1 write-only port? #153

Closed
sbourdeauducq opened this issue Jul 17, 2019 · 5 comments
Closed
Labels

Comments

@sbourdeauducq
Copy link
Member

One trick I've used several times to implement a memory with several (typically N=2...4) read ports plus one write port is to use N dual-port memories with, for each memory, one port used for reading and one port used for writing. The individual write ports are connected in parallel to form the write port into what is the equivalent of a N+1-port memory with N read-only port and 1 write-only port.

Should nMigen automatically implement this pattern when applicable, or should this be done manually by the user?

@whitequark
Copy link
Contributor

You can already do this: simply request the appropriate amount of read ports by calling mem.read_port() several times. The toolchain should duplicate the memories to implement it; I know Yosys does, but I haven't checked ISE, Vivado and Diamond. If they do not it would be an issue.

@sbourdeauducq
Copy link
Member Author

Hmm. One would have to check that carefully (I remember problems with ISE a long time ago), though this would be one of many issues that would disappear if we let Yosys synthesize memories for all FPGA families.

@whitequark
Copy link
Contributor

According to IRC conversation with @cr1901, ISE and Vivado can do that.

@cr1901
Copy link
Contributor

cr1901 commented Jul 24, 2019

Rationale: The default config file of lm32 (including the one used by MiSoC) relies on the synthesizer to duplicate memories for the reg file. I've built enough lm32 SoCs in the past on ISE and Vivado successfully in that configuration to know that the toolchains will duplicate memories.

@whitequark
Copy link
Contributor

Closing; please reopen if there are actual toolchain bugs we need to work around.

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

No branches or pull requests

3 participants