78std::list<TarmacParserRecord::ParserRegEntry>
639 {
"tlbi_vmalle1is", MISCREG_TLBI_VMALLE1IS },
640 {
"tlbi_vae1is", MISCREG_TLBI_VAE1IS },
641 {
"tlbi_aside1is", MISCREG_TLBI_ASIDE1IS },
642 {
"tlbi_vaae1is", MISCREG_TLBI_VAAE1IS },
643 {
"tlbi_vale1is", MISCREG_TLBI_VALE1IS },
644 {
"tlbi_vaale1is", MISCREG_TLBI_VAALE1IS },
645 {
"tlbi_vmalle1", MISCREG_TLBI_VMALLE1 },
646 {
"tlbi_vae1", MISCREG_TLBI_VAE1 },
647 {
"tlbi_aside1", MISCREG_TLBI_ASIDE1 },
648 {
"tlbi_vaae1", MISCREG_TLBI_VAAE1 },
649 {
"tlbi_vale1", MISCREG_TLBI_VALE1 },
650 {
"tlbi_vaale1", MISCREG_TLBI_VAALE1 },
651 {
"tlbi_ipas2e1is", MISCREG_TLBI_IPAS2E1IS },
652 {
"tlbi_ipas2le1is", MISCREG_TLBI_IPAS2LE1IS },
653 {
"tlbi_alle2is", MISCREG_TLBI_ALLE2IS },
654 {
"tlbi_vae2is", MISCREG_TLBI_VAE2IS },
655 {
"tlbi_alle1is", MISCREG_TLBI_ALLE1IS },
656 {
"tlbi_vale2is", MISCREG_TLBI_VALE2IS },
657 {
"tlbi_vmalls12e1is", MISCREG_TLBI_VMALLS12E1IS },
658 {
"tlbi_ipas2e1", MISCREG_TLBI_IPAS2E1 },
659 {
"tlbi_ipas2le1", MISCREG_TLBI_IPAS2LE1 },
660 {
"tlbi_alle2", MISCREG_TLBI_ALLE2 },
661 {
"tlbi_vae2", MISCREG_TLBI_VAE2 },
662 {
"tlbi_alle1", MISCREG_TLBI_ALLE1 },
663 {
"tlbi_vale2", MISCREG_TLBI_VALE2 },
664 {
"tlbi_vmalls12e1", MISCREG_TLBI_VMALLS12E1 },
665 {
"tlbi_alle3is", MISCREG_TLBI_ALLE3IS },
666 {
"tlbi_vae3is", MISCREG_TLBI_VAE3IS },
667 {
"tlbi_vale3is", MISCREG_TLBI_VALE3IS },
668 {
"tlbi_alle3", MISCREG_TLBI_ALLE3 },
669 {
"tlbi_vae3", MISCREG_TLBI_VAE3 },
670 {
"tlbi_vale3", MISCREG_TLBI_VALE3 },
767 for (; it != end; ++it) {
778 auto vv = vc.
as<uint32_t>();
779 values.push_back(vv[0]);
782 values.push_back(elem);
789 auto vv = vc.
as<uint64_t>();
790 values.push_back(vv[0]);
795 values.push_back((uint64_t)(w1) << 32 | w0);
802 auto pv =
pc.as<uint8_t>();
805 p = (
p << 1) | pv[--
i];
814 auto vv = vc.
as<uint64_t>();
815 values.push_back(vv[0]);
816 values.push_back(vv[1]);
823 values.push_back((uint64_t)(w1) << 32 | w0);
824 values.push_back((uint64_t)(w3) << 32 | w2);
832 auto vv = vc.
as<uint64_t>();
834 values.push_back(vv[--
i]);
841 CPSR cpsr =
thread->readMiscRegNoEffect(it->index);
846 values.push_back(cpsr);
852 values.push_back(cpsr);
856 values.push_back(fpcr);
860 values.push_back(fpsr);
862 values.push_back(
thread->readMiscRegNoEffect(it->index));
866 panic(
"Unknown TARMAC trace record type!");
870 if (values.size() != it->values.size()) same =
false;
872 uint32_t
size = values.size();
873 if (
size > it->values.size())
874 size = it->values.size();
877 for (
int i = 0;
i <
size; ++
i) {
878 if (values[
i] != it->values[
i]) {
890 outs <<
"diff> [" << it->repr <<
"] gem5: 0x" << std::hex;
891 for (
auto v : values)
892 outs << std::setw(16) << std::setfill(
'0') <<
v;
894 outs <<
", TARMAC: 0x" << std::hex;
895 for (
auto v : it->values)
896 outs << std::setw(16) << std::setfill(
'0') <<
v;
904 exitSimLoop(
"a mismatch with the TARMAC trace has been detected "
905 "on PC or opcode", 1);
907 exitSimLoop(
"a mismatch with the TARMAC trace has been detected "
914 return "TARMAC parser record event";
923 outs <<
"\nMismatch between gem5 and TARMAC trace @ " << std::dec
925 <<
"[seq_num: " << std::dec <<
instRecord.seq_num
926 <<
", opcode: 0x" << std::hex << (
staticInst->getEMI() & 0xffffffff)
927 <<
", PC: 0x" <<
pc.instAddr()
928 <<
", disasm: " <<
staticInst->disassemble(
pc.instAddr()) <<
"]"
938 _pc, _macroStaticInst),
942 memReq = std::make_shared<Request>();
953 uint64_t written_data = 0;
966 parent.macroopInProgress =
false;
980 outs <<
"diff> [PC] gem5: 0x" << std::hex <<
pc->instAddr()
981 <<
", TARMAC: 0x" <<
instRecord.addr << std::endl;
986 if (arm_inst->encoding() !=
instRecord.opcode) {
989 outs <<
"diff> [opcode] gem5: 0x" << std::hex
990 << arm_inst->encoding()
991 <<
", TARMAC: 0x" <<
instRecord.opcode << std::endl;
1003 outs <<
"diff> [iset_state] gem5: "
1024 outs <<
"diff> [mem(0x" << std::hex <<
memRecord.addr
1025 <<
")] gem5: 0x" << written_data
1035 panic(
"Unknown TARMAC trace record type!");
1046 parent.exitOnInsnDiff)) {
1047 exitSimLoop(
"a mismatch with the TARMAC trace has been detected "
1048 "on PC or opcode", 1);
1051 parent.macroopInProgress =
true;
1061 if (
buf[0] !=
'I') {
1067 assert((
buf[0] ==
'c') && (
buf[1] ==
'p') && (
buf[2] ==
'u'));
1075 if (
buf[0] ==
'I') {
1102 warn(
"Invalid TARMAC trace record (seq_num: %lld)",
1110 }
else if (
buf[0] ==
'R') {
1116 if (std::tolower(
buf[0]) ==
'r' && isdigit(
buf[1])) {
1119 int base_index = atoi(&
buf[1]);
1120 char* pch = strchr(
buf,
'_');
1125 if (strncmp(pch,
"usr", 3) == 0)
1127 else if (strncmp(pch,
"fiq", 3) == 0)
1129 else if (strncmp(pch,
"irq", 3) == 0)
1131 else if (strncmp(pch,
"svc", 3) == 0)
1133 else if (strncmp(pch,
"mon", 3) == 0)
1135 else if (strncmp(pch,
"abt", 3) == 0)
1137 else if (strncmp(pch,
"und", 3) == 0)
1139 else if (strncmp(pch,
"hyp", 3) == 0)
1142 }
else if (std::tolower(
buf[0]) ==
'x' && isdigit(
buf[1])) {
1146 }
else if (std::tolower(
buf[0]) ==
's' && isdigit(
buf[1])) {
1150 }
else if (std::tolower(
buf[0]) ==
'd' && isdigit(
buf[1])) {
1154 }
else if (std::tolower(
buf[0]) ==
'q' && isdigit(
buf[1])) {
1158 }
else if (std::tolower(
buf[0]) ==
'z' && isdigit(
buf[1])) {
1162 }
else if (std::tolower(
buf[0]) ==
'p' && isdigit(
buf[1])) {
1166 }
else if (strncmp(
buf,
"SP_EL", 5) == 0) {
1176 std::string reg_name =
buf;
1177 std::transform(reg_name.begin(), reg_name.end(), reg_name.begin(),
1183 warn(
"Unknown register in TARMAC trace (%s).\n",
buf);
1193 uint64_t hi = strtoull(
buf, NULL, 16);
1195 uint64_t
lo = strtoull(
buf, NULL, 16);
1209 v = (
v << 32) | lsw;
1218 if ((
c ==
':') || (
c ==
'_')) {
1222 v = (
v << 32) | lsw;
1228 }
else if (
buf[0] ==
'M' && (
parent.memWrCheck &&
buf[1] ==
'W')) {
1263 auto mmu =
static_cast<MMU*
>(
thread->getMMUPtr());
1278 if (req->isLLSC() || req->isLocalAccess())
1309 saved_offset =
trace.tellg();
1310 trace >> buf >> buf >> buf;
1313 if (buf[0] ==
'I') {
1317 trace.seekg(saved_offset, std::ios::beg);
1326 panic(
"End of TARMAC trace reached before start PC\n");
1333 switch (isetstate) {
1337 return "Thumb (A32)";
1341 return "UNSUPPORTED";
static unsigned getCurSveVecLen(ThreadContext *tc)
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.
@ 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.
ThreadContext is the external interface to all thread state for anything outside of the CPU.
This proxy attempts to translate virtual addresses using the TLBs.
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.
TarmacBaseRecord(Tick _when, ThreadContext *_thread, const StaticInstPtr _staticInst, const PCStateBase &_pc, const StaticInstPtr _macroStaticInst=nullptr)
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.
Addr startPc
Tracing starts when the PC gets this value for the first time (ignored if 0x0).
#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)
const RegClass intRegClass
constexpr RegClass vecElemClass
VecPredReg::Container VecPredRegContainer
constexpr RegClass vecPredRegClass
@ MISCREG_ID_AA64PFR0_EL1
@ MISCREG_ID_AA64DFR0_EL1
@ MISCREG_ID_AA64DFR1_EL1
@ MISCREG_ID_AA64ISAR1_EL1
@ MISCREG_ID_AA64MMFR1_EL1
@ 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
gem5::VecRegContainer< NumVecElemPerVecReg *sizeof(VecElem)> VecRegContainer
constexpr RegClass vecRegClass
std::ostream & output()
Get the ostream from the current global logger.
Copyright (c) 2024 Arm Limited 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.
void exitSimLoop(const std::string &message, int exit_code, Tick when, Tick repeat, bool serialize)
The "old style" exitSimLoop functions.
bool FullSystem
The FullSystem variable can be used to determine the current mode of simulation.
uint64_t Tick
Tick count type.
RefCountingPtr< StaticInst > StaticInstPtr
constexpr decltype(nullptr) NoFault
std::vector< EventQueue * > mainEventQueue
Array for main event queues.
Declaration of the Packet class.
PortProxy Object Declaration.
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.