Skip to content

Commit 6ff78ef

Browse files
committed
updated top-level docs for VHDL
1 parent 9cf6cd8 commit 6ff78ef

File tree

7 files changed

+41
-109
lines changed

7 files changed

+41
-109
lines changed

docs/api.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ Exporter API
44
If you are not using the `PeakRDL command-line tool <https://peakrdl.readthedocs.io>`_,
55
you can still generate regblocks programmatically using the exporter API:
66

7-
.. autoclass:: peakrdl_regblock.RegblockExporter
7+
.. autoclass:: peakrdl_regblock_vhdl.RegblockExporter
88
:members:
99

1010
Example
1111
-------
12-
Below is a simple example that demonstrates how to generate a SystemVerilog
12+
Below is a simple example that demonstrates how to generate a VHDL
1313
implementation from SystemRDL source.
1414

1515
.. code-block:: python
1616
:emphasize-lines: 2-4, 29-33
1717
1818
from systemrdl import RDLCompiler, RDLCompileError
19-
from peakrdl_regblock import RegblockExporter
20-
from peakrdl_regblock.cpuif.axi4lite import AXI4Lite_Cpuif
21-
from peakrdl_regblock.udps import ALL_UDPS
19+
from peakrdl_regblock_vhdl import RegblockExporter
20+
from peakrdl_regblock_vhdl.cpuif.axi4lite import AXI4Lite_Cpuif
21+
from peakrdl_regblock_vhdl.udps import ALL_UDPS
2222
2323
input_files = [
2424
"PATH/TO/my_register_block.rdl"
@@ -42,7 +42,7 @@ implementation from SystemRDL source.
4242
# A compilation error occurred. Exit with error code
4343
sys.exit(1)
4444
45-
# Export a SystemVerilog implementation
45+
# Export a VHDL implementation
4646
exporter = RegblockExporter()
4747
exporter.export(
4848
root, "path/to/output_dir",

docs/architecture.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Register Block Architecture
33

44
The generated register block RTL is organized into several sections.
55
Each section is automatically generated based on the source register model and
6-
is rendered into the output register block SystemVerilog RTL.
6+
is rendered into the output register block VHDL RTL.
77

88
.. figure:: diagrams/arch.png
99

docs/configuring.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
.. _peakrdl_cfg:
22

3-
Configuring PeakRDL-regblock
4-
============================
3+
Configuring PeakRDL-regblock-vhdl
4+
=================================
55

66
If using the `PeakRDL command line tool <https://peakrdl.readthedocs.io/>`_,
77
some aspects of the ``regblock`` command have additional configuration options
88
available via the PeakRDL TOML file.
99

10-
All regblock-specific options are defined under the ``[regblock]`` TOML heading.
10+
All VHDL regblock-specific options are defined under the ``[regblock-vhdl]`` TOML heading.
1111

1212
.. data:: cpuifs
1313

@@ -20,7 +20,7 @@ All regblock-specific options are defined under the ``[regblock]`` TOML heading.
2020

2121
.. code-block:: toml
2222
23-
[regblock]
23+
[regblock-vhdl]
2424
cpuifs.my-cpuif-name = "my_cpuif_module:MyCPUInterfaceClass"
2525
2626
@@ -41,5 +41,5 @@ All regblock-specific options are defined under the ``[regblock]`` TOML heading.
4141

4242
.. code-block:: toml
4343
44-
[regblock]
44+
[regblock-vhdl]
4545
default_reset = "arst"

docs/faq.rst

Lines changed: 6 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,33 @@
11
Frequently Asked Questions
22
==========================
33

4-
Why isn't there an option for a flat non-struct hardware interface?
4+
Why isn't there an option for a flat non-record hardware interface?
55
-------------------------------------------------------------------
66
SystemRDL is inherently a very hierarchical language.
77
For small register blocks, flattening the hardware interface may be acceptable,
88
but this ends up scaling very poorly as the design becomes larger and has more
99
complex hierarchy.
10-
Using struct compositions for the hardware interface has the benefit of
10+
Using record compositions for the hardware interface has the benefit of
1111
preserving conceptual hierarchy and arrays exactly as defined in the original
1212
SystemRDL.
1313

14-
How do I know I connected everything? Structs are harder to review
14+
How do I know I connected everything? Records are harder to review
1515
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1616
Initially this can be daunting, but fortunately the tool has an option to generate a
1717
flattened hardware interface report upon export. Try using the ``--hwif-report``
1818
command line option when exporting. This is the easiest way to quickly
1919
understand the structure of the hardware interface.
2020

21-
22-
23-
Why does the tool generate un-packed structs? I prefer packed structs.
24-
----------------------------------------------------------------------
25-
Packed structs are great when describing vectors that have bit-level structure.
26-
In this tool, the use of un-packed structs is intentional since the hardware
27-
interface is not something that is meant to be bit-accessible. In the case of
28-
the hardware interface structs, using a packed struct is semantically inappropriate.
29-
30-
... Then how can I initialize the struct?
31-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32-
We get this request most often because designers want to initialize the ``hwif_in``
33-
struct with a simple assignment:
34-
35-
.. code:: systemverilog
36-
37-
always_comb begin
38-
hwif_in = '0;
39-
end
40-
41-
Of course since the struct actually is **unpacked**, this will result in a
42-
compile error which usually leads to the inappropriate assumption that it ought
43-
to be packed. (See this amusing blog post about `X/Y problems <https://xyproblem.info>`_)
44-
45-
If your goal is to initialize the packed struct, fortunately SystemVerilog already
46-
has syntax to do this:
47-
48-
.. code:: systemverilog
49-
50-
always_comb begin
51-
hwif_in = '{default: '0};
52-
end
53-
54-
This is lesser-known syntax, but still very well supported by synthesis
55-
tools, and is the recommended way to handle this.
56-
57-
... Why are unpacked structs preferred?
58-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
59-
In the case of the hardware interface ports, unpacked structs help prevent
60-
mistakes that are very easy to make.
61-
Consider the following situation - a designer has a field that sets the following
62-
properties: ``sw=rw; hw=rw; we;``, and wants to assign the hardware input value,
63-
so they erroneously do the following assignment in Verilog:
64-
65-
.. code:: systemverilog
66-
67-
assign hwif_in.my_register.my_field = <some value>;
68-
69-
This is actually a bug since the ``my_field`` member is actually a struct that
70-
has two members: ``we`` and ``next``. If this were a packed struct, this would
71-
silently compile and you would potentially have a bug that may not be noticed
72-
(depending on how thorough the test campaign is).
73-
With an unpacked struct, this gets flagged immediately as a compile error since
74-
the assignment is invalid.
75-
76-
The designer may have simply forgotten that the field is an aggregate of multiple
77-
members and intended to do the following:
78-
79-
.. code:: systemverilog
80-
81-
assign hwif.my_register.my_field.next = <some value>;
82-
assign hwif.my_register.my_field.we = <some control signal>;
83-
84-
8521
The generated output does not match our organization's coding style
8622
-------------------------------------------------------------------
87-
SystemVerilog coding styles vary wildly, and unfortunately there is little
23+
VHDL coding styles vary wildly, and unfortunately there is little
8824
consensus on this topic within the digital design community.
8925

90-
The output generated by PeakRDL-regblock strives to be as human-readable as possible,
26+
The output generated by PeakRDL-regblock-vhdl strives to be as human-readable as possible,
9127
and follow consistent indentation and styling. We do our best to use the most
9228
widely accepted coding style, but since this is a very opinionated space, it is
9329
impossible to satisfy everyone.
9430

95-
In general, we strive to follow the
96-
`SystemVerilog style guide by lowRISC <https://github.com/lowRISC/style-guides/blob/master/VerilogCodingStyle.md>`_,
97-
but may deviate in some areas if not practical or would impose excessive complexity on the code generator.
98-
99-
10031
The lint tool I am using is flagging violations in generated code
10132
-----------------------------------------------------------------
10233
Code linting tools are a great way to check for user-error, flag inconsistencies,
@@ -113,5 +44,5 @@ complexity to the tool.
11344

11445
If you encounter a lint violation, please carefully review and consider waiving
11546
it if it does not pose an actual danger. If you still believe it is a problem,
116-
please let us know by `submitting an issue <https://github.com/SystemRDL/PeakRDL-regblock/issues>`_
47+
please let us know by `submitting an issue <https://github.com/SystemRDL/PeakRDL-regblock-vhdl/issues>`_
11748
that describes the problem.

docs/hwif.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@ Hardware Interface
22
------------------
33

44
The generated register block will present the entire hardware interface to the user
5-
using two struct ports:
5+
using two record ports:
66

77
* ``hwif_in``
88
* ``hwif_out``
99

1010
All field inputs and outputs as well as signals are consolidated into these
11-
struct ports. The presence of each depends on the specific contents of the design
11+
record ports. The presence of each depends on the specific contents of the design
1212
being exported.
1313

1414

15-
Using structs for the hardware interface has the following benefits:
15+
Using records for the hardware interface has the following benefits:
1616

1717
* Preserves register map component grouping, arrays, and hierarchy.
1818
* Avoids naming collisions and cumbersome signal name flattening.
1919
* Allows for more natural mapping and distribution of register block signals to a design's hardware components.
20-
* Use of unpacked arrays/structs prevents common assignment mistakes as they are enforced by the compiler.
20+
* Use of arrays/records prevents common assignment mistakes as they are enforced by the compiler.
2121

2222

23-
Structs are organized as follows: ``hwif_out.<heir_path>.<feature>``
23+
Records are organized as follows: ``hwif_out.<heir_path>.<feature>``
2424

2525
For example, a simple design such as:
2626

@@ -36,16 +36,16 @@ For example, a simple design such as:
3636
} my_reg[2];
3737
};
3838
39-
... results in the following struct members:
39+
... results in the following record members:
4040

