def m_serio_ex(clock, reset, sdi, sdo, Np=8): pin = [Signal(intbv(0)[8:]) for _ in range(Np)] pout = [Signal(intbv(0)[8:]) for _ in range(Np)] gserio = m_serio(clock, reset, sdi, sdo, pin, pout) @always_seq(clock.posedge, reset=reset) def rtl(): for ii in range(Np): pout[ii].next = pin[ii] return gserio, rtl
def _test(): tbclk = clock.gen() tbdut = m_serio(clock, reset, sdi, sdo, pin, pout) @instance def tbstim(): yield reset.pulse(13) yield clock.posedge # @todo: actually test something for ii in range(1000): yield clock.posedge raise StopSimulation return tbdut, tbclk, tbstim