leonardt / fault

A Python package for testing hardware (part of the magma ecosystem)
BSD 3-Clause "New" or "Revised" License
41 stars 13 forks source link

Using fault with magma.circuit.sequential #176

Open rdaly525 opened 4 years ago

rdaly525 commented 4 years ago

Creating a tester fails when the circuit is defined using circuit.sequential:

The following code snippet fails complaining about a bad type for CLK

import magma as m
from fault import Tester

def test_reg():
    Data = m.Bits[16]
    @m.circuit.sequential
    class Reg:
        def __init__(self):
            self.value : Data = Data(0)

        def __call__(self, in_: Data, en: m.Bit) -> Data:
            retvalue = self.value
            if en:
                self.value =in_
            else:
                self.value = self.value
            return retvalue

    tester = Tester(Reg, Reg.CLK)

Is there a different way I am supposed to send the Tester the CLK port?