GithubHelp home page GithubHelp logo

github30 / atpg4sv Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pfnet-research/atpg4sv

1.0 2.0 0.0 41 KB

A prototype of Concolic Testing engine for SystemVerilog, developed as part of PFN summer internship 2018.

License: MIT License

Makefile 0.08% Python 1.40% OCaml 98.51%

atpg4sv's Introduction

Automatic Test Generator for SystemVerilog

This is a prototype of Concolic Testing engine for SystemVerilog. This program generates 100% line-of-code coverage test cases for a circuit written in SystemVerilog by alternatively repeating concrete execution and simbolic execution in the similar way as DART[1] and HYBRO[2].

There are several limitations on supported SystemVerilog Features.

Disclaimer: PFN provides no warranty or support for this software. Use it at your own risk.

This software is developed as part of PFN summer internship 2018 and the main developer is Hiroki Oshikawa.

How to use

Dependencies

  • OCaml (>= 4.05.0)
    • dune (>= 1.0.1)
    • z3 (>= 4.7.1)
    • ocamlgraph (>= 1.8.8)
    • ppx_deriving (>= 4.2.1)
  • Z3 (>= 4.7.1)
  • menhir (>= 20180703)
  • SystemVerilog Simulator

OCaml libraries and menhir can be installed through opam.

Build and Run

make
_build/default/src/main.exe -i file.sv -f file.bin -v log.vcd -s script.sh

Note: make emits many warnings for now.

  • file.sv : Target program written in SystemVerilog
  • file.bin : File used to read and write input vectors during execution
  • log.vcd : VCD file
  • script.sh : Shell script to run a simulator. It is assumed that file.sh runs file.sv against input vectors in file.bin and dump a result into log.vcd.

Options

-c              dump coverage information
-dparse         dump parsed tree
-dir            dump IR
-dcfg           generate dot files from CFG
-dtrace         dump trace
-dz3            dump z3 log
-dinputs file   dump all input vectors to [file]
-test           run without concrete execution

Procedure of test case generation

  1. Parse a program source code and generate Control Flow Graphs (CFG)
  2. Generate input vectors randomly
  3. Run simulator
  4. Calculate which paths in CFGs were executed from the dumped VCD file
  5. Generate constraints symbolically to execute a part of the program that has not been executed yet
  6. Solve the constraints using SMT
  7. Extract next input vectors from the solution
  8. Repeat 3-7 until all parts of the program are executed

Input vectors generated above procedure comprise a test case.

overview

Structure of src/

  • lexer.mll: Lexer
  • parser.mly: Parser
  • parsetree.ml: Abstract syntax tree
  • ir.ml: Simple intermediate representation(IR) and translation from AST
  • cfg.ml: CFG and translation from IR
  • vis.ml: Visualization of CFG
  • ce.ml: Calculate executed paths from VCD and CFG
  • constraint.ml: Calculate constraints
  • solve.ml: Solve the constraints using Z3
  • main.ml: Put together above

License

MIT License (see the LICENSE file for details).

References

  • [1] P. Godefroid, N. Klarlund, and K. Sen, DART: Directed Automated Random Testing. In Proceedings of the 2005 ACM SIGPLAN conference on Programming language design and implementation (PLDI'05), 2005.
  • [2] L. Liu and S. Vasudevan, Efficient validation input generation in RTL by hybridized source code analysis, In Proceedings of the 2011 Design, Automation & Test in Europe, Grenoble, 2011.

atpg4sv's People

Contributors

wkwkes avatar

Stargazers

 avatar

Watchers

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