从Sphinx中的HDL生成图表。
sphinxcontrib-hdl-diagrams的Python项目详细描述
Sphinx扩展,从HDL代码生成各种类型的图表,支持Verilog, 恩米根和特利尔。在
sphinxcontrib-hdl-diagrams 是一个Sphinx扩展,可以更容易地从中编写漂亮的文档 HDL源文件。它主要使用Yosys读取源文件 并生成图表。在
查看documentation中的示例。在
安装
python3.5+是必需的。在
pip install sphinxcontrib-hdl-diagrams
或者
^{pr2}$斯芬克斯积分
在你的配置文件,添加以下行。在
extensions=[...,'sphinxcontrib_hdl_diagrams',]
非Python依赖项
这些依赖项可以安装在系统上,也可以使用 condaenvironment.yml文件
conda XXXX
必需
默认情况下,verilog-diagram使用PyPI中提供的yowasp-yosys包。 它可以通过运行pip install -r requirements.txt来安装。 但是,您也可以使用安装在系统上的Yosys, 或者使用verilog_diagram_yosys变量指向特定的Yosys二进制文件 在Sphinxconf.py文件中:
要使用系统中可用的Yosys,请使用以下设置:
verilog_diagram_yosys = "system"
如果要指向特定的Yosys二进制文件,请提供程序的路径:
verilog_diagram_yosys = "<path-to-Yosys>"
可选
使用
hdl-diagram
hdl-diagramRST指令可用于从Verilog代码生成图表,并将其包含在文档中。 查看examples以了解如何使用它。在
..hdl-diagram:: file.v :type: XXXXX :module: XXXX :skin: XXXX :yosys_script: XXXX :flatten:
选项
:type:-HDL图类型
- yosys-blackbox-由Yosys呈现的Netlist。在
- yosys-aig-Verilog文件在Yosys中直接生成图像之前运行aigmap。在
- netlistsvg-使用netlistsvg呈现输出
:module:-要绘制哪个模块的图表。在
:flatten:-在生成图像之前使用Yosysflatten命令。在
no-license
此扩展还提供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. moduletop(inputclk,inputdi,outputdo);always@(posedgeclk)do<=di;endmodule// top
..no-license:: verilog/dff.v :language: verilog :caption: verilog/dff.v
// Single flip-flip test. moduletop(inputclk,inputdi,outputdo);always@(posedgeclk)do<=di;endmodule// top
许可证
- 项目
标签: