Currently, all Boolean variables are stored in the pyeda.boolalg.boolfunc.VARIABLESdict. The idea is to make interactive usage easy by globally returning the same variable instance given an identical name and index. For example: id(exprvar('x', 0)) == id(exprvar('x', 0)).
In order to support a modular design style, we need the ability to bind the dict of variable instances to a single module instance in a larger design.
First requirement is a Module base class. Define a new module by extending this class:
class Module:
def __init__(self, name, **params):
self.name = name
self.params = params
class RippleCarryAdder(Module):
def __init__(self, width=8):
...
# TODO: define inputs, outputs, submodules
# TODO: define elaborate protocol
To instantiate: rca = RippleCarryAdder('rca0', width=8). This performs elaboration without any additional steps.
Currently, all Boolean variables are stored in the
pyeda.boolalg.boolfunc.VARIABLES
dict
. The idea is to make interactive usage easy by globally returning the same variable instance given an identical name and index. For example:id(exprvar('x', 0)) == id(exprvar('x', 0))
.In order to support a modular design style, we need the ability to bind the
dict
of variable instances to a single module instance in a larger design.First requirement is a
Module
base class. Define a new module by extending this class:To instantiate:
rca = RippleCarryAdder('rca0', width=8)
. This performs elaboration without any additional steps.