Skip to content

Commit 5cbd079

Browse files
author
Mariusz Glebocki
committed
Initial commit
0 parents  commit 5cbd079

12 files changed

+1559
-0
lines changed

README.rst

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
Sphinx Verilog Domain
2+
=====================
3+
4+
.. warning::
5+
This extension is in development stage.
6+
7+
.. note::
8+
This extension is not a part of sphinxcontrib yet.
9+
10+
Dependencies
11+
------------
12+
13+
* ``lark-parser``
14+
15+
Enabling
16+
--------
17+
18+
Add extension in ``conf.py``::
19+
20+
extensions = [ 'sphinxcontrib.verilogdomain' ]
21+
22+
Usage
23+
-----
24+
25+
Module headers (non-ANSI-style only for now)::
26+
27+
.. verilog::module:: module Top(a, b);
28+
29+
Port declarations::
30+
31+
.. verilog:port:: input wire [31:0] a, b;
32+
33+
Parameter declarations::
34+
35+
.. verilog:parameter:: parameter logic param_name_05 = 1, param_name_05_b = 2;
36+
37+
Declaration aliases (for use with references)::
38+
39+
.. verilog:module:: module \35(4p3|) (z);
40+
:alias: module_escaped
41+
42+
References::
43+
44+
Reference to :verilog:ref:`Top`
45+
Reference to :verilog:ref:`module_escaped`, or just :verilog:ref:`\\35(4p3|)`
46+
47+
Nesting::
48+
49+
.. verilog:module:: module Top1(a, b, c);
50+
51+
.. verilog:port:: input a;
52+
53+
Description of port ``a``
54+
55+
.. verilog:port:: input b;
56+
57+
Description of port ``b``
58+
59+
.. verilog:module:: module Nested(a);
60+
61+
.. verilog:port:: output a;
62+
63+
Description of port ``a`` in ``Nested``
64+
65+
Reference to module ``Top1``'s port ``a``: :verilog:ref:`Top1.a`.

example/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line.
5+
SPHINXOPTS = -E -v
6+
SPHINXBUILD = python -msphinx
7+
SPHINXPROJ = verilogdomain-test
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%:
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

example/source/conf.py

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
#
4+
import os
5+
import sys
6+
7+
# -- General configuration ------------------------------------------------
8+
9+
extensions = [
10+
]
11+
12+
import warnings
13+
14+
sys.path.append(os.path.abspath(os.path.dirname(__file__) + '/../../'))
15+
extensions = ['sphinxcontrib.verilogdomain']
16+
17+
verilog_domain_debug = [
18+
# "add_debug_content",
19+
# "print_parser_tree",
20+
# "print_add_target",
21+
# "print_objects_tree",
22+
]
23+
24+
source_suffix = '.rst'
25+
26+
master_doc = 'index'
27+
28+
html_theme = "alabaster"
29+
30+
# General information about the project.
31+
project = 'sphinx-verilog-domain'
32+
copyright = '2018, Various'
33+
author = 'Various'
34+
35+
# The version info for the project you're documenting, acts as replacement for
36+
# |version| and |release|, also used in various other places throughout the
37+
# built documents.
38+
#
39+
# The short X.Y version.
40+
version = '0.1'
41+
# The full version, including alpha/beta/rc tags.
42+
release = '0.1'
43+
44+
# The language for content autogenerated by Sphinx. Refer to documentation
45+
# for a list of supported languages.
46+
#
47+
# This is also used if you do content translation via gettext catalogs.
48+
# Usually you set "language" from the command line for these cases.
49+
language = None
50+
51+
# List of patterns, relative to source directory, that match files and
52+
# directories to ignore when looking for source files.
53+
# This patterns also effect to html_static_path and html_extra_path
54+
exclude_patterns = []
55+
56+
# The name of the Pygments (syntax highlighting) style to use.
57+
pygments_style = 'default'
58+
59+
# If true, `todo` and `todoList` produce output, else they produce nothing.
60+
todo_include_todos = False
61+
62+
# -- Options for HTML output ----------------------------------------------
63+
64+
html_js_files = [
65+
'http://livejs.com/live.js'
66+
]
67+

example/source/index.rst

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
Verilog Domain test
2+
###################
3+
4+
.. toctree::
5+
6+
port
7+
parameter
8+
module
9+
nesting
10+
nesting2
11+
12+
----
13+
14+
.. verilog:module:: module d ( \
15+
cos_z0, \
16+
sin_z0, \
17+
done, \
18+
z0, \
19+
start, \
20+
clock, \
21+
reset \
22+
);
23+
24+
Sine and cosine computer. `Source <https://github.com/YosysHQ/yosys/blob/master/tests/simple/sincos.v>`_
25+
26+
This module computes the sine and cosine of an input angle. The
27+
floating point numbers are represented as integers by scaling them
28+
up with a factor corresponding to the number of bits after the point.
29+
30+
.. verilog:port:: output signed [19:0] cos_z0;
31+
reg signed [19:0] cos_z0;
32+
33+
cosine of the input angle
34+
35+
.. verilog:port:: output signed [19:0] sin_z0;
36+
reg signed [19:0] sin_z0;
37+
38+
sine of the input angle
39+
40+
.. verilog:port:: output done;
41+
reg done;
42+
43+
output flag indicated completion of the computation
44+
45+
.. verilog:port:: input signed [19:0] z0;
46+
47+
input angle
48+
49+
.. verilog:port:: input start;
50+
51+
input that starts the computation on a posedge
52+
53+
.. verilog:port:: input clock;
54+
55+
clock input
56+
57+
.. verilog:port:: input reset;
58+
59+
reset input
60+

example/source/module.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
verilog:module
2+
**************
3+
4+
.. verilog:module:: (* attr = 2 * 2 *) module test1(a,b,c,d,e,f,g,h);
5+
.. verilog:module:: module test2(a,b,c,d,e,f,g,h);
6+
.. verilog:module:: module complex_ports ( {c,d}, .e(f) );
7+
.. verilog:module:: module split_ports (a[7:4], a[3:0]);
8+
.. verilog:module:: module same_port (.a(i), .b(i));
9+
.. verilog:module:: module renamed_concat (.a({b,c}), f, .g(h[1]));
10+
.. verilog:module:: module same_input (a,a);
11+
.. verilog:module:: module mixed_direction (.p({a, e}));
12+

0 commit comments

Comments
 (0)