-
Notifications
You must be signed in to change notification settings - Fork 790
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
[fpga] Add prim features and tool flow to dump the flash info array cell sites #25533
Conversation
067f883
to
054b79c
Compare
If you were following along #25363 before, only the last commit is new. |
Edit: Never mind. I realized with the way primgen works, it needs to bring in those files. This will be improved with our work with virtual cores to replace primgen! |
b7e19f4
to
7b87af7
Compare
An alternative would've been to leave the memory as-is and require the bitstream cache to explicitly represent partitioning of memories (in practice, of splice-capable memories that are wider than 64 bits), then have tools that break images into the partitions and call updatemem on each of the partitioned MEM files. If that is preferred for reviewers but the approach in this PR isn't too objectionable, I would ask that we target that for the next round and let this one into the repo. We can handle a change to the bitstream cache schema, as is done here, and there is work that continues to be blocked while we lack some way to fix up the flash info page state. |
The failing CW340 CI flows appear to be an ongoing infrastructure failure, not a result of this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @a-will, great job simplifying the memory mapping infrastructure for updatemem
.
@andreaskurth Can you or someone on your end take a look at the FPGA prim changes included in this PR?
Thanks
CHANGE AUTHORIZED: hw/ip/prim_xilinx/rtl/prim_xilinx_pkg.sv |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great to me overall, thanks @a-will! One question and a few suggestions from my side
virtual: | ||
- lowrisc:prim_xilinx:prim_xilinx_pkg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This requires FuseSoC v2.4 to work properly, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, we use virtual cores with my fusesoc fix already. I added the satsolver instructions to our fork at the same time as upstream.
If we use upstream fusesoc, then 2.4 is the first release that includes my commits.
hw/top_earlgrey/data/synth.xdc
Outdated
set_property KEEP_HIERARCHY TRUE [get_cells "top_earlgrey/u_flash_ctrl/u_eflash/u_flash/gen_generic.u_impl_generic/gen_prim_flash_banks[0].u_prim_flash_bank/gen_info_types[0].u_info_mem"] | ||
set_property KEEP_HIERARCHY TRUE [get_cells "top_earlgrey/u_flash_ctrl/u_eflash/u_flash/gen_generic.u_impl_generic/gen_prim_flash_banks[0].u_prim_flash_bank/gen_info_types[1].u_info_mem"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another opportunity to deduplicate (probably not even using eval
)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This actually gets added and removed again because of the changing ideas. If you'd like, I can go back in the history and get rid of its appearance altogether.
CHANGE AUTHORIZED: hw/ip/prim_xilinx/rtl/prim_xilinx_pkg.sv These are new Xilinx-specific prims, which should be functionally equivalent to the existing implementation from an I/O perspective. |
Reduce BUILD file boilerplate by placing all memory map info in a single file. Use a separate Processor element for each map, so the InstData attribute can be used as a key to identify the memory to be updated. This construction also permits multiple memories to be spliced in a single call to updatemem, though that is not implemented in this commit. Adjust MMI dump to use a regex for mem type and a dictionary for each memory's parameters. For the mem type, some memories in the FPGA can consist of both RAMB36 and RAMB18 types, depending on the width of the array. The regex allows more flexible memory cell detection. Rev up the bitstream manifest schema to v3 so the memories contained in the MMI file are described. Add a function to collect MMI data from v2 cache entries and rewrite in the expected v3 format, with the MMI data in a single file. Finally, drop support for bitstream cache entries that do not contain a manifest. The tools to create a manifest have been in the repo for awhile, and as of this commit's creation, no such cache entries remain in the public cloud storage bucket. Signed-off-by: Alexander Williams <[email protected]>
For earlgrey, export the flash info memory maps to the MMI file. Add knowledge of these maps existing to the bitstream cache entries. The flash info arrays are identified by a key in this format: flash<FlashBank>_info<InfoType> Add KEEP_HIERARCHY to the prim_ram_1p instances representing the flash info arrays. This helps keep intelligible hierarchical paths to the memories, so we can readily select the correct cells. This lays groundwork for a future PR where we can splice these memories. Signed-off-by: Alexander Williams <[email protected]>
Add a specialized ram_1p prim for the prim_xilinx library. This prim adds some prim_xilinx-specific parameters to enable selecting particular layouts for embedded memories. The intention is to have the top-level override the parameters with hierarchical assignment. This feature is intended for use with memories that are too wide to fit in updatemem's capabilities (where splicing is required). The flash info pages are one such type, since updatemem can only handle up to 64-bit wide items, and the info page array is 76 bits wide. Synthesis chooses the most efficient layout of the memories, but the layout is awkward for handling splices. Force earlgrey's flash info data and metadata into separate arrays for the FPGA. Signed-off-by: Alexander Williams <[email protected]>
7b87af7
to
9776162
Compare
The AscentLint job is failing, but the report is all green. |
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin earlgrey_1.0.0
git worktree add -d .worktree/backport-25533-to-earlgrey_1.0.0 origin/earlgrey_1.0.0
cd .worktree/backport-25533-to-earlgrey_1.0.0
git switch --create backport-25533-to-earlgrey_1.0.0
git cherry-pick -x 9e1ef80bca3d6648b1091efd1e5e7b3776a220f2 bf595b6f694043433ea71064735cc8088cf6b3b5 9776162eb91b785d2dabc01021dda00e015edd96 |
Collect MMI data into one file.
Reduce BUILD file boilerplate by placing all memory map info in a single file. Use a separate Processor element for each map, so the InstData attribute can be used as a key to identify the memory to be updated. This construction also permits multiple memories to be spliced in a single call to updatemem, though that is not implemented in this commit.
Adjust MMI dump to use a regex for mem type and a dictionary for each memory's parameters. For the mem type, some memories in the FPGA can consist of both RAMB36 and RAMB18 types, depending on the width of the array. The regex allows more flexible memory cell detection.
Rev up the bitstream manifest schema to v3 so the memories contained in the MMI file are described. Add a function to collect MMI data from v2 cache entries and rewrite in the expected v3 format, with the MMI data in a single file.
Add specialized ram_1p prim for Xilinx FPGAs
Add a specialized ram_1p prim for the prim_xilinx library. This prim adds some prim_xilinx-specific configuration ability to enable selecting particular layouts for embedded memories. The intention is to have the top-level specify the configuration via a special prim_xilinx_pkg, which is a virtual core. The prim instance will do a lookup to decide how to split the memories.
This feature is intended for use with memories that are too wide to fit in updatemem's capabilities (where splicing is required). The flash info pages are one such type, since updatemem can only handle up to 64-bit wide items, and the info page array is 76 bits wide. Synthesis chooses the most efficient layout of the memories, but the layout is awkward for handling splices.
Force earlgrey's flash info data and metadata into separate arrays for the FPGA.
Dump flash info maps to the MMI file.
For earlgrey, export the flash info memory maps to the MMI file. Add knowledge of these maps existing to the bitstream cache entries. The
flash info arrays are identified by a key in this format:
This lays groundwork for a future PR where we can splice these memories.
This was tested by hand by manually splicing the uart_smoketest binary into flash bank 0, info partition 0 and running a slightly modified
//sw/device/tests:flash_ctrl_info_access_lc_prod_personalized_fpga_cw310_sival
(to prevent overwriting the data). Without the integrity bits in, the flash control read would get operation errors. With the integrity bits also spliced in, the reads would succeed, and we'd get comparison failures showing data from the MEM file.This PR likely will supersede #25363
Note: The API for the prim_xilinx_pkg is known to be a terrible interface, but it's left this way to avoid alternatives that might change RTL for the ASIC's tree in earlgrey_1.0.0. An example of a more refined approach that changes that RTL might be to expose a top-level parameter for every major memory, so an ID-based lookup could be used to control prim library-specific configuration. That would yield instance-level control as needed.
Partially addresses #21225 and #23038