Git Product home page Git Product logo

morenes / autosva Goto Github PK

View Code? Open in Web Editor NEW

This project forked from princetonuniversity/autosva

1.0 0.0 0.0 58.33 MB

AutoSVA is a tool to automatically generate formal testbenches for unit-level RTL verification. The goal is to, based on annotations made in the signal declaration section of an RTL module, generate liveness properties so that the module would eventually make forward progress.

Home Page: https://blog.yosyshq.com/p/community-spotlight-autosva/

License: Other

Shell 0.85% Python 51.33% Tcl 2.90% Verilog 5.24% SystemVerilog 39.68%

autosva's Introduction

AutoSVA Logo

AutoSVA

AutoSVA was build with the goal of making Formal Property Verification (FPV) more accesible for hardware designers. AutoSVA brings a simple language to make annotations in the signal declaration section of a module interface. This enables our to generate Formal Testbenches (FT) that check that transactions between hardware RTL modules follow their interface especifications. It does not check full correctness of the design but it automatically generate liveness properties (prevent duplicated responses, prevent requests being dropped) and some safety-relate properties of transactions, like data integrity, transaction invariants, uniqueness, stability... To understand this more fully you can read the paper. AutoSVA is publised at the 58th ACM/IEEE Design Automation Conference (DAC'21) December 2021.

This 3 minute video summarizes the approach

Script parameters

The AutoSVA tool is based on a Python script, which takes the next arguments

Required argument
  -f FILENAME, --filename FILENAME
                        Path to DUT RTL module file.
Optional arguments
  -h, --help            show this help message and exit
  -src SOURCE [SOURCE ...], --source SOURCE [SOURCE ...]
                    Path to source code folder where submodules are.
  -i INCLUDE, --include INCLUDE
                    Path to include folder that DUT and submodules use.
  -as SUBMODULE_ASSERT [SUBMODULE_ASSERT ...], --submodule_assert SUBMODULE_ASSERT [SUBMODULE_ASSERT ...]
                    List of submodules for which ASSERT the behavior of
                    outgoing transactions.
  -am SUBMODULE_ASSUME [SUBMODULE_ASSUME ...], --submodule_assume SUBMODULE_ASSUME [SUBMODULE_ASSUME ...]
                    List of submodules for which ASSUME the behavior of
                    outgoing transactions (ASSUME can constrain the DUT).
  -x [XPROP_MACRO], --xprop_macro [XPROP_MACRO]
                    Generate X Propagation assertions, specify argument to
                    create property under <MACRO> (default none)
  -tool [TOOL]      Backend tool to use [jasper|sby] (default sby)

For example:

python autosva.py -f <DUT_PATH/DUT_NAME.v> -v 1 -src <SRC_PATH> -i <INCLUDE_PATH>

You can set the flag -v to generate the verbose output and see the parsing process

Once the FT is generated, you can run the FT on SBY like this:

./run.sh <DUT_NAME>

Troubleshooting

SVA files at the Formal Testbench (FT) are auto-generated every time you execute autosva_py on a DUT_NAME, but manual commands can be added manually to ft_<DUT_NAME>/FPV.sby, for example, to solve the next cases:

A. When SBY is elaborating the project, if it complains about any RTL submodule or include not being found, add its path manually (more info at SymbiYosys ReadTheDocs)

B. Alternatively, you can add blackbox for those submodule if you want to blackbox them

C. If the RTL needs some defines to be set, do so also by appending "read -define =1" after "read -verific"

Reproduce Results at Ariane

Requirements

  1. Python version 2 or superior
  2. A formal tool backend (two tools options are currently supported, you only need one)
    • SymbiYosys (SBY) with Verific, e.g. provided by Tabby CAD at www.yosyshq.com (to run with -tool sby)
    • JasperGold version >= 2015.12 (to run with -tool jg)

Commands

# Clone the Ariane repository with the annotations to the modules
git clone https://github.com/morenes/cva6.git ariane
cd ariane
git checkout autosva
git submodule update --init --recursive --force src
cd ..

# Set DUT_ROOT and AUTOSVA_ROOT env variable
export DUT_ROOT=$PWD/ariane
export AUTOSVA_ROOT=$PWD

# Enter AutoSVA folder and run scripts to update relative Formal Testbenches (FT)
cd autosva 
./setup_ariane.sh
./run.sh mmu      # lsu_lookup_transid_was_a_request shows the ghost response bug

Quickstart tutorial. Reproduce the steps.

In the 14 minute Youtube tutorial we create a Formal Property Verification (FPV) testbench for a FIFO queue. We show step by step how to generate it by adding 3 lines of code of annotations and simply pressing the play button. Our transaction abstraction is applicable to many more modules, and out explicit annotations provide flexibility of names and interface styles, e.g. we support annotating when interfaces use structs, or when transactions do not seem obvious at first.

Commands used

export DUT_ROOT=$PWD/quickstart 
export AUTOSVA_ROOT=$PWD

Then we added the following annotations to the fifo.v inside the quickstart folder

 /*AUTOSVA 
 fifo: in -IN> out
 [INFLIGHT_IDX-1:0] in_transid = fifo.buffer_head_r
 [INFLIGHT_IDX-1:0] out_transid = fifo.buffer_tail_r
 */

Then we run the autosva tool, what will generate the formal testbench called 'ft_fifo':

 python autosva.py -f fifo.v -x XPROP -tool sby

Then we run the formal property verification tool, in this case SBY. We use the run script to run the fifo FT

 ./run.sh fifo

To watch the waveforms of a Counterexample (CEX) we used

 gtkwave ft_fifo/FPV_prv/engine_0/trace.vcd &

autosva's People

Contributors

morenes avatar

Stargazers

 avatar

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.