2019-02-24 20:59:00 +01:00
|
|
|
# sv2v: SystemVerilog to Verilog
|
|
|
|
|
|
2019-03-27 08:41:41 +01:00
|
|
|
sv2v is a tool for converting SystemVerilog ([IEEE 1800-2017]) to ([IEEE
|
|
|
|
|
1364-2005]), with an emphasis on supporting synthesizable SystemVerilog
|
|
|
|
|
features. This project was originally developed to target [Yosys], and so allows
|
|
|
|
|
for disabling the conversion of those [SystemVerilog features which Yosys
|
|
|
|
|
supports].
|
|
|
|
|
|
|
|
|
|
[IEEE 1800-2017]: https://ieeexplore.ieee.org/servlet/opac?punumber=8299593
|
|
|
|
|
[IEEE 1364-2005]: https://ieeexplore.ieee.org/servlet/opac?punumber=10779
|
2019-02-26 21:03:49 +01:00
|
|
|
[Yosys]: http://www.clifford.at/yosys/
|
2019-03-08 17:02:40 +01:00
|
|
|
[SystemVerilog features which Yosys supports]: https://github.com/YosysHQ/yosys#supported-features-from-systemverilog
|
2019-02-24 20:59:00 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
## Installation
|
|
|
|
|
|
|
|
|
|
### Pre-built binaries
|
|
|
|
|
|
2019-03-08 17:02:40 +01:00
|
|
|
We plan on releasing pre-built binaries in the near future.
|
2019-02-24 20:59:00 +01:00
|
|
|
|
|
|
|
|
### Building from source
|
|
|
|
|
|
|
|
|
|
You must have [Stack] installed to build sv2v.
|
|
|
|
|
|
|
|
|
|
[Stack]: https://www.haskellstack.org/
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
git clone https://github.com/zachjs/sv2v
|
|
|
|
|
cd sv2v
|
|
|
|
|
stack setup
|
|
|
|
|
make
|
|
|
|
|
```
|
|
|
|
|
|
2019-03-08 17:02:40 +01:00
|
|
|
This creates the executable at `./bin/sv2v` You can install the binary by
|
|
|
|
|
running `stack install`.
|
2019-02-24 20:59:00 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
2019-02-26 21:03:49 +01:00
|
|
|
The interface for this tool has not yet been finalized. Currently, running `sv2v
|
|
|
|
|
path/to/file.sv` will output the converted file to `stdout`.
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
sv2v [OPTIONS] [FILE]
|
|
|
|
|
|
|
|
|
|
Common flags:
|
2019-03-08 17:02:40 +01:00
|
|
|
-e --exclude=CONV conversion to exclude (always, interface, logic); can
|
|
|
|
|
be specified multiple times
|
2019-02-26 21:03:49 +01:00
|
|
|
-? --help Display help message
|
2019-03-08 17:02:40 +01:00
|
|
|
-V --version Print version information
|
|
|
|
|
--numeric-version Print just the version number
|
2019-02-26 21:03:49 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
2019-02-24 20:59:00 +01:00
|
|
|
## SystemVerilog Parser/AST
|
|
|
|
|
|
|
|
|
|
This project contains a basic preprocessor, lexer, parser, and abstract syntax
|
|
|
|
|
tree for a subset of synthesizable SystemVerilog. The parser is not extremely
|
|
|
|
|
strict, and 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
|
2019-03-08 17:02:40 +01:00
|
|
|
parser if there is significant interest.
|
2019-02-24 20:59:00 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
## License
|
|
|
|
|
|
|
|
|
|
See the LICENSE file for copyright and licensing information.
|