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

unnecessary dual-port RAM #752

Closed
pentin-as opened this issue Dec 25, 2017 · 1 comment
Closed

unnecessary dual-port RAM #752

pentin-as opened this issue Dec 25, 2017 · 1 comment

Comments

@pentin-as
Copy link

When I write this code:
val mem = SeqMem (...)
when (a || b) {
mem.write (...)
}
mem.read (...,!a &&!b && ...)
I have a dual-port RAM.

When I write this code:
val mem = SeqMem (...)
val need_write = a || b
when (need_write) {
mem.write (...)
}
mem.read (...,!need_write && ...)
I have a single-port RAM.

As far as I understand, when there is combinatorial logic in "when", an intermediate signal is created in fir-code, which does not exist in "read".

I propose to make either chisel or firrtl more clever in this part.

@aswaterman
Copy link
Member

aswaterman commented Dec 27, 2017

You should write the code in the more stylized manner of your second example. While it's straightforward to pattern-match your first example, the more general problem requires a logic optimizer to prove mutual exclusivity. That would be nice to have, but it's a lot of work. We don't plan to pattern-match specific cases (like your first example) because it's an incomplete solution to the problem, and we will instead hold out for a more robust analysis.

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

No branches or pull requests

2 participants