微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > ARM MPCore -- (2)

ARM MPCore -- (2)

时间:11-10 来源:互联网 点击:
1. NOP

NOP不一定会占用CPU执行时间,可能在执行该指令前,CPU已将其从管道中移除。

可以用NOP进行填充,使后续指令处于64bit边界上。

2. SEV

向所有CPU Core发送事件信息。

3. WFE (Wait For Event)

如果未设置事件寄存器,则 WFE 会暂时中断挂起执行,直至发生任一以下事件后再恢复执行:
(1)发生 IRQ 中断,除非被 CPSR I 位屏蔽
(2)发生 FIQ 中断,除非被 CPSR F 位屏蔽
(3)发生不精确的数据中止,除非被 CPSR A 位屏蔽
(4)出现调试进入请求(需启用调试)
(5)另一个处理器利用 SEV 指令向事件发送信号
----------------------------
如果设置了事件寄存器,则 WFE 会清除该设置,然后立即返回。
如果实现了 WFE,则还必须实现 SEV。

4. WFI (Wait For Interrupt)

WFI 会暂时将执行中断挂起,直至发生以下事件后再恢复执行:
(1)发生 IRQ 中断,不考虑 CPSR I 位
(2)发生 FIQ 中断,不考虑 CPSR F 位
(3)发生不精确的数据中止,除非被 CPSR A 位屏蔽
(4)出现调试进入请求,无论是否启用调试

5. SEV/WFE用处

SEV/WFE are not intended for synchronisation- but for power management. Because of the way WFE is defined, there is no guarantee that the CPU1 will only awake when CPU0 executes SEV. It could wake at time for any number of reasons. Usually examples show SEV/WFE as a form of simple power management in a spin-lock. Something like:

lock_spin_lock (assume addr in r0)
LDREX r1, [r0]
CMP r1, #UNLOCKED
WFENE ; If not unlocked go to sleep
BNE lock_spin_lock ; on waking, re-check the spin-lock
...

Its the spin-lcok that provides the synchronisation, not the WFE. The WFE just is a way of saving power while you wait for the resource to become free

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top