Skip to content

Commit

Permalink
Docs: Preliminary autocellgroup usage
Browse files Browse the repository at this point in the history
Remove `/source/cell` from .gitignore.
Add a few initial cell pages.
Add YosysCellGroup documenter and cell:group directive.
Update Documenters to use nested json.
Better nested tocs for group.module.source layout.
  • Loading branch information
KrystalDelusion committed May 21, 2024
1 parent f21b579 commit 65f7cbc
Show file tree
Hide file tree
Showing 9 changed files with 331 additions and 130 deletions.
1 change: 0 additions & 1 deletion docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/build/
/source/cmd
/source/cell
/source/generated
/source/_images/**/*.log
/source/_images/**/*.aux
Expand Down
5 changes: 5 additions & 0 deletions docs/source/cell/gate_other.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.. autocellgroup:: gate_other
:caption: Other gate-level cells
:members:
:source:
:linenos:
5 changes: 5 additions & 0 deletions docs/source/cell/word_other.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.. autocellgroup:: word_other
:caption: Other word-level cells
:members:
:source:
:linenos:
50 changes: 50 additions & 0 deletions docs/source/cell/word_unary.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
.. role:: verilog(code)
:language: Verilog

Unary operators
---------------

All unary RTL cells have one input port ``A`` and one output port ``Y``. They
also have the following parameters:

``A_SIGNED``
Set to a non-zero value if the input ``A`` is signed and therefore should be
sign-extended when needed.

``A_WIDTH``
The width of the input port ``A``.

``Y_WIDTH``
The width of the output port ``Y``.

.. table:: Cell types for unary operators with their corresponding Verilog expressions.

================== ==============
Verilog Cell Type
================== ==============
:verilog:`Y = ~A` `$not`
:verilog:`Y = +A` `$pos`
:verilog:`Y = -A` `$neg`
:verilog:`Y = &A` `$reduce_and`
:verilog:`Y = |A` `$reduce_or`
:verilog:`Y = ^A` `$reduce_xor`
:verilog:`Y = ~^A` `$reduce_xnor`
:verilog:`Y = |A` `$reduce_bool`
:verilog:`Y = !A` `$logic_not`
================== ==============

For the unary cells that output a logical value (`$reduce_and`, `$reduce_or`,
`$reduce_xor`, `$reduce_xnor`, `$reduce_bool`, `$logic_not`), when the
``Y_WIDTH`` parameter is greater than 1, the output is zero-extended, and only
the least significant bit varies.

Note that `$reduce_or` and `$reduce_bool` actually represent the same logic
function. But the HDL frontends generate them in different situations. A
`$reduce_or` cell is generated when the prefix ``|`` operator is being used. A
`$reduce_bool` cell is generated when a bit vector is used as a condition in an
``if``-statement or ``?:``-expression.

.. autocellgroup:: unary
:members:
:source:
:linenos:
5 changes: 2 additions & 3 deletions docs/source/cell_gate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ Gate-level cells

.. toctree::
:caption: Gate-level cells
:maxdepth: 1
:glob:
:maxdepth: 2

/cell/gate_*
/cell/gate_other
6 changes: 3 additions & 3 deletions docs/source/cell_word.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ Word-level cells
----------------

.. toctree::
:caption: Word-level cells
:maxdepth: 1
:maxdepth: 2
:glob:

/cell/word_*
/cell/word_unary
/cell/word_other
Loading

0 comments on commit 65f7cbc

Please sign in to comment.