Coder Social home page Coder Social logo

jpsety / verilog2dimacs Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 1.0 6 KB

Coverts a generic Verilog netlist into the DIMACS format compatible with many SAT solvers

Verilog 5.40% Python 94.60%
verilog dimacs converter tseitin-transformation python3

verilog2dimacs's Introduction

Generic Verilog 2 DIMACS Converter

These python functions will convert a verilog circuit into a DIMACS format compatible with a wide variety of SAT solvers. The conversion uses the Tseytin transformation

The verilog netlist must be in the generic gate format <gate_type> <gate_name> (<output> <in0> [<in1> ...]);

Example:

nand NAND2_1 (N10, N1, N3,N6);
nor NAND2_2 (N11, N3, N6, N1);
or NAND2_3 (N16, N2, N11);
and NAND2_4 (N19, N11, N7);

To convert verilog, use verilog2dimacs(path). This will return a list of DIMACS clauses and a dictionary mapping original net names to the DIMACS encoding and a dictionary mapping original net names to the DIMACS encodingg

Constraints can be added to the encoding using constrain(constraints,net_map,clauses)

The clauses and mapping can be exported to a file through write(top,net_map,clauses)

The functions have been verified through simulation. The simulation exercises every possible input value to a circuit and checks that the DIMACS encoding is consistent. The test requires cadical and Cadence xrun to be in $PATH

The test is run with python verilog2dimacs.py c17.v

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.