Skip to content

Commit c40a8f5

Browse files
committed
amaranth.hdl: start all private names with an underscore.
This change follows the reference documentation effort. Fixes #781.
1 parent e88ff13 commit c40a8f5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+4526
-4373
lines changed

amaranth/asserts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from .hdl.ast import AnyConst, AnySeq, Initial, Assert, Assume, Cover
1+
from .hdl._ast import AnyConst, AnySeq, Initial, Assert, Assume, Cover
22

33

44
__all__ = ["AnyConst", "AnySeq", "Initial", "Assert", "Assume", "Cover"]

amaranth/back/rtlil.py

Lines changed: 70 additions & 70 deletions
Large diffs are not rendered by default.

amaranth/back/verilog.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from .._toolchain.yosys import *
2-
from ..hdl import ast, ir
2+
from ..hdl import _ast, _ir
33
from ..lib import wiring
44
from . import rtlil
55

@@ -49,12 +49,12 @@ def convert(elaboratable, name="top", platform=None, *, ports=None, emit_src=Tru
4949
isinstance(elaboratable.signature, wiring.Signature)):
5050
ports = []
5151
for path, member, value in elaboratable.signature.flatten(elaboratable):
52-
if isinstance(value, ast.ValueCastable):
52+
if isinstance(value, _ast.ValueCastable):
5353
value = value.as_value()
54-
if isinstance(value, ast.Value):
54+
if isinstance(value, _ast.Value):
5555
ports.append(value)
5656
elif ports is None:
5757
raise TypeError("The `convert()` function requires a `ports=` argument")
58-
fragment = ir.Fragment.get(elaboratable, platform).prepare(ports=ports, **kwargs)
58+
fragment = _ir.Fragment.get(elaboratable, platform).prepare(ports=ports, **kwargs)
5959
verilog_text, name_map = convert_fragment(fragment, name, emit_src=emit_src, strip_internal_attrs=strip_internal_attrs)
6060
return verilog_text

amaranth/build/plat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from .. import __version__
1010
from .._toolchain import *
1111
from ..hdl import *
12-
from ..hdl.xfrm import DomainLowerer
12+
from ..hdl._xfrm import DomainLowerer
1313
from ..lib.cdc import ResetSynchronizer
1414
from ..back import rtlil, verilog
1515
from .res import *

amaranth/build/res.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from collections import OrderedDict
22
import warnings
33

4-
from ..hdl.ast import *
4+
from ..hdl._ast import *
55
with warnings.catch_warnings():
66
warnings.filterwarnings(action="ignore", category=DeprecationWarning)
77
from ..hdl.rec import *

amaranth/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import argparse
22

3-
from .hdl.ir import Fragment
3+
from .hdl._ir import Fragment
44
from .back import rtlil, cxxrtl, verilog
55
from .sim import Simulator
66

amaranth/hdl/__init__.py

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,29 @@
1-
import warnings
2-
3-
from .ast import Shape, unsigned, signed
4-
from .ast import Value, Const, C, Mux, Cat, Repl, Array, Signal, ClockSignal, ResetSignal
5-
from .dsl import Module
6-
from .cd import ClockDomain
7-
from .ir import Elaboratable, Fragment, Instance
8-
from .mem import Memory
9-
with warnings.catch_warnings():
10-
warnings.filterwarnings(action="ignore", category=DeprecationWarning)
11-
from .rec import Record
12-
from .xfrm import DomainRenamer, ResetInserter, EnableInserter
1+
from ._ast import Shape, unsigned, signed, ShapeCastable, ShapeLike
2+
from ._ast import Value, ValueCastable, ValueLike
3+
from ._ast import Const, C, Mux, Cat, Repl, Array, Signal, ClockSignal, ResetSignal
4+
from ._dsl import SyntaxError, SyntaxWarning, Module
5+
from ._cd import DomainError, ClockDomain
6+
from ._ir import UnusedElaboratable, Elaboratable, DriverConflict, Fragment, Instance
7+
from ._mem import Memory, ReadPort, WritePort, DummyPort
8+
from ._rec import Record
9+
from ._xfrm import DomainRenamer, ResetInserter, EnableInserter
1310

1411

1512
__all__ = [
16-
"Shape", "unsigned", "signed",
17-
"Value", "Const", "C", "Mux", "Cat", "Repl", "Array", "Signal", "ClockSignal", "ResetSignal",
18-
"Module",
19-
"ClockDomain",
20-
"Elaboratable", "Fragment", "Instance",
21-
"Memory",
13+
# _ast
14+
"Shape", "unsigned", "signed", "ShapeCastable", "ShapeLike",
15+
"Value", "ValueCastable", "ValueLike",
16+
"Const", "C", "Mux", "Cat", "Repl", "Array", "Signal", "ClockSignal", "ResetSignal",
17+
# _dsl
18+
"SyntaxError", "SyntaxWarning", "Module",
19+
# _cd
20+
"DomainError", "ClockDomain",
21+
# _ir
22+
"UnusedElaboratable", "Elaboratable", "DriverConflict", "Fragment", "Instance",
23+
# _mem
24+
"Memory", "ReadPort", "WritePort", "DummyPort",
25+
# _rec
2226
"Record",
27+
# _xfrm
2328
"DomainRenamer", "ResetInserter", "EnableInserter",
2429
]

0 commit comments

Comments
 (0)