Unsigned Notation
By Sherwin Chiu
Unsigned Notation
Introduction
Most frequently preformed operation is copying data from one place to another:
From one register to another Between a register and a memory location * Value is not modified as it is copied
Unsigned Notation: The notation does not have a separate bit to represent the sign of the number.
Unsigned Notation
There are two types of unsigned notation:
1. 2.
0001
0111 1000 1001 1111
1
7 8 9 15 (2 - 1)
1
7 (2 - 1) -8 (2 n-1 ) -7 -1
n-1
Addition
Can be easily done when values fit the limitations for non-negative or 2s complement
A little more complicated when it does not.
Straightforward Addition
Adding numbers that fit the limitations can perform a straightforward addition of binary numbers.
When adding two numbers of different signs (+/-), a valid result will always occur.
Overflow
When two numbers being added exceed the number of bits available in the register, an overflow occurs. In non-negative, an overflow flag is notified by the carry out bit. In 2s complement, an overflow flag is notified by both the carry in and carry out bit.
Subtraction
Essentially treated the same as addition, but negating one of the values. X + (-Y) Overflow is still caused by exceeding the number of bits available in the register.
Implementation of SUB: X X Y
Multiplication
We could multiply by adding n copies of the number together, but it would be inefficient.
It is also not how people would do multiplication.
Binary Multiplication
Using binary notation makes multiplication even easier by having only two possible values, 0 (X 0 = 0) or 1 (1 X 1 = 1)
Vo 2: CUU + X Z3: GOTO 2 Micro-operations U0, i 4 CUU+X, ii1 shr(CUV), GOTO 2 CUU+X, ii 1 shr(CUV), GOTO 2 ii 1 shr(CUV), GOTO 2 CUU+X, ii 1 shr(CUV), FINISH1
2: i i 1 Z 3: FINISH1 i x 4 3 0 0 2 1 0 1 0 0 1 0 0100 0001 1000 1111 1111 1 1 C x U xxxx 0000 1101 0110 0011 1001 1110 0 1101 0 V 1011 0 0 Z FINISH 0
Division
Can be done with the same idea of repeated additions like multiplication, but instead for division, it is repeated subtractions.
Shifting is also applicable in the same way as multiplication, just shifting left and subtracting instead.
C42,Z42
3
Y0 1,GOTO 3
shl(CUV),shl(Y),i i-1 2 0 1010 1100
0001
0010 0
C41
C42,Z42 3 C41
CU U+X+1
U U+X,GOTO 3 shl(CUV),shl(Y),i i-1 U U+X+1 1
1101
1010
0101 1000
1000
0100
C42,Z42
3 C41 C42,Z42
Y0 1,GOTO 3
shl(CUV),shl(Y),i i-1 U U+X+1 Y0 1,FINISH1 0 1 0001 0100 0000
0101
1010 1
1011
Conclusion
Basic arithmetic functions are a lot more complicated than what it seems. These implementations are only for unsigned notation. There still exist signed notation and binarycoded decimal. Any Questions?