Exemplo n.º 1
0
def raw():

    # Instantiate HW and Emulator Processors
    readConf()
    hw_proc = rtlHw(N, M, IB_DEPTH, FUVRF_SIZE, VVVRF_SIZE, TB_SIZE,
                    DATA_WIDTH, MAX_CHAINS, BUILDING_BLOCKS, DATA_TYPE,
                    DEVICE_FAM)
    emu_proc = emulatedHw(N, M, IB_DEPTH, FUVRF_SIZE, VVVRF_SIZE, TB_SIZE,
                          MAX_CHAINS, BUILDING_BLOCKS)

    # Create common input values
    num_input_vectors = 3
    pushVals(emu_proc, hw_proc, num_input_vectors, neg_vals=True)

    # Configure firmware - Both HW and Emulator work with the same firmware
    fw = firm.raw(hw_proc.compiler)
    emu_proc.config(fw)
    hw_proc.config(fw)

    # Run HW simulation and emulation
    steps = 30
    hw_results = hw_proc.run(steps=steps, gui=False, log=False)
    emu_results = emu_proc.run(steps=steps)

    # Filter Results
    emu_results_filtered, hw_results_filtered = filterResults(
        emu_results, hw_results, DATA_TYPE)

    # Verify that results are equal
    assert np.allclose(emu_results_filtered, hw_results_filtered, rtol=0.01)
    print("Passed test #1")
Exemplo n.º 2
0
def predictiveness():

    # Instantiate HW and Emulator Processors
    readConf()
    DATA_TYPE = 'int'
    BUILDING_BLOCKS = [
        'InputBuffer', 'FilterReduceUnit', 'VectorScalarReduce',
        'VectorVectorALU', 'DataPacker', 'TraceBuffer'
    ]
    hw_proc = rtlHw(N, M, IB_DEPTH, FUVRF_SIZE, VVVRF_SIZE, TB_SIZE,
                    DATA_WIDTH, MAX_CHAINS, BUILDING_BLOCKS, DATA_TYPE,
                    DEVICE_FAM)
    emu_proc = emulatedHw(N, M, IB_DEPTH, FUVRF_SIZE, VVVRF_SIZE, TB_SIZE,
                          MAX_CHAINS, BUILDING_BLOCKS)

    # Create common input values
    num_input_vectors = 4
    eof1 = [False, True, False, True]
    eof2 = [False, False, False, True]
    pushVals(emu_proc, hw_proc, num_input_vectors, eof1, eof2)

    # Configure firmware - Both HW and Emulator work with the same firmware
    fw = firm.activationPredictiveness(hw_proc.compiler)
    emu_proc.config(fw)
    hw_proc.config(fw)

    # Run HW simulation and emulation
    steps = 45
    hw_results = hw_proc.run(steps=steps, gui=False, log=False)
    emu_results = emu_proc.run(steps=steps)

    # Filter Results
    emu_results_filtered, hw_results_filtered = filterResults(
        emu_results, hw_results, DATA_TYPE)

    # Verify that results are equal
    assert np.allclose(emu_results_filtered, hw_results_filtered, rtol=0.05)
    print("Passed test #7")
Exemplo n.º 3
0
def distribution():

    # Instantiate HW and Emulator Processors
    readConf()
    hw_proc = rtlHw(N, M, IB_DEPTH, FUVRF_SIZE, VVVRF_SIZE, TB_SIZE,
                    DATA_WIDTH, MAX_CHAINS, BUILDING_BLOCKS, DATA_TYPE,
                    DEVICE_FAM)
    emu_proc = emulatedHw(N, M, IB_DEPTH, FUVRF_SIZE, VVVRF_SIZE, TB_SIZE,
                          MAX_CHAINS, BUILDING_BLOCKS)

    # Create common input values
    num_input_vectors = 2
    eof1 = num_input_vectors * [True]
    pushVals(emu_proc, hw_proc, num_input_vectors, eof1)

    # Initialize the memories the same way
    emu_proc.initialize_fu = list(range(FUVRF_SIZE * M))
    hw_proc.initialize_fu = list(range(FUVRF_SIZE * M))

    # Configure firmware - Both HW and Emulator work with the same firmware
    fw = firm.distribution(hw_proc.compiler, 16, 4)
    emu_proc.config(fw)
    hw_proc.config(fw)

    # Run HW simulation and emulation
    steps = 45
    hw_results = hw_proc.run(steps=steps, gui=False, log=False)
    emu_results = emu_proc.run(steps=steps)

    # Filter Results
    emu_results_filtered, hw_results_filtered = filterResults(
        emu_results, hw_results, DATA_TYPE)

    # Verify that results are equal
    assert np.allclose(emu_results_filtered, hw_results_filtered)
    print("Passed test #5")