Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

smt: add support for write-first memories #1948

Merged

Conversation

ekiwi
Copy link
Contributor

@ekiwi ekiwi commented Nov 10, 2020

Contributor Checklist

  • Did you add Scaladoc to every public function/method?
  • n/a Did you update the FIRRTL spec to include every new feature/behavior?
  • Did you add at least one test demonstrating the PR?
  • Did you delete any extraneous printlns/debugging code?
  • Did you specify the type of improvement?
  • Did you state the API impact?
  • Did you specify the code generation impact?
  • Did you request a desired merge strategy?

Type of Improvement

  • new supported feature in the smt backend

API Impact

  • compilation will not fail when encountering write-first memories

Backend Code Generation Impact

  • only impact on SMT/btor2 output

Desired Merge Strategy

  • squash

Reviewer Checklist (only modified by reviewer)

  • Did you add the appropriate labels?
  • Did you mark the proper milestone (1.2.x, 1.3.0, 1.4.0) ?
  • Did you review?
  • Did you check whether all relevant Contributor checkboxes have been checked?
  • Did you mark as Please Merge?

@ekiwi ekiwi requested a review from a team as a code owner November 10, 2020 22:37
@ekiwi ekiwi requested review from jackkoenig and removed request for a team November 10, 2020 22:37
@ekiwi ekiwi added this to the 1.4.x milestone Nov 10, 2020
@ekiwi ekiwi force-pushed the smt-support-write-first-memories branch from 8450800 to 611d93d Compare November 10, 2020 22:39
Copy link
Contributor

@jackkoenig jackkoenig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I confess I don't understand the code 100% but it looks right and the tests look great.

Comment on lines +64 to +87
"Registered read-first memory" should "not return written data after one cycle" taggedAs (RequiresZ3) in {
val cmds =
"""
|reg past_in: UInt<8>, clock
|past_in <= in
|
|assume(clock, eq(read_addr, write_addr), UInt(1), "read_addr = write_addr")
|assert(clock, eq(out, past_in), past_valid, "out = past(in)")
|""".stripMargin
test(registeredTestMem("Mem00", cmds, "old"), MCFail(1), kmax = 3)
}

"Registered write-first memory" should "return written data after one cycle" taggedAs (RequiresZ3) in {
val cmds =
"""
|reg past_in: UInt<8>, clock
|past_in <= in
|
|assume(clock, eq(read_addr, write_addr), UInt(1), "read_addr = write_addr")
|assert(clock, eq(out, past_in), past_valid, "out = past(in)")
|""".stripMargin
test(registeredTestMem("Mem00", cmds, "new"), MCSuccess, kmax = 3)
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love formal tests 🙂

@ekiwi ekiwi added the Please Merge Accepted PRs that are ready to be merged. Useful when waiting on CI. label Nov 11, 2020
@mergify mergify bot merged commit 7d637e2 into chipsalliance:master Nov 11, 2020
mergify bot pushed a commit that referenced this pull request Nov 11, 2020
@mergify mergify bot added the Backported This PR has been backported to marked stable branch label Nov 11, 2020
mergify bot added a commit that referenced this pull request Nov 13, 2020
* smt: add support for write-first memories (#1948)


(cherry picked from commit 7d637e2)

* smt: add old functions for binary compatibility

Co-authored-by: Kevin Laeufer <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Backported This PR has been backported to marked stable branch Please Merge Accepted PRs that are ready to be merged. Useful when waiting on CI.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants