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

[ImportVerilog] How to implement SVA in Moore? #7801

Open
chenbo-again opened this issue Nov 12, 2024 · 1 comment
Open

[ImportVerilog] How to implement SVA in Moore? #7801

chenbo-again opened this issue Nov 12, 2024 · 1 comment

Comments

@chenbo-again
Copy link

Hello fabian and hailong:
@fabianschuiki @hailongSun2000
I'm trying to implement SVA for moore, and the main problem is how to implement property and sequence for moore, I find that dialect LTL is a good choice to model SVA.

The main goal of the ltl dialect is to capture the core formalism underpinning SystemVerilog Assertions (SVAs), the de facto standard for describing temporal logic sequences and properties in hardware verification. (See IEEE 1800-2017 section 16 “Assertions”.) We expressly try not to model this dialect like an AST for SVAs, but instead try to strip away all the syntactic sugar and Verilog quirks, and distill out the core foundation as an IR. Within the CIRCT project, this dialect intends to enable emission of rich temporal assertions as part of the Verilog output, but also provide a foundation for formal tools built ontop of CIRCT.

I think it's a good choice to directly convert SVA to LTL and bypass Moore, we can saving out time and avoid to model sva property again.

@fabianschuiki
Copy link
Contributor

SVA support in ImportVerilog would be absolutely amazing! 🥳 🚀

You could definitely try to directly lower to ops in the LTL` dialect. I'm not entirely sure if this will work, but it's worth experimenting with. Directly going to LTL is similar to directly emitting HW/Comb/Seq in ImportVerilog: it's theoretically possible, but SV has a very weird type system and semantics that make a direct conversion very complicated.

A few weird things in SVA are going to be annoying. One thing I remember are very strange clock inference rules for sequences and properties, where you have to traverse the AST to find a parent always @(*edge ...) construct, or a @(*edge ...) property, or a clocking block, or a default clocking block, to figure out what the clock for an LTL sequence is. LTL also has no concept of property and sequence declarations and reuse, variable capture, etc..

My guess is that you'll want to capture the SVAs in the Moore dialect pretty quickly, because there are going to be some impedance mismatches between the low-level nature of LTL and the craziness that is SystemVerilog. But you definitely don't have to start out with that 😃! Make sure to emit errors for all the SVA expressions and cases that are not supported 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants