15int main(
int argc,
const char *argv[])
24 std::cout <<
"=== Setting up configurations ===" << std::endl;
32 std::cout <<
"=== Finished setting up configurations ===" << std::endl << std::endl;
35 std::cout <<
"=== Setting up test system ===" << std::endl;
37 std::cout <<
" Setting up Memory" << std::endl;
39 bool is_fault_injection = !(
etiss::cfg().
get<std::string>(
"faults.xml",
"")).empty();
41 std::shared_ptr<etiss::SimpleMemSystem> dsys;
42 if (is_fault_injection)
44 dsys = std::make_shared<etiss::MemoryManipulationSystem>();
48 dsys = std::make_shared<etiss::SimpleMemSystem>();
54 std::cout <<
" CPU architecture was not set anywhere! Please set it manually using the arch.cpu configuration "
61 std::list<etiss::uint32> instructions;
63 instructions.push_back(0x80b584b0);
67 for (
auto it_instr : instructions)
70 buf[0] = it_instr >> 24;
71 buf[1] = it_instr >> 16;
72 buf[2] = it_instr >> 8;
74 dsys->dbg_write(pos, buf, 4);
80 std::cout <<
" Setting up CPUCore" << std::endl;
82 std::string CPUArchName =
etiss::cfg().
get<std::string>(
"arch.cpu",
"");
85 std::cout <<
" CPU start address: 0x" << std::hex << sa << std::dec << std::endl;
101 if (is_fault_injection)
110 std::cout <<
"custom command: " << cmd << std::endl;
119 std::cout <<
"=== Finished Setting up test system ===" << std::endl << std::endl;
122 std::cout <<
"=== Setting up plug-ins ===" << std::endl;
124 auto irq_handler = std::make_shared<etiss::InterruptHandler>(cpu->getInterruptVector(), cpu->getInterruptEnable(),
126 cpu->addPlugin(irq_handler);
131 if (
etiss::cfg().get<bool>(
"etiss.log_pc",
false))
134 cpu->addPlugin(std::make_shared<TracePrinter>(0x88888));
138 std::cout <<
"=== Setting up plug-ins ===" << std::endl << std::endl;
142 std::cout << std::endl <<
"=== Simulation start ===" << std::endl;
149 std::cout <<
"=== Simulation end ===" << std::endl << std::endl;
153 std::cout <<
"CPU0 exited with exception: 0x" << std::hex << exception << std::dec <<
": "
154 << etiss::RETURNCODE::getErrorMessages()[exception] << std::endl;
158 case etiss::RETURNCODE::CPUFINISHED:
159 case etiss::RETURNCODE::NOERROR:
160 case etiss::RETURNCODE::CPUTERMINATED:
163 case etiss::RETURNCODE::DBUS_READ_ERROR:
164 case etiss::RETURNCODE::DBUS_WRITE_ERROR:
165 case etiss::RETURNCODE::IBUS_READ_ERROR:
166 case etiss::RETURNCODE::IBUS_WRITE_ERROR:
167 case etiss::RETURNCODE::INTERRUPT:
168 case etiss::RETURNCODE::RESET:
169 case etiss::RETURNCODE::ILLEGALINSTRUCTION:
170 case etiss::RETURNCODE::ILLEGALJUMP:
171 case etiss::RETURNCODE::INSTR_PAGEFAULT:
172 case etiss::RETURNCODE::LOAD_PAGEFAULT:
173 case etiss::RETURNCODE::STORE_PAGEFAULT:
174 case etiss::RETURNCODE::GDBNOERROR:
175 case etiss::RETURNCODE::SYSCALL:
176 case etiss::RETURNCODE::PAGEFAULT:
179 case etiss::RETURNCODE::JITERROR:
180 case etiss::RETURNCODE::JITCOMPILATIONERROR:
183 case etiss::RETURNCODE::GENERALERROR:
184 case etiss::RETURNCODE::RELOADBLOCKS:
185 case etiss::RETURNCODE::RELOADCURRENTBLOCK:
186 case etiss::RETURNCODE::BREAKPOINT:
187 case etiss::RETURNCODE::ARCHERROR:
188 case etiss::RETURNCODE::EMULATIONNOTSUPPORTED:
189 case etiss::RETURNCODE::INVALIDSYSTEM:
static std::shared_ptr< CPUCore > create(std::string archname, std::string instancename="", std::map< std::string, std::string > archoptions=std::map< std::string, std::string >())
Create a CPUCore instance.
int main(int argc, const char *argv[])