"sphinx.ext.intersphinx",
"sphinx.ext.doctest",
"sphinx.ext.todo",
+ "sphinx.ext.autodoc",
+ "sphinx.ext.napoleon",
"sphinx_rtd_theme",
"sphinxcontrib.platformpicker",
]
todo_include_todos = True
+napoleon_google_docstring = False
+napoleon_numpy_docstring = True
+napoleon_use_ivar = True
+
html_theme = "sphinx_rtd_theme"
html_static_path = ["_static"]
html_css_files = ["custom.css"]
start
tutorial
lang
+ stdlib
--- /dev/null
+Standard library
+################
+
+.. todo::
+
+ Write this section.
+
+.. toctree::
+ :maxdepth: 2
+
+ stdlib/coding
--- /dev/null
+Code conversion
+###############
+
+.. py:module:: nmigen.lib.coding
+
+The ``nmigen.lib.coding`` package provides modules for conversion between different encodings of binary numbers.
+
+
+One-hot coding
+==============
+
+.. autoclass:: Encoder()
+.. autoclass:: Decoder()
+
+
+Priority coding
+===============
+
+.. autoclass:: PriorityEncoder()
+.. autoclass:: PriorityDecoder()
+
+
+Gray coding
+===========
+
+.. autoclass:: GrayEncoder()
+.. autoclass:: GrayDecoder()
-"""Encoders and decoders between binary and one-hot representation."""
-
from .. import *
i : Signal(width), in
One-hot input.
o : Signal(range(width)), out
- Encoded binary.
+ Encoded natural binary.
n : Signal, out
Invalid: either none or multiple input bits are asserted.
"""
i : Signal(width), in
Input requests.
o : Signal(range(width)), out
- Encoded binary.
+ Encoded natural binary.
n : Signal, out
Invalid: no input bits are asserted.
"""
class Decoder(Elaboratable):
"""Decode binary to one-hot.
- If ``n`` is low, only the ``i``th bit in ``o`` is asserted.
+ If ``n`` is low, only the ``i``-th bit in ``o`` is asserted.
If ``n`` is high, ``o`` is ``0``.
Parameters
Attributes
----------
i : Signal(width), in
- Input natural binary.
+ Natural binary input.
o : Signal(width), out
Encoded Gray code.
"""
Attributes
----------
i : Signal(width), in
- Input Gray code.
+ Gray code input.
o : Signal(width), out
Decoded natural binary.
"""