sim64 universal 64-bit cycle count support:
MaxCycleCount is accounted by countdown, eliminating the 1-instruction-overhead issue, and removing the need to compare against a growing TotalCycles. Makes main.c responsible for counting total cycles, instead of 6502.c, so the size of MaxCycleCount etc. is fully determined in one location. Makes error.c responsible for PrintCycles instead of paravirt.c, so that it can be treated globally instead of Return value of main() should be SIM65_ERROR because it is unreachable by design.
This commit is contained in:
@@ -41,6 +41,20 @@
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
/* flag to print cycles at program termination */
|
||||
int PrintCycles = 0;
|
||||
|
||||
/* cycles are counted by main.c */
|
||||
extern unsigned long long TotalCycles;
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
@@ -99,3 +113,14 @@ void Internal (const char* Format, ...)
|
||||
va_end (ap);
|
||||
exit (SIM65_ERROR);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SimExit (int Code)
|
||||
/* Exit the simulation with an exit code */
|
||||
{
|
||||
if (PrintCycles) {
|
||||
fprintf (stdout, "%llu cycles\n", TotalCycles);
|
||||
}
|
||||
exit (Code);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user