Giter Club home page Giter Club logo

Comments (10)

Readon avatar Readon commented on June 9, 2024

The problem of your code is

.withConfig( Config.spinal )

This line use Spinal's elaboration config which is not compatible with the formal config one, delete it would work.

from spinalhdl.

janschiefer avatar janschiefer commented on June 9, 2024

The line is necessary to get a purely synchronous reset in this context.

Without this line, the following code is generated:

(...)
  always @(posedge clk or posedge reset) begin
(...)

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

from spinalhdl.

Readon avatar Readon commented on June 9, 2024

This might be a solution.

.withConfig( Config.spinal.includeFormal )

from spinalhdl.

janschiefer avatar janschiefer commented on June 9, 2024

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
--> use .includeFormal as default in FormalConfig and therefore do not generate "assert(...) else ... begin" blocks in formal verification mode
--> use "multiclock on" when an using an ASYNC reset in the default clock domain

from spinalhdl.

Readon avatar Readon commented on June 9, 2024

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 --> use .includeFormal as default in FormalConfig and therefore do not generate "assert(...) else ... begin" blocks in formal verification mode --> use "multiclock on" when an using an ASYNC reset in the default clock domain

I think use "multiclock on" for a synchronized design with only ASYNC reset is a little bit redundant. It might be slower.
If you are using asynchronous clocks, then multiclock on might be a good choice. Have you looked at the FormalFifoCCTester example in the lib?

from spinalhdl.

janschiefer avatar janschiefer commented on June 9, 2024

Not yet...ok.
Well, the assumeResetReleaseSync / assumeIOSync2Clock in this complex example make sense...

--> 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.

from spinalhdl.

janschiefer avatar janschiefer commented on June 9, 2024

Can you help me getting the Spinal basic template to run with assumeResetReleaseSync, and GlobalClock without multiclock mode?

I'm kinda lost here...

from spinalhdl.

Readon avatar Readon commented on June 9, 2024

Can you help me getting the Spinal basic template to run with assumeResetReleaseSync, and GlobalClock without multiclock mode?

I'm kinda lost here...

Those assumeResetReleaseSync and GlobalClock are initially designed for clock crossing design, if you just want to verify a design with different reset, I think they are not necessary.

So if what you want is to verify your design which have cross clock manner, I can give you some hits.
In formal verification of yosys, the asynchronous verification is driven by a hidden clock, so called GlobalClock.
All clocks for the design is generated from that.

The relationship between each clock and reset or io signals should be explicit declared.
This make things complex, so some functions have been wrapped for that.

//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)

from spinalhdl.

Readon avatar Readon commented on June 9, 2024

you can use them by calling withAsync method of FormalConfig.

from spinalhdl.

Readon avatar Readon commented on June 9, 2024

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.
Because if it is documented, the backward compatibility would be the most important thing we should take consider in.

from spinalhdl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.