def check_segment_output_proc():
     while True:
         yield anodos
         yield hdl.delay(5)  # wait for combinatorial outputs
         if anodos == 0b0001:
             assert segmentos == get_segment_out(
                 index_text
             ), "Error: output mismatch. Index = {0}, anodos = {1}, segment_o = {2}".format(
                 index_text, anodos, hex(segmentos))
         elif anodos == 0b0010:
             assert segmentos == get_segment_out(
                 (index_text + 1) % len(text)
             ), "Error: output mismatch. Index = {0}, anodos = {1}, segment_o = {2}".format(
                 index_text, anodos, hex(segmentos))
         elif anodos == 0b0100:
             assert segmentos == get_segment_out(
                 (index_text + 2) % len(text)
             ), "Error: output mismatch. Index = {0}, anodos = {1}, segment_o = {2}".format(
                 index_text, anodos, hex(segmentos))
         elif anodos == 0b1000:
             assert segmentos == get_segment_out(
                 (index_text + 3) % len(text)
             ), "Error: output mismatch. Index = {0}, anodos = {1}, segment_o = {2}".format(
                 index_text, anodos, hex(segmentos))
         else:
             yield hdl.Error("Invalid patter for anodos: {}".format(
                 hdl.bin(anodos, width=4)))
 def timeout():
     rst.next = True
     yield hdl.delay(RESET_TIME * TICK_PERIOD)
     rst.next = False
     yield hdl.delay(TIMEOUT * TICK_PERIOD)
     raise hdl.Error(
         "Test failed: TIMEOUT at {0}. Clock cycles: {1}".format(
             hdl.now(),
             hdl.now() // TICK_PERIOD))
 def timeout():
     rst.next = True
     yield hdl.delay(RESET_TIME * TICK_PERIOD)
     rst.next = False
     yield hdl.delay(TIMEOUT * TICK_PERIOD)
     raise hdl.Error("Test failed: TIMEOUT")
 def timeout():
     yield hdl.delay(TIMEOUT * TICK_PERIOD)
     raise hdl.Error("Test failed: TIMEOUT")