Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit Test Suite Update #352

Merged
merged 99 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from 97 commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
ef72a8a
Made default VL and SVL 128 rather than 512.
FinnWilkinson Nov 6, 2023
af4b028
Corrected return value of getSystemRegisterTag to -1.
FinnWilkinson Nov 6, 2023
c4c34f7
Removed the fno-rtti compiler flag to allow the use of dynamic_cast.
FinnWilkinson Nov 6, 2023
53595d0
Replaced ISATest with ArchitectureTest, and implemented full unit tes…
FinnWilkinson Nov 6, 2023
32ead23
Added tests for Linux class named OSTest.cc to reduce ambiguity.
FinnWilkinson Nov 6, 2023
70fcc0d
Updated OSTest.
FinnWilkinson Nov 6, 2023
33aa812
Added unit tests for LinuxProcess.
FinnWilkinson Nov 8, 2023
4520bbb
Fixed header formatting and spelling mistakes for A64FXPortAllocator.
FinnWilkinson Nov 8, 2023
2572e8d
Added unit test to DecodeUnit.
FinnWilkinson Nov 8, 2023
60d5d91
Created MockPortAllocator class for unit test suite.
FinnWilkinson Nov 8, 2023
1167b04
Removed non-existant functions from MockInstruction.
FinnWilkinson Nov 10, 2023
375de54
Removed un-used function setRegisterReady() from DispatchIssueUnit.
FinnWilkinson Nov 10, 2023
e39a4ef
Added new unit tests for DispatchIssue unit.
FinnWilkinson Nov 27, 2023
925e831
Added more executeUnit tests.
FinnWilkinson Nov 28, 2023
6179669
Moved ShiftValueTests to Regression/AArch64 and added missing MSL shi…
FinnWilkinson Dec 4, 2023
1ebc150
Minor change to RAT test & removal of un-used function.
FinnWilkinson Dec 5, 2023
b552d31
Added tests for FixedLatencyMemoryInterface & changed assert to simul…
FinnWilkinson Dec 5, 2023
b45d118
Added new FlatMemoryInterface unit tests & changed assert to simulati…
FinnWilkinson Dec 5, 2023
25f764d
Updated test structure of A64FXPortAllocatorTest.
FinnWilkinson Dec 6, 2023
663dfe9
Added new FetchUnit unit tests and outlined structure needed for loop…
FinnWilkinson Dec 6, 2023
4ce5b87
Added M1PortAllocator unit tests.
FinnWilkinson Dec 6, 2023
abece7e
Added new fetch unit Loop Buffer tests
Dec 6, 2023
11f325d
Added unit tests for RegisterFileSet.
FinnWilkinson Dec 6, 2023
483f8c5
Added unit tests for ArchitecturalRegisterFileSet.
FinnWilkinson Dec 6, 2023
e760317
Added unit tests for MappedRegisterFileSet.
FinnWilkinson Dec 6, 2023
3448ab5
Minor fix for ExecuteUnitTest.
FinnWilkinson Dec 6, 2023
4af6055
Further minor test fixes.
FinnWilkinson Dec 6, 2023
f4998a4
Fixed shiftValue tests.
FinnWilkinson Dec 7, 2023
f3513db
Removed usage of Dynamic_cast to allow for compilation in Debug mode.
FinnWilkinson Dec 7, 2023
102c1e6
Added flush test to GenericPredictor.
FinnWilkinson Dec 7, 2023
5d22b12
Fixed incorrect case for ArchitecturalRegisterFileSetTest.cc
Dec 7, 2023
e02c938
Changed dirty pointer cast to reinterpret_Cast.
FinnWilkinson Dec 7, 2023
1e6ca46
Minor change to EU unit test.
FinnWilkinson Dec 8, 2023
8d7d83c
Added RenameUnit unit tests.
FinnWilkinson Dec 8, 2023
7ff2536
Added ELF class unit tests.
FinnWilkinson Dec 8, 2023
4e4a9cf
Added Special-File-Dir-Path config option.
FinnWilkinson Dec 11, 2023
90f12d5
Minor changes to model config and default config files.
FinnWilkinson Dec 11, 2023
27b1bb0
New/updated unit tests for LSQ
jj16791 Dec 12, 2023
a3ce86c
Added special file unit tests.
FinnWilkinson Dec 12, 2023
bacdc99
restructured unit tests to add ISA specific folders.
FinnWilkinson Dec 12, 2023
bce11e1
removed un-needed namespace identifiers.
FinnWilkinson Dec 12, 2023
e67d54b
Added base class implementation and files for instruction class unit …
FinnWilkinson Dec 12, 2023
a9e4184
Updated ROB and EU getFlushSeqID to getFlushInsnID as the old name wa…
FinnWilkinson Dec 13, 2023
a01c221
Updated ROB unit tests.
FinnWilkinson Dec 13, 2023
1ecb65e
Created new MockCore class for unit test suite.
FinnWilkinson Dec 13, 2023
c810d98
Created unit tests for AArch64 and RISC-V ExceptionHandlers.
FinnWilkinson Dec 14, 2023
22f6c69
Updated use of getOperandRegisters to getSourceRegisters, and updated…
FinnWilkinson Dec 14, 2023
34d43c0
Removed un-used exception enum with no print out, and removed extra s…
FinnWilkinson Dec 14, 2023
5cef426
Updated exceptionHandler.printException tests for aarch64 and risc-v …
FinnWilkinson Dec 14, 2023
43d4e79
Removed the use of filesystem header as this causes problems with som…
FinnWilkinson Dec 14, 2023
8861f51
Added fix for failing SP related unit tests.
FinnWilkinson Dec 15, 2023
16acf8a
Removed simeng-fileio-test.txt
FinnWilkinson Dec 15, 2023
60c04b6
Further attempt at a stackPointer test failure fix.
FinnWilkinson Dec 15, 2023
5a6430b
Merge remote-tracking branch 'origin/dev' into unit-test-update
FinnWilkinson Dec 18, 2023
af047dc
Integration test fixes after merge, and adding integration tests to t…
FinnWilkinson Dec 18, 2023
d2f2212
Update specialFile directory config option functionality and tests.
FinnWilkinson Dec 19, 2023
788ae7f
Added special file directory to SimEng simulation metadata print out.
FinnWilkinson Dec 19, 2023
86d257c
Added additional SimInfo & modelConfig unit test to integration test.
FinnWilkinson Dec 19, 2023
7f8a7eb
Added unit tests for aarch64 & riscv archInfo classes.
FinnWilkinson Dec 19, 2023
d188e0c
Merge remote-tracking branch 'origin/dev' into unit-test-update
FinnWilkinson Dec 19, 2023
7a0f9b2
Added helper function for fcvtzu (integer) instructions & corrected e…
FinnWilkinson Dec 21, 2023
6ebe1f2
New test for register rewinding in ROB
jj16791 Dec 22, 2023
38ce784
Corrected idleLoopBufferDueToNotTakenBoundary test to have a more mea…
jj16791 Jan 8, 2024
08784f0
Move expectation to correct location in test flow
jj16791 Jan 8, 2024
ac00f9b
Changes for PR comments.
FinnWilkinson Jan 10, 2024
7f03087
More PR comment changes.
FinnWilkinson Jan 10, 2024
25d7d5c
Fixed compile time warning in emulation core
FinnWilkinson Jan 11, 2024
67a8714
Updated riscv arch test for updateSystemTimerRegisters.
FinnWilkinson Jan 11, 2024
a20689f
Usage of ConfigInit changed.
FinnWilkinson Jan 11, 2024
826708d
Fixed MSL implementation.
FinnWilkinson Jan 11, 2024
bfa0233
OSTest fix.
FinnWilkinson Jan 11, 2024
c6df17c
Removed un-necessary classes from aarch64 helper functions.
FinnWilkinson Jan 11, 2024
4ec8f2d
Updated riscv zero register to match that of AArch64.
FinnWilkinson Jan 12, 2024
6372025
Bug fixes and SME performance improvement, and better explained extra…
FinnWilkinson Jan 12, 2024
4c04ff3
Moved shiftValue to more appropriate file.
FinnWilkinson Jan 12, 2024
a2a1639
Fixed shiftValue test header.
FinnWilkinson Jan 12, 2024
db3e3fa
Added AArch64 instruction class unit tests.
FinnWilkinson Jan 15, 2024
32ad643
Jenkins fix
FinnWilkinson Jan 16, 2024
91d62ef
Jenkins fix 2
FinnWilkinson Jan 16, 2024
8b7bce1
Further fixes.
FinnWilkinson Jan 16, 2024
67c7abb
AArch64 unit test and bug fixes.
FinnWilkinson Jan 16, 2024
1f61942
Implemented RiscV Instruction class unit tests.
FinnWilkinson Jan 16, 2024
19cf339
Added stricter usage requirements on addWithCarry aarch64 auxiliary f…
FinnWilkinson Jan 17, 2024
5f9160c
Marginal optimisation of conditionHolds aarch64 auxiliary function.
FinnWilkinson Jan 17, 2024
961ab1f
Fixed rounding logic for AArch64 SVE FRINTN instruction.
FinnWilkinson Jan 17, 2024
a907fed
Removed unused AArch64 auxiliary functions.
FinnWilkinson Jan 17, 2024
16eab3d
Made most micro decoder functions private as all only used internally.
FinnWilkinson Jan 17, 2024
c954043
Jenkins fabsf fix.
FinnWilkinson Jan 18, 2024
1b9ec5e
Added aarch64 auxiliary function unit tests.
FinnWilkinson Jan 18, 2024
07db0dd
Added signed extendValue unit tests, and moved extendValue and extend…
FinnWilkinson Jan 18, 2024
abf2620
Added equality operator to register value.
FinnWilkinson Jan 24, 2024
cdc12f6
Attended to PR comments.
FinnWilkinson Jan 25, 2024
43cca78
Updated aarch64 auxiliary function tests structure.
FinnWilkinson Jan 25, 2024
7c0ca0d
More changes attending to PR comments,
FinnWilkinson Jan 25, 2024
c999177
Minor changes.
FinnWilkinson Jan 26, 2024
712c7e7
Merge remote-tracking branch 'origin/dev' into unit-test-update
FinnWilkinson Jan 26, 2024
9d6e581
Changes for PR comments.
FinnWilkinson Feb 2, 2024
3e29b10
Updated how latency is provided to mem interface in FixedLatencyMemor…
FinnWilkinson Feb 2, 2024
3c24162
Updated (again) how latency is provided to mem interface in FixedLate…
FinnWilkinson Feb 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ endif()
# saves us from having to build all targets before running the tests
add_custom_target(test-all
COMMAND ${CMAKE_CTEST_COMMAND}
DEPENDS unittests regression-aarch64 regression-riscv
DEPENDS unittests regression-aarch64 regression-riscv integrationtests
)
endif()

Expand Down
2 changes: 1 addition & 1 deletion configs/DEMO_RISCV.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ Latencies:
CPU-Info:
# Set Generate-Special-Dir to 'T' to generate the special files directory, or to 'F' to not.
# (Not generating the special files directory may require the user to copy over files manually)
Generate-Special-Dir: true
Generate-Special-Dir: True
# Core-Count MUST be 1 as multi-core is not supported at this time. (TX2 true value is 32)
Core-Count: 1
# Socket-Count MUST be 1 as multi-socket simulations are not supported at this time. (TX2 true value is 2)
Expand Down
17 changes: 14 additions & 3 deletions docs/sphinx/user/configuring_simeng.rst
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,20 @@ CPU Info
These fields are currently only used to generate a replica of the required Special Files directory structure.

Generate-Special-Dir
Values are either "True" or "False".
Dictates whether or not SimEng should generate the SpecialFiles directory tree at runtime.
The alternative to this would be to copy in the required SpecialFiles by hand.
Values are either `True` or `False`.
Dictates whether or not SimEng should generate the Special-Files directory tree at runtime.
If your code requires Special-Files but you wish to use your own / existing files from a real system, you will need to set this option to `False`.
The files which are currently generated / supported in SimEng are:

- `/proc/cpuinfo`
- `/proc/stat`
- `/sys/deviced/system/cpu/online`
- `/sys/deviced/system/cpu/cpu{0..CoreCount}/topology/core_id`
- `/sys/deviced/system/cpu/cpu{0..CoreCount}/topology/physical_package_id`

Special-File-Dir-Path
Represented as a String; is the **absolute path** to the root directory where the Special-Files will be generated *OR* where existing Special-Files are located.
This is optional, and defaults to `SIMENG_BUILD_DIRECTORY/specialFiles`. The root directory must already exist.

Core-Count
Defines the total number of Physical cores (Not including threads).
Expand Down
16 changes: 8 additions & 8 deletions src/include/simeng/CoreInstance.hh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

// Program used when no executable is provided; counts down from
// 1024*1024, with an independent `orr` at the start of each branch.
uint32_t hex_[] = {
static uint32_t hex_[] = {
0x320C03E0, // orr w0, wzr, #1048576
0x320003E1, // orr w0, wzr, #1
0x71000400, // subs w0, w0, #1
Expand Down Expand Up @@ -102,17 +102,20 @@ class CoreInstance {
/** Construct the special file directory. */
void createSpecialFileDirectory();

/** Whether or not the source has been assembled by LLVM. */
bool assembledSource_ = false;
/** The config file describing the modelled core to be created. */
ryml::ConstNodeRef config_;

/** The SimEng Linux kernel object. */
simeng::kernel::Linux kernel_;

/** Reference to source assembled by LLVM. */
char* source_ = nullptr;

/** Size of the source code assembled by LLVM. */
size_t sourceSize_ = 0;

/** The config file describing the modelled core to be created. */
ryml::ConstNodeRef config_;
/** Whether or not the source has been assembled by LLVM. */
bool assembledSource_ = false;

/** Reference to the SimEng linux process object. */
std::unique_ptr<simeng::kernel::LinuxProcess> process_ = nullptr;
Expand All @@ -123,9 +126,6 @@ class CoreInstance {
/** The process memory space. */
std::shared_ptr<char> processMemory_;

/** The SimEng Linux kernel object. */
simeng::kernel::Linux kernel_;

/** Whether or not the dataMemory_ must be set manually. */
bool setDataMemory_ = false;

Expand Down
2 changes: 1 addition & 1 deletion src/include/simeng/Instruction.hh
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ class Instruction {

/** An arbitrary index value for the micro-operation. Its use is based on the
* implementation of specific micro-operations. */
int microOpIndex_;
int microOpIndex_ = 0;
};

} // namespace simeng
12 changes: 12 additions & 0 deletions src/include/simeng/RegisterValue.hh
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,16 @@ class RegisterValue {
alignas(8) char value[MAX_LOCAL_BYTES];
};

inline bool operator==(const RegisterValue& lhs, const RegisterValue& rhs) {
if (lhs.size() == rhs.size()) {
auto lhV = lhs.getAsVector<char>();
auto rhV = rhs.getAsVector<char>();
for (int i = 0; i < lhs.size(); i++) {
if (lhV[i] != rhV[i]) return false;
}
return true;
}
return false;
}

} // namespace simeng
3 changes: 1 addition & 2 deletions src/include/simeng/SpecialFileDirGen.hh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <string>

#include "simeng/config/SimInfo.hh"
#include "simeng/version.hh"

namespace simeng {
class SpecialFileDirGen {
Expand All @@ -22,7 +21,7 @@ class SpecialFileDirGen {

private:
/** Path to the root of the SimEng special files directory. */
const std::string specialFilesDir_ = SIMENG_BUILD_DIR "/specialFiles";
const std::string specialFilesDir_;

/** Values declared in YAML config file needed to create the Special Files
* Directory tree. */
Expand Down
10 changes: 10 additions & 0 deletions src/include/simeng/arch/aarch64/ExceptionHandler.hh
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,16 @@ class ExceptionHandler : public simeng::arch::ExceptionHandler {
static constexpr Register R3 = {RegisterType::GENERAL, 3};
static constexpr Register R4 = {RegisterType::GENERAL, 4};
static constexpr Register R5 = {RegisterType::GENERAL, 5};

/** Let the following ExceptionHandlerTest derived classes be a friend of this
* class to allow proper testing of `readStringThen()`, `readBufferThen()` and
* `printException()` functions. */
friend class AArch64ExceptionHandlerTest_readStringThen_Test;
friend class AArch64ExceptionHandlerTest_readStringThen_maxLen0_Test;
friend class AArch64ExceptionHandlerTest_readStringThen_maxLenReached_Test;
friend class AArch64ExceptionHandlerTest_readBufferThen_Test;
friend class AArch64ExceptionHandlerTest_readBufferThen_length0_Test;
friend class AArch64ExceptionHandlerTest_printException_Test;
};

} // namespace aarch64
Expand Down
61 changes: 4 additions & 57 deletions src/include/simeng/arch/aarch64/Instruction.hh
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,6 @@ namespace simeng {
namespace arch {
namespace aarch64 {

/** Apply the shift specified by `shiftType` to the unsigned integer `value`,
* shifting by `amount`. */
template <typename T>
std::enable_if_t<std::is_integral_v<T> && std::is_unsigned_v<T>, T> shiftValue(
T value, uint8_t shiftType, uint8_t amount) {
switch (shiftType) {
case ARM64_SFT_LSL:
return value << amount;
case ARM64_SFT_LSR:
return value >> amount;
case ARM64_SFT_ASR:
return static_cast<std::make_signed_t<T>>(value) >> amount;
case ARM64_SFT_ROR: {
// Assuming sizeof(T) is a power of 2.
const auto mask = sizeof(T) * 8 - 1;
assert((amount <= mask) && "Rotate amount exceeds type width");
amount &= mask;
return (value >> amount) | (value << ((-amount) & mask));
}
case ARM64_SFT_MSL: {
// pad in with ones instead of zeros
const auto mask = (1 << amount) - 1;
return (value << amount) | mask;
}
case ARM64_SFT_INVALID:
return value;
default:
assert(false && "Unknown shift type");
return 0;
}
}

/** Get the size of the data to be accessed from/to memory. */
inline uint8_t getDataSize(cs_arm64_op op) {
// Check from top of the range downwards
Expand Down Expand Up @@ -203,6 +171,9 @@ const uint8_t NZCV = 3;
const uint8_t SYSTEM = 4;
/** The [256-byte x (SVL / 8)] SME matrix register za. */
const uint8_t MATRIX = 5;

/** A special register value representing the zero register. */
const Register ZERO_REGISTER = {GENERAL, (uint16_t)-1};
} // namespace RegisterType

/** A struct holding user-defined execution information for a aarch64
Expand All @@ -222,7 +193,6 @@ struct ExecutionInfo {
enum class InstructionException {
None = 0,
EncodingUnallocated,
EncodingNotYetImplemented,
ExecutionNotYetImplemented,
AliasNotYetImplemented,
MisalignedPC,
Expand Down Expand Up @@ -366,11 +336,6 @@ class Instruction : public simeng::Instruction {
/** Retrieve the instruction's associated architecture. */
const Architecture& getArchitecture() const;

/** A special register value representing the zero register. If passed to
* `setSourceRegisters`/`setDestinationRegisters`, the value will be
* automatically supplied as zero. */
static const Register ZERO_REGISTER;

private:
/** A reference to the ISA instance this instruction belongs to. */
const Architecture& architecture_;
Expand All @@ -380,11 +345,10 @@ class Instruction : public simeng::Instruction {

/** A vector of source registers. */
std::vector<Register> sourceRegisters;
/** The number of source registers this instruction reads from. */
uint16_t sourceRegisterCount = 0;

/** A vector of destination registers. */
std::vector<Register> destinationRegisters;

/** The number of destination registers this instruction writes to. */
uint16_t destinationRegisterCount = 0;
jj16791 marked this conversation as resolved.
Show resolved Hide resolved

Expand All @@ -404,15 +368,6 @@ class Instruction : public simeng::Instruction {
* registers. */
void decode();

/** Set the source registers of the instruction, and create a corresponding
* operands vector. Zero register references will be pre-supplied with a value
* of 0. */
void setSourceRegisters(const std::vector<Register>& registers);

/** Set the destination registers for the instruction, and create a
* corresponding results vector. */
void setDestinationRegisters(const std::vector<Register>& registers);

// Scheduling
/** The number of operands that have not yet had values supplied. Used to
* determine execution readiness. */
Expand Down Expand Up @@ -499,14 +454,6 @@ class Instruction : public simeng::Instruction {
* for sending to memory (according to instruction type). Each entry
* corresponds to a `memoryAddresses` entry. */
std::vector<RegisterValue> memoryData;

// Execution helpers
/** Extend `value` according to `extendType`, and left-shift the result by
* `shift` */
uint64_t extendValue(uint64_t value, uint8_t extendType, uint8_t shift) const;

/** Extend `value` using extension/shifting rules defined in `op`. */
uint64_t extendOffset(uint64_t value, const cs_arm64_op& op) const;
};

} // namespace aarch64
Expand Down
2 changes: 1 addition & 1 deletion src/include/simeng/arch/aarch64/MicroDecoder.hh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class MicroDecoder {
const Instruction& macroOp, MacroOp& output,
csh capstoneHandle);

private:
/** Detect if there's an overlap between the underlying hardware registers
* (e.g. z5, v5, q5, d5, s5, h5, and b5). */
bool detectOverlap(arm64_reg registerA, arm64_reg registerB);
Expand Down Expand Up @@ -67,7 +68,6 @@ class MicroDecoder {
csh capstoneHandle, bool lastMicroOp = false,
int microOpIndex = 0, uint8_t dataSize = 0);

private:
/** Flag to determine whether instruction splitting is enabled. */
const bool instructionSplit_;

Expand Down
Loading