示例#1
0
def do_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, seed):
    rand = random.Random()
    rand.seed(seed)

    dut_mac_address = get_dut_mac_address()
    broadcast_mac_address = [0xff, 0xff, 0xff, 0xff, 0xff, 0xff]

    # The inter-frame gap is to give the DUT time to print its output
    packets = []

    for mac_address in [dut_mac_address, broadcast_mac_address]:
        packets.append(
            MiiPacket(rand,
                      dst_mac_addr=mac_address,
                      create_data_args=['step', (1, 72)]))

        packets.append(
            MiiPacket(rand,
                      dst_mac_addr=mac_address,
                      create_data_args=['step', (5, 52)],
                      inter_frame_gap=packet_processing_time(tx_phy, 72, mac)))

        packets.append(
            MiiPacket(rand,
                      dst_mac_addr=mac_address,
                      create_data_args=['step', (7, 1500)],
                      inter_frame_gap=packet_processing_time(tx_phy, 52, mac)))

    # Send enough basic frames to ensure the buffers in the DUT have wrapped
    for i in range(11):
        packets.append(
            MiiPacket(rand,
                      dst_mac_addr=dut_mac_address,
                      create_data_args=['step', (i, 1500)],
                      inter_frame_gap=packet_processing_time(
                          tx_phy, 1500, mac)))

    do_error = True

    # The gigabit RGMII can't handle spurious errors
    if tx_clk.get_rate() == Clock.CLK_125MHz:
        do_error = False

    error_driver = TxError(tx_phy, do_error)

    do_rx_test(mac,
               arch,
               rx_clk,
               rx_phy,
               tx_clk,
               tx_phy,
               packets,
               __file__,
               seed,
               level='smoke',
               extra_tasks=[error_driver])
示例#2
0
def do_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, seed):
    rand = random.Random()
    rand.seed(seed)

    dut_mac_address = get_dut_mac_address()

    excess_pad_packets = []

    # Part A - excessive pad
    processing_time = 0
    # These packets should not be dropped (though the standard is ambiguous). The length, however
    # should be reported as the length specified in the len/type field.
    for (num_data_bytes, len_type, step) in [(47, 46, 20), (1504, 46, 21), (1504, 1503, 22)]:
        excess_pad_packets.append(MiiPacket(rand,
            dst_mac_addr=dut_mac_address,
            ether_len_type=[(len_type >> 8) & 0xff, len_type & 0xff],
            create_data_args=['step', (step, num_data_bytes)],
            inter_frame_gap=processing_time
          ))

        # Update packet processing time so that next packet leaves enough time before starting
        processing_time = packet_processing_time(tx_phy, num_data_bytes, mac)

    # Part B - Part A with valid frames before/after the errror frame
    packets = []
    for packet in excess_pad_packets:
        packets.append(packet)

    ifg = tx_clk.get_min_ifg()
    for i,packet in enumerate(excess_pad_packets):
      # First valid frame (allowing time to process previous two valid frames)
      packets.append(MiiPacket(rand,
          dst_mac_addr=dut_mac_address,
          create_data_args=['step', (i%10, choose_small_frame_size(rand))],
          inter_frame_gap=2*packet_processing_time(tx_phy, 46, mac) + packet_processing_time(tx_phy, 1518, mac)
        ))

      # Take a copy to ensure that the original is not modified
      packet_copy = copy.deepcopy(packet)

      # Error frame after minimum IFG
      packet_copy.set_ifg(ifg)
      packets.append(packet_copy)

      # Second valid frame with minimum IFG
      packets.append(MiiPacket(rand,
          dst_mac_addr=dut_mac_address,
          create_data_args=['step', (2 * ((i+1)%10), choose_small_frame_size(rand))],
          inter_frame_gap=ifg
        ))

    do_rx_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, packets, __file__, seed)
示例#3
0
def do_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, seed):
    rand = random.Random()
    rand.seed(seed)

    dut_mac_address = get_dut_mac_address()

    packets = []

    # Part A - Test the sending of all valid size untagged frames
    processing_time = packet_processing_time(tx_phy, 46, mac)
    for num_data_bytes in [46, choose_small_frame_size(rand), 1500]:
        packets.append(
            MiiPacket(rand,
                      dst_mac_addr=dut_mac_address,
                      create_data_args=[
                          'step', (rand.randint(1, 254), num_data_bytes)
                      ],
                      inter_frame_gap=processing_time))
        processing_time = packet_processing_time(tx_phy, num_data_bytes, mac)

    # Part B - Test the sending of sub 46 bytes of data in the length field but valid minimum packet sizes
    # The packet sizes longer than this are covered by Part A
    for len_type in [1, 2, 3, 4, 15, 45]:
        packets.append(
            MiiPacket(rand,
                      dst_mac_addr=dut_mac_address,
                      ether_len_type=[(len_type >> 8) & 0xff, len_type & 0xff],
                      create_data_args=['step', (rand.randint(1, 254), 46)],
                      inter_frame_gap=packet_processing_time(tx_phy, 46, mac)))

    # Part C - Test the sending of all valid size tagged frames
    processing_time = packet_processing_time(tx_phy, 46, mac)
    for num_data_bytes in [42, choose_small_frame_size(rand), 1500]:
        packets.append(
            MiiPacket(rand,
                      dst_mac_addr=dut_mac_address,
                      vlan_prio_tag=[0x81, 0x00, 0x00, 0x00],
                      create_data_args=[
                          'step', (rand.randint(1, 254), num_data_bytes)
                      ],
                      inter_frame_gap=processing_time))
        processing_time = packet_processing_time(tx_phy, num_data_bytes, mac)

    # Part D
    # Not supporting 802.3-2012, so no envelope frames

    # Part E
    # Not doing half duplex 1000Mb/s, so don't test this

    do_rx_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, packets, __file__,
               seed)
示例#4
0
def do_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, seed):
    rand = random.Random()
    rand.seed(seed)

    dut_mac_address = get_dut_mac_address()

    packets = []

    # Part A - Send different length preambles and ensure the packets are still received
    # Check a selection of preamble lengths from 1 byte to 64 bytes (including SFD)
    test_lengths = [3, 4, 5, 61, 127]
    if tx_clk.get_rate() == Clock.CLK_125MHz:
        # The RGMII requires a longer preamble
        test_lengths = [5, 7, 9, 61, 127]

    for num_preamble_nibbles in test_lengths:
        packets.append(
            MiiPacket(rand,
                      dst_mac_addr=dut_mac_address,
                      num_preamble_nibbles=num_preamble_nibbles,
                      create_data_args=[
                          'step',
                          (rand.randint(1, 254), choose_small_frame_size(rand))
                      ],
                      inter_frame_gap=packet_processing_time(tx_phy, 46, mac)))

    do_rx_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, packets, __file__,
               seed)
示例#5
0
def do_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, seed):
    rand = random.Random()
    rand.seed(seed)

    dut_mac_address = get_dut_mac_address()
    broadcast_mac_address = [0xff, 0xff, 0xff, 0xff, 0xff, 0xff]

    # The inter-frame gap is to give the DUT time to print its output
    packets = []

    for mac_address in [dut_mac_address, broadcast_mac_address]:
        packets.append(MiiPacket(rand,
            dst_mac_addr=mac_address,
            create_data_args=['step', (1, 72)]
          ))

        packets.append(MiiPacket(rand,
            dst_mac_addr=mac_address,
            create_data_args=['step', (5, 52)],
            inter_frame_gap=packet_processing_time(tx_phy, 72, mac)
          ))

        packets.append(MiiPacket(rand,
            dst_mac_addr=mac_address,
            create_data_args=['step', (7, 1500)],
            inter_frame_gap=packet_processing_time(tx_phy, 52, mac)
          ))

    # Send enough basic frames to ensure the buffers in the DUT have wrapped
    for i in range(11):
        packets.append(MiiPacket(rand,
            dst_mac_addr=dut_mac_address,
            create_data_args=['step', (i, 1500)],
            inter_frame_gap=packet_processing_time(tx_phy, 1500, mac)
        ))

    do_error = True

    # The gigabit RGMII can't handle spurious errors
    if tx_clk.get_rate() == Clock.CLK_125MHz:
        do_error = False

    error_driver = TxError(tx_phy, do_error)

    do_rx_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, packets, __file__, seed,
               level='smoke', extra_tasks=[error_driver])
示例#6
0
def do_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, seed):
    rand = random.Random()
    rand.seed(seed)

    dut_mac_address = get_dut_mac_address()

    packets = []

    # Part A - Test the sending of all valid size untagged frames
    processing_time = packet_processing_time(tx_phy, 46, mac)
    for num_data_bytes in [46, choose_small_frame_size(rand), 1500]:
        packets.append(MiiPacket(rand,
            dst_mac_addr=dut_mac_address,
            create_data_args=['step', (rand.randint(1, 254), num_data_bytes)],
            inter_frame_gap=processing_time
          ))
        processing_time = packet_processing_time(tx_phy, num_data_bytes, mac)

    # Part B - Test the sending of sub 46 bytes of data in the length field but valid minimum packet sizes
    # The packet sizes longer than this are covered by Part A
    for len_type in [1, 2, 3, 4, 15, 45]:
        packets.append(MiiPacket(rand,
            dst_mac_addr=dut_mac_address,
            ether_len_type=[(len_type >> 8) & 0xff, len_type & 0xff],
            create_data_args=['step', (rand.randint(1, 254), 46)],
            inter_frame_gap=packet_processing_time(tx_phy, 46, mac)
          ))

    # Part C - Test the sending of all valid size tagged frames
    processing_time = packet_processing_time(tx_phy, 46, mac)
    for num_data_bytes in [42, choose_small_frame_size(rand), 1500]:
        packets.append(MiiPacket(rand,
            dst_mac_addr=dut_mac_address,
            vlan_prio_tag=[0x81, 0x00, 0x00, 0x00],
            create_data_args=['step', (rand.randint(1, 254), num_data_bytes)],
            inter_frame_gap=processing_time
          ))
        processing_time = packet_processing_time(tx_phy, num_data_bytes, mac)

    # Part D
    # Not supporting 802.3-2012, so no envelope frames

    # Part E
    # Not doing half duplex 1000Mb/s, so don't test this
        
    do_rx_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, packets, __file__, seed)
示例#7
0
def do_test(mac, tx_clk, tx_phy):
    resources = xmostest.request_resource("xsim")

    testname = 'test_appdata'

    binary = '{test}/bin/{mac}_{phy}/{test}_{mac}_{phy}.xe'.format(
        test=testname, mac=mac, phy=tx_phy.get_name())

    print "Running {test}: {phy} phy at {clk}".format(
        test=testname, phy=tx_phy.get_name(), clk=tx_clk.get_name())

    rand = random.Random()

    dut_mac_address = get_dut_mac_address()
    packets = [
        MiiPacket(rand, dst_mac_addr=[0, 1, 2, 3, 4, 7], src_mac_addr=[0 for x in range(6)],
                  ether_len_type=[0x33, 0x33], inter_frame_gap=packet_processing_time(tx_phy, 64, mac)*4,
                  data_bytes=[1,2,3,4] + [0 for x in range(60)]),
        MiiPacket(rand, dst_mac_addr=[0, 1, 2, 3, 4, 0], src_mac_addr=[0 for x in range(6)],
                  ether_len_type=[0x11, 0x11], inter_frame_gap=packet_processing_time(tx_phy, 64, mac)*4,
                  data_bytes=[1,2,3,4] + [0 for x in range(60)]),
        MiiPacket(rand, dst_mac_addr=[0, 1, 2, 3, 4, 1], src_mac_addr=[0 for x in range(6)],
                  ether_len_type=[0x22, 0x22], inter_frame_gap=packet_processing_time(tx_phy, 64, mac)*4,
                  data_bytes=[5,6,7,8] + [0 for x in range(60)]),
        MiiPacket(rand, dst_mac_addr=[0, 1, 2, 3, 4, 2], src_mac_addr=[0 for x in range(6)],
                  ether_len_type=[0x33, 0x33],
                  inter_frame_gap=packet_processing_time(tx_phy, 64, mac)*4, data_bytes=[4,3,2,1] + [0 for x in range(60)]),
        MiiPacket(rand, dst_mac_addr=[0, 1, 2, 3, 4, 3], src_mac_addr=[0 for x in range(6)],
                  ether_len_type=[0x44, 0x44], inter_frame_gap=packet_processing_time(tx_phy, 64, mac)*4,
                  data_bytes=[8,7,6,5] + [0 for x in range(60)])
      ]

    tx_phy.set_packets(packets)

    tester = xmostest.ComparisonTester(open('test_appdata_{phy}_{mac}.expect'.format(phy=tx_phy.get_name(), mac=mac)),
                                     'lib_ethernet', 'basic_tests', testname,
                                      {'mac':mac, 'phy':tx_phy.get_name(), 'clk':tx_clk.get_name()}, ordered=False)

    simargs = get_sim_args(testname, mac, tx_clk, tx_phy)
    tester.set_min_testlevel('nightly')
    xmostest.run_on_simulator(resources['xsim'], binary,
                              simthreads=[tx_clk, tx_phy],
                              tester=tester,
                              simargs=simargs)
