F-CPU Design Team
F-CPU MANUAL REV. 0.2

add :             integer ADDition

Forms :
add r3, r2, r1
adds r3, r2, r1
addc r3, r2, r1
sadd r3, r2, r1
sadds r3, r2, r1
saddc r3, r2, r1

Function :
            Computes r1 = r2 + r3

Description :
            add performs an integer addition of the two source operands (r3 + r2) and puts the result in the destination operand (r1).

Format :
size :86666
bits :0                 78             1314             1920             2526             31
function :OP_ADDFlagsReg 3Reg 2Reg 1

Flags :
    Flags    SyntaxValuesFunction
8-9.%d postfix*Size parameter
10s- prefix1 if setDefines if the operation is SIMD
11(none yet)0Reserved
12-s postfix1 if setSaturation flag
13-c postfix1 if setCarry flag (2r2w)

Remarks :
            - The -s flag implementation is not mandatory.
            - When the -c and -s flags are both set, the instruction saturates with signed ceilings instead of unsigned ceilings (see 5.5.4 saturate/carry flag). This is not mandatory and traps if the implementation does not support this in hardware.
            - On some implementations, when one source operand is zero, the instruction can be transformed into a mov.

 

Examples :

Scalar :

R1 contains 0xF8 (we only consider the lower byte in the registers)
R2 contains 0x0F

add.b r1, r2, r3 : r3 = 0x07 (default behaviour)
adds.b r1, r2, r3 : r3 = 0xFF (saturation)
addc.b r1, r2, r3 : r3 = 0x07,, r4= 0x01 (carry)

 
SIMD :

R1 contains 0x000000F800000001 (in a 64-bit system)
R2 contains 0x0000000F00000002

sadd.b r1, r2, r3 : r3 = 0x0000000700000003 (default behaviour)
sadds.b r1, r2, r3 : r3 = 0x000000FF00000003 (saturation)
saddc.b r1, r2, r3 : r3 = 0x0000000700000003, r4= 0x0000000100000000 (carry)

 

Performance (FC0 only) :

Execution Unit :  Add/Sub Unit.
Latency :  1 cycle for 8-bit data, 2 cycles for 16-bit to 64-bit data.
Throughput :  1 operation per cycle per ASU.
Scheduling :  Byte chunks :
Cycle        1                2                3                4                5                6        
Stage    FetchDecode /
Register Read
XbarASU[1]XbarRegister
write

Word chunks :
Cycle        1                2                3                4                5                6                7        
Stage    FetchDecode /
Register Read
XbarASU[1]ASU[2]XbarRegister
write

 


mar avr 25 04 : 14 : 55 CEST 2000 by Whygee
Copyright (c) 1999-2000 The F-CPU Group Design Team.