Skip to content

Commit 3aeb734

Browse files
authored
Merge pull request #11 from PyFPGA/dev
Dev
2 parents 537f847 + 9f35a2b commit 3aeb734

File tree

15 files changed

+260
-128
lines changed

15 files changed

+260
-128
lines changed

.github/workflows/docs.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: 'docs'
2+
3+
on:
4+
push:
5+
paths:
6+
- 'docs/**'
7+
- 'hdlconv/**'
8+
branches:
9+
- main
10+
- dev
11+
12+
jobs:
13+
docs:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
- name: Install dependencies
19+
run: pip install . && pip install sphinx sphinx-rtd-theme
20+
- name: Build documentation
21+
run: make docs
22+
- name: Deploy to GitHub Pages
23+
uses: peaceiris/actions-gh-pages@v4
24+
with:
25+
github_token: ${{ secrets.GITHUB_TOKEN }}
26+
publish_dir: docs/build/html

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
all: docs lint test
66

77
docs:
8-
bash docgen.sh
8+
cd docs; make html
99

1010
lint:
1111
pycodestyle hdlconv
@@ -17,5 +17,7 @@ test:
1717

1818
clean:
1919
py3clean .
20+
rm -fr docs/build
2021
rm -fr .pytest_cache
22+
rm -fr `find . -name results`
2123
rm -fr `find . -name __pycache__`

README.md