示例#8
0
def do_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, seed):
    rand = random.Random()
    rand.seed(seed)

    if tx_clk.get_rate() == Clock.CLK_125MHz:
        # This test is not relevant for gigabit
        return

    dut_mac_address = get_dut_mac_address()

    error_packets = []

    # Part A - Valid packet with an extra nibble (should be accepted)
    error_packets.append(MiiPacket(rand,
        dst_mac_addr=dut_mac_address,
        extra_nibble=True,
        create_data_args=['step', (22, choose_small_frame_size(rand))]
      ))

    # Part B - Invalid packet with an extra nibble (should be reported as alignmentError)
    error_packets.append(MiiPacket(rand,
        dst_mac_addr=dut_mac_address,
        extra_nibble=True, corrupt_crc=True,
        create_data_args=['step', (23, choose_small_frame_size(rand))],
        dropped=True
      ))

    # Part C - Parts A and B with valid frames before/after the errror frame
    packets = []
    for packet in error_packets:
        packets.append(packet)

    ifg = tx_clk.get_min_ifg()
    for i,packet in enumerate(error_packets):
      # First valid frame (allowing time to process previous two valid frames)
      packets.append(MiiPacket(rand,
          dst_mac_addr=dut_mac_address,
          create_data_args=['step', (i%10, choose_small_frame_size(rand))],
          inter_frame_gap=2*packet_processing_time(tx_phy, 46, mac)
        ))

      # Take a copy to ensure that the original is not modified
      packet_copy = copy.deepcopy(packet)

      # Error frame after minimum IFG
      packet_copy.set_ifg(ifg)
      packets.append(packet_copy)

      # Second valid frame with minimum IFG
      packets.append(MiiPacket(rand,
          dst_mac_addr=dut_mac_address,
          create_data_args=['step', (2 * ((i+1)%10), choose_small_frame_size(rand))],
          inter_frame_gap=ifg
        ))

    do_rx_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, packets, __file__, seed)
示例#9
0
def do_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, seed):
    rand = random.Random()
    rand.seed(seed)

    dut_mac_address = get_dut_mac_address()

    error_packets = []

    # Part A - maximum jabber size packet
    # Use a valid ether type as the type/len field can't encode the length
    ether_type_ip = [0x08, 0x00]

    # Jabber lengths as defined for 10Mb/s & 100Mb/s
    jabber_length = 9367
    if tx_clk.get_rate() == Clock.CLK_125MHz:
        # Length for 1000Mb/s
        jabber_length = 18742

    error_packets.append(MiiPacket(rand,
        dst_mac_addr=dut_mac_address,
        ether_len_type=ether_type_ip,
        num_preamble_nibbles=7,
        create_data_args=['step', (17, jabber_length)],
        dropped=True
      ))

    # Part B - Part A with valid frames before/after the errror frame
    packets = []
    for packet in error_packets:
        packets.append(packet)

    ifg = tx_clk.get_min_ifg()
    for i,packet in enumerate(error_packets):
      # First valid frame (allowing time to process previous two valid frames)
      packets.append(MiiPacket(rand,
          dst_mac_addr=dut_mac_address,
          create_data_args=['step', (i%10, choose_small_frame_size(rand))],
          inter_frame_gap=2*packet_processing_time(tx_phy, 46, mac)
        ))

      # Take a copy to ensure that the original is not modified
      packet_copy = copy.deepcopy(packet)

      # Error frame after minimum IFG
      packet_copy.set_ifg(ifg)
      packets.append(packet_copy)

      # Second valid frame with minimum IFG
      packets.append(MiiPacket(rand,
          dst_mac_addr=dut_mac_address,
          create_data_args=['step', (2 * ((i+1)%10), choose_small_frame_size(rand))],
          inter_frame_gap=ifg
        ))

    do_rx_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, packets, __file__, seed)
示例#10
0
def do_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, seed):
    rand = random.Random()
    rand.seed(seed)

    dut_mac_address = get_dut_mac_address()

    packets = []

    ifg = tx_clk.get_min_ifg()

    # Part A - Ensure that two packets separated by minimum IFG are received ok
    packets.append(
        MiiPacket(rand,
                  dst_mac_addr=dut_mac_address,
                  create_data_args=[
                      'step',
                      (rand.randint(1, 254), choose_small_frame_size(rand))
                  ]))
    packets.append(
        MiiPacket(rand,
                  dst_mac_addr=dut_mac_address,
                  create_data_args=[
                      'step',
                      (rand.randint(1, 254), choose_small_frame_size(rand))
                  ],
                  inter_frame_gap=ifg))

    # Part B - Determine the minimum IFG that can be supported
    bit_time = ifg / 96

    # Allow lots of time for the DUT to recover between test bursts
    recovery_time = 4 * packet_processing_time(tx_phy, 46, mac)

    # Test shrinking the IFG by different amounts. Use the shrink as the step for debug purposes
    for gap_shrink in [5, 10]:
        new_ifg = ifg - gap_shrink * bit_time

        packets.append(
            MiiPacket(rand,
                      dst_mac_addr=dut_mac_address,
                      create_data_args=[
                          'step', (gap_shrink, choose_small_frame_size(rand))
                      ],
                      inter_frame_gap=recovery_time))
        packets.append(
            MiiPacket(rand,
                      dst_mac_addr=dut_mac_address,
                      create_data_args=[
                          'step', (gap_shrink, choose_small_frame_size(rand))
                      ],
                      inter_frame_gap=new_ifg))

    do_rx_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, packets, __file__,
               seed)
