This is an example of using the Magma debugger mdb.


In [1]:
import magma as m
from magma.simulator.mdb import simulate

The output of the following cell is a snapshot of the interactive session. The lines with >>> correspond to input from the user.


In [2]:
from mantle import Counter

main = m.DefineCircuit('main', "O", m.Out(m.Bits[2]), "COUT", m.Out(m.Bit), "CLK", m.In(m.Clock))
counter = Counter(2)
m.wire(counter.O, main.O)
m.wire(counter.COUT, main.COUT)

simulate(main) # simulator requires a Circuit Definition


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-d8c50e8d0367> in <module>
      6 m.wire(counter.COUT, main.COUT)
      7 
----> 8 simulate(main) # simulator requires a Circuit Definition

~/git/magma/magma/simulator/mdb.py in simulate(main, simulator_type)
    658     simulator = simulator_type(main, main.CLK)
    659 
--> 660     DebugNamePass(main).run()
    661 
    662     console = SimulationConsole(main, simulator)

~/git/magma/magma/passes/passes.py in run(self)
     56 
     57     def run(self):
---> 58          self._run(self.main)
     59          self.done()
     60          return self

~/git/magma/magma/passes/passes.py in _run(self, definition)
     46             instancedefinition = type(instance)
     47             if isdefinition(instancedefinition):
---> 48                 self._run( instancedefinition )
     49 
     50         # call each definition only once

~/git/magma/magma/passes/passes.py in _run(self, definition)
     46             instancedefinition = type(instance)
     47             if isdefinition(instancedefinition):
---> 48                 self._run( instancedefinition )
     49 
     50         # call each definition only once

~/git/magma/magma/passes/passes.py in _run(self, definition)
     53             self.definitions[id_] = definition
     54             if callable(self):
---> 55                 self(definition)
     56 
     57     def run(self):

~/git/magma/magma/passes/debug_name.py in __call__(self, definition)
     31                 # Skip if this pass has already been run (partially or not)
     32                 continue
---> 33             stack = inst.stack
     34             inst.decl = None
     35             for frame_info in stack[1:]: # Skip the first element in the stack, where the inst is placed

AttributeError: 'coreir_add3' object has no attribute 'stack'

In [ ]:


In [ ]: