Hello to all,
I would like to measure the current variation due to Functional Unit activation and deactivation. Can anyone help me out with the assembly program or the code through which I can measure this? I am using LPCXpresso 54114 board(ARM Cortex-M4).
Kindly, help me out with this. I read the various documentation but didn't get a clear picture.
Thanking you,
Regards,
Himanshu
Hi Himanshu,
Do you mean you want to measure power consumption with various peripherals turned on and off?
It would be easier to do the peripheral clock gating control in C rather than at assembly level.
First, start with a simple "hello world" type of application to make sure you got the board up and running.
Then configure clock setting of the processor to make sure you know how fast the processor and the memory systems are running at.
And move on to look into the SYSCON block in LPC5411x to see how to turn peripherals on and off.
LPC5411x user manual can be found in : http://cache.nxp.com/docs/en/user-guide/UM10914.pdf
This document the control registers, peripheral registers, memory map, etc.
regards,
Joseph
Thank you so much for your quick reply. What I want is to measure the current variation due to functional unit activation and deactivation based on the instruction in the program.
For example, ADD R0,R1,R2 and other data processing instruction required ALU and it's a part of a functional unit. As well LDR R0,[R1,#0x1] and other memory access instruction also need functional unit in order to successful execution.
So, I want to know the change in the current variation, when such instruction comes into the pipeline which activates functional unit also I would like to measure the current when an instruction comes which doesn't need a functional unit or in other words functional unit deactivation.
But I am not understanding how to measure this variation in the current. Since an effect in the current due to individual instruction is difficult and we need to loop them in order to measure the current consumption. I am using NXP basedLPCXpresso IDE for that, which measures the current during an execution of a program.
Regards,Himanshu
This will be challenging as the power consumption of each small parts in the processor is insignificant when compared to power consumption of memories, oscillator, clock buffers, etc. Don't forget that for each instruction execution, in parallel you can have instruction fetches, and the power consumption of instruction fetches can be much higher (due to flash memory accesses).
Maybe starting with a simple loop with NOPs
loop:
NOP
...
B loop
Observe the power waveform, and then replace one of the instruction in the loop with an ADD instruction to see what is the impact. Even when NOP is executed, you will still have instruction fetches, and hence exercise one of the bus interface, some parts of the memory system, etc. You might see a period glitch in the power value when the branch is executed.
If the power pattern doesn't change when you added an ADD instruction, it means the power taken by the ALU in relative to other parts is so small that it is not observable.
Hello Mr. Yiu,
Thank you very much for your quick reply. I have tried the sample code, provided by you. From the resultant power pattern, it was difficult to see any difference with 1 ADD instruction in the loop of NOP instruction. But, on trial of more ADD consecutive instruction, there was a significant jump in the power pattern.
What can be the reason, or is it due to the consecutiveness of the ADD instruction only?
In NOP instruction sequence there is no write to register bank so all registers could be clock gated.
When a sequence of ADD instructions are executed, the result of the ADD need to be stored and hence the power used by the register bank would be higher (destination register need to be active every cycle).
Thank you so much for the explanation. It is really helpful.
Thank you once again,