|
| 1 | +SymbiFlow Verilog to VtR XML (v2x) |
| 2 | +=================================== |
| 3 | + |
| 4 | + |
| 5 | +.. image:: https://readthedocs.org/projects/python-symbiflow-v2x/badge/?version=latest |
| 6 | + :target: https://python-symbiflow-v2x.readthedocs.io/en/latest/?badge=latest |
| 7 | + :alt: Documentation Status |
| 8 | + |
| 9 | +.. image:: https://travis-ci.com/SymbiFlow/python-symbiflow-v2x.svg?branch=master |
| 10 | + :target: https://travis-ci.com/SymbiFlow/python-symbiflow-v2x |
| 11 | + :alt: Build Status |
| 12 | + |
| 13 | + |
| 14 | +v2x is a tool for converting specialized annotated Verilog models into XML needed for |
| 15 | +`Verilog to Routing flow <https://docs.verilogtorouting.org/en/latest/arch/reference/>`_. |
| 16 | + |
| 17 | +Documentation can be found at `https://python-symbiflow-v2x.readthedocs.io/en/latest/ <https://python-symbiflow-v2x.readthedocs.io/en/latest/examples.html>`_. |
| 18 | + |
| 19 | +Installation |
| 20 | +------------ |
| 21 | + |
| 22 | +v2x can be installed from a local git repository using pip. |
| 23 | + |
| 24 | +.. code-block:: |
| 25 | +
|
| 26 | + cd python-symbiflow-v2x |
| 27 | + pip install . |
| 28 | +
|
| 29 | +Alternatively, it can be installed from GitHub directly. |
| 30 | + |
| 31 | +.. code-block:: |
| 32 | +
|
| 33 | + pip install git+https://github.com/SymbiFlow/python-symbiflow-v2x.git#egg=python-symbiflow-v2x |
| 34 | +
|
| 35 | +Usage |
| 36 | +----- |
| 37 | + |
| 38 | +After installing v2x, you can run ``python -m v2x`` to use it. |
| 39 | + |
| 40 | +.. code-block:: |
| 41 | +
|
| 42 | + python -m v2x -h |
| 43 | + usage: __main__.py [-h] [--top TOP] [--outfile OUTFILE] [--includes INCLUDES] |
| 44 | + [--mode {pb_type,model}] |
| 45 | + input.v [input.v ...] |
| 46 | +
|
| 47 | + Verilog to XML |
| 48 | +
|
| 49 | + positional arguments: |
| 50 | + input.v One or more Verilog input files, that will be passed |
| 51 | + to Yosys internally. They should be enough to generate |
| 52 | + a flattened representation of the model, so that paths |
| 53 | + through the model can be determined. |
| 54 | +
|
| 55 | + optional arguments: |
| 56 | + -h, --help show this help message and exit |
| 57 | + --top TOP Top level module, will usually be automatically |
| 58 | + determined from the file name im.v |
| 59 | + --outfile OUTFILE, -o OUTFILE |
| 60 | + Output filename, default 'output.xml' |
| 61 | + --includes INCLUDES Comma separate list of include directories. |
| 62 | + --mode {pb_type,model} |
| 63 | + Output file type, possible values are: pb_type and |
| 64 | + model. Default value is pb_type |
| 65 | +
|
| 66 | +For example, to generate a pb_type xml file from adder.v, run |
| 67 | + |
| 68 | +.. code-block:: |
| 69 | +
|
| 70 | + python -m v2x -o adder.pb_type.xml adder.v |
| 71 | +
|
| 72 | +Or, to generate a model xml file, run |
| 73 | + |
| 74 | +.. code-block:: |
| 75 | +
|
| 76 | + python -m v2x --mode model -o adder.model.xml adder.v |
| 77 | +
|
| 78 | +v2x expects the module name to be the same as the file name. If it is different, make sure to specifiy it with the ``--top`` argument. |
| 79 | + |
| 80 | +.. code-block:: |
| 81 | +
|
| 82 | + python -m v2x --top BLOCK -o adder.pb_type.xml adder.v |
| 83 | +
|
| 84 | +Tests |
| 85 | +----- |
| 86 | + |
| 87 | +The test cases are stored in tests/, and pytest can be used to run them. |
| 88 | + |
| 89 | +.. code-block:: |
| 90 | +
|
| 91 | + rm -rf build # run this step so that pytest uses the latest files for the tests |
| 92 | + pytest -vv |
| 93 | +
|
| 94 | +If you are making changes to any python code, make sure that they follow the PEP8 style guide by running flake8. |
| 95 | + |
| 96 | +.. code-block:: |
| 97 | +
|
| 98 | + flake8 tests |
| 99 | + flake8 v2x |
| 100 | +
|
| 101 | +Documentation |
| 102 | +------------- |
| 103 | + |
| 104 | +We use sphinx for our documentation and the files are stored in docs/. To host it locally (if you are planning to update it), you can use the Makefile inside. |
| 105 | + |
| 106 | +First, run ``make env`` to prepare a Conda environment that contains the necessary packages to build and host the documentation site. After that, simply run ``make livehtml`` which starts a local server running at port 8000 with the documentation site. |
| 107 | + |
| 108 | +.. code-block:: |
| 109 | +
|
| 110 | + cd docs |
| 111 | + make env |
| 112 | + make livehtml |
| 113 | +
|
| 114 | +Talks |
| 115 | +----- |
| 116 | + |
| 117 | +**VPR device models generation from Verilog with V2X - Karol Gugala - ORConf 2019** |
| 118 | + |
| 119 | + |
| 120 | +.. image:: https://img.youtube.com/vi/a31vH_tZLBM/0.jpg |
| 121 | + :target: https://www.youtube.com/watch?v=a31vH_tZLBM |
| 122 | + :alt: v2x orconf talk |
| 123 | + |
0 commit comments