Lines changed: 0 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -3,92 +3,6 @@
33
HDL converter (between VHDL, SystemVerilog and/or Verilog), based on [GHDL](https://github.com/ghdl/ghdl), [Yosys](https://github.com/YosysHQ/yosys), [Synlig](https://github.com/chipsalliance/synlig) and the plugins [ghdl-yosys-plugin](https://github.com/ghdl/ghdl-yosys-plugin) and [yosys-slang](https://github.com/povik/yosys-slang).
44
It relies on [Docker](https://docs.docker.com/get-docker) and [PyFPGA containers](https://github.com/PyFPGA/containers).
55

6-
> Known limitation: the files must be located either under the `$HOME` directory or under the current working directory (`$PWD`) for Docker to be able to find and access them.
7-
86
* `vhdl2vhdl`: converts from a newer VHDL to VHDL'93 (using `ghdl`).
97
* `vhdl2vlog`: converts from VHDL to Verilog (backends: `ghdl` or `yosys`).
108
* `slog2vlog`: converts from SystemVerilog to Verilog (frontends: `slang`, `synlig` or `yosys`).
11-
12-
# Documentation
13-
14-
```
15-
usage: vhdl2vhdl [-h] [-v] [--no-docker] [-g GENERIC VALUE] [-a ARCH]
16-
[-f FILENAME] [-o PATH] -t TOPNAME
17-
FILE[,LIBRARY] [FILE[,LIBRARY] ...]
18-
19-
VHDL to VHDL
20-
21-
positional arguments:
22-
FILE[,LIBRARY] VHDL file/s (with an optional LIBRARY specification)
23-
24-
optional arguments:
25-
-h, --help show this help message and exit
26-
-v, --version show program's version number and exit
27-
--no-docker do not use Docker (use system tools instead)
28-
-g GENERIC VALUE, --generic GENERIC VALUE
29-
specify a top-level Generic (can be specified multiple
30-
times)
31-
-a ARCH, --arch ARCH specify a top-level Architecture
32-
-f FILENAME, --filename FILENAME
33-
resulting file name [<TOPNAME>.<EXT>]
34-
-o PATH, --odir PATH output directory [results]
35-
-t TOPNAME, --top TOPNAME
36-
specify the top-level of the design
37-
```
38-
39-
```
40-
usage: vhdl2vlog [-h] [-v] [--no-docker] [--backend TOOL] [-g GENERIC VALUE]
41-
[-a ARCH] [-f FILENAME] [-o PATH] -t TOPNAME
42-
FILE[,LIBRARY] [FILE[,LIBRARY] ...]
43-
44-
VHDL to Verilog
45-
46-
positional arguments:
47-
FILE[,LIBRARY] VHDL file/s (with an optional LIBRARY specification)
48-
49-
optional arguments:
50-
-h, --help show this help message and exit
51-
-v, --version show program's version number and exit
52-
--no-docker do not use Docker (use system tools instead)
53-
--backend TOOL backend tool [ghdl]
54-
-g GENERIC VALUE, --generic GENERIC VALUE
55-
specify a top-level Generic (can be specified multiple
56-
times)
57-
-a ARCH, --arch ARCH specify a top-level Architecture
58-
-f FILENAME, --filename FILENAME
59-
resulting file name [<TOPNAME>.<EXT>]
60-
-o PATH, --odir PATH output directory [results]
61-
-t TOPNAME, --top TOPNAME
62-
specify the top-level of the design
63-
```
64-
65-
```
66-
usage: slog2vlog [-h] [-v] [--no-docker] [--frontend TOOL] [-p PARAM VALUE]
67-
[-d DEFINE VALUE] [-i PATH] [-f FILENAME] [-o PATH] -t
68-
TOPNAME
69-
FILE [FILE ...]
70-
71-
SystemVerilog to Verilog
72-
73-
positional arguments:
74-
FILE System Verilog file/s
75-
76-
optional arguments:
77-
-h, --help show this help message and exit
78-
-v, --version show program's version number and exit
79-
--no-docker do not use Docker (use system tools instead)
80-
--frontend TOOL frontend tool [slang]
81-
-p PARAM VALUE, --param PARAM VALUE
82-
specify a top-level Parameter (can be specified
83-
multiple times)
84-
-d DEFINE VALUE, --define DEFINE VALUE
85-
specify a Define (can be specified multiple times)
86-
-i PATH, --include PATH
87-
specify an Include Path (can be specified multiple
88-
times)
89-
-f FILENAME, --filename FILENAME
90-
resulting file name [<TOPNAME>.<EXT>]
91-
-o PATH, --odir PATH output directory [results]
92-
-t TOPNAME, --top TOPNAME
93-
specify the top-level of the design
94-
```

docgen.sh

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

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
SPHINXOPTS ?=
2+
SPHINXBUILD ?= sphinx-build
3+
SOURCEDIR = .
4+
BUILDDIR = build
5+
HELPERS = $(BUILDDIR)/vhdl2vhdl $(BUILDDIR)/vhdl2vlog $(BUILDDIR)/slog2vlog
6+
7+
PYTHONPATH := $(PWD)/..
8+
export PYTHONPATH
9+
10+
help:
11+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
12+
13+
.PHONY: help Makefile
14+
15+
$(HELPERS):
16+
@mkdir -p $(@D)
17+
@python3 ../hdlconv/$(@F).py -h > $@
18+
19+
%: Makefile $(HELPERS)
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/conf.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# -*- coding: utf-8 -*-
2+
3+
import sys, re
4+
from pathlib import Path
5+
6+
sys.path.insert(0, str(Path.cwd().resolve().parent))
7+
8+
# -- Project information -----------------------------------------------------
9+
10+
project = 'HDLconv'
11+
copyright = '2023-2025, HDLconv Project'
12+
author = 'HDLconv contributors'
13+
14+
# -- General configuration ---------------------------------------------------
15+
16+
extensions = [
17+
'sphinx.ext.autodoc',
18+
'sphinx.ext.extlinks',
19+
'sphinx.ext.intersphinx',
20+
'sphinx.ext.todo',
21+
'sphinx.ext.viewcode',
22+
]
23+
24+
autodoc_default_options = {
25+
"members": True,
26+
'undoc-members': True,
27+
'inherited-members': True,
28+
}
29+
30+
extlinks = {
31+
'repositoy': ('https://github.com/PyFPGA/HDLconv/tree/main/%s', None)
32+
}
33+
34+
exclude_patterns = ['build']
35+
36+
# -- Options for HTML output -------------------------------------------------
37+
38+
html_theme = 'sphinx_rtd_theme'
39+
html_static_path = ['images']

docs/images/logo.png

12.9 KB
Loading

docs/index.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
HDLconv's documentation
2+
=======================
3+
4+
.. image:: images/logo.png
5+
:width: 200 px
6+
:align: center
7+
:target: https://github.com/PyFPGA/HDLconv
8+
9+
.. toctree::
10+
11+
intro
12+
tutorial
13+
scripts
14+
15+
.. |timestamp| date:: %Y-%m-%d %H:%M (%Z)
16+
17+
.. note::
18+
19+
Documentation generated on |timestamp|.

docs/intro.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
Introduction
2+
============
3+
4+
HDL converter provides a set of command-line utilities for converting between VHDL, SystemVerilog, and Verilog.
5+
Those, gathers files and options, then orchestrates the execution of the following tools - either separately or in combination when required.
6+
7+
* `GHDL <https://github.com/ghdl/ghdl>`_
8+
* `Yosys <https://github.com/YosysHQ/yosys>`_
9+
* `Synlig <https://github.com/chipsalliance/synlig>`_
10+
* `ghdl-yosys-plugin <https://github.com/ghdl/ghdl-yosys-plugin>`_
11+
* `yosys-slang <https://github.com/povik/yosys-slang>`_
12+
13+
To avoid the need to install multiple tools, it relies on `Docker <https://docs.docker.com/get-docker>`_ and `PyFPGA containers <https://github.com/PyFPGA/containers>`_.
14+
15+
Command-line utilities
16+
----------------------
17+
18+
* ``vhdl2vhdl``: converts from a newer VHDL to VHDL'93.
19+
* Solved using ``ghdl``.
20+
* ``vhdl2vlog``: converts from VHDL to Verilog. This has two alternatives:
21+
* Purely ``ghdl`` (**default**).
22+
* Uses ``ghdl-yosys-plugin`` as frontend and ``yosys`` as backend.
23+
* ``slog2vlog``: converts from SystemVerilog to Verilog. This has three alternatives:
24+
* Uses ``yosys-slang`` as frontend and ``yosys`` as backend (**default**).
25+
* Purely ``synlig`` (based on ``Surelog`` and ``yosys``).
26+
* Purely ``yosys`` (simpler SV support, but could be sufficient in some cases).
27+
28+
.. note::
29+
Multiple alternatives are provided so you can try different options if one does not work.

docs/scripts.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Scripts reference
2+
=================
3+
4+
vhdl2vhdl
5+
---------
6+
7+
.. literalinclude:: build/vhdl2vhdl
8+
9+
vhdl2vlog
10+
---------
11+
12+
.. literalinclude:: build/vhdl2vlog
13+
14+
slog2vlog
15+
---------
16+
17+
.. literalinclude:: build/slog2vlog

0 commit comments

Comments
 (0)