EED2003 Digital Design
Presentation 1:
Digital Computers and
Number Systems
Asst. Prof.Dr. Ahmet ÖZKURT
Asst. Prof.Dr Hakkı T. YALAZAN
Based on the notes ofJaeyoung Choi, choi@comp.ssu.ac.kr fall 2000
1.1 Digital Computers
Digital Computers
‘information age’
a prominent and growing role in modern society
'generality'
follow a sequence of instruction, called a program,
that operates on given data
perform a variety of information-processing tasks
Digital computer
the best-known example of a digital system
manipulate discrete elements of information
(ex) 10 decimal digits, 26 letters of the alphabets, ....
1.1 Digital Computers
Signals
electrical signals such as voltages and currents
two discrete values
High (output) 4.5~5.5 (input) 3.0~5.5
Low (output) -0.5~1.0 (input) -0.5~2.0
High & Low (H & L), True & False, 1 & 0
Binary Number System
a binary digit is called a bit
information is represented in group of bits
use various coding techniques
1.1 Digital Computers
Computer Structure
1.1 Digital Computers
Basic Structure
memory unit: stores programs, input, output, data
ALU Unit (Arithmetic Logic Unit): performs arithmetic and other
dataprocessing operations, as specified by the program
control unit: supervises the flow of information between units
(CPU = control unit + data path)
input device: key board
output device: CRT, LCD
More
FPU (floating-point unit)
MMU (memory management unit)
(Memory: MMU + internal cache + external cache + RAM)
Combinational Logic
logic circuits for digital systems: combinational vs sequential
Combinational Circuit
outputs are determined by the present applied inputs
performs an operation, which can be specified logically
by a set of Boolean expressions
Combinational
Circuit
1.2 Number Systems
decimal number (base 10 or radix 10)
724.5 = 7 x 102 + 2 x 101 + 4 x 100 + 5 x 10-1
In general,
AnAn-1....A1A0.A-1A-2....A-m+1A-m
Each Ai coefficient is (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
base r or radix r
expressed with a power series in r
An rn + An-1 rn-1 + .... + A1 r1 + A0 r0 + A-1 r-1 + A-2 r-2 + .…
+ A-m+1 r-m+1 + A-m r-m
expresses in positional notation
AnAn-1....A1A0.A-1A-2....A-m+1A-m
. is called radix point
1.2 Number Systems
An is the most significant digit (msd)
A-m is the least significant digit (lsd)
enclose coefficients in parentheses and place a
subscript
(312.4)5 = 3 x 52 + 1 x 51 + 2 x 50 + 4 x 5-1
= 75 + 5 + 2 + 0.8 = (82.8)10
in computer work, binary, octal, and hexadecimal is
popular
Binary Numbers
base 2 with two digits: 0 & 1
(11010)2 = 1x24 + 1x23 + 0x22 + 1x21 + 1x20 = (26)10
digits in a binary numbers are called bits
powers of two are listed in Table 1-1.
1.2 Number Systems
Table 1-1: Powers of Two
210 = 1024 referred to as K (Kilo); 220 as M (Mega);
230 as G (Giga)
1.2 Number Systems
conversion of decimal to binary
successively subtracts powers of two from the
decimal number
(625)10 = ( ? )2
625 - 512 = 113 512 = 29
113 - 64 = 49 64 = 26
49 - 32 = 17 32 = 25
17 - 16 = 1 16 = 24
1- 1 = 0 1 = 20
(625)10 = 29 + 26 + 25 + 24 + 20 = (1001110001) 2
1.2 Number Systems
Octal and Hexadecimal Number
octal number - base 8 (0, 1, ..., 6, 7)
(127.4)8 = 1x82 + 2x81 + 7x80 + 4x8-1 = (87.5 )10
hexadecimal number - base 16 (0,1,....,9,A,B,C,D,E,F)
(B65F)16 = 11x163 + 6x162 + 5x161 + 15x160 =
(46687)10
1 octal digit = 3 binary digits
1 hexa digit = 4 binary digits
conversion
(0010 1100 0110 1011. 1111 0000 0110)2 =
(2C6B.F06)16
(3A6.C)16 = 0011 1010 0110. 1100 =
(1110100110.11)2
1.2 Number Systems
Table 1-2 Numbers with Different Bases
1.3 Arithmetic Operations
addition, subtraction, and multiplication
same as for decimal numbers
(Ex1.1) (59F)16 + (E46)16
(1)
59F 5 9 15
E46 14 4 6
13E5 19 14 21
1 3 E 5
(Ex1.2) (762)8 x (45)8
(Octal) (Octal) (Decimal) (Octal)
762 5x2 = 10 = 8 + 2 = 12
45 5x6+1 = 31 = 24 + 7 = 37
4672 5x7+3 = 38 = 32 + 6 = 46
3710 4x2 = 8= 8+0 = 10
43772 4x6+1 = 25 = 24 + 1 = 31
4x7+3 = 31 = 24 + 7 = 37
1.3 Arithmetic Operations
Conversion from Decimal to Other Base
(Ex1.3) (153)10 = ( ? )8
153/8 = 19 + 1/8 .... 1
19/8 = 2 + 3/8 .... 3
2/8 = 0 + 2/8 .... 2
(153)10 = (231)8
(Ex1.5) (0.6875)10 = ( ? )2
0.6875 x 2 = 1.375 .... 1
0.375 x 2 = 0.75 .... 0
0.75 x 2 = 1.5 .... 1
0.5 x 2 = 1.0 .... 1
(0.6875)10 = (0.1011)2
1.4 Decimal Codes
decimal number system (people are accustomed to)
(vs) binary number system (natural for computer)
2 ways
convert decimal numbers to binary
perform all arithmetic calculation in binary
and then convert the binary results back to decimal
perform the arithmetic operations with decimal numbers
when they are stored in coded form
n-bit binary code
a group of n bits up to 2n distinct combinations of 1's &
0's
2-bit binary code: 00, 01, 10, 11
1.4 Decimal Codes
10 decimal digits
4-bit binary code (6 are unassigned)
numerous different binary codes
BCD (Binary Coded Decimal)
0 0000 5 0101
1 0001 6 0110
2 0010 7 0111
3 0011 8 1000
4 0100 9 1001
(185)10
= (0001 1000 0101)BCD = (101110001)2
BCD numbers are decimal numbers, not binary
numbers
1.4 Decimal Codes
BCD Addition
4 0100 4 0100 8 1000
+5 0101 +8 1000 +9 1001
9 1001 12 1100 17 1 0001
+0110 +0110
1 0010 1 0111
add two BCD numbers as if two binary numbers
if sum is greater than or equal to 1010, add 0110
1.5 Alphanumeric Codes
handle of data of numbers and letters
set of elements include 10 digits, 26 letters, special
characters
36 ~ 64 letters if only capital letters: need 6 bits
64 ~ 128 letters if upper/lower letters: need 7 bits
ASCII Character Code
standard binary code is ASCII (Table 1.4)
ASCII contain 94 graphic chars + 34 control chars
Parity Bit
ASCII is a 7-bit code + 1 bit => 8-bit (1 byte)
\---- used for specific purpose
1.5 Alphanumeric Codes
parity bit: total number of 1 is even (even parity)
total number of 1 is odd (odd parity)
(even parity) (odd parity)
ASCII A = 1000001 01000001 11000001
ASCII T = 1010100 11010100
01010100
- helpful in detecting errors during the transmission of
information
Unicode
a new standard for 16-bit alphanumeric codes
referred to as Unicode/10646
16 bits provide 65,536 code words,
represent the symbols and ideographs of the
world's languages
16 bits, implemented in computers by 2 bytes
little-endian vs big-endian
Complements
Complements
2 types:
radix complement: r's complement
diminished radix complement: (r-1)'s complement
2's & 1's for binary numbers
10's & 9's for decimal numbers
1's complement of N (binary number): (2n - 1) - N
1's comp of 1011001 ==> 0100110
1's comp of 0001111 ==> 1110000
Complements
2's complement of N: 2n - N for N != 0, 0 for N = 0
add 1 to the 1's complement
2's comp of 101100 ==> 010011 + 1 ==> 010100
leaving all least significant 0's and the first 1 unchanged then
replacing 1's with 0's, 0's with 1's
2's comp of 1101100 ==> 0010100
2's complement of N is 2n – N
& the complement of the complement is 2n - (2n-N) = N
Complements
Subtraction with Complements
(M - N)
1) add 2's comp of the
subtrahend N to the minuend
M
M + (2n-N) = M - N + 2n
2) if M > N, the end cary is
discarded
3) if M < N, the result is 2n - (N
- M)
take the 2's complement of
the sum & place a minus sign
avoid overflow problem to
accomodate the sum