4141
.. code-block:: text
4242
43-
hwif_out.my_reg[0].my_field.value
44-
hwif_in.my_reg[0].my_field.next
45-
hwif_in.my_reg[0].my_field.we
46-
hwif_out.my_reg[1].my_field.value
47-
hwif_in.my_reg[1].my_field.next
48-
hwif_in.my_reg[1].my_field.we
43+
hwif_out.my_reg(0).my_field.value
44+
hwif_in.my_reg(0).my_field.next_q
45+
hwif_in.my_reg(0).my_field.we
46+
hwif_out.my_reg(1).my_field.value
47+
hwif_in.my_reg(1).my_field.next_q
48+
hwif_in.my_reg(1).my_field.we
4949
5050
For brevity in this documentation, hwif features will be described using shorthand
5151
notation that omits the hierarchical path: ``hwif_out..<feature>``

docs/index.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,17 @@ The easiest way to use PeakRDL-regblock-vhdl is via the `PeakRDL command line t
2222
python3 -m pip install peakrdl-regblock-vhdl[cli]
2323
2424
# Export!
25-
peakrdl regblock atxmega_spi.rdl -o regblock/ --cpuif axi4-lite
25+
peakrdl regblock-vhdl atxmega_spi.rdl -o regblock/ --cpuif axi4-lite
2626
2727
2828
Links
2929
-----
3030

31-
- `Source repository <https://github.com/SystemRDL/PeakRDL-regblock>`_
32-
- `Release Notes <https://github.com/SystemRDL/PeakRDL-regblock/releases>`_
33-
- `Issue tracker <https://github.com/SystemRDL/PeakRDL-regblock/issues>`_
34-
- `PyPi <https://pypi.org/project/peakrdl-regblock>`_
31+
- `Source repository <https://github.com/SystemRDL/PeakRDL-regblock-vhdl>`_
32+
- `Release Notes <https://github.com/SystemRDL/PeakRDL-regblock-vhdl/releases>`_
33+
- `Issue tracker <https://github.com/SystemRDL/PeakRDL-regblock-vhdl/issues>`_
34+
- `PyPi <https://pypi.org/project/peakrdl-regblock-vhdl>`_
35+
- `SystemVerilog Exporter <https://github.com/SystemRDL/PeakRDL-regblock>`_
3536
- `SystemRDL Specification <http://accellera.org/downloads/standards/systemrdl>`_
3637

