3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-06-06 14:13:23 +00:00

docs/util: Cells now have properties

Properties are both an option:
```
.. cell:def:: $add
   :properties: is_evaluable
```
and a field:
```
.. cell:def:: $eqx

   :property x-aware:
   :property is_evaluable:
```

Properties as an option appear in the property index: linking a given property to all cells with that property; while properties as a field display with the cell.
This commit is contained in:
Krystine Sherwin 2024-09-06 15:17:51 +12:00
parent e3d939b719
commit ce6a7fe4fc
No known key found for this signature in database
2 changed files with 184 additions and 21 deletions

View file

@ -33,7 +33,7 @@ class YosysCell:
code: str
inputs: list[str]
outputs: list[str]
properties: dict[str, bool]
properties: list[str]
class YosysCellGroupDocumenter(Documenter):
objtype = 'cellgroup'
@ -298,11 +298,22 @@ class YosysCellDocumenter(YosysCellGroupDocumenter):
self.add_line(f'.. {domain}:{directive}:: {sig}', sourcename)
# options
opt_attrs = ["title", ]
opt_attrs = ["title", "properties", ]
for attr in opt_attrs:
val = getattr(cell, attr, None)
if isinstance(val, list):
val = ' '.join(val)
if val:
self.add_line(f' :{attr}: {val}', sourcename)
self.add_line('\n', sourcename)
# fields
field_attrs = ["properties", ]
for field in field_attrs:
attr = getattr(cell, field, [])
for val in attr:
self.add_line(f' :{field} {val}:', sourcename)
if self.options.noindex:
self.add_line(' :noindex:', sourcename)