Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 0.0.post160 instead.

PyPI PyPI version Documentation Build Status codecov

Sphinx Extension which generates various types of diagrams from HDL code, supporting Verilog, nMigen and RTLIL.

sphinxcontrib-hdl-diagrams is a Sphinx extension to make it easier to write nice documentation from HDL source files. It primarily uses Yosys to read the source files and generate the diagrams.

Check out the documentation for examples.

Installation

Python 3.5+ is required.

pip install sphinxcontrib-hdl-diagrams

Or,

python3 -m pip install sphinxcontrib-hdl-diagrams

Sphinx Integration

In your conf.py, add the following lines.

extensions = [
    ...,
    'sphinxcontrib_hdl_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

By default, verilog-diagram uses the yowasp-yosys package provided in PyPI. It can be installed by running pip install -r requirements.txt. However, you could also use Yosys that is installed on your system, or point to the specific Yosys binary using verilog_diagram_yosys variable in the Sphinx conf.py file:

To use Yosys that is available in your system, use the following setting:

verilog_diagram_yosys = "system"

If you want to point to the specific Yosys binary, provide the path to the program:

verilog_diagram_yosys = "<path-to-Yosys>"

Optional

Usage

hdl-diagram

The hdl-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.

.. hdl-diagram:: file.v
   :type: XXXXX
   :module: XXXX
   :skin: XXXX
   :yosys_script: XXXX
   :flatten:

Options

:type: - HDL 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-2021  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-hdl-diagrams 0.0.post150

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-hdl-diagrams 0.0.post150
File Size Uploaded
sphinxcontrib-hdl-diagrams-0.0.post150.tar.gz 13.9 kB Details

Built distribution (wheel)

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

Total release size: 27.6 kB

Release files / sphinxcontrib-hdl-diagrams-0.0.post150.tar.gz

Download URL sphinxcontrib-hdl-diagrams-0.0.post150.tar.gz
Size 13.9 kB
Tags Source
SHA-256 checksum
How to use checksums
914349ce22efa8342bf5c8c061c834611ca0a1f36d4e743ce408ae03ff4f5c6a
BLAKE2b-256 checksum
How to use checksums
22e397930adb1b6a6a5711fc2785e30edbf52ee85df7c63de281d5ec288908a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

Release files / sphinxcontrib_hdl_diagrams-0.0.post150-py3-none-any.whl

Download URL sphinxcontrib_hdl_diagrams-0.0.post150-py3-none-any.whl
Size 13.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c3a93516487c801f55f7e30f831305fe4f9c4588d57fc7cc93edbb122f1468d8
BLAKE2b-256 checksum
How to use checksums
f0f88372dd78b9aa41a3d317ea2a94568dddc839ca5c14ed889d3ae32194ef61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
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