-
Notifications
You must be signed in to change notification settings - Fork 216
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
DCCM load/store conflict situation #36
Comments
Hi, Resolution of resource conflicts are handled by the hardware. |
Please try out the latest release, and reopen if needed. |
I've pulled newest version of the project but it doesn't help. I'll describe the issue I've found. In case which I've explored there is a sequence of store operation and then store and load to the same address are done. As I've understood load and store units work in parallel and are not synchronous. Because of payload store unit is busy when new accesses come, so it postpones new memory write operations. And when load access happens it is executed immediately, as load unit is doing nothing at that time. This error is reproducible, so I've created small test-case to illustrate it. Here is assembler file (dccm_test.s.txt) and its disassembled version (dccm_test.dS.txt). Last two instructions uses the same addresses (sp+12 or 0x7_FFCC). As you can see on waveforms store to 0x7_FFCC happens a few cycles later then load from it, but in assembly program and disassembled code order is reversed. So, it causes reading of X's from this address. |
Reopening this issue. The way the DCCM works, for alignment and ECC handling, is that it does a read-modify-write, for non-word stores or unaligned stores because the ECC has to be calculated before updating the memory. If the memories are not initialized at reset, this could result in X propagation in simulation for such cases. Word stores that are aligned do not do a read-modify-write. |
I didn't understand how do you run your test. Please, provide run commands/test sources/linker file and exec.log from simulation. FYI: TB sets up reset to address 0, your code starts from 0x80000000, You need to be aware that external memories are 64KB only and ignore upper 16 bits of the address. Also the $readmemh tasks, loading the RAMs will not load bytes, which address is higher than 0xffff . Please, take a look on tests code and linker files of the provided examples to get hints how to deal with DCCM, ICCM code and data. These are a bit tricky. The TB setup has changed since 1.4 . exec.log helps to understand what processor did during a test simulation. ( although it doesn't show registers updates for external loads) |
I'm using custom testbench and configurations, so addresses differ from default ones. For complication and linking of the program I used this commands:
Here are links for initial and main parts of the program. In general both ICCM and DCCM work fine except of this "store-load" case. So, it seems there is a problem in coherency mechanism of the processor. |
OK, this is effect of the uninitialized memory with ECC protection and Store to Load bypassing in the Store buffer. You need first write the DCCM locations, you are going to use, then you can read them in any order. The problem happens if you write uninitialized location and read immediately from it. Theoretically, memory with ECC protection should be first "initialized" by word aligned word size stores and only then it can be freely accessed. The crt0 can execute the whole application data region zeroing and only then C coded main can use it as data, stack or heap ... |
Initialization of stack area with zeros helped to avoid coherence problem. But what will happen in real life situation in this case? BTW. Is it possible to remove ECC checking from ICCM and DCCM with some option as it is done at I-Cache? |
The PRM has this verbiage in section 3.4: We will update it to be explicit about the initialization mechanisms, adding the following: Note: If the DCCM is uninitialized, a load following a store to the same address may get incorrect data. If firmware initializes the DCCM, aligned word-sized stores should be used (because they don’t check ECC), followed by a fence, before any load instructions to DCCM addresses are executed. |
mfdc[8] disables ECC checking/correction for all swerv memories. |
but you still may get simulation problems if your application will read uninitialized memory locations |
@aprnath @agrobman And as for the situation with store followed by load instruction in my testcase. If Store to Load bypassing in the Store buffer happens why then LSU reads DCCM at all? There is aligned word-sized store, so generaly we don't care about data in the memory as it'll be fully overwritten. |
We don't have plans to create a design parameter to remove ECC protection from the memories. Again the CCMs were designed in assumption that the memories had to be initialized before use. |
Ok, it's clear. |
DCCM data outputs are forced to 0 values at he testbench.
Does this mean DCCM is not supposed to be used?
And if DCCM is in the working state, I've got a question.
Does LSU support resolving of conflicts when store and load operations are performed with the same target address? Or such situations should be resolved on the software side?
The text was updated successfully, but these errors were encountered: