Professional Documents
Culture Documents
Logical Operations
AND, OR, NOT, XOR, etc.
Shift Operations
Logical Arithmetic
Number System
Radix r number (radix = 2, 8, 10, 16, etc.) p 1 q p 1q p 2 ...q0 .q1q2 ...qn qi * r i
i n
Complement
To represent negative data, we use Radix or Radix-1 complement Radix complement of A = rN - A Radix-1 complement of A = (rN -1) - A
Number System
Example
1111 + 1011 0100 1011 1111 1000 0111 1 1000 (2s complement) (1s complement) + C B Binary 15 3 C 15 4 B 15 5 A (15s complement) 1 B (16s complement) Hexadecimal
Binary Codes
Binary Codes (radix = 2)
Unsigned number:
No sign bit. N bits binary code: 0 ~ 2N-1
Signed number:
MSB is sign bit. 1s complement, 2s complement
Binary Codes
1s 2s complement Positive : same as unsigned number Negative : invert every bit complement Positive : same as unsigned number Negative : invert every bit, and add 1
Binary Codes
Sign-bit extension :
Positive : fill left with 0 Negative : fill left with 1 Example : 4bit 8bit
5 : 0101b 0000 0101b -5 : 1011b 1111 1011b
Binary Codes
Fast Conversion radix 2 8,16, radix 10 2
regard 3bits in binary as 1 digit of octal number. regard 4bits in binary as 1 digit of hexadecimal number. (cf. BCH)
Unicode
16bit code Can represent more characters than ASCII code.
Unpacked 0000 0001 0000 0010 0000 0110 0000 0010 0000 0011
0000 1001 0000 0001 0000 0000
Signed byte
-128 64 32 16 8 4 2 1
Agenda (Chapter 1)
Part II 1. Number System Part II 2. ALU
Arithmetic Operations
Integer, Floating-Point number ADD, SUB, MUL, DIV
Logical Operations
AND, OR, NOT, XOR, etc.
Shift Operations
Logical Arithmetic
ALU
What is ALU?
Arithmetic and Logical Unit
Arithmetic Operation
Integer, Floating-point number
Logical Operation
Binary data(0, 1)
Components of a ALU
Arithmetic Op. Logical Op. Complement Unit
1s Complement
Neg. number with 1s complement
2s Complement
Neg. Number with 2s complement
Logic Operations
AND, OR, NOT, XOR, selective-set, selective-complement, mask, insert, compare, etc.
Bitwise operation
Example ) A = 1011 0101, B = 0011 1011 A AND B = 0011 0001
Shift Operation
Logical Shift 0
0 Circular Shift
Shift Operation
Scheme of logical shift register
CLK
0
Right Sift R
Left Sift
Shift Operation
Arithmetic shift
Same as Logical Shift except MSB. Reason?
0
A A/B
A A+1 A A1
Division
Increment Decrement
0011 = 3
1001 = -7
0111 = 7
0000 = 0
0110
=6
1010 = -6
1100 = -4
1100 = -4
Carry
Booth Algorithm
It can be used to multiply any combination of negative or positive number.
01
AA- M
Q0, Q-1
AA+ M
11, 00
Right Shift A,Q, Q-1 Cnt Cnt -1 no
Cnt = 0 ?
End
Flow chart of Unsigned n-bit number division - Q in the Q reg. - R in the A reg.
Cnt Cnt -1 no
Cnt = 0
yes
End
Floating Point
S Exponent(E) Significand(M)
1.001001 26
Step 2
Step 3 normalize N1 + N2
N2
Step 1
N1
N2
Step 2
Step 2
Step 3
normalize
Step 3
normalize
N1 N2
N1 N2
Exponent underflow
Set result 0
Mantissa underflow
Rounding
Mantissa overflow
Realignment