Professional Documents
Culture Documents
Chapter 1
Digital Systems and Binary Numbers
Contents
Topics
Contact
Hours
No. of
Weeks
- Combinational Logic
12
Total
45
15
Assessment schedule
Essential Books
Assessment Methods
First Midterm Exam
Class Participation
project
Final Exam
Total
Week
Weighting of
Assessments
35 %
Every Lecture
25 %
12
Lab
After week15
40 %
100 %
Hall.
Recommended Books
• “FUNDAMENTALS OF LOGIC DESIGN”, by Charles H. Roth,
# Digital computers
General purposes
Many scientific, industrial and commercial applications
# Digital systems
# 1.5 Complements
Analog to Digital
# Sampling – Discretization of time axix.
# Analog system
#
# Digital system
#
#
X(t)
t
Analog signal
t
Discrete signalDigital Logic Design Ch1-9
Digits 0 and 1
Words (symbols) False (F) and True (T)
Words (symbols) Low (L) and High (H)
And words On and Off
2
# Digit Weight
#
V(t)
Weight = (Base)
Logic 1
-1
5 1 2
-2
7 4
Position
# Magnitude
100
10
500
10
0.1 0.01
# Formal Notation
10 digits { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }
# Digit Position
undefine
0.7 0.04
-1
-2
d2*B +d1*B +d0*B +d-1*B +d-2*B
Logic 0
t
Binary digital signal
Digital Logic Design Ch1-11
(512.74)10
Digital Logic Design Ch1-12
Octal Number System
# Base = 8
#
# Base = 2
8 digits { 0, 1, 2, 3, 4, 5, 6, 7 }
# Weights
#
Weight = (Base)
Position
64
# Magnitude
#
# Weights
# Formal Notation
1/8 1/64
5 1 2
7 4
-1
#
-1
Position
# Magnitude
#
-2
5 *8 +1 *8 +2 *8 +7 *8 +4 *8
Weight = (Base)
-2
1/2 1/4
1 0 1
0 1
# Formal Notation
-1
0
-2
-1
1 *2 +0 *2 +1 *2 +0 *2 +1 *2
# Groups of bits
=(330.9375)10
4 bits = Nibble
-2
=(5.25)10
8 bits = Byte
(512.74)8
(101.01)2
1011
11000101
The Power of 2
# Base = 16
#
16 digits { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F }
# Weights
#
Weight = (Base)
Position
256
# Magnitude
#
16
1 E 5
# Formal Notation
2n
n
2n
20=1
28=256
21=2
29=512
22=4
10
210=1024
23=8
11
211=2048
24=16
12
212=4096
25=32
20
220=1M
Mega
26=64
30
230=1G
Giga
27=128
40
240=1T
Tera
1/16 1/256
7 A
-1
-1
-2
-2
=(485.4765625)10
(1E5.7A)16
Kilo
Addition
Binary Addition
# Decimal Addition
# Column Addition
1
+
1
Carry
5
5
= 61
= 23
= 84
+
= Ten ≥ Base
# Subtract a Base
Digital Logic Design Ch1-17
≥ (2)10
Binary Multiplication
# Bit by bit
1
2
= 77
= 23
0
= 54
−
0
= (10)2
1
x
0
0
1
Evaluate
Magnitude
Octal
(Base 8)
Evaluate
Magnitude
Example: (13)10
Decimal
(Base 10)
Binary
(Base 2)
Quotient
Remainder
Coefficient
6
3
1
0
1
0
1
1
a0 = 1
a1 = 0
a2 = 1
a3 = 1
13/ 2 =
6 /2=
3 /2=
1 /2=
Hexadecimal
(Base 16)
Answer:
Evaluate
Magnitude
Example: (0.625)10
175 / 8 =
21 / 8 =
2 /8=
0.625 * 2 = 1
0.25 * 2 = 0
0.5
*2= 1
.
.
.
Fraction
Coefficient
25
5
0
a-1 = 1
a-2 = 0
a-3 = 1
Coefficient
7
5
2
a0 = 7
a1 = 5
a2 = 2
Example: (0.3125)10
Integer
0.3125 * 8 = 2
0.5
*8= 4
Answer:
MSB
Remainder
21
2
0
Answer:
Integer
LSB
Example: (175)10
Answer:
.
.
Fraction
Coefficient
5
0
a-1 = 2
a-2 = 4
LSB
Digital Logic Design Ch1-23
Octal
Binary
000
001
010
011
100
101
110
111
digit
Assume Zeros
Example:
( 1 0 1 1 0 . 0 1 )2
( 2
. 2 )8
# 16 = 24
# Each group of 4 bits represents a
hexadecimal digit
Assume Zeros
Example:
( 1 0 1 1 0 . 0 1 )2
(1
. 4 )16
Example:
2 )8
Assume Zeros
Assume Zeros
( 0 1 0 1 1 0 . 0 1 0 )2
(1
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
( 2
Binary
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
Hex
4 )16
Decimal
Binary
Octal
Hex
00
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
00
01
02
03
04
05
06
07
10
11
12
13
14
15
16
17
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
1.5 Complements
# There are two types of complements for each base-r system: the radix complement
and
(rn –1) – N
Complements
# 1’s Complement (Diminished Radix Complement)
All ‘0’s become ‘1’s
All ‘1’s become ‘0’s
Example (10110000)2
# (01001111)2
If you add a number and its 1’s complement …
#
#
# Observation:
#
#
#
10110000
+ 01001111
11111111
Digital Logic Design Ch1-30
Complements
Complements
# 2’s Complement (Radix Complement)
# Radix Complement
OR
The r's complement of an n-digit number N in base r is defined as
rn – N for N ≠ 0 and as 0 for N = 0. Comparing with the (r − 1) 's
complement, we note that the r's complement is obtained by adding 1
to the (r − 1) 's complement, since rn – N = [(rn − 1) – N] + 1.
10110000
# Example: Base-10[(rn – 1) – N ]+ 1
10110000
01001111
# Example: Base-2
1
01010000
01010000
Complements
Complements
# Example 1.5
# Example 1.6
#
Complements
Complements
# Subtraction of unsigned numbers can also be done by means of the (r − 1)'s
# Example 1.7
#
Given the two binary numbers X = 1010100 and Y = 1000011, perform the
subtraction (a) X – Y ; and (b) Y − X, by using 2's complement.
complement. Remember that the (r − 1) 's complement is one less then the r's
complement.
# Example 1.8
#
values.
# It is customary to represent the sign with a bit placed in the
leftmost position of the number since binary digits.
# The convention is to make the sign bit 0 for positive and 1 for
negative.
# Example:
#
#
#
01001
= 9 (Unsigned binary No.)
or
+9 (Signed binary No.)
11001
= 25 (Unsigned binary No.)
or
- 9 (Signed binary No.)
No confusion in identifying the bits if the type of representation is known.
magnitude convention.
#
# Example:
#
#
#
1’s Complement + 1
three representations.
#
In 2’s-complement form:
1.
2.
Take the 2’s complement of the subtrahend (including the sign bit)
and add it to the minuend (including sign bit).
A carry out of sign-bit position is discarded.
(± A) − (+ B) = (± A) + (−B)
(± A) − (−B) = (± A) + (+ B)
# Example:
(− 6) − (− 13)
Binary Codes
# BCD Code
#
#
Binary Codes
Binary Code
# BCD Code
# Example:
Consider decimal 185 and its corresponding value in BCD and binary:
# BCD addition
Binary Code
Binary Codes
# Example:
#
Binary code for decimal digits require a minimum of four bits per digit.
Many codes can be formulated by arranging four bits into 10 distinct
combinations.
Each code uses 10 out of 16 possibilities.
Remaining 6 combinations are discarded.
BCD and 2421 are weighted codes.
BCD code has weight of 8, 4, 2 and 1 e.g.
#
#
#
#
#
Binary Codes
#
#
Digital Logic Design Ch1-49
Binary Codes)
Binary Codes
# Gray Code
#
# Gray Code
#
Binary Codes
Binary Codes
# Gray code is used in applications where normal sequence of
1
+
1
+
+
0
Binary Codes
Binary Codes
Binary Codes
Format Effectors
»
Information Separator
#
e.g. paragraphs & pages.
ASCII, 7 bit code often used to store on one byte, where MSB is 1, are
used for symbols of greek and italic type fonts
Digital Logic Design Ch1-57
ASCII Properties
Table 1.7)
# A popular code used to represent information sent as characterbased data.
# It uses 7-bits to represent:
#
#
Lower to upper case translation (and vice versa) occurs by flipping bit 6.
flow control (e.g. STX and ETX start and end text areas).
Binary Codes
# Error-Detecting Code
#
# Error-Detecting Code
# Example:
#
Consider the following two characters and their even and odd parity:
#
#
#
Message A: 100010011
# Registers
# A binary cell is a device that possesses two stable states and is capable of
storing
one of the two states.
# A register is a group of binary cells. A register with n cells can store any
discrete
quantity of information that contains n bits.
n cells
2n possible states
CPU
# A binary cell
#
#
#
Inputs: Keyboard,
mouse, modem,
microphone
# A register
#
#
Memory
Control
unit
Datapath
Outputs: CRT,
LCD, modem,
speakers
Input/Output
# Register Transfer
#
#
#
Synchronous or
Asynchronous?
Transfer of information
Transfer of information
# The other major component
of a digital system
#
Circuit elements to
manipulate individual bits of
information
Load-store machine
LD
LD
ADD
SD
R1;
R2;
R3, R2, R1;
R3;
Binary Logic
AND
OR
NOT
0
1
z=x•y=xy
z=x+y
z = x = x’
Switching Circuits
Binary Logic
# Logic gates
AND
OR
3
Logic 1
2
Un-define
1
Logic 0
0
Binary Logic
Binary Logic
# Logic gates
#
# Logic gates
Quiz 1
bits.
# Convert the Hexadecimal No. 68BE to binary and then binary to
octal.
# Express the following numbers in decimal.
#
#
#
(10110.0101)2
(26.24)8
(FAFA)16
11011010
01110110
00000000
25000000
#
#
X-Y
Y-X using
» Using 2’s complement form
» Using 1’s complement form
# Write signed magnitude, signed 1’s complement and signed 2’s
complement of -2, -4, -6 and -7
»
complement form.
# Two binary Nos.