SystemVerilog to Verilog conversion
Go to file
Zachary Snow 88579c6d1f logic conversion fixes produced reg-to-output bindings
- generally cleaned up and documented the Logic conversion
- made exprToLHS a shared helper function, now uses Maybe
- ported existing local exprToLHS helpers to the new one
2019-04-22 20:44:35 -04:00
src logic conversion fixes produced reg-to-output bindings 2019-04-22 20:44:35 -04:00
test struct conversion supports struct literals as task/function args 2019-04-22 13:58:14 -04:00
.gitignore switch to using stack 2019-02-11 23:48:49 -05:00
.travis.yml more robust and cache-friendly Linux Travis CI 2019-04-17 21:33:09 -04:00
LICENSE reformat license 2019-04-18 18:52:05 -04:00
Makefile initial lexer tests; general test harness 2019-04-02 23:11:16 -04:00
README.md updated documentation 2019-04-18 19:33:16 -04:00
Setup.hs Initial commit: fork of https://github.com/tomahawkins/verilog 2019-02-07 23:49:12 -05:00
stack.yaml updated Stack snapshot; handled pattern matching failure issues introduced in GHC 8.6 2019-04-16 15:52:38 -04:00
sv2v.cabal added conversion which moves top-level tasks and functions into modules 2019-04-22 01:18:25 -04:00

README.md

sv2v: SystemVerilog to Verilog

sv2v converts SystemVerilog (IEEE 1800-2017) to Verilog (IEEE 1364-2005), with an emphasis on supporting synthesizable language constructs.

The primary goal of this project is to create a completely free and open-source tool for converting SystemVerilog to Verilog. While methods for performing this conversion already exist, they generally either rely on commercial tools, or are pretty incomplete.

This project was originally developed to target Yosys, and so allows for disabling the conversion of those SystemVerilog features which Yosys supports.

Dependencies

All of sv2v's dependencies are free and open-source.

  • Build Dependencies
    • Haskell Stack - Haskell build system
    • Haskell dependencies are managed in sv2v.cabal
  • Test Dependencies

Installation

Pre-built binaries

We plan on releasing pre-built binaries in the future.

Building from source

You must have Stack installed to build sv2v.

git clone https://github.com/zachjs/sv2v.git
cd sv2v
make

This creates the executable at ./bin/sv2v. Stack takes care of installing exact (compatible) versions of the compiler and sv2v's build dependencies.

You can install the binary to your local bin path (typically ~/.local/bin) by running stack install, or copy over the executable manually.

Usage

sv2v takes in a list of files and prints the converted Verilog to stdout. Users may specify include search paths, define macros during preprocessing, and exclude some of the conversion.

Below is the current usage printout. This interface is subject to change.

sv2v [OPTIONS] [FILES]

Common flags:
  -e --exclude=CONV         exclude a particular conversion (always,
                            interface, logic)
  -i --incdir=DIR           add directory to include search path
  -d --define=NAME[=VALUE]  define a macro for preprocessing
  -? --help                 Display help message
  -V --version              Print version information
     --numeric-version      Print just the version number

Supported Features

sv2v supports most synthesizable SystemVerilog features. Current notable exceptions include package/import/export, interfaces with parameter bindings, and complex (non-identifier) modport expressions. Assertions are also supported, but are simply dropped during conversion.

If you find a bug or have a feature request, please create an issue. Preference will be given to issues which include examples or test cases.

SystemVerilog Frontend

This project contains a preprocessor and lexer, a parser, and an abstract syntax tree representation for a subset of the SystemVerilog specification. The parser is not very strict. The AST allows for the representation of syntactically (and semantically) invalid Verilog. The goal is to be more general in the representation to enable more standardized and straightforward conversion procedures. This could be extended into an independent and more fully-featured frontend if there is significant interest.

Testing

The current test suite is limited. Tests can be run with make test.

License

See the LICENSE file for copyright and licensing information.