ARM Technical Support Knowledge Articles

What is the purpose of WFI and WFE instructions and the event signals ?

Applies to: Cortex-A5

Answer

We have 2 instructions for entering low-power standby state where most clocks are gated: WFI and 
WFE.

They differ slightly in their entry and wake-up conditions, with the main difference being that 
WFE makes use of the event register, the SEV instruction and EVENTI, EVENTO signals.

WFI is targeted at entering either standby, dormant or shutdown mode, where an interrupt is 
required to wake-up the processor.

A usage for WFE is to put it into a spinlock loop. Where a CPU wants to access a shared resource 
such as shared memory, we can use a semaphore flag location managed by exclusive load and store 
access. If multiple CPUs are trying to access the resource, one will get access and will start to 
use the resource while the other CPUs will be stuck in the spinlock loop. To save power, you can 
insert the WFE instruction into the loop so the CPUs instead of looping continuously will enter 
STANDBTWFE. Then the CPU who has been using the resource should execute SEV instruction after it 
has finished using the resource. This will wake up all other CPUs from STANDBYWFE and another CPU 
can then access the shared resource.

The reason for having EVENTI and EVENTO is to export a pulse on EVENTO when an SEV instruction is 
executed by any of the CPUs. This signal would connect to EVENTI of a second Cortex-A5 MPCore 
cluster and would cause any CPUs in STANDBYWFE state to leave standby. So these signals just 
expand the usage of WFE mode across multiple clusters. If you have a single cluster, then you do 
not need to use them.

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential