Пример #1
0
def test_setup_dma(dut):
    """
    Description:
        Set Values Within Simulation and make sure they stimulate
        The correct places
            Read Number of Sources
            Read Number of Sinks
            Read Number of Instructions
            Source Testing:
                Enable DMA
                Source Address
                Address Increment
                Address Decrement
                Address No Change
                Set Sink Address
                Set Instruction Address
            Sink Testing:
                Sink Address
                Address Increment
                Address Decrement
                Address No Change
                Quantum
            Instruction
                Continue Testing
                Next Address
                Source Reset Address on Command
                Sink Reset Address on Command
                Egress Enable and Egress Bond Address
                Ingress Enable and Ingress Bond Address

    Test ID: 1

    Expected Results:
        Write to all registers
    """

    dut.test_id = 1
    nysa = NysaSim(dut)
    yield(nysa.reset())
    nysa.read_sdb()

    dma = DMA(nysa, nysa.find_device(DMA)[0])
    yield nysa.wait_clocks(10)
    yield cocotb.external(dma.setup)()
    yield nysa.wait_clocks(10)
    yield cocotb.external(dma.enable_dma)(True)
    yield nysa.wait_clocks(10)
    #print "Enable dma"

    SINK_ADDR = 2
    INST_ADDR = 7
    NEXT_INST_ADDR =3
    INGRESS_ADDR = 2
    EGRESS_ADDR = 4

    level = logging.INFO
    l = logging.getLogger("cocotb.gpi")
    #print "dma.channel_count: %d" % dma.channel_count

    #Source
    for i in range (0, dma.channel_count):
        #Set Channel Address Increment
        yield cocotb.external(dma.enable_source_address_increment)(i, True)
        l.setLevel(logging.ERROR)
        if not dut.s1.dmacntrl.flag_src_addr_inc[i].value.get_value():
            raise cocotb.result.TestFailure("Channel [%d] source addr increment is false when it should be true" % i)
        l.setLevel(level)
        r = yield cocotb.external(dma.is_source_address_increment)(i)
        if r != True:
            raise cocotb.result.TestFailure("Channel [%d] source Addr should be [%d] but is [%d]" % (i, INST_ADDR, r))

        yield cocotb.external(dma.enable_source_address_increment)(i, False)
        r = yield cocotb.external(dma.is_source_address_increment)(i)
        if r != False:
            raise cocotb.result.TestFailure("Channel [%d] source Addr should be [%d] but is [%d]" % (i, INST_ADDR, r))
        l.setLevel(logging.ERROR)
        if dut.s1.dmacntrl.flag_src_addr_inc[i].value.get_value():
            raise cocotb.result.TestFailure("Channel [%d] source addr increment is false when it should be false" % i)
        l.setLevel(level)

        #Set Channel Address Decrement
        yield cocotb.external(dma.enable_source_address_decrement)(i, True)
        l.setLevel(logging.ERROR)
        if not dut.s1.dmacntrl.flag_src_addr_dec[i].value.get_value():
            raise cocotb.result.TestFailure("Channel [%d] source addr decrement is false when it should be true" % i)
        l.setLevel(level)
        r = yield cocotb.external(dma.is_source_address_decrement)(i)
        if r != True:
            raise cocotb.result.TestFailure("Channel [%d] source Addr should be [%d] but is [%d]" % (i, INST_ADDR, r))

        yield cocotb.external(dma.enable_source_address_decrement)(i, False)
        r = yield cocotb.external(dma.is_source_address_decrement)(i)
        if r != False:
            raise cocotb.result.TestFailure("Channel [%d] source Addr should be [%d] but is [%d]" % (i, INST_ADDR, r))
        l.setLevel(logging.ERROR)
        if dut.s1.dmacntrl.flag_src_addr_dec[i].value.get_value():
            raise cocotb.result.TestFailure("Channel [%d] source addr decrement is true when it should be false" % i)
        l.setLevel(level)

        #Channel Enable
        yield cocotb.external(dma.enable_channel)(i, True)
        l.setLevel(logging.ERROR)
        if not dut.s1.dmacntrl.dma_enable[i].value.get_value():
            raise cocotb.result.TestFailure("Channel [%d] source addr enable is false when it should be true" % i)
        l.setLevel(level)
        r = yield cocotb.external(dma.is_channel_enable)(i)

        if r == False:
            raise cocotb.result.TestFailure("Channel [%d] DMA Enable should be true but it is not" % (i))
        yield cocotb.external(dma.enable_channel)(i, False)
        l.setLevel(logging.ERROR)
        if dut.s1.dmacntrl.dma_enable[i].value.get_value():
            raise cocotb.result.TestFailure("Channel [%d] source addr enable is false when it should be true" % i)
        l.setLevel(level)
        r = yield cocotb.external(dma.is_channel_enable)(i)
        if r:
            raise cocotb.result.TestFailure("Channel [%d] DMA Enable should be false but it is not" % (i))

        #Set Channel Sink Address
        yield cocotb.external(dma.set_channel_sink_addr)(i, SINK_ADDR)
        l.setLevel(logging.ERROR)
        addr = get_register_range(dut.s1.dmacntrl.src_control[i], dmam.BIT_SINK_ADDR_TOP, dmam.BIT_SINK_ADDR_BOT)
        l.setLevel(level)
        if addr != SINK_ADDR:
            cocotb.result.TestFailure("Channel [%d] Sink Address should be [%d] but is [%d]" % (i, SINK_ADDR, addr))
        r = yield cocotb.external(dma.get_channel_sink_addr)(i)
        if SINK_ADDR != r:
            raise cocotb.result.TestFailure("Channel [%d] Sink Addr should be [%d] but is [%d]" % (i, SINK_ADDR, r))

        #Set Channel Instruction Address
        yield cocotb.external(dma.set_channel_instruction_pointer)(i, INST_ADDR)
        l.setLevel(logging.ERROR)
        inst_addr = get_register_range(dut.s1.dmacntrl.src_control[i], dmam.BIT_INST_PTR_TOP, dmam.BIT_INST_PTR_BOT)
        l.setLevel(level)
        if inst_addr != INST_ADDR:
            raise cocotb.result.TestFailure("Channel [%d] Insruction Addr should be [%d] but is [%d]" % (i, INST_ADDR, inst_addr))
        r = yield cocotb.external(dma.get_channel_instruction_pointer)(i)
        if INST_ADDR != r:
            raise cocotb.result.TestFailure("Channel [%d] Insruction Addr should be [%d] but is [%d]" % (i, INST_ADDR, r))

    #Sink
    for i in range (0, dma.sink_count):

        #Enable and Disable the dest incrementing
        yield cocotb.external(dma.enable_dest_address_increment)(i, True)
        l.setLevel(logging.ERROR)
        if not dut.s1.dmacntrl.flag_dest_addr_inc[i].value.get_value():
            raise cocotb.result.TestFailure("Sink [%d] DMA Sink Address Increment not enabled" % (i))
        l.setLevel(level)
        r = yield cocotb.external(dma.is_dest_address_increment)(i)
        if r != True:
            raise cocotb.result.TestFailure("Sink [%d] DMA Sink Address Increment not enabled" % (i))
        yield cocotb.external(dma.enable_dest_address_increment)(i, False)
        l.setLevel(logging.ERROR)
        if dut.s1.dmacntrl.flag_dest_addr_inc[i].value.get_value():
            raise cocotb.result.TestFailure("Sink [%d] DMA Sink Address Increment not enabled" % (i))
        l.setLevel(level)
        r = yield cocotb.external(dma.is_dest_address_increment)(i)
        if r:
            raise cocotb.result.TestFailure("Sink [%d] DMA Sink Address Increment enabled" % (i))


        #Enable and Disable the dest decrementing
        yield cocotb.external(dma.enable_dest_address_decrement)(i, True)
        l.setLevel(logging.ERROR)
        if not dut.s1.dmacntrl.flag_dest_addr_dec[i].value.get_value():
            raise cocotb.result.TestFailure("Sink [%d] DMA Sink Address Decrement not enabled" % (i))
        l.setLevel(level)
        r = yield cocotb.external(dma.is_dest_address_decrement)(i)
        if r != True:
            raise cocotb.result.TestFailure("Sink [%d] DMA Sink Address Decrement not enabled" % (i))

        yield cocotb.external(dma.enable_dest_address_decrement)(i, False)
        if dut.s1.dmacntrl.flag_dest_addr_dec[i].value.get_value():
            raise cocotb.result.TestFailure("Sink [%d] DMA Sink Address Decrement not enabled" % (i))
        l.setLevel(level)
        r = yield cocotb.external(dma.is_dest_address_decrement)(i)
        if r:
            raise cocotb.result.TestFailure("Sink [%d] DMA Sink Address Decrement enabled" % (i))

        #Enable and Disable the sink respect quantum
        yield cocotb.external(dma.enable_dest_respect_quantum)(i, True)
        l.setLevel(logging.ERROR)
        if not dut.s1.dmacntrl.flag_dest_data_quantum[i].value.get_value():
            raise cocotb.result.TestFailure("Sink [%d] DMA Sink Address Respect Quantum not enabled" % (i))
        l.setLevel(level)
        r = yield cocotb.external(dma.is_dest_respect_quantum)(i)
        if r != True:
            raise cocotb.result.TestFailure("Sink [%d] DMA Sink Address Respect Quantum not enabled" % (i))

        yield cocotb.external(dma.enable_dest_respect_quantum)(i, False)
        l.setLevel(logging.ERROR)
        if dut.s1.dmacntrl.flag_dest_data_quantum[i].value.get_value():
            raise cocotb.result.TestFailure("Sink [%d] DMA Sink Address Respect Quantum enabled" % (i))
        l.setLevel(level)
        r = yield cocotb.external(dma.is_dest_respect_quantum)(i)
        if r:
            raise cocotb.result.TestFailure("Sink [%d] DMA Sink Address Respect Quantum enabled" % (i))

    #Instruction
    for i in range(dma.get_instruction_count()):
        #Continue Testing
        yield cocotb.external(dma.enable_instruction_continue)(i, True)
        l.setLevel(logging.ERROR)
        if not dut.s1.dmacntrl.flag_instruction_continue[i].value.get_value():
            raise cocotb.result.TestFailure("Instruction [%d] Instruction Continue Not Enabled When it shouldn't be" % (i))
        l.setLevel(level)
        yield cocotb.external(dma.enable_instruction_continue)(i, False)
        l.setLevel(logging.ERROR)
        if dut.s1.dmacntrl.flag_instruction_continue[i].value.get_value():
            raise cocotb.result.TestFailure("Instruction [%d] Instruction Continue Enabled When it shouldn't be" % (i))
        l.setLevel(level)

        #Next Address
        yield cocotb.external(dma.set_instruction_next_instruction)(i, NEXT_INST_ADDR)
        l.setLevel(logging.ERROR)
        addr = dut.s1.dmacntrl.cmd_next[i].value.get_value()
        l.setLevel(level)
        if addr != NEXT_INST_ADDR:
            raise cocotb.result.TestFailure("Instruction [%d] Next Address Should be [%d] but is [%d]" % (i, NEXT_INST_ADDR, addr))

        yield cocotb.external(dma.set_instruction_next_instruction)(i, 0)
        l.setLevel(logging.ERROR)
        addr = dut.s1.dmacntrl.cmd_next[i].value.get_value()
        l.setLevel(level)
        if addr != 0:
            raise cocotb.result.TestFailure("Instruction [%d] Next Address Should be [%d] but is [%d]" % (i, 0, addr))

        #Source Reset Address on Command
        yield cocotb.external(dma.enable_instruction_src_addr_reset_on_cmd)(i, True)
        l.setLevel(logging.ERROR)
        if not dut.s1.dmacntrl.flag_src_addr_rst_on_cmd[i].value.get_value():
            raise cocotb.result.TestFailure("Instruction [%d] Reset Source Address on command is not set" % (i))
        l.setLevel(level)
        yield cocotb.external(dma.enable_instruction_src_addr_reset_on_cmd)(i, False)
        l.setLevel(logging.ERROR)
        if dut.s1.dmacntrl.flag_src_addr_rst_on_cmd[i].value.get_value():
            raise cocotb.result.TestFailure("Instruction [%d] Reset Source Address on command is set" % (i))
        l.setLevel(level)

        #Sink Reset Address on Command
        yield cocotb.external(dma.enable_instruction_dest_addr_reset_on_cmd)(i, True)
        l.setLevel(logging.ERROR)
        if not dut.s1.dmacntrl.flag_dest_addr_rst_on_cmd[i].value.get_value():
            raise cocotb.result.TestFailure("Instruction [%d] Reset Destination Address on command is not set" % (i))
        l.setLevel(level)

        yield cocotb.external(dma.enable_instruction_dest_addr_reset_on_cmd)(i, False)
        if dut.s1.dmacntrl.flag_dest_addr_rst_on_cmd[i].value.get_value():
            raise cocotb.result.TestFailure("Instruction [%d] Reset Destination Address on command is set" % (i))
        l.setLevel(level)

        #Egress Enable and Egress Bond Address
        yield cocotb.external(dma.set_instruction_egress)(i, EGRESS_ADDR)
        yield cocotb.external(dma.enable_egress_bond)(i, True)
        l.setLevel(logging.ERROR)
        addr = dut.s1.dmacntrl.egress_bond_ip[i].value.get_value()

        if not dut.s1.dmacntrl.flag_egress_bond[i].value.get_value():
            raise cocotb.result.TestFailure("Instruction [%d] Egress is not Enabled when it should be" % (i))
        l.setLevel(level)

        if addr != EGRESS_ADDR:
            raise cocotb.result.TestFailure("Instruction [%d] Egress Address Should be [%d] but is [%d]" % (i, EGRESS_ADDR, addr))

        yield cocotb.external(dma.enable_egress_bond)(i, False)
        if dut.s1.dmacntrl.flag_egress_bond[i].value.get_value():
            raise cocotb.result.TestFailure("Instruction [%d] Egress is Enabled when it shouldn't be" % (i))

        #Ingress Enable and Ingress Bond Address
        yield cocotb.external(dma.set_instruction_ingress)(i, INGRESS_ADDR)
        yield cocotb.external(dma.enable_ingress_bond)(i, True)
        l.setLevel(logging.ERROR)
        addr = dut.s1.dmacntrl.ingress_bond_ip[i].value.get_value()
        if not dut.s1.dmacntrl.flag_ingress_bond[i].value.get_value():
            raise cocotb.result.TestFailure("Instruction [%d] Ingress is not Enabled when it should be" % (i))
        l.setLevel(level)
        if addr != INGRESS_ADDR:
            raise cocotb.result.TestFailure("Instruction [%d] Ingress Address Should be [%d] but is [%d]" % (i, EGRESS_ADDR, addr))

        yield cocotb.external(dma.enable_ingress_bond)(i, False)

        l.setLevel(logging.ERROR)
        if dut.s1.dmacntrl.flag_ingress_bond[i].value.get_value():
            raise cocotb.result.TestFailure("Instruction [%d] Ingress is Enabled when it shouldn't be" % (i))
        l.setLevel(level)


    print "Finished"


    yield nysa.wait_clocks(10)
Пример #2
0
def test_setup_dma(dut):
    """
    Description:
        Set Values Within Simulation and make sure they stimulate
        The correct places
            Read Number of Sources
            Read Number of Sinks
            Read Number of Instructions
            Source Testing:
                Enable DMA
                Source Address
                Address Increment
                Address Decrement
                Address No Change
                Set Sink Address
                Set Instruction Address
            Sink Testing:
                Sink Address
                Address Increment
                Address Decrement
                Address No Change
                Quantum
            Instruction
                Continue Testing
                Next Address
                Source Reset Address on Command
                Sink Reset Address on Command
                Egress Enable and Egress Bond Address
                Ingress Enable and Ingress Bond Address

    Test ID: 1

    Expected Results:
        Write to all registers
    """

    dut.test_id = 1
    nysa = NysaSim(dut)
    yield (nysa.reset())
    nysa.read_sdb()

    dma = DMA(nysa, nysa.find_device(DMA)[0])
    yield nysa.wait_clocks(10)
    yield cocotb.external(dma.setup)()
    yield nysa.wait_clocks(10)
    yield cocotb.external(dma.enable_dma)(True)
    yield nysa.wait_clocks(10)
    #print "Enable dma"

    SINK_ADDR = 2
    INST_ADDR = 7
    NEXT_INST_ADDR = 3
    INGRESS_ADDR = 2
    EGRESS_ADDR = 4

    level = logging.INFO
    l = logging.getLogger("cocotb.gpi")
    #print "dma.channel_count: %d" % dma.channel_count

    #Source
    for i in range(0, dma.channel_count):
        #Set Channel Address Increment
        yield cocotb.external(dma.enable_source_address_increment)(i, True)
        l.setLevel(logging.ERROR)
        if not dut.s1.dmacntrl.flag_src_addr_inc[i].value.get_value():
            raise cocotb.result.TestFailure(
                "Channel [%d] source addr increment is false when it should be true"
                % i)
        l.setLevel(level)
        r = yield cocotb.external(dma.is_source_address_increment)(i)
        if r != True:
            raise cocotb.result.TestFailure(
                "Channel [%d] source Addr should be [%d] but is [%d]" %
                (i, INST_ADDR, r))

        yield cocotb.external(dma.enable_source_address_increment)(i, False)
        r = yield cocotb.external(dma.is_source_address_increment)(i)
        if r != False:
            raise cocotb.result.TestFailure(
                "Channel [%d] source Addr should be [%d] but is [%d]" %
                (i, INST_ADDR, r))
        l.setLevel(logging.ERROR)
        if dut.s1.dmacntrl.flag_src_addr_inc[i].value.get_value():
            raise cocotb.result.TestFailure(
                "Channel [%d] source addr increment is false when it should be false"
                % i)
        l.setLevel(level)

        #Set Channel Address Decrement
        yield cocotb.external(dma.enable_source_address_decrement)(i, True)
        l.setLevel(logging.ERROR)
        if not dut.s1.dmacntrl.flag_src_addr_dec[i].value.get_value():
            raise cocotb.result.TestFailure(
                "Channel [%d] source addr decrement is false when it should be true"
                % i)
        l.setLevel(level)
        r = yield cocotb.external(dma.is_source_address_decrement)(i)
        if r != True:
            raise cocotb.result.TestFailure(
                "Channel [%d] source Addr should be [%d] but is [%d]" %
                (i, INST_ADDR, r))

        yield cocotb.external(dma.enable_source_address_decrement)(i, False)
        r = yield cocotb.external(dma.is_source_address_decrement)(i)
        if r != False:
            raise cocotb.result.TestFailure(
                "Channel [%d] source Addr should be [%d] but is [%d]" %
                (i, INST_ADDR, r))
        l.setLevel(logging.ERROR)
        if dut.s1.dmacntrl.flag_src_addr_dec[i].value.get_value():
            raise cocotb.result.TestFailure(
                "Channel [%d] source addr decrement is true when it should be false"
                % i)
        l.setLevel(level)

        #Channel Enable
        yield cocotb.external(dma.enable_channel)(i, True)
        l.setLevel(logging.ERROR)
        if not dut.s1.dmacntrl.dma_enable[i].value.get_value():
            raise cocotb.result.TestFailure(
                "Channel [%d] source addr enable is false when it should be true"
                % i)
        l.setLevel(level)
        r = yield cocotb.external(dma.is_channel_enable)(i)

        if r == False:
            raise cocotb.result.TestFailure(
                "Channel [%d] DMA Enable should be true but it is not" % (i))
        yield cocotb.external(dma.enable_channel)(i, False)
        l.setLevel(logging.ERROR)
        if dut.s1.dmacntrl.dma_enable[i].value.get_value():
            raise cocotb.result.TestFailure(
                "Channel [%d] source addr enable is false when it should be true"
                % i)
        l.setLevel(level)
        r = yield cocotb.external(dma.is_channel_enable)(i)
        if r:
            raise cocotb.result.TestFailure(
                "Channel [%d] DMA Enable should be false but it is not" % (i))

        #Set Channel Sink Address
        yield cocotb.external(dma.set_channel_sink_addr)(i, SINK_ADDR)
        l.setLevel(logging.ERROR)
        addr = get_register_range(dut.s1.dmacntrl.src_control[i],
                                  dmam.BIT_SINK_ADDR_TOP,
                                  dmam.BIT_SINK_ADDR_BOT)
        l.setLevel(level)
        if addr != SINK_ADDR:
            cocotb.result.TestFailure(
                "Channel [%d] Sink Address should be [%d] but is [%d]" %
                (i, SINK_ADDR, addr))
        r = yield cocotb.external(dma.get_channel_sink_addr)(i)
        if SINK_ADDR != r:
            raise cocotb.result.TestFailure(
                "Channel [%d] Sink Addr should be [%d] but is [%d]" %
                (i, SINK_ADDR, r))

        #Set Channel Instruction Address
        yield cocotb.external(dma.set_channel_instruction_pointer)(i,
                                                                   INST_ADDR)
        l.setLevel(logging.ERROR)
        inst_addr = get_register_range(dut.s1.dmacntrl.src_control[i],
                                       dmam.BIT_INST_PTR_TOP,
                                       dmam.BIT_INST_PTR_BOT)
        l.setLevel(level)
        if inst_addr != INST_ADDR:
            raise cocotb.result.TestFailure(
                "Channel [%d] Insruction Addr should be [%d] but is [%d]" %
                (i, INST_ADDR, inst_addr))
        r = yield cocotb.external(dma.get_channel_instruction_pointer)(i)
        if INST_ADDR != r:
            raise cocotb.result.TestFailure(
                "Channel [%d] Insruction Addr should be [%d] but is [%d]" %
                (i, INST_ADDR, r))

    #Sink
    for i in range(0, dma.sink_count):

        #Enable and Disable the dest incrementing
        yield cocotb.external(dma.enable_dest_address_increment)(i, True)
        l.setLevel(logging.ERROR)
        if not dut.s1.dmacntrl.flag_dest_addr_inc[i].value.get_value():
            raise cocotb.result.TestFailure(
                "Sink [%d] DMA Sink Address Increment not enabled" % (i))
        l.setLevel(level)
        r = yield cocotb.external(dma.is_dest_address_increment)(i)
        if r != True:
            raise cocotb.result.TestFailure(
                "Sink [%d] DMA Sink Address Increment not enabled" % (i))
        yield cocotb.external(dma.enable_dest_address_increment)(i, False)
        l.setLevel(logging.ERROR)
        if dut.s1.dmacntrl.flag_dest_addr_inc[i].value.get_value():
            raise cocotb.result.TestFailure(
                "Sink [%d] DMA Sink Address Increment not enabled" % (i))
        l.setLevel(level)
        r = yield cocotb.external(dma.is_dest_address_increment)(i)
        if r:
            raise cocotb.result.TestFailure(
                "Sink [%d] DMA Sink Address Increment enabled" % (i))

        #Enable and Disable the dest decrementing
        yield cocotb.external(dma.enable_dest_address_decrement)(i, True)
        l.setLevel(logging.ERROR)
        if not dut.s1.dmacntrl.flag_dest_addr_dec[i].value.get_value():
            raise cocotb.result.TestFailure(
                "Sink [%d] DMA Sink Address Decrement not enabled" % (i))
        l.setLevel(level)
        r = yield cocotb.external(dma.is_dest_address_decrement)(i)
        if r != True:
            raise cocotb.result.TestFailure(
                "Sink [%d] DMA Sink Address Decrement not enabled" % (i))

        yield cocotb.external(dma.enable_dest_address_decrement)(i, False)
        if dut.s1.dmacntrl.flag_dest_addr_dec[i].value.get_value():
            raise cocotb.result.TestFailure(
                "Sink [%d] DMA Sink Address Decrement not enabled" % (i))
        l.setLevel(level)
        r = yield cocotb.external(dma.is_dest_address_decrement)(i)
        if r:
            raise cocotb.result.TestFailure(
                "Sink [%d] DMA Sink Address Decrement enabled" % (i))

        #Enable and Disable the sink respect quantum
        yield cocotb.external(dma.enable_dest_respect_quantum)(i, True)
        l.setLevel(logging.ERROR)
        if not dut.s1.dmacntrl.flag_dest_data_quantum[i].value.get_value():
            raise cocotb.result.TestFailure(
                "Sink [%d] DMA Sink Address Respect Quantum not enabled" % (i))
        l.setLevel(level)
        r = yield cocotb.external(dma.is_dest_respect_quantum)(i)
        if r != True:
            raise cocotb.result.TestFailure(
                "Sink [%d] DMA Sink Address Respect Quantum not enabled" % (i))

        yield cocotb.external(dma.enable_dest_respect_quantum)(i, False)
        l.setLevel(logging.ERROR)
        if dut.s1.dmacntrl.flag_dest_data_quantum[i].value.get_value():
            raise cocotb.result.TestFailure(
                "Sink [%d] DMA Sink Address Respect Quantum enabled" % (i))
        l.setLevel(level)
        r = yield cocotb.external(dma.is_dest_respect_quantum)(i)
        if r:
            raise cocotb.result.TestFailure(
                "Sink [%d] DMA Sink Address Respect Quantum enabled" % (i))

    #Instruction
    for i in range(dma.get_instruction_count()):
        #Continue Testing
        yield cocotb.external(dma.enable_instruction_continue)(i, True)
        l.setLevel(logging.ERROR)
        if not dut.s1.dmacntrl.flag_instruction_continue[i].value.get_value():
            raise cocotb.result.TestFailure(
                "Instruction [%d] Instruction Continue Not Enabled When it shouldn't be"
                % (i))
        l.setLevel(level)
        yield cocotb.external(dma.enable_instruction_continue)(i, False)
        l.setLevel(logging.ERROR)
        if dut.s1.dmacntrl.flag_instruction_continue[i].value.get_value():
            raise cocotb.result.TestFailure(
                "Instruction [%d] Instruction Continue Enabled When it shouldn't be"
                % (i))
        l.setLevel(level)

        #Next Address
        yield cocotb.external(dma.set_instruction_next_instruction)(
            i, NEXT_INST_ADDR)
        l.setLevel(logging.ERROR)
        addr = dut.s1.dmacntrl.cmd_next[i].value.get_value()
        l.setLevel(level)
        if addr != NEXT_INST_ADDR:
            raise cocotb.result.TestFailure(
                "Instruction [%d] Next Address Should be [%d] but is [%d]" %
                (i, NEXT_INST_ADDR, addr))

        yield cocotb.external(dma.set_instruction_next_instruction)(i, 0)
        l.setLevel(logging.ERROR)
        addr = dut.s1.dmacntrl.cmd_next[i].value.get_value()
        l.setLevel(level)
        if addr != 0:
            raise cocotb.result.TestFailure(
                "Instruction [%d] Next Address Should be [%d] but is [%d]" %
                (i, 0, addr))

        #Source Reset Address on Command
        yield cocotb.external(dma.enable_instruction_src_addr_reset_on_cmd)(
            i, True)
        l.setLevel(logging.ERROR)
        if not dut.s1.dmacntrl.flag_src_addr_rst_on_cmd[i].value.get_value():
            raise cocotb.result.TestFailure(
                "Instruction [%d] Reset Source Address on command is not set" %
                (i))
        l.setLevel(level)
        yield cocotb.external(dma.enable_instruction_src_addr_reset_on_cmd)(
            i, False)
        l.setLevel(logging.ERROR)
        if dut.s1.dmacntrl.flag_src_addr_rst_on_cmd[i].value.get_value():
            raise cocotb.result.TestFailure(
                "Instruction [%d] Reset Source Address on command is set" %
                (i))
        l.setLevel(level)

        #Sink Reset Address on Command
        yield cocotb.external(dma.enable_instruction_dest_addr_reset_on_cmd)(
            i, True)
        l.setLevel(logging.ERROR)
        if not dut.s1.dmacntrl.flag_dest_addr_rst_on_cmd[i].value.get_value():
            raise cocotb.result.TestFailure(
                "Instruction [%d] Reset Destination Address on command is not set"
                % (i))
        l.setLevel(level)

        yield cocotb.external(dma.enable_instruction_dest_addr_reset_on_cmd)(
            i, False)
        if dut.s1.dmacntrl.flag_dest_addr_rst_on_cmd[i].value.get_value():
            raise cocotb.result.TestFailure(
                "Instruction [%d] Reset Destination Address on command is set"
                % (i))
        l.setLevel(level)

        #Egress Enable and Egress Bond Address
        yield cocotb.external(dma.set_instruction_egress)(i, EGRESS_ADDR)
        yield cocotb.external(dma.enable_egress_bond)(i, True)
        l.setLevel(logging.ERROR)
        addr = dut.s1.dmacntrl.egress_bond_ip[i].value.get_value()

        if not dut.s1.dmacntrl.flag_egress_bond[i].value.get_value():
            raise cocotb.result.TestFailure(
                "Instruction [%d] Egress is not Enabled when it should be" %
                (i))
        l.setLevel(level)

        if addr != EGRESS_ADDR:
            raise cocotb.result.TestFailure(
                "Instruction [%d] Egress Address Should be [%d] but is [%d]" %
                (i, EGRESS_ADDR, addr))

        yield cocotb.external(dma.enable_egress_bond)(i, False)
        if dut.s1.dmacntrl.flag_egress_bond[i].value.get_value():
            raise cocotb.result.TestFailure(
                "Instruction [%d] Egress is Enabled when it shouldn't be" %
                (i))

        #Ingress Enable and Ingress Bond Address
        yield cocotb.external(dma.set_instruction_ingress)(i, INGRESS_ADDR)
        yield cocotb.external(dma.enable_ingress_bond)(i, True)
        l.setLevel(logging.ERROR)
        addr = dut.s1.dmacntrl.ingress_bond_ip[i].value.get_value()
        if not dut.s1.dmacntrl.flag_ingress_bond[i].value.get_value():
            raise cocotb.result.TestFailure(
                "Instruction [%d] Ingress is not Enabled when it should be" %
                (i))
        l.setLevel(level)
        if addr != INGRESS_ADDR:
            raise cocotb.result.TestFailure(
                "Instruction [%d] Ingress Address Should be [%d] but is [%d]" %
                (i, EGRESS_ADDR, addr))

        yield cocotb.external(dma.enable_ingress_bond)(i, False)

        l.setLevel(logging.ERROR)
        if dut.s1.dmacntrl.flag_ingress_bond[i].value.get_value():
            raise cocotb.result.TestFailure(
                "Instruction [%d] Ingress is Enabled when it shouldn't be" %
                (i))
        l.setLevel(level)

    print "Finished"

    yield nysa.wait_clocks(10)