Professional Documents
Culture Documents
th
Data registers
Pointer registers
Frame pointer
Accumulator registers
signed immediate
uimm unsigned immediate
-4 to +3
uimm3 0 to 7
Any register R0 to R7, P0 to P5
Any data register R0 to R7 Preg
Any pointer register P0 to P5
AZ, AN, AC0, AC1, V, VS, AV0, AV0S, AV1, AV1S, AQ
low part of register (R0.L) reg_hi high part of register (P0.H)
20
16
12
8
4
0
20
16
12
8
4
0
// NOT IN R3
// inPar3 originally in R2
// inPar2 originally in R1
// inPar1 originally in R0
// IN STUFF relative to FP
// This is relative to SP
// Passed on STACK NOT IN R3
// outPar3 overwrites R2
// outPar2 overwrites R1
// outPar1 overwrites R0
.extern _Subroutine;
// void Foo(INPAR1, INPAR2, INPAR3, INPAR4)
COMPARE (CONTINUED)
COMPARE INSTRUCTIONS
CC = Operand_1
CC = Operand_1
CC = Operand_1
CC = Operand_1
CC = Operand_1
== Operand_2;
<= Operand_2;
signed compare
<= Operand_2 (UI); unsigned compare
< Operand_2;
signed compare
< Operand_2 (UI); unsigned compare
Operand_1 Preg
uimm3
Operand_2 A1
MOVE CC INSTRUCTIONS
Dest OP CC Dest Dreg, statbit
OP =, |=, &=, ^= e.g. R0 |= CC;
IF CC DPreg = DPreg ;
IF ! CC DPreg = DPreg ;
/* move if CC = 1 */
/* move if CC = 0 */
NEGATE CC INSTRUCTIONS
CC = ! CC;
LOGICAL INSTRUCTIONS
Dreg = Dreg1 LOGICAL_OP Dreg2;
LOGICAL_OP - &, |, ^
Dreg = ~Dreg1; complement
Also BXOR and BXORSHIFT -- more later
BIT INSTRUCTIONS
BitInstruction(Dreg, bit position) where bit_position is 0 to 31
BitInstruction is BITCLR (clear), BITSET (set), BITTGL (toggle),
CC =BITTST (Dreg, bit position)
Bit test
CC = !BITTST (Dreg, bit position) Bit test
R0 = R1.B(X); R0 = R1.B(Z); // Extract and sign extend a byte value
// CANT DO MATH ON A BYTE VALUE DIRECTLY
Dreg = DEPOSIT ( backgroundDreg, foregroundDreg ) ;
Dreg = DEPOSIT ( Dreg, Dreg ) (X) ; /* sign-extended */
LOGICAL SHIFT
LSHIFT or >>
ARITHMETIC INSTRUCTIONS
dest_reg = ABS src_reg;
dest_reg = src_reg_1 + src_reg_2;
NOTE: dest_reg.LorH = src_reg1.LorH + src_reg2.LorH (mode); mode = (NS) or (S)
// Arithmetic is saturating or non-saturating (normal math is NS)
NOTE: dest_reg = src_reg_1 +|- srec_reg_2; H + H and L + L operations both done
// Can also do + | +, + | -, - | +, - | Dreg_lo_hi = Dreg + Dreg (RND20) ; STEP 1: Downshift by 4 and then
Dreg_lo_hi = Dreg - Dreg (RND20) ; STEP 2: perform operation, round top 16 bits
STEP 3: and use top 16 bits fractional number
Dreg_lo_hi = Dreg + Dreg (RND12) ; STEP 1: Upshift by 4 and then
Dreg_lo_hi = Dreg - Dreg (RND12) ; STEP 2: perform operation,
STEP 3: round and use top 16 bits
Dreg = MAX ( Dreg , Dreg ) ;
Dreg = MIN ( Dreg , Dreg ) ;
Preg -= Preg ;
Ireg -= Mreg ;
Preg += Preg (BREV) ;
Ireg += Mreg (opt_brev) ;
dest_reg = src_reg_0 * src_reg_1 (opt_mode) (16 bit mult)
Dreg *= Dreg ; (32 bit mult)
accumulator = src_reg_0 * src_reg_1 (opt_mode)
accumulator += src_reg_0 * src_reg_1 (opt_mode)
accumulator = src_reg_0 * src_reg_1 (opt_mode)
dest_reg_half = (accumulator = src_reg_0 * src_reg_1) (opt_mode)
dest_reg_half = (accumulator += src_reg_0 * src_reg_1) (opt_mode)
dest_reg_half = (accumulator = src_reg_0 * src_reg_1) (opt_mode)
dest_reg = (accumulator = src_reg_0 * src_reg_1) (opt_mode)
dest_reg = (accumulator += src_reg_0 * src_reg_1) (opt_mode)
dest_reg = (accumulator = src_reg_0 * src_reg_1) (opt_mode)
dest_reg = src_reg;
dest_accumulator = src_accumulator
dest_reg = src_reg (RND) (32 bit to 16 bit round and saturate)
accumulator = accumulator (S)
dest_reg = SIGNBITS sample_register
dest_reg = src_reg_1 - src_reg_2;
Ireg -= 2 ;
Ireg -= 4 ;
ROTATE
dest_reg = ROT src_reg BY rotate_magnitude;
accumulator_new = ROT accumulator_old BY rotate_magnitude;
(1 << 1)
(1 << 2)
(1 << 3)
(1 << 4)
// 0x10 -- RO
There are also other FIO Mask registers with a similar format
FIO_MASKA_C -- Write 1 to Clear
FIO_MASKA_T Write 1 to toggle
FIO_MASKB_D Write 1 to enable, write 0 to clear
FIO_MASKB_S Write 1 to Set
FIO_MASKB_C Write 1 to Clear
FIO_MASKB_T Write 1 to toggle
WATCH-DOG TIMER
WATCH-DOG TIMER
INTERRUPT CONTROL
INTERRUPT CONTROL
CORE TIMER
GENERAL PURPOSE
TIMER0, TIMER1, TIMER2
Also TIMERx_WIDTH
and TIMERx_PERIOD
which are 32-bit registers
GENERAL PURPOSE
TIMER0, TIMER1, TIMER2
All three GP timers have equivalent registers
e.g. THUS TIMERX_WIDTH MEANS REPLACE X BY 0, 1, 2
TIMER0_WIDTH, TIMER1_WIDTH, TIMER2_WIDTH
TIMERx_COUNTER, x = 0, 1, 2
TIMERx_PERIOD, x = 0, 1, 2
TIMERx_WIDTH, x = 0, 1, 2
All have following format
DYNAMIC POWER MANAGEMENT
SPI INTERFACE
SPI HARDWARE