Propeller Manual

Table Of Contents
3: Assembly Language Reference – COGID
COGID
Instruction: Get current cog’s ID.
COGID Destination
Result: The current cog’s ID (0-7) is written to Destination.
Destination (d-field) is the register to write the cog’s ID into.
Opcode Table:
–INSTR– ZCRI –CON– –DEST– –SRC– Z Result C Result Result Clocks
000011 0011 1111 ddddddddd ------001
ID = 0 0 Written 7..22
Concise Truth Table:
In Out
Destination Source
1
Z
C
Effects
Destination
2
Z C
$----_----; - %0_00000001; 1 -
-
wz wc
$0000_0000; 0 1 0
$----_----; - %0_00000001; 1 -
-
wz wc
$1; 1 .. $7; 7 0 0
1
Source is automatically set to immediate value 1 by the assembler to indicate that this is the COGID hub instruction.
2
Destination Out (written Destination) will be 0 through 7, depending on which cog executed the instruction.
Explanation
COGID returns the ID of the cog that executed the command. The COGID instruction behaves
similar to the Spin command of the same name; see
COGID on page 75.
If the
WZ effect is specified, the Z flag is set if the cog ID is zero. The result is written to
Destination unless the
NR effect is specified.
COGID is a hub instruction. Hub instructions require 7 to 22 clock cycles to execute depending
on the relation between the cog’s hub access window and the instruction’s moment of
execution. See Hub on page 24 for more information.
Propeller Manual v1.1 · Page 283