Skip to content

Commit 9abbe25

Browse files
authored
Merge pull request #39 from daniellimws/readme-rst
Convert README.md to README.rst
2 parents abd4b57 + 95f6b22 commit 9abbe25

File tree

4 files changed

+204
-167
lines changed

4 files changed

+204
-167
lines changed

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include README.md
1+
include README.rst
22
include LICENSE
33

44
recursive-exclude * __pycache__

README.md

Lines changed: 0 additions & 164 deletions
This file was deleted.

README.rst

Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
sphinxcontrib-verilog-diagrams
2+
==============================
3+
4+
5+
.. image:: https://img.shields.io/pypi/v/sphinxcontrib-verilog-diagrams.svg
6+
:target: https://pypi.python.org/pypi/sphinxcontrib-verilog-diagrams
7+
:alt: PyPI
8+
9+
10+
.. image:: https://img.shields.io/pypi/pyversions/sphinxcontrib-verilog-diagrams.svg
11+
:target: https://pypi.python.org/pypi/sphinxcontrib-verilog-diagrams
12+
:alt: PyPI version
13+
14+
15+
.. image:: https://readthedocs.org/projects/sphinxcontrib-verilog-diagrams/badge
16+
:target: https://sphinxcontrib-verilog-diagrams.readthedocs.io/en/latest/
17+
:alt: Documentation
18+
19+
20+
.. image:: https://travis-ci.com/SymbiFlow/sphinxcontrib-verilog-diagrams.svg?branch=master
21+
:target: https://travis-ci.com/SymbiFlow/sphinxcontrib-verilog-diagrams
22+
:alt: Build Status
23+
24+
25+
.. image:: https://codecov.io/gh/SymbiFlow/sphinxcontrib-verilog-diagrams/branch/master/graph/badge.svg
26+
:target: https://codecov.io/gh/SymbiFlow/sphinxcontrib-verilog-diagrams
27+
:alt: codecov
28+
29+
30+
----
31+
32+
Sphinx Extension which generates various types of diagrams from Verilog code.
33+
34+
`sphinxcontrib-verilog-diagrams <https://github.com/SymbiFlow/sphinxcontrib-verilog-diagrams>`_
35+
is a Sphinx extension to make it easier to write nice documentation from
36+
Verilog files. It primarily uses `Yosys <https://github.com/YosysHQ/yosys>`_ to do the Verilog reading.
37+
38+
Check out the `documentation <https://sphinxcontrib-verilog-diagrams.readthedocs.io/en/latest>`_ for examples.
39+
40+
Installation
41+
------------
42+
43+
Python 3.5+ is required.
44+
45+
.. code-block::
46+
47+
pip install sphinxcontrib-verilog-diagrams
48+
49+
Or,
50+
51+
.. code-block::
52+
53+
python3 -m pip install sphinxcontrib-verilog-diagrams
54+
55+
Sphinx Integration
56+
^^^^^^^^^^^^^^^^^^
57+
58+
In your conf.py, add the following lines.
59+
60+
.. code-block:: python
61+
62+
extensions = [
63+
...,
64+
'sphinxcontrib_verilog_diagrams',
65+
]
66+
67+
Non-Python Dependencies
68+
^^^^^^^^^^^^^^^^^^^^^^^
69+
70+
These dependencies can be either installed on your system or install using the
71+
conda ``environment.yml`` file with;
72+
73+
.. code-block:: bash
74+
75+
conda XXXX
76+
77+
Required
78+
~~~~~~~~
79+
80+
* |yosys|_
81+
.. |yosys| replace:: `yosys`
82+
.. _yosys: https://github.com/YosysHQ/yosys
83+
84+
Optional
85+
~~~~~~~~
86+
87+
* |netlistsvg|_
88+
.. |netlistsvg| replace:: `netlistsvg`
89+
.. _netlistsvg: https://github.com/nturley/netlistsvg
90+
91+
Usage
92+
-----
93+
94+
``verilog-diagram``
95+
^^^^^^^^^^^^^^^^^^^
96+
97+
The ``verilog-diagram`` RST directive can be used to generate a diagram from Verilog code and include it in your documentation.
98+
Check out the `examples <https://sphinxcontrib-verilog-diagrams.readthedocs.io/en/latest/>`_ to see how to use it.
99+
100+
.. code-block:: rst
101+
102+
103+
.. verilog-diagram:: file.v
104+
:type: XXXXX
105+
:module: XXXX
106+
:flatten:
107+
108+
Options
109+
~~~~~~~
110+
111+
``:type:`` - Verilog Diagram Types;
112+
113+
114+
* ``yosys-blackbox`` - Netlist rendered by Yosys.
115+
* ``yosys-aig`` - Verilog file run through ``aigmap`` before image is generated directly in Yosys.
116+
* ``netlistsvg`` - Render output with `netlistsvg <https://github.com/nturley/netlistsvg>`_
117+
118+
``:module:`` - Which module to diagram.
119+
120+
``:flatten:`` - Use the Yosys ``flatten`` command before generating the image.
121+
122+
Example
123+
~~~~~~~
124+
125+
Here is a diagram of a 4-bit carry chain.
126+
127+
128+
.. image:: ./carry4-flatten.svg
129+
:target: ./carry4-flatten.svg
130+
:alt: 4-bit carry chain
131+
132+
133+
``no-license``
134+
^^^^^^^^^^^^^^
135+
136+
This extension also provides the ``no-license`` directive which can be used to include code blocks from a file, but omitting the license header
137+
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.
138+
139+
.. code-block:: rst
140+
141+
142+
.. no-license:: verilog/dff.v
143+
:language: verilog
144+
:linenos:
145+
:caption: verilog/dff.v
146+
147+
Example
148+
~~~~~~~
149+
150+
Here is a comparison between the ``literalinclude`` and ``no-license`` directives.
151+
152+
.. code-block:: rst
153+
154+
.. literalinclude:: verilog/dff.v
155+
:language: verilog
156+
:caption: verilog/dff.v
157+
158+
.. code-block:: verilog
159+
160+
/*
161+
* Copyright (C) 2020 The SymbiFlow Authors.
162+
*
163+
* Licensed under the Apache License, Version 2.0 (the "License");
164+
* you may not use this file except in compliance with the License.
165+
* You may obtain a copy of the License at
166+
*
167+
* https://www.apache.org/licenses/LICENSE-2.0
168+
*
169+
* Unless required by applicable law or agreed to in writing, software
170+
* distributed under the License is distributed on an "AS IS" BASIS,
171+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
172+
* See the License for the specific language governing permissions and
173+
* limitations under the License.
174+
*
175+
* SPDX-License-Identifier: Apache-2.0
176+
*/
177+
178+
// Single flip-flip test.
179+
module top(input clk, input di, output do);
180+
always @( posedge clk )
181+
do <= di;
182+
endmodule // top
183+
184+
.. code-block:: rst
185+
186+
.. no-license:: verilog/dff.v
187+
:language: verilog
188+
:caption: verilog/dff.v
189+
190+
.. code-block:: verilog
191+
192+
// Single flip-flip test.
193+
module top(input clk, input di, output do);
194+
always @( posedge clk )
195+
do <= di;
196+
endmodule // top
197+
198+
Licence
199+
-------
200+
201+
`Apache 2.0 <LICENSE>`_

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
else:
3333
__version__ = "0.0.dev0"
3434

35-
readme_file = path.join(__dir__, 'README.md')
35+
readme_file = path.join(__dir__, 'README.rst')
3636
try:
3737
with open(readme_file) as f:
3838
readme = f.read()
@@ -53,7 +53,7 @@
5353
version=__version__,
5454
description='Generate diagrams from Verilog in Sphinx.',
5555
long_description=readme,
56-
long_description_content_type="text/markdown",
56+
long_description_content_type="text/x-rst",
5757
author="Tim 'mithro' Ansell",
5858
author_email='me@mith.ro',
5959
url='https://github.com/SymbiFlow/sphinxcontrib-verilog-diagrams',

0 commit comments

Comments
 (0)