65using namespace ArmISA;
755 for (; it != end; ++it) {
766 auto vv = vc.
as<uint32_t>();
767 values.push_back(vv[0]);
770 values.push_back(elem);
777 auto vv = vc.
as<uint64_t>();
778 values.push_back(vv[0]);
783 values.push_back((uint64_t)(w1) << 32 | w0);
790 auto pv =
pc.as<uint8_t>();
793 p = (
p << 1) | pv[--
i];
802 auto vv = vc.
as<uint64_t>();
803 values.push_back(vv[0]);
804 values.push_back(vv[1]);
811 values.push_back((uint64_t)(w1) << 32 | w0);
812 values.push_back((uint64_t)(w3) << 32 | w2);
820 auto vv = vc.
as<uint64_t>();
822 values.push_back(vv[--
i]);
834 values.push_back(cpsr);
840 values.push_back(cpsr);
844 const uint32_t ones = (uint32_t)(-1);
853 fpcrMask.stride = ones;
854 fpcrMask.rMode = ones;
858 values.push_back(fpscr & fpcrMask);
862 const uint32_t ones = (uint32_t)(-1);
875 values.push_back(fpscr & fpsrMask);
881 panic(
"Unknown TARMAC trace record type!");
885 if (values.size() != it->values.size()) same =
false;
887 uint32_t
size = values.size();
888 if (
size > it->values.size())
889 size = it->values.size();
892 for (
int i = 0;
i <
size; ++
i) {
893 if (values[
i] != it->values[
i]) {
905 outs <<
"diff> [" << it->repr <<
"] gem5: 0x" << std::hex;
906 for (
auto v : values)
907 outs << std::setw(16) << std::setfill(
'0') <<
v;
909 outs <<
", TARMAC: 0x" << std::hex;
910 for (
auto v : it->values)
911 outs << std::setw(16) << std::setfill(
'0') <<
v;
919 exitSimLoop(
"a mismatch with the TARMAC trace has been detected "
920 "on PC or opcode", 1);
922 exitSimLoop(
"a mismatch with the TARMAC trace has been detected "
929 return "TARMAC parser record event";
938 outs <<
"\nMismatch between gem5 and TARMAC trace @ " << std::dec
942 <<
", PC: 0x" <<
pc.instAddr()
953 _pc, _macroStaticInst),
957 memReq = std::make_shared<Request>();
968 uint64_t written_data = 0;
995 outs <<
"diff> [PC] gem5: 0x" << std::hex <<
pc->instAddr()
1004 outs <<
"diff> [opcode] gem5: 0x" << std::hex
1005 << arm_inst->encoding()
1018 outs <<
"diff> [iset_state] gem5: "
1040 <<
")] gem5: 0x" << written_data
1050 panic(
"Unknown TARMAC trace record type!");
1062 exitSimLoop(
"a mismatch with the TARMAC trace has been detected "
1063 "on PC or opcode", 1);
1076 if (
buf[0] !=
'I') {
1082 assert((
buf[0] ==
'c') && (
buf[1] ==
'p') && (
buf[2] ==
'u'));
1090 if (
buf[0] ==
'I') {
1099 char c = trace.peek();
1117 warn(
"Invalid TARMAC trace record (seq_num: %lld)",
1125 }
else if (
buf[0] ==
'R') {
1131 if (std::tolower(
buf[0]) ==
'r' && isdigit(
buf[1])) {
1134 int base_index = atoi(&
buf[1]);
1135 char* pch = strchr(
buf,
'_');
1140 if (strncmp(pch,
"usr", 3) == 0)
1142 else if (strncmp(pch,
"fiq", 3) == 0)
1144 else if (strncmp(pch,
"irq", 3) == 0)
1146 else if (strncmp(pch,
"svc", 3) == 0)
1148 else if (strncmp(pch,
"mon", 3) == 0)
1150 else if (strncmp(pch,
"abt", 3) == 0)
1152 else if (strncmp(pch,
"und", 3) == 0)
1154 else if (strncmp(pch,
"hyp", 3) == 0)
1157 }
else if (std::tolower(
buf[0]) ==
'x' && isdigit(
buf[1])) {
1161 }
else if (std::tolower(
buf[0]) ==
's' && isdigit(
buf[1])) {
1165 }
else if (std::tolower(
buf[0]) ==
'd' && isdigit(
buf[1])) {
1169 }
else if (std::tolower(
buf[0]) ==
'q' && isdigit(
buf[1])) {
1173 }
else if (std::tolower(
buf[0]) ==
'z' && isdigit(
buf[1])) {
1177 }
else if (std::tolower(
buf[0]) ==
'p' && isdigit(
buf[1])) {
1181 }
else if (strncmp(
buf,
"SP_EL", 5) == 0) {
1191 std::string reg_name =
buf;
1192 std::transform(reg_name.begin(), reg_name.end(), reg_name.begin(),
1198 warn(
"Unknown register in TARMAC trace (%s).\n",
buf);
1208 uint64_t hi = strtoull(
buf, NULL, 16);
1210 uint64_t
lo = strtoull(
buf, NULL, 16);
1224 v = (
v << 32) | lsw;
1232 char c = trace.peek();
1233 if ((
c ==
':') || (
c ==
'_')) {
1237 v = (
v << 32) | lsw;
1247 char c = trace.peek();
1293 if (req->isLLSC() || req->isLocalAccess())
1324 saved_offset =
trace.tellg();
1325 trace >> buf >> buf >> buf;
1328 if (buf[0] ==
'I') {
1332 trace.seekg(saved_offset, std::ios::beg);
1341 panic(
"End of TARMAC trace reached before start PC\n");
1348 switch (isetstate) {
1352 return "Thumb (A32)";
1356 return "UNSUPPORTED";
static unsigned getCurSveVecLen(ThreadContext *tc)
Fault translateAtomic(const RequestPtr &req, ThreadContext *tc, Mode mode) override
Addr instAddr() const
Returns the memory address of the instruction this PC points to.
This object is a proxy for a port or other object which implements the functional response protocol,...
void readBlob(Addr addr, void *p, uint64_t size) const
Higher level interfaces based on the above.
T * get() const
Directly access the pointer itself without taking a reference.
@ NO_ACCESS
The request should not cause a memory access.
@ funcRequestorId
This requestor id is used for functional requests that don't come from a particular device.
virtual const std::string & disassemble(Addr pc, const loader::SymbolTable *symtab=nullptr) const
Return string representation of disassembled instruction.
virtual uint64_t getEMI() const
bool isLastMicroop() const
ThreadContext is the external interface to all thread state for anything outside of the CPU.
virtual RegVal getReg(const RegId ®) const
virtual const PCStateBase & pcState() const =0
virtual RegVal readMiscRegNoEffect(RegIndex misc_reg) const =0
virtual BaseMMU * getMMUPtr()=0
This proxy attempts to translate virtual addresses using the TLBs.
Vector Register Abstraction This generic class is the model in a particularization of MVC,...
VecElem * as()
View interposers.
Addr addr
The address that was accessed.
unsigned flags
The flags that were assigned to the request.
std::unique_ptr< PCStateBase > pc
union gem5::trace::InstRecord::Data data
Addr size
The size of the memory request.
ISetState
ARM instruction set state.
static ISetState pcToISetState(const PCStateBase &pc)
Returns the Instruction Set State according to the current PCState.
TarmacRecordType
TARMAC trace record type.
bool advanceTrace()
Advances the TARMAC trace up to the next instruction, register, or memory access record.
const char * iSetStateToStr(ISetState isetstate) const
Returns the string representation of an instruction set state.
static ParserInstEntry instRecord
Buffer for instruction trace records.
static std::list< ParserRegEntry > destRegRecords
List of records of destination registers.
bool mismatchOnPcOrOpcode
True if a mismatch has been detected for this instruction on PC or opcode.
static char buf[MaxLineLength]
Buffer used for trace file parsing.
static ParserRegEntry regRecord
Buffer for register trace records.
static void printMismatchHeader(const StaticInstPtr inst, const PCStateBase &pc)
Print a mismatch header containing the instruction fields as reported by gem5.
static TarmacRecordType currRecordType
Type of last parsed record.
bool mismatch
True if a mismatch has been detected for this instruction.
RequestPtr memReq
Request for memory write checks.
std::unordered_map< std::string, RegIndex > MiscRegMap
Map from misc.
static const int MaxLineLength
bool parsingStarted
True if a TARMAC instruction record has already been parsed for this instruction.
bool readMemNoEffect(Addr addr, uint8_t *data, unsigned size, unsigned flags)
Performs a memory access to read the value written by a previous write.
static ParserMemEntry memRecord
Buffer for memory access trace records (stores only).
TarmacParserRecord(Tick _when, ThreadContext *_thread, const StaticInstPtr _staticInst, const PCStateBase &_pc, TarmacParser &_parent, const StaticInstPtr _macroStaticInst=NULL)
static MiscRegMap miscRegMap
static int8_t maxVectorLength
Max.
Tarmac Parser: this tracer parses an existing Tarmac trace and it diffs it with gem5 simulation statu...
std::ifstream trace
TARMAC trace file.
bool cpuId
If true, the trace format includes the CPU id.
void advanceTraceToStartPc()
Helper function to advance the trace up to startPc.
bool exitOnDiff
If true, the simulation is stopped as the first mismatch is detected.
bool macroopInProgress
True if a macroop is currently in progress.
bool exitOnInsnDiff
If true, the simulation is stopped as the first mismatch is detected on PC or opcode.
AddrRange ignoredAddrRange
Ignored addresses (ignored if empty).
bool memWrCheck
If true, memory write accesses are checked.
Addr startPc
Tracing starts when the PC gets this value for the first time (ignored if 0x0).
bool contains(const Addr &a) const
Determine if the range contains an address.
#define panic(...)
This implements a cprintf based panic() function.
static const RegId & und(unsigned index)
static const RegId & mon(unsigned index)
static const RegId & hyp(unsigned index)
static const RegId & usr(unsigned index)
static const RegId & fiq(unsigned index)
static const RegId & irq(unsigned index)
static const RegId & abt(unsigned index)
static const RegId & svc(unsigned index)
constexpr RegClass vecElemClass
VecPredReg::Container VecPredRegContainer
constexpr RegClass intRegClass
constexpr RegClass vecPredRegClass
@ MISCREG_ID_AA64PFR0_EL1
@ MISCREG_TLBI_IPAS2LE1IS
@ MISCREG_ID_AA64DFR0_EL1
@ MISCREG_ID_AA64DFR1_EL1
@ MISCREG_ID_AA64ISAR1_EL1
@ MISCREG_ID_AA64MMFR1_EL1
@ MISCREG_TLBI_VMALLS12E1
@ MISCREG_TLBI_VMALLS12E1IS
@ MISCREG_ID_AA64MMFR0_EL1
@ MISCREG_ID_AA64MMFR2_EL1
@ MISCREG_DBGCLAIMSET_EL1
@ MISCREG_DBGCLAIMCLR_EL1
@ MISCREG_ID_AA64AFR1_EL1
@ MISCREG_ID_AA64AFR0_EL1
@ MISCREG_ID_AA64ISAR0_EL1
@ MISCREG_DBGAUTHSTATUS_EL1
@ MISCREG_ID_AA64PFR1_EL1
constexpr RegClass vecRegClass
std::ostream & output()
Get the ostream from the current global logger.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
std::shared_ptr< FaultBase > Fault
std::shared_ptr< Request > RequestPtr
Tick curTick()
The universal simulation clock.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
bool FullSystem
The FullSystem variable can be used to determine the current mode of simulation.
uint64_t Tick
Tick count type.
void exitSimLoop(const std::string &message, int exit_code, Tick when, Tick repeat, bool serialize)
Schedule an event to exit the simulation loop (returning to Python) at the end of the current cycle (...
constexpr decltype(nullptr) NoFault
std::vector< EventQueue * > mainEventQueue
Array for main event queues.
Declaration of the Packet class.
PortProxy Object Declaration.
std::vector< uint64_t > values
Event triggered to check the value of the destination registers.
ThreadContext * thread
Current thread context.
std::unique_ptr< PCStateBase > pc
PC of the current instruction.
bool mismatchOnPcOrOpcode
True if a mismatch has been detected for this instruction on PC or opcode.
TarmacParser & parent
Reference to the TARMAC trace object to which this record belongs.
bool mismatch
True if a mismatch has been detected for this instruction.
const StaticInstPtr inst
Current instruction.
const char * description() const
Return a C string describing the event.