示例#11
0
def do_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, seed):
    rand = random.Random()
    rand.seed(seed)

    dut_mac_address = get_dut_mac_address()

    error_packets = []

    # Part A - length errors (len/type field value greater than actual data length)
    for (num_data_bytes, len_type, step) in [(46, 47, 20), (46, 1505, 21), (1504, 1505, 22)]:
        error_packets.append(MiiPacket(rand,
            dst_mac_addr=dut_mac_address,
            ether_len_type=[(len_type >> 8) & 0xff, len_type & 0xff],
            create_data_args=['step', (step, num_data_bytes)],
            dropped=True
          ))

        # Also do this for VLAN tagged frames
        error_packets.append(MiiPacket(rand,
            dst_mac_addr=dut_mac_address, vlan_prio_tag=[0x81, 0x00, 0x00, 0x00],
            ether_len_type=[(len_type >> 8) & 0xff, len_type & 0xff],
            create_data_args=['step', (step, num_data_bytes)],
            dropped=True
          ))

    # Part B - Part A with valid frames before/after the errror frame
    packets = []
    for packet in error_packets:
        packets.append(packet)

    ifg = tx_clk.get_min_ifg()
    for i,packet in enumerate(error_packets):
      # First valid frame (allowing time to process previous two valid frames)
      packets.append(MiiPacket(rand,
          dst_mac_addr=dut_mac_address,
          create_data_args=['step', (i%10, choose_small_frame_size(rand))],
          inter_frame_gap=2*packet_processing_time(tx_phy, 46, mac)
        ))

      # Take a copy to ensure that the original is not modified
      packet_copy = copy.deepcopy(packet)

      # Error frame after minimum IFG
      packet_copy.set_ifg(ifg)
      packets.append(packet_copy)

      # Second valid frame with minimum IFG
      packets.append(MiiPacket(rand,
          dst_mac_addr=dut_mac_address,
          create_data_args=['step', (2 * ((i+1)%10), choose_small_frame_size(rand))],
          inter_frame_gap=ifg
        ))

    do_rx_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, packets, __file__, seed)
示例#12
0
def do_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, seed):
    rand = random.Random()
    rand.seed(seed)

    dut_mac_address = get_dut_mac_address()

    error_packets = []

    # Part A - Invalid SFD nibble: use preamble nibble (0x5)
    error_packets.append(MiiPacket(rand,
        dst_mac_addr=dut_mac_address,
        sfd_nibble=0x5,
        create_data_args=['step', (19, choose_small_frame_size(rand))],
        dropped=True
      ))

    # Part B - Invalid SFD: replace last byte of preamble with 0x9 instead of 0x5
    error_packets.append(MiiPacket(rand,
        dst_mac_addr=dut_mac_address,
        preamble_nibbles=[0x5 for x in range(14)] + [0x9],
        create_data_args=['step', (20, choose_small_frame_size(rand))],
        dropped=True
      ))

    # Part C - Parts A and B with valid frames before/after the errror frame
    packets = []
    for packet in error_packets:
        packets.append(packet)

    ifg = tx_clk.get_min_ifg()
    for i,packet in enumerate(error_packets):
      # First valid frame (allowing time to process previous two valid frames)
      packets.append(MiiPacket(rand,
          dst_mac_addr=dut_mac_address,
          create_data_args=['step', (i%10, choose_small_frame_size(rand))],
          inter_frame_gap=2*packet_processing_time(tx_phy, 46, mac)
        ))

      # Take a copy to ensure that the original is not modified
      packet_copy = copy.deepcopy(packet)

      # Error frame after minimum IFG
      packet_copy.set_ifg(ifg)
      packets.append(packet_copy)

      # Second valid frame with minimum IFG
      packets.append(MiiPacket(rand,
          dst_mac_addr=dut_mac_address,
          create_data_args=['step', (2 * ((i+1)%10), choose_small_frame_size(rand))],
          inter_frame_gap=ifg
        ))

    do_rx_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, packets, __file__, seed)
示例#13
0
def do_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, seed):
    rand = random.Random()
    rand.seed(seed)

    dut_mac_address = get_dut_mac_address()

    packets = []

    ifg = tx_clk.get_min_ifg()

    # Part A - Ensure that two packets separated by minimum IFG are received ok
    packets.append(MiiPacket(rand,
        dst_mac_addr=dut_mac_address,
        create_data_args=['step', (rand.randint(1, 254), choose_small_frame_size(rand))]
      ))
    packets.append(MiiPacket(rand,
        dst_mac_addr=dut_mac_address,
        create_data_args=['step', (rand.randint(1, 254), choose_small_frame_size(rand))],
        inter_frame_gap=ifg
      ))

    # Part B - Determine the minimum IFG that can be supported
    bit_time = ifg/96

    # Allow lots of time for the DUT to recover between test bursts
    recovery_time = 4*packet_processing_time(tx_phy, 46, mac)

    # Test shrinking the IFG by different amounts. Use the shrink as the step for debug purposes
    for gap_shrink in [5, 10]:
        new_ifg = ifg - gap_shrink * bit_time

        packets.append(MiiPacket(rand,
            dst_mac_addr=dut_mac_address,
            create_data_args=['step', (gap_shrink, choose_small_frame_size(rand))],
            inter_frame_gap=recovery_time
          ))
        packets.append(MiiPacket(rand,
            dst_mac_addr=dut_mac_address,
            create_data_args=['step', (gap_shrink, choose_small_frame_size(rand))],
            inter_frame_gap=new_ifg
          ))

    do_rx_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, packets, __file__, seed)
示例#14
0
def do_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, seed):
    rand = random.Random()
    rand.seed(seed)

    dut_mac_address = get_dut_mac_address()

    packets = []

    # Part A - Send different length preambles and ensure the packets are still received
    # Check a selection of preamble lengths from 1 byte to 64 bytes (including SFD)
    test_lengths = [3, 4, 5, 61, 127]
    if tx_clk.get_rate() == Clock.CLK_125MHz:
        # The RGMII requires a longer preamble
        test_lengths = [5, 7, 9, 61, 127]

    for num_preamble_nibbles in test_lengths:
        packets.append(MiiPacket(rand,
            dst_mac_addr=dut_mac_address,
            num_preamble_nibbles=num_preamble_nibbles,
            create_data_args=['step', (rand.randint(1, 254), choose_small_frame_size(rand))],
            inter_frame_gap=packet_processing_time(tx_phy, 46, mac)
          ))

    do_rx_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, packets, __file__, seed)
示例#15
0
def do_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, seed):
    rand = random.Random()
    rand.seed(seed)

    dut_mac_address = get_dut_mac_address()

    # Part A
    error_packets = []

    # Test Frame 1 - Fragments (no SFD, no valid CRC)
    max_fragment_len = 143
    if tx_clk.get_rate == Clock.CLK_125MHz:
        max_fragment_len = 142

    # Incrememnt is meant to be 1, but for pragmatic reasons just test a subset of options (range(2, max_fragment_len, 1))
    for m in [2, max_fragment_len/3, max_fragment_len/2, max_fragment_len]:
      error_packets.append(MiiPacket(rand,
          num_preamble_nibbles=m, num_data_bytes=0,
          sfd_nibble=None, dst_mac_addr=[], src_mac_addr=[], ether_len_type=[],
          send_crc_word=False,
          dropped=True
        ))

    # Test Frame 2 - Runts - undersized data with a valid CRC
    # NOTES:
    #  - Take 4 off the data length to leave room for the CRC
    #  - The data contents will be the DUT MAC address when long enough to contain a dst address
    # Incrememnt is meant to be 1, but for pragmatic reasons just test a subset of options (range(5, 45, 1))
    for n in [5, 25, 45]:
      error_packets.append(MiiPacket(rand,
          dst_mac_addr=[], src_mac_addr=[], ether_len_type=[],
          data_bytes=[(x & 0xff) for x in range(n - 4)],
          dropped=True
        ))

    # There should have been no errors logged by the MAC
    #controller.dumpStats()

    # Part B

    # Test Frame 5 - send a 7-octect preamble
    error_packets.append(MiiPacket(rand,
        num_preamble_nibbles=15, num_data_bytes=0,
        sfd_nibble=None, dst_mac_addr=[], src_mac_addr=[],
        ether_len_type=[], send_crc_word=False,
        dropped=True
      ))

    # Test Frame 6 - send a 7-octect preamble with SFD
    error_packets.append(MiiPacket(rand,
        num_preamble_nibbles=15, num_data_bytes=0,
        dst_mac_addr=[], src_mac_addr=[],
        ether_len_type=[], send_crc_word=False,
        dropped=True
      ))

    # Test Frame 7 - send a 7-octect preamble with SFD and dest MAC
    error_packets.append(MiiPacket(rand,
        num_preamble_nibbles=15, num_data_bytes=6,
        dst_mac_addr=dut_mac_address,
        src_mac_addr=[], ether_len_type=[], send_crc_word=False,
        dropped=True
      ))

    # Test Frame 8 - send a 7-octect preamble with SFD, dest and src MAC
    error_packets.append(MiiPacket(rand,
        num_preamble_nibbles=15, num_data_bytes=12,
        dst_mac_addr=dut_mac_address,
        ether_len_type=[], send_crc_word=False,
        dropped=True
      ))

    # There should have been no errors logged by the MAC
    #controller.dumpStats()

    # Part C
    # Don't support flow control - so don't run

    # Part D
    # Parts A & B with valid frames before/after the errror frame
    packets = []
    for packet in error_packets:
        packets.append(packet)

    ifg = tx_clk.get_min_ifg()
    for i,packet in enumerate(error_packets):
      # First valid frame (allowing time to process previous two valid frames)
      packets.append(MiiPacket(rand,
          dst_mac_addr=dut_mac_address,
          create_data_args=['step', (i%10, 46)],
          inter_frame_gap=2*packet_processing_time(tx_phy, 46, mac)
        ))

      # Take a copy to ensure that the original is not modified
      packet_copy = copy.deepcopy(packet)

      # Error frame after minimum IFG
      packet_copy.set_ifg(ifg)
      packets.append(packet_copy)

      # Second valid frame with minimum IFG
      packets.append(MiiPacket(rand,
          dst_mac_addr=dut_mac_address,
          create_data_args=['step', (2 * ((i+1)%10), 46)],
          inter_frame_gap=ifg
        ))

    do_rx_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, packets, __file__, seed)
示例#16
0
def do_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, seed):
    rand = random.Random()
    rand.seed(seed)

    dut_mac_address = get_dut_mac_address()

    error_packets = []

    # Part A - maximum jabber size packet
    # Use a valid ether type as the type/len field can't encode the length
    ether_type_ip = [0x08, 0x00]

    # Jabber lengths as defined for 10Mb/s & 100Mb/s
    jabber_length = 9367
    if tx_clk.get_rate() == Clock.CLK_125MHz:
        # Length for 1000Mb/s
        jabber_length = 18742

    error_packets.append(
        MiiPacket(rand,
                  dst_mac_addr=dut_mac_address,
                  ether_len_type=ether_type_ip,
                  num_preamble_nibbles=7,
                  create_data_args=['step', (17, jabber_length)],
                  dropped=True))

    # Part B - Part A with valid frames before/after the errror frame
    packets = []
    for packet in error_packets:
        packets.append(packet)

    ifg = tx_clk.get_min_ifg()
    for i, packet in enumerate(error_packets):
        # First valid frame (allowing time to process previous two valid frames)
        packets.append(
            MiiPacket(rand,
                      dst_mac_addr=dut_mac_address,
                      create_data_args=[
                          'step', (i % 10, choose_small_frame_size(rand))
                      ],
                      inter_frame_gap=2 *
                      packet_processing_time(tx_phy, 46, mac)))

        # Take a copy to ensure that the original is not modified
        packet_copy = copy.deepcopy(packet)

        # Error frame after minimum IFG
        packet_copy.set_ifg(ifg)
        packets.append(packet_copy)

        # Second valid frame with minimum IFG
        packets.append(
            MiiPacket(rand,
                      dst_mac_addr=dut_mac_address,
                      create_data_args=[
                          'step',
                          (2 * ((i + 1) % 10), choose_small_frame_size(rand))
                      ],
                      inter_frame_gap=ifg))

    do_rx_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, packets, __file__,
               seed)
示例#17
0
def do_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, seed):
    rand = random.Random()
    rand.seed(seed)

    dut_mac_address = get_dut_mac_address()

    packets = []
    error_packets = []

    # Part A - untagged frame

    # Valid maximum size untagged frame (1500 data + 18 header & CRC bytes)
    packets.append(
        MiiPacket(rand,
                  dst_mac_addr=dut_mac_address,
                  create_data_args=['step', (1, 1500)]))

    # Oversized untagged frame - one byte too big for the 1522 bytes allowed per frame
    packet = MiiPacket(rand,
                       dst_mac_addr=dut_mac_address,
                       create_data_args=['step', (2, 1505)],
                       inter_frame_gap=packet_processing_time(
                           tx_phy, 1500, mac),
                       dropped=True)
    packets.append(packet)
    error_packets.append(packet)

    # Oversized untagged frame - too big for the 1522 bytes allowed per frame
    packet = MiiPacket(rand,
                       dst_mac_addr=dut_mac_address,
                       create_data_args=['step', (3, 1600)],
                       inter_frame_gap=packet_processing_time(
                           tx_phy, 1500, mac),
                       dropped=True)
    packets.append(packet)
    error_packets.append(packet)

    # Part B - VLAN/Prio tagged frame
    vlan_prio_tag = [0x81, 0x00, 0x00, 0x00]

    # Valid maximum size tagged frame (1500 data + 22 header & CRC bytes)
    packets.append(
        MiiPacket(rand,
                  dst_mac_addr=dut_mac_address,
                  vlan_prio_tag=vlan_prio_tag,
                  create_data_args=['step', (10, 1500)]))

    # Oversized tagged frame - just one byte too big
    packet = MiiPacket(rand,
                       dst_mac_addr=dut_mac_address,
                       vlan_prio_tag=vlan_prio_tag,
                       create_data_args=['step', (11, 1501)],
                       inter_frame_gap=packet_processing_time(
                           tx_phy, 1500, mac),
                       dropped=True)
    packets.append(packet)
    error_packets.append(packet)

    # Oversized tagged frame
    packet = MiiPacket(rand,
                       dst_mac_addr=dut_mac_address,
                       vlan_prio_tag=vlan_prio_tag,
                       create_data_args=['step', (12, 1549)],
                       inter_frame_gap=packet_processing_time(
                           tx_phy, 1500, mac),
                       dropped=True)
    packets.append(packet)
    error_packets.append(packet)

    # Part C
    # TODO - oversized envelope frame

    # Part D
    # Don't support flow control - so don't run

    # Part E
    # Parts A - C with valid frames before/after the errror frame
    ifg = tx_clk.get_min_ifg()
    for i, packet in enumerate(error_packets):
        # First valid frame (allowing time to process previous two valid frames)
        packets.append(
            MiiPacket(rand,
                      dst_mac_addr=dut_mac_address,
                      create_data_args=[
                          'step', (i % 10, choose_small_frame_size(rand))
                      ],
                      inter_frame_gap=2 *
                      packet_processing_time(tx_phy, 46, mac)))

        # Take a copy to ensure that the original is not modified
        packet_copy = copy.deepcopy(packet)

        # Error frame after minimum IFG
        packet_copy.set_ifg(ifg)
        packets.append(packet_copy)

        # Second valid frame with minimum IFG
        packets.append(
            MiiPacket(rand,
                      dst_mac_addr=dut_mac_address,
                      create_data_args=[
                          'step',
                          (2 * ((i + 1) % 10), choose_small_frame_size(rand))
                      ],
                      inter_frame_gap=ifg))

    do_rx_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, packets, __file__,
               seed)
示例#18
0
def do_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, seed):
    rand = random.Random()
    rand.seed(seed)

    dut_mac_address = get_dut_mac_address()

    packets = []
    error_packets = []

    # Part A - untagged frame

    # Valid maximum size untagged frame (1500 data + 18 header & CRC bytes)
    packets.append(MiiPacket(rand,
        dst_mac_addr=dut_mac_address, create_data_args=['step', (1, 1500)]
      ))

    # Oversized untagged frame - one byte too big for the 1522 bytes allowed per frame
    packet = MiiPacket(rand,
        dst_mac_addr=dut_mac_address, create_data_args=['step', (2, 1505)],
        inter_frame_gap=packet_processing_time(tx_phy, 1500, mac),
        dropped=True
      )
    packets.append(packet)
    error_packets.append(packet)

    # Oversized untagged frame - too big for the 1522 bytes allowed per frame
    packet = MiiPacket(rand,
        dst_mac_addr=dut_mac_address, create_data_args=['step', (3, 1600)],
        inter_frame_gap=packet_processing_time(tx_phy, 1500, mac),
        dropped=True
      )
    packets.append(packet)
    error_packets.append(packet)

    # Part B - VLAN/Prio tagged frame
    vlan_prio_tag = [0x81, 0x00, 0x00, 0x00]

    # Valid maximum size tagged frame (1500 data + 22 header & CRC bytes)
    packets.append(MiiPacket(rand,
        dst_mac_addr=dut_mac_address, vlan_prio_tag=vlan_prio_tag,
        create_data_args=['step', (10, 1500)]
      ))

    # Oversized tagged frame - just one byte too big
    packet = MiiPacket(rand,
        dst_mac_addr=dut_mac_address, vlan_prio_tag=vlan_prio_tag,
        create_data_args=['step', (11, 1501)],
        inter_frame_gap=packet_processing_time(tx_phy, 1500, mac),
        dropped=True
      )
    packets.append(packet)
    error_packets.append(packet)

    # Oversized tagged frame
    packet = MiiPacket(rand,
        dst_mac_addr=dut_mac_address, vlan_prio_tag=vlan_prio_tag,
        create_data_args=['step', (12, 1549)],
        inter_frame_gap=packet_processing_time(tx_phy, 1500, mac),
        dropped=True
      )
    packets.append(packet)
    error_packets.append(packet)

    # Part C
    # TODO - oversized envelope frame

    # Part D
    # Don't support flow control - so don't run

    # Part E
    # Parts A - C with valid frames before/after the errror frame
    ifg = tx_clk.get_min_ifg()
    for i,packet in enumerate(error_packets):
      # First valid frame (allowing time to process previous two valid frames)
      packets.append(MiiPacket(rand,
          dst_mac_addr=dut_mac_address,
          create_data_args=['step', (i%10, choose_small_frame_size(rand))],
          inter_frame_gap=2*packet_processing_time(tx_phy, 46, mac)
        ))

      # Take a copy to ensure that the original is not modified
      packet_copy = copy.deepcopy(packet)

      # Error frame after minimum IFG
      packet_copy.set_ifg(ifg)
      packets.append(packet_copy)

      # Second valid frame with minimum IFG
      packets.append(MiiPacket(rand,
          dst_mac_addr=dut_mac_address,
          create_data_args=['step', (2 * ((i+1)%10), choose_small_frame_size(rand))],
          inter_frame_gap=ifg
        ))

    do_rx_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, packets, __file__, seed)
示例#19
0
def do_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, seed):
    rand = random.Random()
    rand.seed(seed)

    dut_mac_address = get_dut_mac_address()

    error_packets = []

    # Part A - length errors (len/type field value greater than actual data length)
    for (num_data_bytes, len_type, step) in [(46, 47, 20), (46, 1505, 21),
                                             (1504, 1505, 22)]:
        error_packets.append(
            MiiPacket(rand,
                      dst_mac_addr=dut_mac_address,
                      ether_len_type=[(len_type >> 8) & 0xff, len_type & 0xff],
                      create_data_args=['step', (step, num_data_bytes)],
                      dropped=True))

        # Also do this for VLAN tagged frames
        error_packets.append(
            MiiPacket(rand,
                      dst_mac_addr=dut_mac_address,
                      vlan_prio_tag=[0x81, 0x00, 0x00, 0x00],
                      ether_len_type=[(len_type >> 8) & 0xff, len_type & 0xff],
                      create_data_args=['step', (step, num_data_bytes)],
                      dropped=True))

    # Part B - Part A with valid frames before/after the errror frame
    packets = []
    for packet in error_packets:
        packets.append(packet)

    ifg = tx_clk.get_min_ifg()
    for i, packet in enumerate(error_packets):
        # First valid frame (allowing time to process previous two valid frames)
        packets.append(
            MiiPacket(rand,
                      dst_mac_addr=dut_mac_address,
                      create_data_args=[
                          'step', (i % 10, choose_small_frame_size(rand))
                      ],
                      inter_frame_gap=2 *
                      packet_processing_time(tx_phy, 46, mac)))

        # Take a copy to ensure that the original is not modified
        packet_copy = copy.deepcopy(packet)

        # Error frame after minimum IFG
        packet_copy.set_ifg(ifg)
        packets.append(packet_copy)

        # Second valid frame with minimum IFG
        packets.append(
            MiiPacket(rand,
                      dst_mac_addr=dut_mac_address,
                      create_data_args=[
                          'step',
                          (2 * ((i + 1) % 10), choose_small_frame_size(rand))
                      ],
                      inter_frame_gap=ifg))

    do_rx_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, packets, __file__,
               seed)
示例#20
0
def do_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, seed):
    rand = random.Random()
    rand.seed(seed)

    dut_mac_address = get_dut_mac_address()

    error_packets = []

    # Test that packets where the RXER line goes high are dropped even
    # if the rest of the packet is valid

    # Error on the first nibble of the preamble
    num_data_bytes = choose_small_frame_size(rand)
    error_packets.append(MiiPacket(rand,
        dst_mac_addr=dut_mac_address,
        num_data_bytes=num_data_bytes,
        error_nibbles=[0],
        dropped=True
      ))

    # Error somewhere in the middle of the packet
    num_data_bytes = choose_small_frame_size(rand)
    error_packets.append(MiiPacket(rand,
        dst_mac_addr=dut_mac_address,
        num_data_bytes=num_data_bytes,
        dropped=True
      ))
    packet = error_packets[-1]
    error_nibble = rand.randint(packet.num_preamble_nibbles + 1, len(packet.get_nibbles()))
    packet.error_nibbles = [error_nibble]

    # Due to BUG 16233 the RGMII code won't always detect an error in the last two bytes
    num_data_bytes = choose_small_frame_size(rand)
    error_packets.append(MiiPacket(rand,
        dst_mac_addr=dut_mac_address,
        num_data_bytes=num_data_bytes,
        dropped=True
      ))
    packet = error_packets[-1]
    packet.error_nibbles = [len(packet.get_nibbles()) - 5]

    # Now run all packets with valid frames before/after the errror frame to ensure the
    # errors don't interfere with valid frames
    packets = []
    for packet in error_packets:
        packets.append(packet)

    ifg = tx_clk.get_min_ifg()
    for i,packet in enumerate(error_packets):
      # First valid frame (allowing time to process previous two valid frames)
      packets.append(MiiPacket(rand,
          dst_mac_addr=dut_mac_address,
          create_data_args=['step', (i%10, choose_small_frame_size(rand))],
          inter_frame_gap=3*packet_processing_time(tx_phy, 46, mac)
        ))

      # Take a copy to ensure that the original is not modified
      packet_copy = copy.deepcopy(packet)

      # Error frame after minimum IFG
      packet_copy.set_ifg(ifg)
      packets.append(packet_copy)

      # Second valid frame with minimum IFG
      packets.append(MiiPacket(rand,
          dst_mac_addr=dut_mac_address,
          create_data_args=['step', (2 * ((i+1)%10), choose_small_frame_size(rand))],
          inter_frame_gap=ifg
        ))

    do_rx_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, packets, __file__, seed)
