Professional Documents
Culture Documents
Computer Science Chap04
Computer Science Chap04
CHAPTER 4
KUAN-CHOU LAI
an × r n + an -1 × r n -1 + .... + a2 × r 2 + a1 × r1 + a0
+ a-1 × r -1 + a- 2 × r - 2 + .... + a- m × r - m
– Examples
( 4021.2)5 = 4 ´ 53 + 0 ´ 52 + 2 ´ 51 + 1 ´ 50 + 2 ´ 5-1 = (511.4)10
(110101) = 1 ´ 25 + 1 ´ 2 4 + 0 ´ 23 + 1 ´ 2 2 + 0 ´ 21 + 1 ´ 20
= 32 + 16 + 4 + 1 = (53)10
6 x 82 = 6 x 64 = 384
+ 4 x 81 = 4 x 8 = 32
+ 2 x 8º =2x1 = 2
= 418 in base 10
222 13 0
16 3567 16 222 16 13
32 16 0
36 62 13
32 48
47 14
32
15
D E F
Low Voltage = 0
High Voltage = 1 all bits have 0 or 1
• Ex.
– 9’s complement of 546700 is 999999-546700 =
453299
– 1’s complement of 0101101 is 1010010
ì 0 , if N =0 ü
• r’s complement = í n ý
îr - N , if N ¹0 þ
• Ex.
– 10’s complement of 012398 is 987602
– 2’s complement of 0110111 is 1001001
– Arithmetic Subtraction
(±A) – (+B) = (±A) + (-B)
(±A) – (-B) = (±A) + (+B)
Bit combinations
a b Value
0 0 1
0 1 0
1 0 0
1 1 1
0 1 0
• Practice exercise
– Label Output-2
High Performance Computing Laboratory@NTCU © Lai, Kuan-Chou 155
Circuit Construction
• Example of compare-for-equality (CE) circuit
– Goal
test two unsigned binary numbers for exact equality
output 1 → if two numbers are equal
output 0 → if they are not equal
– First, construct 1 bit circuit
– Built by combining together 1-bit comparison circuits (1-
CE)
– Integers are equal if corresponding bits are equal (AND
together 1-CD circuits for each pair of bits)
– Case 1 + Case 2 =