How to compute(display) cycle consumed by each instruction, when feeding multiple instructions as interrupt?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to compute(display) cycle consumed by each instruction, when feeding multiple instructions as interrupt?

907 Views
himanshudoshi
Contributor III

Kindly, help me out as I wanna display the cycles computed by each instruction in sequence of instructions as input

0 Kudos
Reply
3 Replies

680 Views
jeremyzhou
NXP Employee
NXP Employee

Hi HIMANSHU DOSHI,

Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.

You can try these method to measure the the elapsed time.

IAR Techniques for measuring the elapsed time 

Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

680 Views
himanshudoshi
Contributor III

Hii jeremyzhou‌, Thank you very much for your effort. I got the point, u wanna coney. But, I am not able to implement into LPCXpresso IDE. Is it possible for you to write a demo code for me. That will be great help for me. My aim is get the time display on which the interrupt is going to perform into the MCU. And trace/display the cycles consumed by each instruction. This is my piece of code. What I want is to note down the exact time on which the _WFI(); is turning on. And also the number of cycle taken by each of the instruction (in our case ADD,NOP,ADD). So, I want to note down the cycle per instruction and the time stamps in micro/nano seconds on which _WFI(); is goin to start. Also, it will be a great help if we can get/display these things on the console window out of Debug mode or in real-time mode.

#include "board.h"
#include <time.h>
#include <stdio.h>
#define TICKRATE_HZ (1) /* 10 ticks per second */
void SysTick_Handler(void)
{
   asm(
         "ADD R6, R5, R4\t\n"
         "NOP\t\n"
         "ADD R6, R5, R4\t\n"
         );
}
/* Main application entry point */
int main(void)
{
int loop = 1;
SystemCoreClockUpdate();
Board_Init();
Board_LED_Set(0, false); //0
   asm(
         "MOV R4,#0x0\t\n"
         "MOV R5,#0x0\t\n"
         "MOV R6,#0x0\t\n"
         );
//SysTick_Handler;
/* Enable SysTick Timer */
SysTick_Config(SystemCoreClock / TICKRATE_HZ);
printf("hello world.\r\n");
   while (1) {
                  __WFI();
                }
return 0;
}
Kindly, reply me thank you very much.
0 Kudos
Reply

680 Views
jeremyzhou
NXP Employee
NXP Employee

Hi HIMANSHU DOSHI

The Techinique 3: Using the MCU timer is suitably no matter which IDE you choose.

2017-03-08_14-30-22.jpg

                                                                    Fig 1

And you also can find the set of instructions and their cycle counts in the related Cortex-M core's technical reference manual, you can find the technical reference manual in the link below.

ARM Information Center 


Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------