3738

docs/licensing.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Licensing
22
=========
33

4-
Re-distribution of the PeakRDL-regblock code generator tool shall adhere to the
4+
Re-distribution of the PeakRDL-regblock-vhdl code generator tool shall adhere to the
55
terms outlined by the GNU GPL v3 license. For a copy of the license, see:
6-
https://github.com/SystemRDL/PeakRDL-regblock/blob/main/LICENSE
6+
https://github.com/SystemRDL/PeakRDL-regblock-vhdl/blob/main/LICENSE
77

88

99
Why GPL?
@@ -23,19 +23,19 @@ explicitly mentioned in the exemptions below.
2323

2424
What is exempt from the GPL v3 license?
2525
---------------------------------------
26-
Don't worry. Not everything that the PeakRDL-regblock project touches is
26+
Don't worry. Not everything that the PeakRDL-regblock-vhdl project touches is
2727
considered GPL v3 code.
2828

2929
The following are exempt and are free to use with no restrictions:
3030

31-
* Any code that is generated using PeakRDL-regblock is 100% yours. Since it
31+
* Any code that is generated using PeakRDL-regblock-vhdl is 100% yours. Since it
3232
was derived from your regblock definition, it remains yours. You can
3333
distribute it freely, use it in a proprietary ASIC, sell it as part of an
3434
IP, whatever.
3535
* Any code snippets in this documentation can be freely copy/pasted. These are
3636
examples that are intended for this purpose.
3737
* All reference files that are downloadable from this documentation, which are
38-
also available in the `hdl-src folder in the repository <https://github.com/SystemRDL/PeakRDL-regblock/tree/main/hdl-src>`_
38+
also available in the `hdl-src folder in the repository <https://github.com/SystemRDL/PeakRDL-regblock-vhdl/tree/main/hdl-src>`_
3939

4040

4141
Can I use this as part of my company's internally developed tools?

0 commit comments

Comments
 (0)