Skip to content

Commit b8dafaa

Browse files
committed
Make all top-level pyrtl names canonical, and stop using submodule names.
This makes the documentation consistently use top-level names like `pyrtl.WireVector`, instead of submodule-level names like `pyrtl.wire.WireVector`. This also updates `examples` and `tests` to consistently use the canonical top-level names. Users should not be aware of pyrtl's submodule structure. For example, users should not know or care that `mux` is a `corecircuit` and not a `helperfunc`.
1 parent 685eaa4 commit b8dafaa

32 files changed

+594
-603
lines changed

CHANGELOG.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
### Added
1212

1313
- An optimization pass to [optimize inverter chains](https://github.com/UCSBarchlab/PyRTL/blob/d5f8dbe53f54e61e1d54722449e4894b885243c7/pyrtl/passes.py#L130)
14-
- `one_hot_to_binary` encoder ([documentation](https://pyrtl.readthedocs.io/en/latest/helpers.html#pyrtl.helperfuncs.one_hot_to_binary))
15-
- `binary_to_one_hot` decoder ([documentation](https://pyrtl.readthedocs.io/en/latest/helpers.html#pyrtl.helperfuncs.binary_to_one_hot))
14+
- `one_hot_to_binary` encoder ([documentation](https://pyrtl.readthedocs.io/en/latest/helpers.html#pyrtl.one_hot_to_binary))
15+
- `binary_to_one_hot` decoder ([documentation](https://pyrtl.readthedocs.io/en/latest/helpers.html#pyrtl.binary_to_one_hot))
1616

1717
### Changed
1818

@@ -31,7 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3131
### Added
3232

3333
- Added an `initialize_registers` option to `output_to_verilog`
34-
([documentation](https://pyrtl.readthedocs.io/en/latest/export.html#pyrtl.importexport.output_to_verilog))
34+
([documentation](https://pyrtl.readthedocs.io/en/latest/export.html#pyrtl.output_to_verilog))
3535

3636
### Changed
3737

@@ -46,8 +46,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4646
### Added
4747

4848
- Named `WireVector` slices with `wire_struct` and `wire_matrix`. See documentation:
49-
- [wire_struct](https://pyrtl.readthedocs.io/en/latest/helpers.html#pyrtl.helperfuncs.wire_struct)
50-
- [wire_matrix](https://pyrtl.readthedocs.io/en/latest/helpers.html#pyrtl.helperfuncs.wire_matrix)
49+
- [wire_struct](https://pyrtl.readthedocs.io/en/latest/helpers.html#pyrtl.wire_struct)
50+
- [wire_matrix](https://pyrtl.readthedocs.io/en/latest/helpers.html#pyrtl.wire_matrix)
5151

5252
### Changed
5353

docs/analysis.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,23 @@ Estimation
1616
Optimization
1717
------------
1818

19-
.. autofunction:: pyrtl.passes.optimize
19+
.. autofunction:: pyrtl.optimize
2020

2121
Synthesis
2222
---------
2323

24-
.. autofunction:: pyrtl.passes.synthesize
24+
.. autofunction:: pyrtl.synthesize
2525

26-
.. autoclass:: pyrtl.core.PostSynthBlock
26+
.. autoclass:: pyrtl.PostSynthBlock
2727
:show-inheritance:
2828
:members:
2929

3030
Individual Passes
3131
-----------------
3232

33-
.. autofunction:: pyrtl.passes.common_subexp_elimination
34-
.. autofunction:: pyrtl.passes.constant_propagation
35-
.. autofunction:: pyrtl.passes.nand_synth
36-
.. autofunction:: pyrtl.passes.and_inverter_synth
37-
.. autofunction:: pyrtl.passes.one_bit_selects
38-
.. autofunction:: pyrtl.passes.two_way_concat
33+
.. autofunction:: pyrtl.common_subexp_elimination
34+
.. autofunction:: pyrtl.constant_propagation
35+
.. autofunction:: pyrtl.nand_synth
36+
.. autofunction:: pyrtl.and_inverter_synth
37+
.. autofunction:: pyrtl.one_bit_selects
38+
.. autofunction:: pyrtl.two_way_concat

docs/basic.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ the design. :class:`.Const` is useful for specifying hard-wired values and
1818
:class:`.Register` is how sequential elements are created (they all have an
1919
implicit clock).
2020

21-
.. inheritance-diagram:: pyrtl.wire.WireVector
22-
pyrtl.wire.Input
23-
pyrtl.wire.Output
24-
pyrtl.wire.Const
25-
pyrtl.wire.Register
21+
.. inheritance-diagram:: pyrtl.WireVector
22+
pyrtl.Input
23+
pyrtl.Output
24+
pyrtl.Const
25+
pyrtl.Register
2626
:parts: 1
2727

2828
WireVector
2929
----------
3030

31-
.. autoclass:: pyrtl.wire.WireVector
31+
.. autoclass:: pyrtl.WireVector
3232
:members:
3333
:special-members: __init__, __add__, __sub__, __mul__, __getitem___,
3434
__len__, __ilshift__, __and__, __or__, __xor__, __lt__,
@@ -37,21 +37,21 @@ WireVector
3737
Input Pins
3838
----------
3939

40-
.. autoclass:: pyrtl.wire.Input
40+
.. autoclass:: pyrtl.Input
4141
:members:
4242
:show-inheritance:
4343

4444
Output Pins
4545
-----------
4646

47-
.. autoclass:: pyrtl.wire.Output
47+
.. autoclass:: pyrtl.Output
4848
:members:
4949
:show-inheritance:
5050

5151
Constants
5252
---------
5353

54-
.. autoclass:: pyrtl.wire.Const
54+
.. autoclass:: pyrtl.Const
5555
:members:
5656
:show-inheritance:
5757
:special-members: __init__

docs/blocks.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Block and Logic Nets
44
Blocks
55
------
66

7-
.. autoclass:: pyrtl.core.Block
7+
.. autoclass:: pyrtl.Block
88
:members:
99
:exclude-members: sanity_check_memblock, sanity_check_memory_sync, sanity_check_net, sanity_check_wirevector
1010

@@ -16,17 +16,17 @@ Blocks
1616
Most PyRTL operations operate on the global ``working_block`` by default. PyRTL
1717
provides several functions to inspect and manipulate the ``working_block``:
1818

19-
.. autofunction:: pyrtl.core.working_block
19+
.. autofunction:: pyrtl.working_block
2020

21-
.. autofunction:: pyrtl.core.reset_working_block
21+
.. autofunction:: pyrtl.reset_working_block
2222

23-
.. autofunction:: pyrtl.core.set_working_block
23+
.. autofunction:: pyrtl.set_working_block
2424

25-
.. autofunction:: pyrtl.core.temp_working_block
25+
.. autofunction:: pyrtl.temp_working_block
2626

2727
LogicNets
2828
---------
2929

30-
.. autoclass:: pyrtl.core.LogicNet
30+
.. autoclass:: pyrtl.LogicNet
3131
:members:
3232
:undoc-members:

docs/export.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,29 @@ Exporting and Importing Designs
44
Exporting Hardware Designs
55
--------------------------
66

7-
.. autofunction:: pyrtl.importexport.output_to_verilog
7+
.. autofunction:: pyrtl.output_to_verilog
88

9-
.. autofunction:: pyrtl.importexport.output_to_firrtl
9+
.. autofunction:: pyrtl.output_to_firrtl
1010

1111
Exporting Testbenches
1212
---------------------
1313

14-
.. autofunction:: pyrtl.importexport.output_verilog_testbench
14+
.. autofunction:: pyrtl.output_verilog_testbench
1515

1616
Importing Verilog
1717
-----------------
1818

19-
.. autofunction:: pyrtl.importexport.input_from_blif
20-
.. autofunction:: pyrtl.importexport.input_from_verilog
19+
.. autofunction:: pyrtl.input_from_blif
20+
.. autofunction:: pyrtl.input_from_verilog
2121

2222
Outputting for Visualization
2323
----------------------------
2424

25-
.. autofunction:: pyrtl.visualization.output_to_trivialgraph
26-
.. autofunction:: pyrtl.visualization.output_to_graphviz
27-
.. autofunction:: pyrtl.visualization.graphviz_detailed_namer
28-
.. autofunction:: pyrtl.visualization.output_to_svg
29-
.. autofunction:: pyrtl.visualization.block_to_graphviz_string
30-
.. autofunction:: pyrtl.visualization.block_to_svg
31-
.. autofunction:: pyrtl.visualization.trace_to_html
32-
.. autofunction:: pyrtl.visualization.net_graph
25+
.. autofunction:: pyrtl.output_to_trivialgraph
26+
.. autofunction:: pyrtl.output_to_graphviz
27+
.. autofunction:: pyrtl.graphviz_detailed_namer
28+
.. autofunction:: pyrtl.output_to_svg
29+
.. autofunction:: pyrtl.block_to_graphviz_string
30+
.. autofunction:: pyrtl.block_to_svg
31+
.. autofunction:: pyrtl.trace_to_html
32+
.. autofunction:: pyrtl.net_graph

docs/helpers.rst

Lines changed: 44 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,19 @@ Cutting and Extending WireVectors
66

77
The functions below provide ways of combining, slicing, and extending
88
:class:`WireVectors<.WireVector>` in ways that are often useful in hardware
9-
design. The functions below extend those member functions of the
9+
design. The functions below extend those member functions of the
1010
:class:`.WireVector` class itself (which provides support for the Python
1111
builtin :func:`len`, slicing e.g. ``wire[3:6]``,
12-
:meth:`~pyrtl.wire.WireVector.zero_extended`,
13-
:meth:`~pyrtl.wire.WireVector.sign_extended`, and many operators such as
14-
addition and multiplication).
15-
16-
.. autofunction:: pyrtl.corecircuits.concat
17-
.. autofunction:: pyrtl.corecircuits.concat_list
18-
.. autofunction:: pyrtl.corecircuits.match_bitwidth
19-
.. autofunction:: pyrtl.helperfuncs.truncate
20-
.. autofunction:: pyrtl.helperfuncs.chop
21-
.. autofunction:: pyrtl.helperfuncs.wire_struct
22-
.. autofunction:: pyrtl.helperfuncs.wire_matrix
12+
:meth:`~.WireVector.zero_extended`, :meth:`~.WireVector.sign_extended`, and
13+
many operators such as addition and multiplication).
14+
15+
.. autofunction:: pyrtl.concat
16+
.. autofunction:: pyrtl.concat_list
17+
.. autofunction:: pyrtl.match_bitwidth
18+
.. autofunction:: pyrtl.truncate
19+
.. autofunction:: pyrtl.chop
20+
.. autofunction:: pyrtl.wire_struct
21+
.. autofunction:: pyrtl.wire_matrix
2322

2423
Coercion to WireVector
2524
----------------------
@@ -32,19 +31,19 @@ hardware development.
3231

3332
See :ref:`wirevector_coercion` for examples and more details.
3433

35-
.. autofunction:: pyrtl.corecircuits.as_wires
34+
.. autofunction:: pyrtl.as_wires
3635

3736
Control Flow Hardware
3837
---------------------
3938

40-
.. autofunction:: pyrtl.corecircuits.mux
41-
.. autofunction:: pyrtl.corecircuits.select
39+
.. autofunction:: pyrtl.mux
40+
.. autofunction:: pyrtl.select
4241
.. autoclass:: pyrtl.helperfuncs.MatchedFields
4342
:members:
4443
:undoc-members:
45-
.. autofunction:: pyrtl.helperfuncs.match_bitpattern
46-
.. autofunction:: pyrtl.corecircuits.bitfield_update
47-
.. autofunction:: pyrtl.corecircuits.bitfield_update_set
44+
.. autofunction:: pyrtl.match_bitpattern
45+
.. autofunction:: pyrtl.bitfield_update
46+
.. autofunction:: pyrtl.bitfield_update_set
4847

4948
Interpreting Vectors of Bits
5049
----------------------------
@@ -56,30 +55,30 @@ values into their corresponding bit vectors, can both be a bit of a pain. The
5655
functions below do not create any hardware but rather help in the process of
5756
reasoning about bit vector representations of human understandable values.
5857

59-
.. autofunction:: pyrtl.helperfuncs.val_to_signed_integer
58+
.. autofunction:: pyrtl.val_to_signed_integer
6059
.. autoclass:: pyrtl.helperfuncs.ValueBitwidthTuple
6160
:members: value, bitwidth
62-
.. autofunction:: pyrtl.helperfuncs.infer_val_and_bitwidth
63-
.. autofunction:: pyrtl.helperfuncs.val_to_formatted_str
64-
.. autofunction:: pyrtl.helperfuncs.formatted_str_to_val
65-
.. autofunction:: pyrtl.helperfuncs.log2
61+
.. autofunction:: pyrtl.infer_val_and_bitwidth
62+
.. autofunction:: pyrtl.val_to_formatted_str
63+
.. autofunction:: pyrtl.formatted_str_to_val
64+
.. autofunction:: pyrtl.log2
6665

6766
Debugging
6867
---------
6968

70-
.. autofunction:: pyrtl.core.set_debug_mode
71-
.. autofunction:: pyrtl.helperfuncs.probe
72-
.. autofunction:: pyrtl.helperfuncs.rtl_assert
69+
.. autofunction:: pyrtl.set_debug_mode
70+
.. autofunction:: pyrtl.probe
71+
.. autofunction:: pyrtl.rtl_assert
7372

7473
Reductions
7574
----------
7675

77-
.. autofunction:: pyrtl.corecircuits.and_all_bits
78-
.. autofunction:: pyrtl.corecircuits.or_all_bits
79-
.. autofunction:: pyrtl.corecircuits.xor_all_bits
80-
.. autofunction:: pyrtl.corecircuits.parity
81-
.. autofunction:: pyrtl.corecircuits.rtl_any
82-
.. autofunction:: pyrtl.corecircuits.rtl_all
76+
.. autofunction:: pyrtl.and_all_bits
77+
.. autofunction:: pyrtl.or_all_bits
78+
.. autofunction:: pyrtl.xor_all_bits
79+
.. autofunction:: pyrtl.parity
80+
.. autofunction:: pyrtl.rtl_any
81+
.. autofunction:: pyrtl.rtl_all
8382

8483
.. _extended_logic_and_arithmetic:
8584

@@ -92,20 +91,20 @@ design. The functions below extend those member functions of the
9291
:class:`.WireVector` class itself (which provides support for unsigned
9392
addition, subtraction, multiplication, comparison, and many others).
9493

95-
.. autofunction:: pyrtl.corecircuits.signed_add
96-
.. autofunction:: pyrtl.corecircuits.signed_sub
97-
.. autofunction:: pyrtl.corecircuits.signed_mult
98-
.. autofunction:: pyrtl.corecircuits.signed_lt
99-
.. autofunction:: pyrtl.corecircuits.signed_le
100-
.. autofunction:: pyrtl.corecircuits.signed_gt
101-
.. autofunction:: pyrtl.corecircuits.signed_ge
102-
.. autofunction:: pyrtl.corecircuits.shift_left_logical
103-
.. autofunction:: pyrtl.corecircuits.shift_left_arithmetic
104-
.. autofunction:: pyrtl.corecircuits.shift_right_logical
105-
.. autofunction:: pyrtl.corecircuits.shift_right_arithmetic
94+
.. autofunction:: pyrtl.signed_add
95+
.. autofunction:: pyrtl.signed_sub
96+
.. autofunction:: pyrtl.signed_mult
97+
.. autofunction:: pyrtl.signed_lt
98+
.. autofunction:: pyrtl.signed_le
99+
.. autofunction:: pyrtl.signed_gt
100+
.. autofunction:: pyrtl.signed_ge
101+
.. autofunction:: pyrtl.shift_left_logical
102+
.. autofunction:: pyrtl.shift_left_arithmetic
103+
.. autofunction:: pyrtl.shift_right_logical
104+
.. autofunction:: pyrtl.shift_right_arithmetic
106105

107106
Encoders and Decoders
108107
---------------------
109108

110-
.. autofunction:: pyrtl.helperfuncs.one_hot_to_binary
111-
.. autofunction:: pyrtl.helperfuncs.binary_to_one_hot
109+
.. autofunction:: pyrtl.one_hot_to_binary
110+
.. autofunction:: pyrtl.binary_to_one_hot

docs/index.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ overloaded operations such as :meth:`~.WireVector.__add__` or
8686
derived from :class:`.WireVector`. Coupled with :class:`.MemBlock` (and
8787
:class:`.RomBlock`), this is all a user needs to create a functional hardware design.
8888

89-
.. inheritance-diagram:: pyrtl.wire.WireVector
90-
pyrtl.wire.Input
91-
pyrtl.wire.Output
92-
pyrtl.wire.Const
93-
pyrtl.wire.Register
89+
.. inheritance-diagram:: pyrtl.WireVector
90+
pyrtl.Input
91+
pyrtl.Output
92+
pyrtl.Const
93+
pyrtl.Register
9494
:parts: 1
9595

9696
After specifying a hardware design, there are then options to simulate your
@@ -141,10 +141,10 @@ internal invariants and assertions over the core logic graph which should never
141141
encountered when constructing designs in the normal ways. If you hit a confusing
142142
:class:`.PyrtlError` or any :class:`.PyrtlInternalError` feel free to file an issue.
143143

144-
.. autoclass:: pyrtl.pyrtlexceptions.PyrtlError
144+
.. autoclass:: pyrtl.PyrtlError
145145
:members:
146146

147-
.. autoclass:: pyrtl.pyrtlexceptions.PyrtlInternalError
147+
.. autoclass:: pyrtl.PyrtlInternalError
148148
:members:
149149

150150
Reference Guide

docs/regmem.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@ Registers and Memories
44
Registers
55
---------
66

7-
.. autoclass:: pyrtl.wire.Register
7+
.. autoclass:: pyrtl.Register
88
:members:
99
:show-inheritance:
1010
:special-members: __init__
1111

1212
Memories
1313
--------
1414

15-
.. autoclass:: pyrtl.memory.MemBlock
15+
.. autoclass:: pyrtl.MemBlock
1616
:members:
1717
:special-members: __init__, __getitem__, __setitem__
1818

1919
ROMs
2020
----
2121

22-
.. autoclass:: pyrtl.memory.RomBlock
22+
.. autoclass:: pyrtl.RomBlock
2323
:members:
2424
:show-inheritance:
2525
:special-members: __init__, __getitem__

0 commit comments

Comments
 (0)