-
-
Notifications
You must be signed in to change notification settings - Fork 302
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
Formal verification: Verilog generated when using synchronous resets is not understood by SymbiYosys #1314
Comments
The problem of your code is
This line use Spinal's elaboration config which is not compatible with the formal config one, delete it would work. |
The line is necessary to get a purely synchronous reset in this context. Without this line, the following code is generated:
Maybe I'm wrong, but that seems like an async reset to me. This async reset actually triggers another bug, but within SpinalTemplateSbt: SpinalHDL/SpinalTemplateSbt#39 Proposed fix / hack / bypass (?): #1315 |
This might be a solution. .withConfig( Config.spinal.includeFormal ) |
Yes this actually works in SYNC reset mode. In ASYNC reset mode we actually need to set the SymbiYosys multiclock mode. Here my attempt to fix both issues: #1320 |
I think use "multiclock on" for a synchronized design with only ASYNC reset is a little bit redundant. It might be slower. |
Not yet...ok. --> I need to implement this in the SpinalHDL Template, so the template formal workflow works again by default. Actually the real issue here seens the complete lack of documentation for all of SpinalHDL awesome and kick-ass "hidden" features. |
Can you help me getting the Spinal basic template to run with assumeResetReleaseSync, and GlobalClock without multiclock mode? I'm kinda lost here... |
Those So if what you want is to verify your design which have cross clock manner, I can give you some hits. The relationship between each clock and reset or io signals should be explicit declared. //assume the pushClock's period while verification.
gclk.assumeClockTiming(pushClock, pushPeriod)
//this keep the reset signal synchronize with it's corresponding clock. here pushClock domain's reset is synchronized with it's clock.
gclk.assumeResetReleaseSync(pushClock)
//this function make sure push.valid signal is a signal synchronized with the pushClock domain's clock.
gclk.assumeIOSync2Clock(pushClock, dut.io.push.valid) Also, some utilities is design for timing. //this keep the reset last for popPeriod.
gclk.keepBoolLeastCycles(reset, popPeriod)
//this make sure pushClock domain's reset and popClock domain's reset active at the same time.
gclk.alignAsyncResetStart(pushClock, popClock) |
you can use them by calling withAsync method of FormalConfig. |
About the documentation, the formal verification currently is still not widely used, especially the Cross Clocking one. So I want to wait more test before we documented the usage. |
SpinalHDL: 1.10.1
Scala version: 2.12.18
sbt version: 1.9.8
SymbiYosys version: Git 19.02.204
Problem:
Fix:
Full demonstration: https://github.com/janschiefer/SpinalTemplateSbt/tree/code-generation-sync-reset
Let's try to verify code, that geneate a sychronous reset:
Config.scala:
MyTopLevelFormal.scala:
SymbiYosys logfile:
unnamed.sv:
When I manually edit the generated file and change line 41 to "assert((dut_io_state != _zz_1));" and remove the "else begin (...) end"-block sby works like a charm.
The text was updated successfully, but these errors were encountered: