int main(int argc, const char *argv[]) { // Check arguments and ensure application to load specified if(!cmdParser(argc, argv)) { icmMessage("E", PLATFORM, "Command Line parser error"); icmExitSimulation(1); return 1; } // the constructor createPlatform(); icmSimulationStarting(); addPlatformDocumentation(); // Ignore specific message that compatibility mode causes icmIgnoreMessage("ARM_MORPH_BII"); // simulate the platform icmProcessorP final = icmSimulatePlatform(); // was simulation interrupted or did it complete if(final && (icmGetStopReason(final)==ICM_SR_INTERRUPT)) { icmPrintf("*** simulation interrupted\n"); } icmTerminate(); icmExitSimulation(0); return 0; }
int main(int argc, const char *argv[]) { // Check arguments and ensure application to load specified if(!cmdParser(argc, argv)) { icmMessage("E", "platform", "Command Line parser error"); icmExitSimulation(1); return 1; } icmPrintf("3x cascaded transparent MMC\n"); // the constructor createPlatform(); icmSimulationStarting(); // run until exit icmSimulatePlatform(); // free simulation data structures icmTerminate(); icmExitSimulation(0); return 0; }
int main(int argc, const char *argv[]) { icmCLPP parser = icmCLParser("ArmIntegratorCP", ICM_AC_ALL); icmCLParserUsageMessage(parser, "Usage (Linux Kernel)\n" " ArmIntegratorCP --kernel <kernel image> --ramdisk <initial ramdisk>\n" "Usage (BareMetal)\n" " ArmIntegratorCP --program <elf file> --semihost <semihost file> --nographics\n"); cmdParserAddUserArgs(parser); icmCLParseArgs(parser, argc, argv); // Check to see what UART options are used // Bool setUartport = icmCLParseArgUsed (parser,"uartport"); if (options.uartconsole && setUartport) { icmMessage("E", PLATFORM"_CFG", "Can only specify one of --uartport and --uartconsole"); } else if (setUartport) { char buf[32]; snprintf(buf, sizeof(buf), "0x"FMT_6408x, options.uartport); icmOverride(PLATFORM"/"UART"/portnum", buf); // Override the parameter to cause the UART to open port "portnum" } else if (options.uartconsole) { icmOverride(PLATFORM"/"UART"/console", "1"); // Override the parameter to cause the UART to open a console } if(options.nographics) { icmOverride(PLATFORM"/"LCD"/noGraphics", "1"); } // Check to see if the program argument is loading a non Linux Kernel if(icmCLParseArgUsed (parser,"program")) { if(icmCLParseArgUsed (parser,"kernel")) { icmMessage("E", PLATFORM, "Arguments '--program' and '--kernel' cannot be used together"); } else { icmMessage("I", PLATFORM, "Loading baremetal application, disabling '%s'", SMARTLOADER); icmOverride(PLATFORM"/"SMARTLOADER"/disable", "1"); } } else { if(options.kernel) { icmOverride(PLATFORM"/"SMARTLOADER"/kernel", options.kernel); } if(options.ramdisk) { icmOverride(PLATFORM"/"SMARTLOADER"/initrd", options.ramdisk); } } platformConstructor(); if(icmCLParseArgUsed (parser,"program") && (options.semihost)) { icmAddInterceptObject (handles.arm1_c, PLATFORM"/"CPU"/semihost",options.semihost, NULL, NULL); } icmSimulationStarting(); icmSimulatePlatform(); icmTerminate(); return 0; }
int main(int argc, char *argv[]) { // check for the application program name argument if((argc<3)) { icmPrintf( "usage: %s <kernelFile> <ramdisk>\n" "%s\n", argv[0], arguments ); return -1; } char *kernelFile = argv[1]; char *ramDisk = argv[2]; parseArgs(3, argc, argv); Uns32 icmAttrsArm = ICM_ATTR_SIMEX; // simulate exceptions Uns32 icmAttrsXilinx = ICM_ATTR_DEFAULT; Uns32 icmInitAttrs = ICM_STOP_ON_CTRLC // Ctr-C stops simulation | ICM_VERBOSE // Print out statistics on simulation finish | (wallClock ? ICM_WALLCLOCK : 0); // Do not move time forward when blocked // the constructor createPlatform(icmInitAttrs); createPlatformArm(kernelFile, ramDisk, icmAttrsArm); createPlatformXilinx(icmAttrsXilinx); if(enableDebug && selectCore) { icmProcessorP proc = icmFindProcessorByName(coreName); if(proc) { // If there's a processor of this name, set this for debug // This is required for debug using a standard GDB via RSP. // It's not required for Imperas MPD icmDebugThisProcessor(proc); } else { icmMessage("F", "DEBUG", "Core %s could not be found for debugging", coreName); } } if (stopafter) { // test mode, run for limited number of instructions if(!icmSetSimulationStopTime(stopafter)){ icmPrintf("Failed to Set Stop Time %f\n", stopafter); return -1; } } // run till the end icmSimulatePlatform(); // finish and clean up icmTerminate(); return 0; }
int main(int argc, char *argv[]) { // the constructor createPlatform(); // load fixed application icmLoadProcessorMemory(handles.processor, "application/application.OR1K.elf", ICM_LOAD_DEFAULT, False, True); // run till the end icmSimulatePlatform(); icmTerminate(); return 0; }
int main(int argc, char *argv[]) { // check for the application program name argument if((argc<1)) { icmPrintf( "usage: %s %s\n", argv[0], arguments ); return -1; } parseArgs(1, argc, argv); Uns32 icmAttrsArm = ICM_ATTR_SIMEX; // simulate exceptions Uns32 icmAttrsXilinx = ICM_ATTR_DEFAULT; Uns32 icmInitAttrs = ICM_STOP_ON_CTRLC // Ctr-C stops simulation | ICM_VERBOSE // Print out statistics on simulation finish | (wallClock ? ICM_WALLCLOCK : 0); // Do not move time forward when blocked // the constructor createPlatform(icmInitAttrs); createPlatformArm(icmAttrsArm); createPlatformXilinx(icmAttrsXilinx); if (stopafter) { // test mode, run for limited number of instructions if(!icmSetSimulationStopTime(stopafter)){ icmPrintf("Failed to Set Stop Time %f\n", stopafter); return -1; } } // run till the end icmSimulatePlatform(); // finish and clean up icmTerminate(); return 0; }
int main(int argc, const char *argv[]) { // Check arguments and ensure application to load specified if(!cmdParser(argc, argv)) { icmMessage("E", PLATFORM, "Command Line parser error"); icmExitSimulation(1); return 1; } // the constructor createPlatform(); // run till the end icmSimulatePlatform(); // finish and clean up icmTerminate(); icmExitSimulation(0); return 0; }
int main(int argc, const char *argv[]) { // Check arguments and ensure application to load specified if(!cmdParser(argc, argv)) { icmMessage("E", "platform", "Command Line parser error"); return 1; } // the constructor createPlatform(); icmSimulationStarting(); // apply watchpoints in shared memory applyWatchpoints(handles.shared); // set register watchpoints for processor0 only applyRegWatchpoints(handles.processor0); // this is set to step for one instruction Bool stepOver = False; Bool finished = False; icmProcessorP stopProcessor = NULL; // query registers and register groups in processor0 queryRegisters(handles.processor0); while(!finished) { // simulate the platform using the default scheduler if(stepOver) { icmSetICountBreakpoint(stopProcessor, 1); stopProcessor = icmSimulatePlatform(); stepOver = False; } else { applyBreakpoints(handles.processor0); applyBreakpoints(handles.processor1); stopProcessor = icmSimulatePlatform(); clearBreakpoints(handles.processor0); clearBreakpoints(handles.processor1); } switch(icmGetStopReason(stopProcessor)) { case ICM_SR_EXIT: finished = True; break; case ICM_SR_FINISH: finished = True; break; case ICM_SR_BP_ICOUNT: icmPrintf( "Processor %s icount %u stopped at icount\n", icmGetProcessorName(stopProcessor, "/"), (Uns32)icmGetProcessorICount(stopProcessor) ); break; case ICM_SR_BP_ADDRESS: icmPrintf( "Processor %s icount %u stopped at address 0x%08x\n", icmGetProcessorName(stopProcessor, "/"), (Uns32)icmGetProcessorICount(stopProcessor), (Uns32)icmGetPC(stopProcessor) ); stepOver = True; break; case ICM_SR_WATCHPOINT: icmPrintf( "Processor %s icount %u stopped at watchpoint\n", icmGetProcessorName(stopProcessor, "/"), (Uns32)icmGetProcessorICount(stopProcessor) ); handleWatchpoints(); break; default: icmPrintf( "Processor %s icount %u stopped for reason %u\n", icmGetProcessorName(stopProcessor, "/"), (Uns32)icmGetProcessorICount(stopProcessor), icmGetStopReason(stopProcessor) ); break; } } icmTerminate(); return 0; }
// Platform entry point int main(int argc, char **argv) { // Get the name of the application to run from the command line if (argc != 2) { icmPrintf("usage: %s <pa application>\n", argv[0]); return -1; } // Initialize OVPsim, enabling verbose mode to get statistics at end of execution icmInit(ICM_VERBOSE | ICM_STOP_ON_CTRLC | ICM_ENABLE_IMPERAS_INTERCEPTS, NULL, 0); /*************************************************************************************************** MURAC Primary Architecture - ARM processor ***************************************************************************************************/ #ifdef INTECEPT_OBJECT_SUPPORTED const char *armModel = icmGetVlnvString(NULL, "arm.ovpworld.org", "processor", "arm", "1.0", "model"); #endif const char *armSemihost = icmGetVlnvString(NULL, "arm.ovpworld.org", "semihosting", "armNewlib", "1.0", "model"); icmAttrListP armUserAttr = icmNewAttrList(); icmAddStringAttr(armUserAttr, "compatibility", "gdb"); icmAddStringAttr(armUserAttr, "variant", "Cortex-A8"); icmAddStringAttr(armUserAttr, "UAL", "1"); // Create the Primary Architecture (PA) processor icmProcessorP pa = icmNewProcessor( "pa", // CPU name "arm", // CPU type 0, // CPU cpuId 0, // CPU model flags 32, // address bits #ifdef INTECEPT_OBJECT_SUPPORTED armModel, // model file #else MURAC_PA_MODEL_FILE, // model file #endif "modelAttrs", // model attributes SIMULATION_FLAGS, // simulation flags armUserAttr, // user-defined attributes armSemihost, // semi-hosting file "modelAttrs" // semi-hosting attributes ); #ifdef INTECEPT_OBJECT_SUPPORTED // Add intercept libarary for MURAC Primary Architecture instructions icmAddInterceptObject(pa, "murac_pa", MURAC_PA_INSTRUCTIONS_FILE, "modelAttrs", 0); #endif /*************************************************************************************************** System Memory ***************************************************************************************************/ // Local memory for the PA // the ARM processor toolchain sites code in lower memory and stack in higher memory // so we will use two memories // NOTE: this is just a consequence of the default linker script used icmMemoryP codeMemory = icmNewMemory("code_memory", ICM_PRIV_RWX, 0x9fffffff); icmMemoryP localPA = icmNewMemory("local_pa_memory", ICM_PRIV_RWX, 0x0fffffff); // Local memory for the AA icmMemoryP localAA = icmNewMemory("local_aa_memory", ICM_PRIV_RWX, 0x0fffffff); // Processor state memory (shared) icmMemoryP prStateMemory = icmNewMemory("pr_state_memory", ICM_PRIV_RWX, 0x100); /*************************************************************************************************** System Bus connections ***************************************************************************************************/ icmBusP busPA = icmNewBus("pa_bus", 32); icmBusP busAA = icmNewBus("aa_bus", 32); // Connect Primary Architecture to the pa bus icmConnectProcessorBusses(pa, busPA, busPA); // Connect memories to the busses icmConnectMemoryToBus(busPA, "pa_code_memory_port", codeMemory, 0x00000000); icmConnectMemoryToBus(busPA, "pa_local_memory_port", localPA, 0xf0000000); icmConnectMemoryToBus(busPA, "pa_pr_state_memory_port", prStateMemory, 0xcf000000); icmConnectMemoryToBus(busAA, "aa_code_memory_port", codeMemory, 0x00000000); icmConnectMemoryToBus(busAA, "aa_local_memory_port", localAA, 0xf0000000); icmConnectMemoryToBus(busAA, "aa_pr_state_memory_port", prStateMemory, 0xcf000000); /*************************************************************************************************** MURAC Peripherals (Auxiliary Architecture) ***************************************************************************************************/ icmAttrListP fpgaAttrs = icmNewAttrList(); if(finishOnSoftReset) { icmAddUns64Attr(fpgaAttrs, "stoponsoftreset", 1); } icmPseP muracFpga = icmNewPSE("muracFpga", MURAC_AA_FPGA_PSE_FILE, fpgaAttrs, 0, 0); // Connect memory access ports to the bus icmConnectPSEBus(muracFpga, busAA, "fpga_memread", True, 0x00000000, 0xffffffff); icmConnectPSEBus(muracFpga, busAA, "fpga_memwrite", True, 0x00000000, 0xffffffff); /*************************************************************************************************** System Interrupt connections ***************************************************************************************************/ icmNetP intBrArch = icmNewNet("brArch"); icmNetP intRetArch = icmNewNet("retArch"); // connect the processor interrupt port to the net icmConnectProcessorNet(pa, intBrArch, "brarch", ICM_OUTPUT); // connect the FPGA interrupt port to the net icmConnectPSENet(muracFpga, intBrArch, "fpga_brarch", ICM_INPUT); // connect the processor interrupt port to the net icmConnectProcessorNet(pa, intRetArch, "fiq", ICM_INPUT); // connect the FPGA interrupt port to the net icmConnectPSENet(muracFpga, intRetArch, "fpga_retarch", ICM_OUTPUT); /*************************************************************************************************** Information ***************************************************************************************************/ // Show the bus connections icmPrintf("\nPrimary Architecture Bus Connections\n"); icmPrintBusConnections(busPA); icmPrintf("\nAuxiliary Architecture Bus Connections\n"); icmPrintBusConnections(busAA); icmPrintf("\nNet Connections\n"); icmPrintNetConnections(); icmPrintf("\n"); /*************************************************************************************************** MURAC Simulation ***************************************************************************************************/ // Load the application code into the primary architecture memory icmLoadProcessorMemory(pa, argv[1], False, False, True); // Run the simulation until done (no instruction limit) icmProcessorP final = icmSimulatePlatform(); if ( final && (icmGetStopReason(final) == ICM_SR_INTERRUPT ) ) { icmPrintf("*** MURAC simulation interrupted\n"); } // report the total number of instructions executed icmPrintf("MURAC Primary Architecture has executed " FMT_64u " instructions\n", icmGetProcessorICount(pa)); icmTerminate(); return 0; }