Skip to main content
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
   :skin: XXXX
   :yosys_script: 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
   :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
   :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

Release files for sphinxcontrib-verilog-diagrams 0.0.post95

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sphinxcontrib-verilog-diagrams 0.0.post95
File Size Uploaded
sphinxcontrib-verilog-diagrams-0.0.post95.tar.gz 11.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sphinxcontrib-verilog-diagrams 0.0.post95
File Interpreter ABI Platform
sphinxcontrib_verilog_diagrams-0.0.post95-py3-none-any.whl Python 3 none any Details

Total release size: 24.6 kB

Release files / sphinxcontrib-verilog-diagrams-0.0.post95.tar.gz

Download URL sphinxcontrib-verilog-diagrams-0.0.post95.tar.gz
Size 11.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c127dc3458c7f5f3a018f033ff39a3d973a6b78ab9e093db6a63c73b45d3ab04
BLAKE2b-256 checksum
How to use checksums
1c5e95ccafdf0da3561f27449d18051dcbb85cb2e1d04100fa75e9d86cc834ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.0.3 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.5.2

Release files / sphinxcontrib_verilog_diagrams-0.0.post95-py3-none-any.whl

Download URL sphinxcontrib_verilog_diagrams-0.0.post95-py3-none-any.whl
Size 12.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
80a64e05b5e213fcf62344070b4b4dccaa1798077023dd922f77a0b9354f3afe
BLAKE2b-256 checksum
How to use checksums
892f0c0683bc21f5b7a532f0be8deb7c2a2edf05cc65fb6d332243254cc433af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.0.3 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.5.2
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page