This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Speed difference between the target and the simulator

I'm trying to toggle an output pin but I have some timing differences between simulator and the target.
The following code is reporting me a factor of two between the simulator speed and the target (the simulator is faster than the what I'm measuring with an oscilloscope).

while (1 == 1)
{
LCD_RW = 0;
delay_xxms ();
LCD_RW = 1;
delay_xxms ();
}

void delay_xxms (void)
{
unsigned long int i, j;

for (j = 0; j < 0x0206; j ++)
{
for (i = 0; i < 0x00FA; i ++)
{
_nop_ ();
}
}
}

But! If I'm using a timer interrupt, I have the SAME timing on the target and the simulator (no other interrupts are enabled).

void LCD_timer (void) interrupt 0x0024
{
/* stop timer */
GPT12E_T4CON_T4R = 0;
if (LCD_RS == 0)
{
LCD_RS = 1;
}
else
{
LCD_RS = 0;
}
GPT12E_T4 = 0x00C8; /* supposed that f = 8 MHz and BPS = 00b (value after reset) */
/* clear timer flag */
GPT12E_T4IC_IR = 0;
/* start timer */
GPT12E_T4CON_T4R = 1;
}

I'm using the Infineon XC164 Controller and uVision 3 simulator. The quartz frequency in the simulator is 8MHZ, the same on the target. I have the PLL bypassed; PLLIDIV = 0, PLLODIV = 0, CPSYS = 0, no change if (WSRAM = 0 or WSRAM = 1), or if (WSFLASH = 00 or WSFLASH = 01)

What is happening here?

Parents
  • This could not be an answer. Let's suppose you are right. The timer is counting also cycles, so i should see also the same factor in the pin toggle by the timer intrerrupt and this is not true. The timer is using the same clock as the CPU.

    I'm missing something in the code, or we have a simulator bug.

    I'm not talking about differences of some ps!

Reply
  • This could not be an answer. Let's suppose you are right. The timer is counting also cycles, so i should see also the same factor in the pin toggle by the timer intrerrupt and this is not true. The timer is using the same clock as the CPU.

    I'm missing something in the code, or we have a simulator bug.

    I'm not talking about differences of some ps!

Children
  • The timer is counting also cycles, so i should see also the same factor in the pin toggle by the timer intrerrupt and this is not true. The timer is using the same clock as the CPU.
    No, the timer is not counting cycles, it is counting cycles/n

    I'm missing something in the code, or we have a simulator bug.
    It is not a bug that the simulator does not do something it does not claim to do.

    I'm not talking about differences of some ps!
    if you change the PC to a faster/slower one, the simulator "execution time" will change too. There is NO, NONE, NADA "timing" in the simulator, just cycles of some, possibly, arbitray time. I will even guess that the "cycle time" is not constant, it does not have to be for a simulator

    Erik