示例#21
0
def do_test(mac, tx_clk, tx_phy):
    resources = xmostest.request_resource("xsim")

    testname = 'test_appdata'

    binary = '{test}/bin/{mac}_{phy}/{test}_{mac}_{phy}.xe'.format(
        test=testname, mac=mac, phy=tx_phy.get_name())

    print "Running {test}: {phy} phy at {clk}".format(test=testname,
                                                      phy=tx_phy.get_name(),
                                                      clk=tx_clk.get_name())

    rand = random.Random()

    dut_mac_address = get_dut_mac_address()
    packets = [
        MiiPacket(rand,
                  dst_mac_addr=[0, 1, 2, 3, 4, 7],
                  src_mac_addr=[0 for x in range(6)],
                  ether_len_type=[0x33, 0x33],
                  inter_frame_gap=packet_processing_time(tx_phy, 64, mac) * 4,
                  data_bytes=[1, 2, 3, 4] + [0 for x in range(60)]),
        MiiPacket(rand,
                  dst_mac_addr=[0, 1, 2, 3, 4, 0],
                  src_mac_addr=[0 for x in range(6)],
                  ether_len_type=[0x11, 0x11],
                  inter_frame_gap=packet_processing_time(tx_phy, 64, mac) * 4,
                  data_bytes=[1, 2, 3, 4] + [0 for x in range(60)]),
        MiiPacket(rand,
                  dst_mac_addr=[0, 1, 2, 3, 4, 1],
                  src_mac_addr=[0 for x in range(6)],
                  ether_len_type=[0x22, 0x22],
                  inter_frame_gap=packet_processing_time(tx_phy, 64, mac) * 4,
                  data_bytes=[5, 6, 7, 8] + [0 for x in range(60)]),
        MiiPacket(rand,
                  dst_mac_addr=[0, 1, 2, 3, 4, 2],
                  src_mac_addr=[0 for x in range(6)],
                  ether_len_type=[0x33, 0x33],
                  inter_frame_gap=packet_processing_time(tx_phy, 64, mac) * 4,
                  data_bytes=[4, 3, 2, 1] + [0 for x in range(60)]),
        MiiPacket(rand,
                  dst_mac_addr=[0, 1, 2, 3, 4, 3],
                  src_mac_addr=[0 for x in range(6)],
                  ether_len_type=[0x44, 0x44],
                  inter_frame_gap=packet_processing_time(tx_phy, 64, mac) * 4,
                  data_bytes=[8, 7, 6, 5] + [0 for x in range(60)])
    ]

    tx_phy.set_packets(packets)

    tester = xmostest.ComparisonTester(
        open('test_appdata_{phy}_{mac}.expect'.format(phy=tx_phy.get_name(),
                                                      mac=mac)),
        'lib_ethernet', 'basic_tests', testname, {
            'mac': mac,
            'phy': tx_phy.get_name(),
            'clk': tx_clk.get_name()
        })

    simargs = get_sim_args(testname, mac, tx_clk, tx_phy)
    tester.set_min_testlevel('nightly')
    xmostest.run_on_simulator(resources['xsim'],
                              binary,
                              simthreads=[tx_clk, tx_phy],
                              tester=tester,
                              simargs=simargs)
示例#22
0
def do_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, seed):
    rand = random.Random()
    rand.seed(seed)

    dut_mac_address = get_dut_mac_address()

    error_packets = []

    # Part A - Invalid preamble nibbles, but the frame should still be received
    preamble_nibbles = [0x5, 0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5]
    if tx_clk.get_rate() == Clock.CLK_125MHz:
        preamble_nibbles = [0x5, 0x5, 0x5, 0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5]

    error_packets.append(MiiPacket(rand,
        dst_mac_addr=dut_mac_address,
        preamble_nibbles=preamble_nibbles,
        create_data_args=['step', (rand.randint(1, 254), choose_small_frame_size(rand))]
      ))

    # Part B - Invalid preamble nibbles, but the packet should still be received
    preamble_nibbles = [0x5, 0x5, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0x5]
    if tx_clk.get_rate() == Clock.CLK_125MHz:
        preamble_nibbles = [0x5, 0x5, 0x5, 0x5, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0x5]

    error_packets.append(MiiPacket(rand,
        dst_mac_addr=dut_mac_address,
        preamble_nibbles=preamble_nibbles,
        create_data_args=['step', (rand.randint(1, 254), choose_small_frame_size(rand))],
        inter_frame_gap=packet_processing_time(tx_phy, 46, mac)
      ))

    # Part C - Invalid preamble nibbles, but the packet should still be received
    preamble_nibbles = [0x5, 0x5, 0x5, 0x5, 0x5, 0x5, 0x5, 0x5, 0x5, 0x5, 0x5, 0x8, 0x5, 0xf, 0x5]

    error_packets.append(MiiPacket(rand,
        dst_mac_addr=dut_mac_address,
        preamble_nibbles=preamble_nibbles,
        create_data_args=['step', (rand.randint(1, 254), choose_small_frame_size(rand))],
        inter_frame_gap=packet_processing_time(tx_phy, 46, mac)
      ))

    # Part D - Parts A, B and C with valid frames before/after the errror frame
    packets = []
    for packet in error_packets:
        packets.append(packet)

    ifg = tx_clk.get_min_ifg()
    for i,packet in enumerate(error_packets):
      # First valid frame (allowing time to process previous two valid frames)
      packets.append(MiiPacket(rand,
          dst_mac_addr=dut_mac_address,
          create_data_args=['step', (i%10, choose_small_frame_size(rand))],
          inter_frame_gap=3*packet_processing_time(tx_phy, 46, mac)
        ))

      # Take a copy to ensure that the original is not modified
      packet_copy = copy.deepcopy(packet)

      # Error frame after minimum IFG
      packet_copy.set_ifg(ifg)
      packets.append(packet_copy)

      # Second valid frame with minimum IFG
      packets.append(MiiPacket(rand,
          dst_mac_addr=dut_mac_address,
          create_data_args=['step', (2 * ((i+1)%10), choose_small_frame_size(rand))],
          inter_frame_gap=ifg
        ))

    do_rx_test(mac, arch, rx_clk, rx_phy, tx_clk, tx_phy, packets, __file__, seed)