MyHDL

Monitoring Signal variable outside a class realtime

Hello,

Lets say i have a class with a method:

class TestBlk():
   def block_connect(self, reset, clk, stimulus):
     test=Signal(bool(1))

My testbench needs to monitor the signal changes of the variable test from outside this class and inject some stimulus.
How can i access the variable test from outside this class to monitor the signal changes ? Is it possible?

Thank you

Your question looks like it is more a Python problem than a MyHDL problem. Right ?

yes, in fact i think it is a python problem. Iā€™m a bit new to python, hence the query. Is there any solution to this currently ? With system verilog i think there is a possibility to access signals inside a hierarchical module with a ā€˜.ā€™ operator. This makes it monitoring hierarchial signals from testbenches very easy.

class TestBlk():
    def __init__(self):
        self.test = Signal(bool(1))

   def block_connect(self, reset, clk, stimulus):
1 Like

Thank you, it works!