示例#1
0
test_case_table = mk_test_case_table([
    ('msg_func                ncols  nrows src_init src_pintv  src_fintv sink_init sink_pintv sink_fintv'
     ),
    [
        'basic',
        basic_pkts,
        2,
        2,
        0,
        0,
        0,
        0,
        0,
        0,
    ],
    [
        'basic4x4',
        basic_pkts,
        4,
        4,
        0,
        0,
        0,
        0,
        0,
        0,
    ],
    [
        'basic2x7',
        basic_pkts,
        2,
        7,
        0,
        0,
        0,
        0,
        0,
        0,
    ],
    [
        'basic2x7_delay',
        basic_pkts,
        2,
        7,
        0,
        0,
        0,
        20,
        0,
        0,
    ],
    [
        'offchip2x7',
        basic_offchip_pkts,
        2,
        7,
        0,
        0,
        0,
        0,
        0,
        0,
    ],
    [
        'long2x7',
        offchip_long_pkts,
        2,
        7,
        0,
        0,
        0,
        0,
        0,
        0,
    ],
    [
        'neighbor2x2',
        neighbor_pkts,
        2,
        2,
        0,
        0,
        0,
        0,
        0,
        0,
    ],
    [
        'neighbor2x3',
        neighbor_pkts,
        2,
        3,
        0,
        0,
        0,
        0,
        0,
        0,
    ],
    [
        'neighbor3x3',
        neighbor_pkts,
        3,
        3,
        0,
        0,
        0,
        0,
        0,
        0,
    ],
    [
        'neighbor4x4',
        neighbor_pkts,
        4,
        4,
        0,
        0,
        0,
        0,
        0,
        0,
    ],
    [
        'neighbor2x7',
        neighbor_pkts,
        2,
        7,
        0,
        0,
        0,
        0,
        0,
        0,
    ],
])
    #   src_x src_y dst_x dst_y opq   payload
    (0, 0, 0, 1, 0x00, 0x0010),
    (1, 0, 1, 1, 0x01, 0x0020),
    (3, 2, 1, 1, 0x02, 0x0020),
    (1, 0, 1, 1, 0x03, 0x0020),
    (1, 3, 2, 1, 0x04, 0x0020),
    (3, 5, 1, 0, 0x05, 0x0020),
]

#-------------------------------------------------------------------------
# test case table
#-------------------------------------------------------------------------

test_case_table = mk_test_case_table([
    ("msg_list    wid  ht  src_init src_intv sink_init sink_intv"),
    ["simple2x2", simple_2x2, 2, 2, 0, 0, 0, 0],
    ["simple4x4", simple_4x4, 4, 4, 0, 0, 0, 0],
    ["simple8x8", simple_8x8, 8, 8, 0, 0, 0, 0],
])

#-------------------------------------------------------------------------
# run test
#-------------------------------------------------------------------------


@pytest.mark.parametrize(**test_case_table)
def test_mesh_simple(test_params):
    PktType = mk_mesh_pkt(ncols=test_params.wid, nrows=test_params.ht, vc=1)

    src_msgs, sink_msgs = mk_src_sink_msgs(PktType, test_params.msg_list,
                                           test_params.wid, test_params.ht)
    th = TestHarness(
示例#3
0
        10,
    ]


#-------------------------------------------------------------------------
# Test cases
#-------------------------------------------------------------------------


@pytest.mark.parametrize(**mk_test_case_table([
    ("msg_func        lat   src_lat sink_lat  "),
    ["basic", basic_msgs, 0, 0, 0],
    ["basic_lat1", basic_msgs, 1, 0, 0],
    ["basic_lat2", basic_msgs, 2, 0, 0],
    ["basic_lat3", basic_msgs, 3, 0, 0],
    ["basic_lat4", basic_msgs, 4, 0, 0],
    ["basic_lat10", basic_msgs, 10, 0, 0],
    ["basic_3_14", basic_msgs, 0, 3, 14],
    ["basic_lat1_3_14", basic_msgs, 1, 3, 14],
    ["basic_lat4_3_14", basic_msgs, 4, 3, 14],
    ["basic_lat10_3_14", basic_msgs, 10, 3, 14],
]))
def test_delay_pipe_deq(test_params, cmdline_opts):
    msgs = test_params.msg_func()
    run_sim(
        TestHarness(DelayPipeDeqCL, msgs[::2], msgs[1::2], test_params.lat,
                    test_params.src_lat, test_params.sink_lat))


@pytest.mark.parametrize(**mk_test_case_table([
    ("msg_func        lat   src_lat sink_lat  "),
    ['basic1x2', basic_pkts, 1, 2, 0, 0, 0],
    ['neighbor4x4', neighbor_pkts, 4, 4, 0, 0, 0],
    ['neighbor5x2', neighbor_pkts, 5, 2, 0, 0, 0],
    ['neighbor3x3_delay', neighbor_pkts, 4, 4, 5, 2, 9],
    ['product4x4', product_pkts, 4, 4, 0, 0, 4],
    ['product8x8', product_pkts, 8, 8, 0, 0, 2],
    ['product3x4', product_pkts, 3, 4, 0, 0, 1],
    ['product7x3', product_pkts, 7, 3, 0, 0, 1],
    ['product8x1', product_pkts, 8, 1, 0, 0, 0],
    ['product8x1_delay', product_pkts, 8, 1, 0, 0, 10],
    ['product8x1_delay', product_pkts, 8, 1, 0, 0, 10],
    ['hotspot4x1', hotspot_pkts, 4, 1, 0, 0, 0],
    ['hotspot4x1_delay', hotspot_pkts, 4, 1, 0, 0, 13],
]

test_case_table = mk_test_case_table(test_cases)

#-------------------------------------------------------------------------
# test driver
#-------------------------------------------------------------------------


@pytest.mark.parametrize(**test_case_table)
def test_mflit_xbar(test_params, cmdline_opts):
    pkts = test_params.msg_func(test_params.n_in, test_params.n_out)
    th = TestHarness(TestHeader, test_params.n_in, test_params.n_out, pkts)
    th.set_param(
        'top.sink*.construct',
        initial_delay=test_params.init,
        flit_interval_delay=test_params.f_intv,
        packet_interval_delay=test_params.p_intv,
示例#5
0
        payload = [x for x in range(i % 10)]
        pkts.append(mk_pkt(n, src_x, src_y, n, dst_x, dst_y, payload))

    return pkts


#-------------------------------------------------------------------------
# test case table
#-------------------------------------------------------------------------

test_case_table = mk_test_case_table([
    ('msg_func        ncols  nrows'),
    ['basic', basic_pkts, 2, 2],
    ['basic4x4', basic_pkts, 4, 4],
    ['basic2x7', basic_pkts, 2, 7],
    ['neighbor2x2', neighbor_pkts, 2, 2],
    ['neighbor2x3', neighbor_pkts, 2, 3],
    ['neighbor3x3', neighbor_pkts, 3, 3],
    ['neighbor4x4', neighbor_pkts, 4, 4],
    ['neighbor2x7', neighbor_pkts, 2, 7],
])

#-------------------------------------------------------------------------
# test driver
#-------------------------------------------------------------------------


@pytest.mark.parametrize(**test_case_table)
def test_piton_mesh(test_params, cmdline_opts):
    ncols = test_params.ncols
    nrows = test_params.nrows
示例#6
0
            ])

    return msgs


#-------------------------------------------------------------------------
# Test Case Table
#-------------------------------------------------------------------------

test_case_table = mk_test_case_table([
    ("msg_func          stall lat src_init src_intv sink_init sink_intv"),
    ["basic", basic_msgs, 0.0, 1, 0, 0, 0, 0],
    ["stream", stream_msgs, 0.0, 1, 0, 0, 0, 0],
    ["subword_rd", subword_rd_msgs, 0.0, 1, 0, 0, 0, 0],
    ["subword_wr", subword_wr_msgs, 0.0, 1, 0, 0, 0, 0],
    ["amo", amo_msgs, 0.0, 1, 0, 0, 0, 0],
    ["random", random_msgs, 0.0, 1, 0, 0, 0, 0],
    ["random_3x14", random_msgs, 0.0, 1, 5, 3, 7, 14],
    ["stream_stall0.5_lat0", stream_msgs, 0.5, 1, 0, 0, 0, 0],
    ["stream_stall0.0_lat4", stream_msgs, 0.0, 4, 0, 0, 0, 0],
    ["stream_stall0.5_lat4", stream_msgs, 0.5, 4, 0, 0, 0, 0],
    ["random_stall0.5_lat4_3x14", random_msgs, 0.5, 4, 5, 14, 7, 14],
])

#-------------------------------------------------------------------------
# Test cases for 1 port
#-------------------------------------------------------------------------


@pytest.mark.parametrize(**test_case_table)
def test_1port(test_params, cmdline_opts):
    msgs = test_params.msg_func(0x1000)
                req('wr', i, base_addr + 4 * idx, 0, num),
                resp('wr', i, 0, 0),
            ])

    return msgs


#-------------------------------------------------------------------------
# Test table for generic test
#-------------------------------------------------------------------------

test_case_table = mk_test_case_table([
    ("msg_func             src sink"),
    ["basic_single_msgs", basic_single_msgs, 0, 0],
    ["basic_multiple_msgs", basic_multiple_msgs, 0, 0],
    ["random", random_msgs, 0, 0],
    ["random_0_3", random_msgs, 0, 3],
    ["random_3_0", random_msgs, 3, 0],
    ["random_3_5", random_msgs, 3, 5],
])

#-------------------------------------------------------------------------
# Test table for generic test
#-------------------------------------------------------------------------


@pytest.mark.parametrize(**test_case_table)
def test(test_params, cmdline_opts):

    # instantiate test harness
    [ 0,  0,  0,  0,  0,  0,  x,  x,  x,  x ],
  ] )

#-------------------------------------------------------------------------
# Parameterized Testing with Test Case Table
#-------------------------------------------------------------------------
# Note: FL is always 1-stage!

test_case_table = mk_test_case_table([
  (                 "nstages inputs      "),
  [ "1stage_stream", 1,      tvec_stream  ],
  [ "1stage_dups",   1,      tvec_dups    ],
  [ "1stage_sorted", 1,      tvec_sorted  ],
  [ "1stage_random", 1,      tvec_random  ],
  [ "2stage_stream", 2,      tvec_stream  ],
  [ "2stage_dups",   2,      tvec_dups    ],
  [ "2stage_sorted", 2,      tvec_sorted  ],
  [ "2stage_random", 2,      tvec_random  ],
  [ "3stage_stream", 3,      tvec_stream  ],
  [ "3stage_dups",   3,      tvec_dups    ],
  [ "3stage_sorted", 3,      tvec_sorted  ],
  [ "3stage_random", 3,      tvec_random  ],
])

@pytest.mark.parametrize( **test_case_table )
def test_sort_fl( test_params ):
  nstages = test_params.nstages
  inputs  = test_params.inputs
  run_test_vector_sim( SortUnitFL(), mk_test_vector_table( 1, inputs ) )

#-------------------------------------------------------------------------
示例#9
0
    #0x00000000C280004041E0000200000000, 0x00000000000000000000000000000000,
    #0x00000000BFFFFFCF000000004FFFDFF7, 0x000000000000000000000000C2800040,
    #0x0000000000000000015E834A00000000, 0x000000000000000000000000BFFFFFCF

    #0x0000000000000000015E834A00000000, 0x000000000000000000000000BFFFFFCF,
]

#-------------------------------------------------------------------------
# Test Case small
#-------------------------------------------------------------------------

test_case = mk_test_case_table([
    ("msgs        src_delay  sink_delay"),
    [
        "basic_0x0",
        basic_msgs,
        0,
        0,
    ],
])

#-------------------------------------------------------------------------
# Test cases
#-------------------------------------------------------------------------


