Parallax P2 Edge Module - Datasheet

allowing one cog at a time the exclusive status of 'owner' of a particular lock ID. In order to be useful, all
participant cogs must agree on a lock's ID and what purpose it serves.
The LOCK instructions are:
LOCKNEW D {WC}
LOCKRET {#}D
LOCKTRY {#}D {WC}
LOCKREL {#}D {WC}
Lock Usage
In order to use a lock, one cog must first allocate a lock with LOCKNEW and communicate that lock's ID with other
cooperative cogs. Cooperative cogs then use LOCKTRY and LOCKREL to respectively take or release ownership
of the state which that lock represents. If the lock is no longer needed by the application, it may be returned to the
unallocated lock pool by executing LOCKRET. A cog may allocate more than one lock.
At any time, a cog may attempt to own a lock (ie: the state that lock represents) by using LOCKTRY. The Hub
grants or denies ownership in response, ensuring that, at most, one cog owns the lock at any time. If a cog is
granted ownership, it can perform the task defined for that lock and then use LOCKRET to release ownership,
allowing any other cog to attempt ownership. Only the cog that has taken ownership of the lock can release it;
however, a lock will also be implicitly released if the owner cog is stopped (COGSTOP) or restarted (COGINIT).
CORDIC Solver
The Hub contains a 54-stage pipelined CORDIC solver (Coordinate Rotation Digital Computer) that can compute
the following functions for all cogs:
32 x 32 unsigned multiply with 64-bit product
64 / 32 unsigned divide with 32-bit quotient and 32-bit remainder
Square root of 64-bit unsigned value with 32-bit result
32-bit signed (X, Y) rotation around (0, 0) by a 32-bit angle with 32-bit signed (X, Y) results
32-bit signed (X, Y) to 32-bit (length, angle) cartesian to polar operation
32-bit (length, angle) to 32-bit signed (X, Y) polar to cartesian operation
32-bit unsigned integer to 5:27-bit logarithm
5:27-bit logarithm to 32-bit unsigned integer
Each cog can issue one CORDIC instruction per its hub access window (which occurs once every eight clocks)
and retrieve the result 55 clocks later via the GETQX and GETQY instructions. For faster throughput cogs can take
advantage of the hub access window and CORDIC pipeline to issue a stream of CORDIC instructions interleaved
with retrieving corresponding results.
Multiply
Use the QMUL instruction to multiply two unsigned 32-bit numbers together and retrieve the CORDIC results with
the GETQX and GETQY instructions (for lower and upper long, respectively).
Divide
Use the QDIV or QFRAC instruction (either with optional preceding SETQ instruction) to divide a 64-bit numerator
by a 32-bit denominator, then retrieve the CORDIC results with the GETQX and GETQY instructions (for quotient
and remainder, respectively).
Copyright © Parallax Inc. 2021/05/27 Parallax Propeller 2 (P2X8C4M64P) Datasheet Page 18