-
Notifications
You must be signed in to change notification settings - Fork 177
Module with multiple memories have no readmem statements #2168
Comments
I think I have the same issue, try using --no-dedup option. |
I'll test this out but believe the readmem should be generated for all memories since they could contain different content and initialization right? |
Yea definitely, I believe it's a more general problem where any annotation is getting lost after duplicate modules are merged/deduped. |
Confirming that with |
yea, tho it's still a big problem for me at least, since I have several thousand replicated modules, so using no-dedup is not really an option for me. I'd be happy to try to fix this, but i have no idea where to start... @jackkoenig @seldridge ? |
@ekiwi any pointers on how to tackle this? Using no-dedup is the way? |
This seems to be a bug, but I do not understand enough about how annotations are supposed to interact with Dedup to know how to address it. @jackkoenig and @seldridge should know more about this part of firrtl. |
I poked around this a bit and I think solving the fundamental issue is a bit tricky but doable. It mainly just requires a bit of cleverness (and time). Perhaps a more patchy solution to unblock people is to do a manual deduplication of these emitter annotations in the emitter. It doesn't solve the issue for everything but at least would unblock people here. |
Nice! great it's on the milestone too :) |
Fixed by #2286, to be released in FIRRTL 1.4.4 (Chisel 3.4.4) |
I tested this out with Chisel3 3.5-SNAPSHOT as of 20/07/2021 and saw that if the memory instances have different width or size and different hex files, both instances are correctly generated in the output Verilog. But I still see some problems with some cases:
My main use-case for this feature is to have reusable memory modules that could be customized in the generation, like one 32k memory A that is initialized by A.hex and a second 32k memory B that is initialized by B.hex. Cc. @jared-barocsi |
@carlosedp looking at the problems you mention:
Is that a problem? They're identical in every way, are you wanting that to prevent deduplication?
Am I correct that the desired behavior is that there will be two modules, one initialized with each hex file? |
This is correct, since they are the same about all characteristics, they should be de-duplicated. Sorry if I implied they shouldn't.
This is the problem I meant, they are the same object but have different initialization so shouldn't be deduplicated or give an error. Just both generated similar to the "different width/size" case with it's own file. |
Okay this makes sense. Yeah I think we selected erroring because we weren't certain what to do, but you are right that it shouldn't be an error, the modules just shouldn't be deduplicated. |
I'm reopening this because while it's "mostly fixed" (and the remaining issue can be worked around at least), we should be duplicating instead of erroring. |
To workaround the error @carlosedp is seeing, you can make sure the modules instantiating the memories don't deduplicate. There are a few ways you can do this, trading off how explicit the workaround is vs. how well it works for other cases.
|
Thanks Jack, the second option is neat that I can add to the module object itself. |
Checklist
What is the current behavior?
I noticed that having multiple memory objects, the
readmem
statements are not generated for neither memory.Just commenting out the
mem2
andloadStorePort2
objects,mem
gets it'sreadmemh
.Here is a sample code I'm using:
Am I doing something wrong in my code or really is there is a problem in generation?
Is there a real case use for this?
What is the expected behavior?
Both memories have their
readmem
statements.Steps to Reproduce
Code below
Your environment
Chisel and Firrtl SNAPSHOT.
External Information
The text was updated successfully, but these errors were encountered: