-
Notifications
You must be signed in to change notification settings - Fork 12
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
Limited support for Distributed Memory / LUTRAM #20
Comments
Very good, thanks! |
Added support for RAM128X1S and RAM256X1S though not sufficiently tested. I was able to build litex-ddr-kc705 after latest changes. However, I am now running into DDR memtest issues it seems: https://gist.github.com/hansemro/5f48f4098e59f9db2e34ae25cb0b6ecd |
@hansemro Wow, that was quick! We might want to write some basic tests here: |
@hansfbaier Sounds good. I'll try to write some tests soon. DDR issue could be totally unrelated to this. |
@hansemro Yes, very likely your code works. I never got 8 modules working nice with OpenXC7. At some point the timing just falls apart, because of congestion, I suppose. See my comment on your gist. |
Rebased experimental branch on 8120acd (current stable-backports) |
@hansemro great, thanks |
Fixed up RAM32X1D not creating RAMD32 instances (was creating RAMD64 instances previously) and made sure RAM32X1S is handled in pack_dram (forgot this one apparently). |
Made initial tests: https://github.com/hansemro/primitive-tests/commits/lutram-tests/
Notably nextpnr-xilinx hangs with RAM256X1S. Seems #10 made this observation months ago. I'll try to spend some time debugging this. |
RAM256X1S and RAM256X1D were not handled correctly since their address pins are in an array A[N:0] rather than specified individually (A0, A1, A2, ... ). I'll need to validate every transform rule anyway... |
@hansemro I pushed an MMCM-fix to stable-backports. The MMCM should work now, if you have time to try. |
@hansfbaier Thanks for the heads up. I will get to it at some point. I decided it is better for me to fix dual-port LUTRAMs before moving forward, because everything is broken (for at least xc7, not sure about ultrascale).
|
Yes definitely, that is more important. Thanks for working on this. |
I misspoke since I was testing RAM256X1D (thought I was testing RAM256X1S) which does not fit in xc7 anyhow. Still, yosys should not allow unsupported LUTRAMs to be synthesized! |
@hansemro How are things going? Have you been able to test the changes? |
MMCM is confirmed working with multiple clock outputs on KC705 though with a BUFG on all clock outputs. fasm2frames would throw segment DB errors if I didn't have them. Test branch: https://github.com/hansemro/primitive-tests/commits/mmcm-blinky-kc705-db-error/ Interestingly, the first clock output didn't require me to place BUFG buffer, though it should probably have one.
Things were going well until I had to handle each LUTRAM as an edge case. Initially, I was less bothered to write things down, but now I feel it is appropriate to actually spend time documenting the port/parameter transformations for all cells (including ultrascale-only cells). I intend to resume work on validation and get xc7 cells covered. Anyhow, it turns out I made some incorrect assumptions about some things. Here are some TODOs:
Will elaborate further with a follow-up post on LUTRAM transformations to RAMS/RAMD primitive cells to LUT5/LUT6 BELs in more detail. |
Yes, I had similar observations. |
Thanks for the update! |
Naming Notation:I'll define the following name notation to fold port/parameter names:
LUTRAM Cell Table:Additional notes:
|
XC7 LUTRAM to LUTRAM Primitive Transformations:LUTRAMs are broken down to primitive cell(s) that will eventually map to SLICEM LUT_OR_MEM6/LUT_OR_MEM5 BEL site(s) once placed. Convention:
RAM32X1S -> 1x RAMS32Cell Rules:
Parameter Rules:
Port Rules:
RAM32X1D -> 2x RAMD32Cell Rules:
Parameter Rules:
Port Rules:
RAM32M -> 2x RAMS32 + 6x RAMD32Cell Rules:
Parameter Rules:
Port Rules:
RAM64X1S -> RAMS64ECell Rules:
Parameter Rules:
Port Rules:
RAM64X1D -> 2x RAMD64ECell Rules:
Parameter Rules:
Port Rules:
RAM64M -> 4x RAMD64ECell Rules:
Parameter Rules:
Port Rules:
RAM128X1S -> 2x RAMS64ECell Rules:
Parameter Rules:
Port Rules:
RAM128X1D -> 4x RAMD64ECell Rules:
Parameter Rules:
Port Rules:
RAM256X1S -> 4x RAMS64ECell Rules:
Parameter Rules:
Port Rules:
|
LUTRAM Primitive to BEL Transformations:Additional notes:
RAMD64E -> LUT_OR_MEM6 BEL
RAMS64E -> LUT_OR_MEM6 BEL
RAMD32 -> LUT_OR_MEM6 BEL
RAMD32 -> LUT_OR_MEM5 BEL
RAMS32 -> LUT_OR_MEM6 BEL
RAMS32 -> LUT_OR_MEM5 BEL
|
Thanks for the effort! I am looking forward to what you will come up with! |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Issue: nextpnr does nothing with
|
Great work! |
Something that bothered me about how RAM{S,D}64E maps to LUT_OR_MEM6 BEL is that only DI1 data input is used to write to both internal LUT_OR_MEM5 BELs. Somehow one of the LUT_OR_MEM5 BEL can select between DI1 and DI2 data inputs, but this is not really well documented. Recently, I stumbled on the following physical design rules (in
Coincidentally, 018-clb-ram prjxray fuzzer found that RAM.SMALL configuration bit is set for RAM32M/RAM32X1{S,D} and SRL16E, but not set for RAM64M/RAM{64,128}X{S,D}/RAM256X1S and SRLC32E. This all seems to indicate RAM.SMALL bit is used for data input selection for upper LUT_OR_MEM5 BEL (one with DI2 input and initialized with INIT[63:32]). Here is a block diagram to help visualize what I see of LUT_OR_MEM6 BEL: |
Good to see you making progress! |
@hansemro the DI2 can't be used, it would make the Infinite loop in place. there is some check in the place, if the lutram used the DI2 port, and the wa7-8 ports are not being config, It cannot complete the place |
@lehaifeng000 Yes, nextpnr does not currently have the capacity to pack/place RAM32X1S/RAMS32 which would occupy and utilize both LUT_OR_MEM5 BELs. As you say, placer will get stuck because LUT_OR_MEM5/RAM32* with DI2 is not yet accepted as legal: nextpnr-xilinx/xilinx/arch_place.cc Lines 114 to 117 in 9debb87
Additionally, how {C,B}X pins are connected to {C,B}LUTs and WA7USED/WA8USED BEL should also be considered in legalization. I believe, Vivado avoids this by making it illegal to place mismatched LUTRAM types in the same CLB SLICEM site. However, I will need to look more into this. If we update the packer to utilize DI2, we will need to and should update the placer and legalization accordingly. |
I tend to understand and try to modify place, inserting rules into the placement process. |
@hansfbaier @hansemro |
@lehaifeng000 my email address [email protected] should be visible in every git commit. Same for @hansemro |
|
Issue Description
memory_libmap
pass in Yosys 0.18 and newer would synthesize LUTRAMs unsupported by nextpnr including:Part of the issue stems from nextpnr not fully supporting all LUTRAMs in the Distributed RAM packer in
xilinx/pack_dram.cc
.Resolving this should also address openXC7/demo-projects#6.
Tasks/Status
TODO: rewrite tasks
Development Branches
References
See 018-clb-ram minitest. Build and view design checkpoint in Vivado.
https://f4pga.readthedocs.io/projects/prjxray/en/latest/architecture/dram_configuration.html
https://docs.xilinx.com/v/u/en-US/ug474_7Series_CLB
https://docs.xilinx.com/v/u/en-US/ug574-ultrascale-clb
https://docs.xilinx.com/r/en-US/ug953-vivado-7series-libraries
https://docs.xilinx.com/r/en-US/ug974-vivado-ultrascale-libraries
https://www.xilinx.com/content/dam/xilinx/support/documents/sw_manuals/xilinx14_7/7series_hdl.pdf
https://docs.amd.com/v/u/en-US/7series_hdl
https://github.com/Xilinx/XilinxUnisimLibrary/tree/master/verilog/src/unisims
The text was updated successfully, but these errors were encountered: