49 setClear =flagCleared-flagSet;
50 setStarted =handlerStarted-flagSet;
51 setFinished =handlerFinished-flagSet;
52 startedFinished =handlerFinished-handlerStarted;
71 long_SetClear=shortDummy;
72 long_SetStarted=shortDummy;
73 long_SetFinished=shortDummy;
74 long_StartedFinished=shortDummy;
76 short_SetClear=longDummy;
77 short_SetStarted=longDummy;
78 short_SetFinished=longDummy;
79 short_StartedFinished=longDummy;
85 if (actual.setClear< short_SetClear.setClear) {
86 short_SetClear=actual;
89 if (actual.setClear> long_SetClear.setClear) {
93 if (actual.setStarted< short_SetStarted.setStarted) {
94 short_SetStarted=actual;
97 if( actual.setStarted> long_SetStarted.setStarted) {
98 long_SetStarted=actual;
101 if ( actual.setFinished< short_SetFinished.setFinished) {
102 short_SetFinished= actual;
105 if ( actual.setFinished > long_SetFinished.setFinished) {
106 long_SetFinished= actual;
109 if (actual.startedFinished < short_StartedFinished.startedFinished) {
110 short_StartedFinished= actual;
113 if (actual.startedFinished > long_StartedFinished.startedFinished) {
114 long_StartedFinished= actual;
119 if ((actual.flagSet!=0) &&
120 (actual.flagCleared!=0) &&
121 (actual.handlerStarted!=0) &&
122 (actual.handlerFinished!=0))
124 CalculateStatistic();
136 os << hex << x <<
":" ;
173 map<unsigned int, IrqStatisticPerVector>::const_iterator ii;
175 os <<
"IRQ STATISTIC" << endl;
176 os <<
"\tFlagSet\tflagCleared\tHandlerStarted\tHandlerFinished\tSet->Clear\tSet->Started\tSet->Finished\tStarted->Finished"<<endl;
179 os <<
"Statistic for vector: 0x" << hex << ii->first << endl;
188 bytesPerVector(bytes),
189 vectorTableSize(tblsize),
191 irqStack(tblsize, NULL),
195 debugInterruptTable(tblsize, (
Hardware*)NULL)
217 unsigned int newPC = 0xffffffff;
228 actualVector = index;
234 actualVector = index;
303 assert(existing == source);
309 avr_message(
"Interrupt vector table (for comparison against a datasheet)\n");
310 avr_message(
"Vector | Address/2 | Source Peripheral (class)\n");
314 const char * handler = (i==0) ?
"funct AvrDevice::Reset()" 315 : source ?
typeid(*source).name() :
"(unsupported or not registered)";
Basic AVR device, contains the core functionality.
SystemClockOffset handlerFinished
SystemClockOffset handlerStarted
SystemClockOffset flagSet
SystemClockOffset GetCurrentTime() const
Returns the current simulation time.
unsigned int irqStackSize
virtual void ClearIrqFlag(unsigned int vector)
IrqStatisticEntry long_SetClear
IrqStatisticEntry long_StartedFinished
HWIrqSystem(AvrDevice *_core, int bytes_per_vector, int number_of_vectors)
SystemClockOffset startedFinished
IrqStatistic irqStatistic
SystemClockOffset setClear
SystemClockOffset setStarted
Build a register for TraceValue's.
bool enableIRQStatistic
global switch to enable irq statistic (default is disabled)
void RegisterTraceValue(TraceValue *t)
Registers a TraceValue for this register.
unsigned int vectorTableSize
number of entries supported by the device, not bytes
static SystemClock & Instance()
Returns the central SystemClock instance for the application.
void SetIrqFlag(Hardware *, unsigned int vector_index)
IrqStatisticEntry short_StartedFinished
ostream & helpHexOut(ostream &os, unsigned long long x)
IrqStatistic(AvrDevice *)
void IrqHandlerStarted(unsigned int vector_index)
void CalculateStatistic()
std::string int2str(int i)
Convert an int into a string.
const std::string & GetFname(void)
Return filename from loaded program.
unsigned int GetNewPc(unsigned int &vector_index)
returns a new PC pointer if interrupt occurred, -1 otherwise.
std::vector< Hardware * > irqStack
priority queue of pending interrupts (i.e. waiting to be processed)
void RegisterPrintable(Printable *x)
SystemClockOffset setFinished
IrqStatisticEntry long_SetFinished
IrqStatisticEntry short_SetStarted
ostream & operator<<(ostream &os, const IrqStatisticEntry &ise)
std::vector< TraceValue * > irqTrace
const std::string GetTraceValuePrefix(void)
Returns the scope prefix.
void UnregisterTraceValue(TraceValue *t)
Unregisters a TraceValue, remove it from register.
void DebugVerifyInterruptVector(unsigned int vector_index, const Hardware *source)
In datasheets RESET vector is index 1 but we use 0! And not a byte address.
SystemClockOffset flagCleared
void ClearIrqFlag(unsigned int vector_index)
virtual bool LevelInterruptPending(unsigned int vector)
IrqStatisticEntry long_SetStarted
static Application * GetInstance()
std::map< unsigned int, IrqStatisticPerVector > entries
void IrqHandlerFinished(unsigned int vector_index)
IrqStatisticEntry short_SetFinished
virtual bool IsLevelInterrupt(unsigned int vector)
IrqStatisticEntry short_SetClear
std::vector< const Hardware * > debugInterruptTable