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

[FIRRTL] FIRRTL needs a contract interface #7661

Open
dobios opened this issue Oct 4, 2024 · 2 comments
Open

[FIRRTL] FIRRTL needs a contract interface #7661

dobios opened this issue Oct 4, 2024 · 2 comments
Labels
FIRRTL Involving the `firrtl` dialect verif

Comments

@dobios
Copy link
Member

dobios commented Oct 4, 2024

I introduced an interface for hardware contracts to the verif dialect. This should be exposed to FIRRTL so that we can access it via Chisel. Here is an idea of what is needed:

  • Modules need to be able to contain a contract region that contains the module's pre-post-conditions (as well as future invariants that might be introduces). This can also contain arbitrary hardware and reason about the module's interface. This should map to verif.contract.
  • We need a way to define preconditions, probably through something like require, that maps to verif.require.
  • We need a way to define postconditions, with something like ensure, that maps to verif.ensure. These should be allowed to reason about the module's outputs.

Here's an example of how I think this can be used:

public module Foo:
	input in : UInt<32>
	output out : UInt<32>

	contract:
		node prec0 = gt(in, 0)
		require prec0
		node prec1 = lt(in, 1000)
		require prec1
		node post = ;;some post-condition;;
		ensure post
		
	;; Body of the module
@dobios dobios added FIRRTL Involving the `firrtl` dialect verif labels Oct 4, 2024
@dobios dobios assigned uenoku and unassigned uenoku Oct 4, 2024
@dobios
Copy link
Member Author

dobios commented Oct 4, 2024

Maybe @uenoku or @fabianschuiki would have some left-over bandwidth to look into this?

@fabianschuiki
Copy link
Contributor

Hey @dobios, I'm definitely going to poke at this in the near future! This is a fantastic building block to make formal verification more modular and composable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FIRRTL Involving the `firrtl` dialect verif
Projects
None yet
Development

No branches or pull requests

3 participants