Module Testbench
Testbench Module.
ATbMod
Bases: BaseMod
Testbench Module.
Attributes:
| Name | Type | Description |
|---|---|---|
filelists |
ModFileLists
|
File Lists. |
dut_mods |
tuple[Any, ...]
|
Testbench is limited to these kind of modules. |
title |
str
|
Title. |
dut |
BaseMod
|
Module Under Test. |
parent |
BaseMod | None
|
Parent. |
Create testbench for dut.
The TopModRef and load() function allow to wrap any design module with a testbench.
Module Testbench Examples
Example:
>>> import ucdp as u
>>> class MyMod(u.AMod):
...
... def _build(self):
... self.add_port(u.UintType(4), "data_i")
... self.add_port(u.UintType(4), "data_o")
...
>>> class OtherMod(u.AMod):
...
... def _build(self):
... self.add_port(u.UintType(4), "data_i")
... self.add_port(u.UintType(4), "data_o")
...
>>> class GenTbMod(u.ATbMod):
...
... def _build(self):
... # Build testbench for self.dut here
... pass
...
... @staticmethod
... def build_dut():
... return MyMod()
>>> tb = GenTbMod()
>>> tb
<ucdp.modtb.GenTbMod(inst='gen_tb_my', libname='ucdp', modname='gen_tb_my', dut=<ucdp.modtb.MyMod(...)>)>
>>> tb.dut
<ucdp.modtb.MyMod(inst='my', libname='ucdp', modname='my')>
>>> tb = GenTbMod(OtherMod())
>>> tb
<ucdp.modtb.GenTbMod(inst='gen_tb_other', libname='ucdp', modname='...', dut=<ucdp.modtb.OtherMod(...)>)>
>>> tb.dut
<ucdp.modtb.OtherMod(inst='other', libname='ucdp', modname='other')>
TopModRef and load() handle that gracefully and allow pairing of testbench and dut on command line and in configuration files.
search_duts
classmethod
Iterate over topmod and return modules which can be tested by this testbench.
search_dut_topmodrefs
classmethod
Iterate over topmod and return TopModRef for modules which can be tested by this testbench.
AGenericTbMod
Bases: ATbMod
A Generic Testbench which adapts to dut.