-
Notifications
You must be signed in to change notification settings - Fork 177
[smem] fix read-under-write serialization #2595
Conversation
Also adds some tests for the parser and the serializer.
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.
Nice.
One concern about the serialization format. I'd prefer to always serialize this.
it should "serialize read-under-write behavior for smems correctly" in { | ||
def parseSerializeParse(src: String): Circuit = Parser.parse(Parser.parse(src).serialize) | ||
val undefined = parseSerializeParse(SMemTestCircuit.src("")) | ||
assert(SMemTestCircuit.findRuw(undefined) == ReadUnderWrite.Undefined) |
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.
Nit: using non-assert matchers may be more readable:
SMemTestCircuit.findRuw(undefined) should be (ReadUnderWrite.Undefined)
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.
I disagree. I like to keep things simple and scalatest will still highlight the failure correctly when using plain asserts. The should
or must
matchers have some weird corner cases (I forgot what they were, but there was some trouble in the past that would have been avoided by sticking to the basics).
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.
Let me know if you insist on using the should
and I will change it in order to get this change in.
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.
There's no problem with using them here and continuing to use them aligns with all the other tests in this file.
For corner cases, you may be thinking of string matching on include
vs contains
? The former looks for a substring match and the latter looks for an exact match.
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.
Don't care. It's good to land as-is. 👍
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.
LGTM
it should "serialize read-under-write behavior for smems correctly" in { | ||
def parseSerializeParse(src: String): Circuit = Parser.parse(Parser.parse(src).serialize) | ||
val undefined = parseSerializeParse(SMemTestCircuit.src("")) | ||
assert(SMemTestCircuit.findRuw(undefined) == ReadUnderWrite.Undefined) |
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.
There's no problem with using them here and continuing to use them aligns with all the other tests in this file.
For corner cases, you may be thinking of string matching on include
vs contains
? The former looks for a substring match and the latter looks for an exact match.
* [smem] fix read-under-write serialization Also adds some tests for the parser and the serializer. * Serializer: always serialize smem ruw behavior * test: simplify smem test circuit (cherry picked from commit 82af22f)
* [smem] fix read-under-write serialization Also adds some tests for the parser and the serializer. * Serializer: always serialize smem ruw behavior * test: simplify smem test circuit (cherry picked from commit 82af22f) Co-authored-by: Kevin Laeufer <laeufer@cs.berkeley.edu>
Also adds some tests for the parser and
the serializer.
Type of Improvement
API Impact
Backend Code Generation Impact
Reviewer Checklist (only modified by reviewer)
Please Merge
?