在 Sphinx 中从 Verilog 生成图表。
项目描述
Sphinx 扩展从 HDL 代码生成各种类型的图表,支持 Verilog、nMigen 和 RTLIL。
sphinxcontrib-hdl-diagrams 是一个 Sphinx 扩展,可以更轻松地从 HDL 源文件编写漂亮的文档。它主要使用Yosys读取源文件并生成图表。
查看文档以获取示例。
安装
需要 Python 3.5+。
pip install sphinxcontrib-hdl-diagrams
或者,
python3 -m pip install sphinxcontrib-hdl-diagrams
狮身人面像集成
在您的 conf.py 中,添加以下行。
extensions = [
...,
'sphinxcontrib_hdl_diagrams',
]
非 Python 依赖项
这些依赖项可以安装在您的系统上,也可以使用 conda environment.yml文件安装;
conda XXXX
必需的
默认情况下,verilog-diagram使用 PyPI 中提供的yowasp-yosys包。可以通过运行pip install -r requirements.txt来安装它。但是,您也可以使用安装在系统上的 Yosys,或者使用 Sphinx conf.py文件中的verilog_diagram_yosys变量指向特定的 Yosys 二进制文件:
要使用系统中可用的 Yosys,请使用以下设置:
verilog_diagram_yosys = "system"
如果要指向特定的 Yosys 二进制文件,请提供程序的路径:
verilog_diagram_yosys = "<path-to-Yosys>"
可选的
用法
hdl图
hdl-diagram RST 指令可用于从 Verilog 代码生成图表并将其包含在您的文档中。查看示例以了解如何使用它。
.. hdl-diagram:: file.v
:type: XXXXX
:module: XXXX
:skin: XXXX
:yosys_script: XXXX
:flatten:
选项
:type: - HDL 图表类型;
yosys-blackbox - Yosys 呈现的网表。
yosys-aig -在直接在 Yosys 中生成图像之前,通过aigmap运行 Verilog 文件
netlistsvg - 使用netlistsvg渲染输出
:module: - 要绘制的模块。
:flatten: - 在生成图像之前使用 Yosys flatten命令。
例子
这是一个 4 位进位链的示意图。
无执照
此扩展还提供了no-license指令,可用于包含文件中的代码块,但省略文件顶部的许可标头。它的行为类似于literalinclude指令,但是lines选项被覆盖以仅显示许可证头之后的行。
.. no-license:: verilog/dff.v
:language: verilog
:linenos:
:caption: verilog/dff.v
例子
下面是literalinclude和no-license指令之间的比较。
.. 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
执照
项目详情
sphinxcontrib -verilog-diagrams-0.1.0.tar.gz 的哈希值
| 算法 | 哈希摘要 | |
|---|---|---|
| SHA256 | 2bdf2ff8f5a983a2f9b36b49bab034a3442f6e0a82af5020d27695f84319e1ba |
|
| MD5 | b3c3bbd71ae2e9b9003e49fcb67e0b99 |
|
| 布莱克2-256 | f863bf76e64fa122b36b08c6e8ef7af186de1e482d112b21adeddfc3429fa3e2 |
sphinxcontrib_verilog_diagrams -0.1.0-py3-none-any.whl 的哈希值
| 算法 | 哈希摘要 | |
|---|---|---|
| SHA256 | c0500909ec5b94b59625015aca5ffec59d431098674b6f085cad249c21499c4b |
|
| MD5 | f9322f0e3659bc10249c54f475273b9c |
|
| 布莱克2-256 | 8d76f6aff623215f9366264145ca8cec986a89d6f896d537df1ca5695c8a9bed |