Digital System Design Notes
Digital System Design Notes
t t
Analog Digital
Analog Digital
• Binary
• 2
• 0, 1
• Octal
• 8
• 0, 1, … 7
• Hexa-
decimal
• 16
• 0, 1, … 9,
• A, B, … F
Decimal Number System
• Base (also called radix) = 10
– 10 digits { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }
• Digit Position 2 1 0 1 2
(512.74)10
Octal Number System
• Base = 8
– 8 digits { 0, 1, 2, 3, 4, 5, 6, 7 }
• Weights 64 8 1 1/8 1/64
11000101
Hexadecimal Number System
• Base = 16
– 16 digits { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F }
• Weights 256 16 1 1/16 1/256
1 1 0
= Ten ≥ Base
➔ Subtract a Base
Binary Addition
• Column Addition
1 1 1 1 1 1
1 1 1 1 0 1 = 61
+ 1 0 1 1 1 = 23
1 0 1 0 1 0 0 = 84
≥ (2) 10
Binary Subtraction
• Borrow a “Base” when needed
1 2 = (10)2
0 2 2 0 0 2
1 0 0 1 1 0 1 = 77
− 1 0 1 1 1 = 23
0 1 1 0 1 1 0 = 54
Binary Multiplication
• Bit by bit
1 0 1 1 1
x 1 0 1 0
0 0 0 0 0
1 0 1 1 1
0 0 0 0 0
1 0 1 1 1
1 1 1 0 0 1 1 0
Number Base Conversions
Evaluate
Magnitude
Octal
(Base 8)
Evaluate
Magnitude
Decimal Binary
(Base 10) (Base 2)
Hexadeci
mal
(Base 16)
Evaluate
Magnitude
Decimal (Integer) to Binary Conversion
• Divide the number by the ‘Base’ (=2)
• Take the remainder (either 0 or 1) as a
coefficient
• Take the quotient and repeat the division
Quotient Remainder Coefficient
Example: (13)10 1 / 2 = 6 1 a0 = 1
3 /2= 3 0 a1 = 0
6 /2= 1 1 a2 = 1
3 /2= 0 1 a3 = 1
1 Answer: (13)10 = (a 3 a 2 a 1 a 0)2 = (1101)2
MSB LSB
Decimal (Fraction) to Binary
Conversion
• Multiply the number by the ‘Base’ (=2)
• Take the integer (either 0 or 1) as a coefficient
• Take the resultant fraction and repeat the
division
Integer Fraction Coefficient
Example: (0.625)10
0.62 *2= 1 . 25 a-1 = 1
0.2
5 *2= 0 . 5 a-2 = 0
0.
5 *2= 1 . 0 a-3 = 1
5
Answer: (0.625)10 = (0.a 1 a 2 a 3)2 = (0.101)2
MSB LSB
Decimal to Octal Conversion
Example: (175)10
Quotient Remainder Coefficient
17 / 8 = 21 7 a0 = 7
5 /8= 2 5 a1 = 5
21 / 8 = 0 2 a2 = 2
2
Answer: (175)10 = (a 2 a 1 a 0)8 = (257)8
Example: (0.3125)10
Integer Fraction Coefficient
0.3125 * 8 = 2 . 5 a-1 = 2
0. *8= 4 . 0 a-2 = 4
5
Answer: (0.3125)10 = (0.a 1 a 2 a 3)8 = (0.24)8
Binary − Octal Conversion
Octal Binary
• 8=2 3
0 000
• Each group of 3 bits 1 001
represents an octal digit 2 010
Assume Zeros
Example: 3 011
( 1 0 1 1 0 . 0 1 )2 4 100
5 101
6 110
( 2 6 . 2 )8 7 111
( 0 1 0 1 1 0 . 0 1 0 )2
(1 6 . 4 )16
10110000
+ 01001111
11111111
Complements
• Radix Complement
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 = [(r n − 1) – N] + 1.
Example: Base-10
The 10's complement of 012398 is 987602
The 10's complement of 246700 is 753300
Example: Base-2
The 2's complement of 1101100 is
0010100
The 2's complement of 0110111 is
1001001
Complements
• 2’s Complement (Radix Complement)
– Take 1’s complement then add 1
OR– Toggle all bits to the left of the first ‘1’ from the right
Example:
Number:
1’s Comp.: 1 0 1 1 0 0 0 0 10110000
01001111
+ 1
01010000 01010000
Complements
• Subtraction with Complements
– The subtraction of two n-digit unsigned numbers
M – N in base r can be done as follows:
Complements
• Example 1.5
– Using 10's complement, subtract 72532 – 3250.
Example 1.6
– Using 10's complement, subtract 3250 – 72532.
There is no end
carry.
(− 6) − (− (11111010 −
13) 11110011)
• Example: (11111010 +
00001101)
00000111 (+
7)
Binary Codes
• BCD Code
– A number with k decimal digits
will require 4k bits in BCD.
– Decimal 396 is represented in
BCD with 12bits as 0011 1001
0110, with each group of 4
bits representing one decimal
digit.
– A decimal number in BCD is
the same as its equivalent
binary number only when the
number is between 0 and 9.
– The binary combinations 1010
through 1111 are not used
and have no meaning in BCD.
The Digital Codes
Binary Coded Decimal (BCD)
• Would it be easy for you if you can replace a
decimal number with an individual binary
code?
– Such as 00011001 = 19 10
• The 8421 code is a type of BCD to do that.
• BCD code provides an excellent interface to
binary systems:
– Keypad inputs
– Digital readouts
Binary Coded Decimal
Decimal
0 1 2 3 4 5 6 7 8 9
Digit
BCD 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001
Note: 1010, 1011, 1100, 1101, 1110, and 1111 are INVALID CODE!
1 1 1 0 1 Gray
The Gray Code
• Gray-to-Binary Conversion
– The MSB in the binary code is the same as the
corresponding bit in the Gray code.
– Add each binary code bit generated to the Gray
code bit in the next adjacent position. Discard
carries.
ex: convert the Gray code word 11011 to binary
1 1 0 1 1 Gray
+ + + +
1 0 0 1 0 Binary
The Gray Code - Application
Bit
0
Bit
1
Bit
2
Bit
3
http://www.mipraso.de/
enzyklopaedie/g/gray-code-scheibe. http://www.engr.colostate.
gif edu/~dga/mechatronics/
figures/9-11.gif
Alphanumeric Codes
• Represent numbers and alphabetic
characters.
– Also represent other characters such as symbols
and various instructions necessary for conveying
information.
• The ASCII is the most common alphanumeric
code.
– ASCII = American Standard Code for Information
Interchange
ASCII
• ASCII has 128 characters and symbols
represented by a 7-bit binary code.
– It can be considered an 8-bit code with the MSB
always 0. (00h-7Fh)
• 00h-1Fh (the first 32) – control characters
• 20h-7Fh – graphics symbols (can be printed or
displayed)
ASCII
Table
http://ascii-table.com/img/table.gif
Extended ASCII
• There are an additional 128 characters that
were adopted by IBM for use in their PCs. It’s
popular and is used in applications other than
PCs → unofficial standard.
– The extended ASCII characters are represented
by an 8-bit code series from 80h-FFh
Extended ASCII
Table
http://ascii-table.com/img/table-pc.
gif
Binary Code
• Example:
– Consider decimal 185 and its corresponding value
in BCD and binary:
• BCD addition
Binary Code
Example:
– Consider the addition of 184 + 576 = 760 in BCD:
11 11
0 1
1-1 and onto!!
Binary Codes
• American Standard Code for Information Interchange (ASCII) Character
Code
Binary Codes
• ASCII Character Code
ASCII Character Codes
• American Standard Code for Information Interchange
(Refer to Table 1.7)
• A popular code used to represent information sent as
character-based data.
• It uses 7-bits to represent:
– 94 Graphic printing characters.
– 34 Non-printing characters.
• Some non-printing characters are used for text format
(e.g. BS = Backspace, CR = carriage return).
• Other non-printing characters are used for record
marking and flow control (e.g. STX and ETX start and
end text areas).
Binary Codes
• Error-Detecting Code
– To detect errors in data communication and
processing, an eighth bit is sometimes added to
the ASCII character to indicate its parity.
– A parity bit is an extra bit included with a
message to make the total number of 1's either
even or odd.
• Example:
– Consider the following two characters and their
even and odd parity:
Binary Codes
• Error-Detecting Code
– Redundancy (e.g. extra information), in the form of extra
bits, can be incorporated into binary code words to detect
and correct errors.
– A simple form of redundancy is parity, an extra bit
appended onto the code word to make the number of 1’s
odd or even. Parity can detect all single-bit errors and
some multiple-bit errors.
– A code word has even parity if the number of 1’s in the
code word is even.
– A code wordMessage
has odd parity if the
1000100 1 number
(even of 1’s in the
code word isA:odd. 1 parity)
Message 1000100 0 (odd
– Example: B: 1 parity)
Binary Logic
• Definition of Binary Logic
– Binary logic consists of binary variables and a set of logical operations.
– The variables are designated by letters of the alphabet, such as A, B, C, x, y, z,
etc, with each variable having two and only two distinct possible values: 1
and 0,
– Three basic logical operations: AND, OR, and NOT.
Binary Logic
• Truth Tables, Boolean Expressions, and Logic Gates
AND OR NOT
x y z x y z x z
0 0 0 0 0 0 0 1
0 1 0 0 1 1 1 0
1 0 0 1 0 1
1 1 1 1 1 1
z= x• y= xy z= x+ y z = x = x’
Switching Circuits
AND OR
Binary Logic
• Logic gates
– Example of binary signals
3
Logic 1
2
Un-
1 de ne
Logic
0 0
68
Boolean Algebra
69
Boolean Algebra
70
Boolean Algebra
71
Boolean Algebra
72
Boolean Algebra
• As with common
arithmetic, Boolean
operations have rules of
precedence.
• The NOT operator has
highest priority, followed
by AND and then OR.
• This is how we chose
the (shaded) function
subparts in our table.
73
Boolean Algebra
74
Boolean Algebra
• Boolean Constants
– these are ‘0’ (false) and ‘1’ (true)
• Boolean Variables
– variables that can only take the vales ‘0’ or ‘1’
• Boolean Functions
– each of the logic functions (such as AND, OR and NOT)
are represented by symbols as described above
• Boolean Theorems
– a set of identities and laws – see text for details
• Boolean identities
AND Function OR Function NOT function
0∙0=0 0+0=0
0∙1=0 0+1=1
1∙0=0 1+0=1
1∙1=1 1+1=1
A∙0=0 A+0=A
0∙A=0 0+A=A
A∙1=A A+1=1
1∙A=A 1+A=1
A∙A=A A+A=A
• Boolean laws
Commutative law Absorption law
78
Boolean Algebra
79
Boolean Algebra
80
Boolean Algebra
81
Boolean Algebra
82
Boolean Algebra
is:
83
Boolean Algebra
84
Boolean Algebra
85
Boolean Algebra
86
Boolean Algebra
87
Logic Gates
88
Logic Gates
• The three simplest gates are the AND, OR, and NOT
gates.
89
Logic Gates
90
Logic Gates
91
Logic Gates
92
Logic Gates
93
Digital Components