NY6 User Manual
Ver 1.3 2019/03/28
17
2.5 Arithmetic Logic Unit (ALU)
The NY6 series provides a 4-bit arithmetic logic unit with a 4-bit accumulator to perform logic, unsigned
arithmetic, data transfer and conditional branch operation. We have two status bits (carry and zero) to
indicate the result of the operation. One or two operands will be the data sources of the ALU operation. The
operands can be ACC, RAM, register, or literal constant data.
2.5.1 ALU Instruction Summary
2.5.1.1 Logic Instruction
Instruction
Function
Flag Influenced
XORM m
A
←
M[m]
⊕
A
Z
ANDM m
A
←
M[m] & A
Z
XORL L
A
←
L
⊕
A
Z
ANDL L
A
←
L & A
Z
ORL L
A
←
L | A
Z
RRC
Right Rotate A with C
C, Z
RLC
Left Rotate A with C
C, Z
RRA
Right Rotate A
RLA
Left Rotate A
M[m] : 4-bit RAM data at memory address m1, 0x00
≤
m
≤
0x3F.
2.5.1.2 Arithmetic Instruction
Instruction
Function
Flag Influenced
ADDM m
{C, A} ← A + M[m] + C
C, Z
SUBM m
{C, A}
←
A – M[m] - (~B)
C, Z
INCM m
{C, M[m]} ← M[m] + 1
C, Z
DECM m
{C, M[m]} ← M[m]
- 1
C, Z
ADDL L
A
←
A + L + C
C, Z
SUBL L
{C, A}
←
A - L - (~B)
C, Z
INCA
A
←
A + 1
C, Z
DECA
A
←
A - 1
C, Z
M[m] : 4-bit RAM data at memory address m1, 0x00
≤
m
≤
0x3F.
B : 1-bit borrow flag data, shared with carry flag, B=~C.