@pytest.mark.parametrize(**test_case)
def test_stack_8bit(test_params, cmdline_opts):

    th = TestHarness(hard_bits=4, loopback=1,
                     queue_size=4)  # all 0s = no additional modules
        # offchip xpos  ypos  payload
        mk_pkt(True, 0, 0, [0x8badf00d_faceb00c]),
        mk_pkt(False, 0, 0, []),
        mk_pkt(True, 0, 0, [0x8badf00d_faceb00c, 0xbaaaaaad_f000000d]),
        mk_pkt(False, 0, 0, [0x11111111_aaaaaaaa, 0x000edcba_badaceee]),
    ]


#-------------------------------------------------------------------------
# test case table
#-------------------------------------------------------------------------

test_case_table = mk_test_case_table([
    ('msg_func      pos_x pos_y'),
    ['offchip_0_6', offchip_pkts, 0, 6],
    ['offchip_1_6', offchip_pkts, 1, 6],
    ['offchip_0_5', offchip_pkts, 0, 5],
    ['mix_0_6', mix_pkts, 0, 6],
])

#-------------------------------------------------------------------------
# test driver
#-------------------------------------------------------------------------


@pytest.mark.parametrize(**test_case_table)
def test_piton_router_2x7(test_params):
    pkts = test_params.msg_func()
    pos_x = test_params.pos_x
    pos_y = test_params.pos_y
    th = TestHarness(PitonPosition, pkts, pos_x, pos_y)
示例#11
0
test_case_8bits = mk_test_case_table([
    ("msgs        src_delay  sink_delay"),
    [
        "basic_0x0",
        basic_msgs,
        0,
        0,
    ],
    [
        "basic_1x5",
        basic_msgs,
        1,
        5,
    ],
    [
        "basic_3x1",
        basic_msgs,
        3,
        1,
    ],
    [
        "basic_8x8",
        basic_msgs,
        8,
        8,
    ],
    [
        "basic_7x7",
        basic_msgs,
        7,
        7,
    ],
])
示例#12
0
test_case_table = mk_test_case_table([
    ("msgs        src_delay  sink_delay"),
    [
        "basic_0x0",
        basic_msgs,
        0,
        0,
    ],
    [
        "basic_5x0",
        basic_msgs,
        5,
        0,
    ],
    [
        "basic_0x5",
        basic_msgs,
        0,
        5,
    ],
    [
        "basic_3x9",
        basic_msgs,
        3,
        9,
    ],
    [
        "random_3x9",
        random_msgs,
        3,
        9,
    ],
])
  for input_ in inputs:
    test_vector_table.append( [ input_, last_results.popleft() ] )
    last_results.append( b8( input_ + nstages, trunc_int=True ) )

  return test_vector_table

#-------------------------------------------------------------------------
# Parameterized Testing with Test Case Table
#-------------------------------------------------------------------------

test_case_table = mk_test_case_table([
  (                    "nstages inputs                "),
  [ "2stage_small",    2,       [ 0x00, 0x03, 0x06 ]   ],
  [ "2stage_large",    2,       [ 0xa0, 0xb3, 0xc6 ]   ],
  [ "2stage_overflow", 2,       [ 0x00, 0xfe, 0xff ]   ],
  [ "2stage_random",   2,       sample(range(0xff),20) ],
  [ "3stage_small",    3,       [ 0x00, 0x03, 0x06 ]   ],
  [ "3stage_large",    3,       [ 0xa0, 0xb3, 0xc6 ]   ],
  [ "3stage_overflow", 3,       [ 0x00, 0xfe, 0xff ]   ],
  [ "3stage_random",   3,       sample(range(0xff),20) ],
])

@pytest.mark.parametrize( **test_case_table )
def test( test_params, cmdline_opts ):
  nstages = test_params.nstages
  inputs  = test_params.inputs
  run_test_vector_sim( RegIncrNstage( nstages ),
    mk_test_vector_table( nstages, inputs ), cmdline_opts )

#-------------------------------------------------------------------------
# Parameterized Testing of With nstages = [ 1, 2, 3, 4, 5, 6 ]