65using namespace ArmISA;
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]);
846 values.push_back(cpsr);
852 values.push_back(cpsr);
856 const uint32_t ones = (uint32_t)(-1);
865 fpcrMask.stride = ones;
866 fpcrMask.rMode = ones;
870 values.push_back(fpscr & fpcrMask);
874 const uint32_t ones = (uint32_t)(-1);
887 values.push_back(fpscr & fpsrMask);
893 panic(
"Unknown TARMAC trace record type!");
897 if (values.size() != it->values.size()) same =
false;
899 uint32_t
size = values.size();
900 if (
size > it->values.size())
901 size = it->values.size();
904 for (
int i = 0;
i <
size; ++
i) {
905 if (values[
i] != it->values[
i]) {
917 outs <<
"diff> [" << it->repr <<
"] gem5: 0x" << std::hex;
918 for (
auto v : values)
919 outs << std::setw(16) << std::setfill(
'0') <<
v;
921 outs <<
", TARMAC: 0x" << std::hex;
922 for (
auto v : it->values)
923 outs << std::setw(16) << std::setfill(
'0') <<
v;
931 exitSimLoop(
"a mismatch with the TARMAC trace has been detected "
932 "on PC or opcode", 1);
934 exitSimLoop(
"a mismatch with the TARMAC trace has been detected "
941 return "TARMAC parser record event";
950 outs <<
"\nMismatch between gem5 and TARMAC trace @ " << std::dec
954 <<
", PC: 0x" <<
pc.instAddr()
965 _pc, _macroStaticInst),
969 memReq = std::make_shared<Request>();
980 uint64_t written_data = 0;
1007 outs <<
"diff> [PC] gem5: 0x" << std::hex <<
pc->instAddr()
1016 outs <<
"diff> [opcode] gem5: 0x" << std::hex
1017 << arm_inst->encoding()
1030 outs <<
"diff> [iset_state] gem5: "
1052 <<
")] gem5: 0x" << written_data
1062 panic(
"Unknown TARMAC trace record type!");
1074 exitSimLoop(
"a mismatch with the TARMAC trace has been detected "
1075 "on PC or opcode", 1);
1088 if (
buf[0] !=
'I') {
1094 assert((
buf[0] ==
'c') && (
buf[1] ==
'p') && (
buf[2] ==
'u'));
1102 if (
buf[0] ==
'I') {
1111 char c = trace.peek();
1129 warn(
"Invalid TARMAC trace record (seq_num: %lld)",
1137 }
else if (
buf[0] ==
'R') {
1143 if (std::tolower(
buf[0]) ==
'r' && isdigit(
buf[1])) {
1146 int base_index = atoi(&
buf[1]);
1147 char* pch = strchr(
buf,
'_');
1152 if (strncmp(pch,
"usr", 3) == 0)
1154 else if (strncmp(pch,
"fiq", 3) == 0)
1156 else if (strncmp(pch,
"irq", 3) == 0)
1158 else if (strncmp(pch,
"svc", 3) == 0)
1160 else if (strncmp(pch,
"mon", 3) == 0)
1162 else if (strncmp(pch,
"abt", 3) == 0)
1164 else if (strncmp(pch,
"und", 3) == 0)
1166 else if (strncmp(pch,
"hyp", 3) == 0)
1169 }
else if (std::tolower(
buf[0]) ==
'x' && isdigit(
buf[1])) {
1173 }
else if (std::tolower(
buf[0]) ==
's' && isdigit(
buf[1])) {
1177 }
else if (std::tolower(
buf[0]) ==
'd' && isdigit(
buf[1])) {
1181 }
else if (std::tolower(
buf[0]) ==
'q' && isdigit(
buf[1])) {
1185 }
else if (std::tolower(
buf[0]) ==
'z' && isdigit(
buf[1])) {
1189 }
else if (std::tolower(
buf[0]) ==
'p' && isdigit(
buf[1])) {
1193 }
else if (strncmp(
buf,
"SP_EL", 5) == 0) {
1203 std::string reg_name =
buf;
1204 std::transform(reg_name.begin(), reg_name.end(), reg_name.begin(),
1210 warn(
"Unknown register in TARMAC trace (%s).\n",
buf);
1220 uint64_t hi = strtoull(
buf, NULL, 16);
1222 uint64_t
lo = strtoull(
buf, NULL, 16);
1236 v = (
v << 32) | lsw;
1244 char c = trace.peek();
1245 if ((
c ==
':') || (
c ==
'_')) {
1249 v = (
v << 32) | lsw;
1259 char c = trace.peek();
1305 if (req->isLLSC() || req->isLocalAccess())
1336 saved_offset =
trace.tellg();
1337 trace >> buf >> buf >> buf;
1340 if (buf[0] ==
'I') {
1344 trace.seekg(saved_offset, std::ios::beg);
1353 panic(
"End of TARMAC trace reached before start PC\n");
1360 switch (isetstate) {
1364 return "Thumb (A32)";
1368 return "UNSUPPORTED";
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)
VecPredReg::Container VecPredRegContainer
constexpr RegClass vecElemClass
constexpr RegClass intRegClass
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
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.
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.