Skip to content

Commit

Permalink
[#64893] Test multiple transaction widths in abp3_completer_mem example
Browse files Browse the repository at this point in the history
  • Loading branch information
adrabarek committed Sep 4, 2024
1 parent ce351b4 commit c53266e
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 7 deletions.
8 changes: 6 additions & 2 deletions samples/apb3_completer_mem/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@ set(SIM_TOP sim)
set(SIM_TOP_FILE sim.sv)
set(SIM_FILES apb3_completer_mem.sv)

# TODO: Tests currently assume 32 bits, changing this will cause them to fail.
# Modify the tests to work with all possible bus widths.
set(APB3_DATA_WIDTH 32 CACHE STRING "Width of data channels in the APB3 bus")

# Verilator variables
set(VERILATOR_CSOURCES ../../cpp/sim_main_dpi.cpp)
set(VERILATOR_ARGS --timing --assert)
set(VERILATOR_ARGS --timing --assert -GAPB3BusDataWidth=${APB3_DATA_WIDTH})

# Questa variables
set(QUESTA_ARGS "")
set(QUESTA_OPTIMIZATION_ARGS -floatparameters+ReceiverPort+SenderPort+Address)
set(QUESTA_OPTIMIZATION_ARGS -floatparameters+ReceiverPort+SenderPort+Address -GAPB3BusDataWidth=${APB3_DATA_WIDTH})

# CMake file doing the hard job
include(../../cmake/build-cosimulation.cmake)
3 changes: 2 additions & 1 deletion samples/apb3_completer_mem/platform.repl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
mem: Verilated.VerilatedPeripheral @ sysbus <0x0, +0x10000>
maxWidth: 32
// Note: QuadWord accesses will be truncated to the APB3 bus width (32-bits in this example)
maxWidth: 64
limitBuffer: 1000000
timeout: 10000
address: "127.0.0.1"
10 changes: 10 additions & 0 deletions samples/apb3_completer_mem/tests.robot
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Test Teardown Run Keywords
*** Variables ***
${DUT} mem
${TEST_DATA} 12345678CAFEBABE5A5A5A5ADEADBEEF
${TEST_DATA_32BIT_TRUNCATED} 1234567800000000

${DPI_PLATFORM} ${CURDIR}/platform.resc
${BUILD_DIRECTORY} ${CURDIR}/build
Expand All @@ -26,8 +27,17 @@ Memory Should Contain
Should Contain ${res} ${val}

Test Read And Write Memory
Write To Peripheral ${DUT} QuadWord 0x0 ${TEST_DATA}
# The APB3 bus data width in the example is 32-bits. The platform specifies
# maxWidth as 64, so there must be no error, but the result must be
# truncated to the APB3 bus data width
Should Peripheral Contain ${DUT} QuadWord 0x0 ${TEST_DATA_32BIT_TRUNCATED}
Write To Peripheral ${DUT} DoubleWord 0x0 ${TEST_DATA}
Should Peripheral Contain ${DUT} DoubleWord 0x0 ${TEST_DATA}
Write To Peripheral ${DUT} Word 0x0 ${TEST_DATA}
Should Peripheral Contain ${DUT} Word 0x0 ${TEST_DATA}
Write To Peripheral ${DUT} Byte 0x0 ${TEST_DATA}
Should Peripheral Contain ${DUT} Byte 0x0 ${TEST_DATA}


*** Test Cases ***
Expand Down
8 changes: 6 additions & 2 deletions samples/apb3_requester_synth/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@ set(SIM_FILES
apb3_requester_synth.sv
)

# TODO: Tests currently assume 32 bits, changing this will cause them to fail.
# Modify the tests to work with all possible bus widths.
set(APB3_DATA_WIDTH 32 CACHE STRING "Width of data channels in the APB3 bus")

# Verilator variables
set(VERILATOR_CSOURCES ../../cpp/sim_main_dpi.cpp)
set(VERILATOR_ARGS --timing --assert)
set(VERILATOR_ARGS --timing --assert -GAPB3BusDataWidth=${APB3_DATA_WIDTH})

# Questa variables
set(QUESTA_ARGS "")
set(QUESTA_OPTIMIZATION_ARGS -floatparameters+ReceiverPort+SenderPort+Address)
set(QUESTA_OPTIMIZATION_ARGS -floatparameters+ReceiverPort+SenderPort+Address -GAPB3BusDataWidth=${APB3_DATA_WIDTH})

# CMake file doing the hard job
include(../../cmake/build-cosimulation.cmake)
6 changes: 4 additions & 2 deletions samples/apb3_standalone/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ set(SIM_FILES
../../samples/apb3_completer_mem/apb3_completer_mem.sv
)

set(APB3_DATA_WIDTH 32 CACHE STRING "Width of data channels in the APB3 bus")

# Verilator variables
set(VERILATOR_CSOURCES sim_main.cpp)
set(VERILATOR_ARGS --timing --assert)
set(VERILATOR_ARGS --timing --assert -GAPB3BusDataWidth=${APB3_DATA_WIDTH})

# Questa variables
set(QUESTA_ARGS "")
set(QUESTA_OPTIMIZATION_ARGS "")
set(QUESTA_OPTIMIZATION_ARGS -GAPB3BusDataWidth=${APB3_DATA_WIDTH})

# CMake file doing the hard job
include(../../cmake/build-cosimulation.cmake)

0 comments on commit c53266e

Please sign in to comment.