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

[WIP] Add library features for formal testing against streams and PipelinedMemoryBus #1637

Open
wants to merge 24 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
34b084d
Add exhaustive formal testing for stream arbiter
jdavidberger Jan 1, 2025
3e6cbca
Add asserts to allow inductive formal testing to pass
jdavidberger Jan 1, 2025
c0a47c0
Library enhancments to facilitate main commits
jdavidberger Jan 2, 2025
380cefa
Additional formal check functions on StreamFifo, inline asserts for i…
jdavidberger Jan 2, 2025
da5ea4d
Add StreamFifo inductive proof test runner
jdavidberger Jan 2, 2025
bd6ae62
Add formal assertions for PipelinedMemoryBus, Arbiter and decoder. Ad…
jdavidberger Jan 2, 2025
0bf80ac
Fix underflow predicate; CI breaking formatting
jdavidberger Jan 2, 2025
d24b189
Fix GHDL based tests
jdavidberger Jan 2, 2025
137759b
Relax invariance for PMB
jdavidberger Jan 2, 2025
3109aa5
Move asserts into formalAsserts function
jdavidberger Jan 2, 2025
3d73eb6
Forgot to include default case in FormalDut
jdavidberger Jan 2, 2025
c1aa54f
PMB now needs a custom clone override
jdavidberger Jan 3, 2025
a29dd62
Add formal asserts for counters
jdavidberger Jan 3, 2025
5999692
Fix PMB formal test by adding in the formal asserts trait
jdavidberger Jan 3, 2025
6b56b1d
Swap default reset for formal testing to SYNC; add ASYNC mutator. Thi…
jdavidberger Jan 3, 2025
7cbc216
Remove stray comma
jdavidberger Jan 3, 2025
1dd6993
Set reset to high for Pinsec test otherwise it'll trigger asserts sin…
jdavidberger Jan 3, 2025
4668452
Clean up StreamFifo formalAsserts
jdavidberger Jan 6, 2025
e5d10af
Rename trait; add in a seperate method to handle formal assertions fo…
jdavidberger Jan 6, 2025
f81b9c5
Add formal test for StreamFork
jdavidberger Jan 6, 2025
c3194b8
Output assertions
jdavidberger Jan 6, 2025
320be42
Add parens to formalAsserts definition
jdavidberger Jan 6, 2025
d4c39ac
Add formalValidInputs to predicate use of formalAssumes
jdavidberger Jan 6, 2025
2c92d07
Change stream asserts to use === overload; Propogate assert locations…
jdavidberger Jan 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix PMB formal test by adding in the formal asserts trait
  • Loading branch information
jdavidberger committed Jan 3, 2025
commit 59996920b83909c8c84ace10305fd0e13397c04a
26 changes: 26 additions & 0 deletions core/src/main/scala/spinal/core/formal/Misc.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package spinal.core.formal

import spinal.core.{Area, Bool, Component, assert, assume}

import scala.collection.mutable

object FormalDut{
def apply[T <: Component](dut : T) = {
val c = Component.current
Expand Down Expand Up @@ -29,8 +31,32 @@ trait WithFormalAsserts {
assert(cond, Seq(msg:_*))
}
}

def withFormalAsserts() : this.type = {
formalAsserts()
this
}
}

object WithFormalAsserts {
def formalAssertsChildren(c: Component, useAssumes : Boolean = false): Unit = {
def apply(c : Component, walkSet : mutable.HashSet[Component]) : Unit = {
if (!walkSet.contains(c)) {

walkSet += c
c match {
case c: WithFormalAsserts => {
c.formalAsserts(useAssumes)
}
case _ => c.walkComponents(apply(_, walkSet))
}
}
}

c.addPrePopTask(() => {
val walkSet = new mutable.HashSet[Component]()
walkSet += c
c.walkComponents(apply(_, walkSet))
})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class PipelinedMemoryBusDecoderFormal(mappings: Seq[AddressMapping], pendingRspM
}
}

class PipelinedMemoryBusInterconnectComponent(mappings: Seq[AddressMapping], pendingRspMax : Int, portCount : Int, rspRouteQueue : Boolean) extends Component {
class PipelinedMemoryBusInterconnectComponent(mappings: Seq[AddressMapping], pendingRspMax : Int, portCount : Int, rspRouteQueue : Boolean) extends Component with WithFormalAsserts {
val config = PipelinedMemoryBusConfig(32, 32)

val io = new Bundle {
Expand All @@ -91,6 +91,12 @@ class PipelinedMemoryBusInterconnectComponent(mappings: Seq[AddressMapping], pen
io.masters.foreach(master => {
interconnect.addMaster(master, io.slaves)
})


override def formalAsserts(implicit useAssumes: Boolean) = {
WithFormalAsserts.formalAssertsChildren(this, useAssumes)
new Area {}
}
}

class PipelinedMemoryBusInterconnectFormal(mappings: Seq[AddressMapping], pendingRspMax : Int, portCount : Int, rspRouteQueue : Boolean) extends Component {
Expand Down