Processor control

Todo

write me

Introduction

Todo

write me

Execution state

The falcon processor can be in one of three states:

  • RUNNING: processor is actively executing instructions
  • STOPPED: no instructions are being executed, interrupts are ignored
  • SLEEPING: no instructions are being executed, but interrupts can restart execution

The state can be changed as follows:

From To Cause
any STOPPED Reset [non-crypto]
any RUNNING Reset [crypto]
STOPPED RUNNING Start by UC_CTRL
RUNNING STOPPED Exit instruction
RUNNING STOPPED Double trap
RUNNING SLEEPING Sleep instruction
SLEEPING RUNNING Interrupt

The EXIT interrupt

Whenever falcon execution state is changed to STOPPED for any reason other than reset (exit instruction, double trap, or the crypto reset scrubber finishing), falcon interrupt line 4 is active for one cycle (triggering the EXIT interrupt if it’s set to level mode).

Halting microcode execution: exit

Halts microcode execution, raises EXIT interrupt.

Instructions:
Name Description Subopcode
exit Halt microcode execution 2
Instruction class:
unsized
Operands:
[none]
Forms:
Form Opcode
[no operands] f8
Operation:
EXIT;

Waiting for interrupts: sleep

If the $flags bit given as argument is set, puts the microprocessor in sleep state until an unmasked interrupt is received. Otherwise, is a nop. If interrupted, return pointer will point to start of the sleep instruction, restarting it if the $flags bit hasn’t been cleared.

Instructions:
Name Description Subopcode
sleep Wait for interrupts 28
Instruction class:
unsized
Operands:
FLAG
Forms:
Form Opcode
I8 f4
Operation:
if ($flags & 1 << FLAG)
        state = SLEEPING;