Skip to main content

Generate diagrams from Verilog in Sphinx.

Project description

sphinxcontrib-verilog-diagrams

PyPI PyPI version Documentation Build Status codecov


Sphinx Extension which generates various types of diagrams from Verilog code.

sphinxcontrib-verilog-diagrams is a Sphinx extension to make it easier to write nice documentation from Verilog files. It primarily uses Yosys to do the Verilog reading.

Check out the documentation for examples.

Installation

Python 3.5+ is required.

pip install sphinxcontrib-verilog-diagrams

Or,

python3 -m pip install sphinxcontrib-verilog-diagrams

Sphinx Integration

In your conf.py, add the following lines.

extensions = [
    ...,
    'sphinxcontrib_verilog_diagrams',
]

Non-Python Dependencies

These dependencies can be either installed on your system or install using the conda environment.yml file with;

conda XXXX

Required

Optional

Usage

verilog-diagram

The verilog-diagram RST directive can be used to generate a diagram from Verilog code and include it in your documentation. Check out the examples to see how to use it.

.. verilog-diagram:: file.v
   :type: XXXXX
   :module: XXXX
   :flatten:

Options

:type: - Verilog Diagram Types;

  • yosys-blackbox - Netlist rendered by Yosys.
  • yosys-aig - Verilog file run through aigmap before image is generated directly in Yosys.
  • netlistsvg - Render output with netlistsvg

:module: - Which module to diagram.

:flatten: - Use the Yosys flatten command before generating the image.

Example

Here is a diagram of a 4-bit carry chain.

4-bit carry chain

no-license

This extension also provides the no-license directive which can be used to include code blocks from a file, but omitting the license header at the top of the file. It behaves like the literalinclude directive, but the lines option is overridden to only show the lines after the license header.

.. no-license:: verilog/dff.v
   :language: verilog
   :linenos:
   :caption: verilog/dff.v

Example

Here is a comparison between the literalinclude and no-license directives.

.. literalinclude:: verilog/dff.v
   :language: verilog
   :linenos:
   :caption: verilog/dff.v
/*
 * Copyright (C) 2020  The SymbiFlow Authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * SPDX-License-Identifier: Apache-2.0
 */

// Single flip-flip test.
module top(input clk, input di, output do);
  always @( posedge clk )
    do <= di;
endmodule // top
.. no-license:: verilog/dff.v
   :language: verilog
   :linenos:
   :caption: verilog/dff.v
// Single flip-flip test.
module top(input clk, input di, output do);
  always @( posedge clk )
    do <= di;
endmodule // top

Licence

Apache 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sphinxcontrib-verilog-diagrams-0.0.post62.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file sphinxcontrib-verilog-diagrams-0.0.post62.tar.gz.

File metadata

  • Download URL: sphinxcontrib-verilog-diagrams-0.0.post62.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1.post20200616 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.6

File hashes

Hashes for sphinxcontrib-verilog-diagrams-0.0.post62.tar.gz
Algorithm Hash digest
SHA256 9b8e43d757777b5bbef3756970ac6357990e8e5b78c5137b6b9a8eb4e5bd538f
MD5 da3bd59f2722abb8c635bd1b45c4de51
BLAKE2b-256 04c4fd7ea28003ea7c92cb8ab98af433f035a696c92eff9868456205405ac6e9

See more details on using hashes here.

File details

Details for the file sphinxcontrib_verilog_diagrams-0.0.post62-py3-none-any.whl.

File metadata

  • Download URL: sphinxcontrib_verilog_diagrams-0.0.post62-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1.post20200616 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.6

File hashes

Hashes for sphinxcontrib_verilog_diagrams-0.0.post62-py3-none-any.whl
Algorithm Hash digest
SHA256 8fbeef1156aa57b7e9c2d30a1a72cb3ac6f0713dcc28a1885e264d056b62a09c
MD5 5e571d965cad000c1356c8d66ca92e16
BLAKE2b-256 0c56317e06e33266896bdf20b87ee76351824826b5f6d71aa352415f4be0463f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page