Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
LOGIC DESIGN
Fall 2014
1
By Wessam El-Behaidy
Assistant Professor ,
Computer Science Department
BINARY CODES
3
Lecture 2
BINARY CODES
Digital systems:
Use signals that have 2 distinct values and circuit
elements that have 2 stable states
Represent and manipulate not only binary numbers
but also many other discrete elements of information
Section 1.7
Decimal
Symbol
BCD
Digit
0000 0001 0010 0011 0100 0101 0110 0111 1000 1001
Note: 1010, 1011, 1100, 1101, 1110, and 1111 are INVALID CODE!
Section 1.7
BCD ADDITION
Example:
4
+5
9
0100
+1000
1100
+0110
10010
4
+8
12
0100
+0101
1001
> 9 (1001)
BCD
Digit
>9
1000
+ 1001
10001
+0110
10111
1
0000 0001 0010 0011 0100 0101 0110 0111 1000 1001
Section 1.7
Decimal
Symbol
8
+9
17
BCD
1010
0110
0000
>9
760
7
Section 1.7
Binary sum
Add 6
BCD sum
184
+576
Section 1.7
Binary codes
for decimal
digits require
a minimum of
4 bits per digit
Many
different
codes can be
formulated by
arranging 4
bits into 10
distinct
combinations
WEIGHTED CODES
BCD
Ex:
Section 1.7
0110BCD =610
because 8*0 + 4*1 + 2*1+ 1*0 = 6
11012421 =710
because 2*1 + 4*1 + 2*0 + 1*1 =7
01108,4,-2,-1=210
because 8*0 + 4*1 + (-2)*1 + (-1)*0 =2
SELF-COMPLEMENTING CODES
The
10
Section 1.7
Important:
Section 1.7
ALPHANUMERIC CODES
Section 1.7
12
ASCII(A)= 1000001
Column 100, row 0001
Section 1.7
13
ASCII CODE
14
Section 1.7
15
Section 1.7
ERROR-DETECTING CODE
To detect errors in data communication and
processing, an 8th bit is sometimes added to
ASCII character to indicate its parity.
A parity bit is an extra bit included with a
message to make the total number of 1s either
even or odd.
Section 1.7
ASCII A=1000001
ASCII T=1010100
EVEN PARITY
It is the most used.
At the sender:
At the receiver:
The parity of each character is checked
If the parity of the received character is not even,
then at least one bit has changed during
transmission
17
Section 1.7
If no error is detected,
Section 1.7
18
REGISTER
The binary information must have a physical
existence in some medium for storing individual
bits.
A binary cell
A register
n-1
.
19
Section 1.8
A register with
n bits with
n binary cells
Section 1.8
20
Before we proceed,
Any questions?
BINARY LOGIC
Binary
values.
Examples:
The
z = x . y or
OR
Ex:
Ex:
NOT
Ex:
Section 1.9
AND
A, B, y, z, or X1
z = x + y z is equal to x OR y
z=x
or
22
TRUTH TABLE
It is a table of all possible combinations of the
variables
It shows the relation between
Section 1.9
23
TIMING DIAGRAM
Timing diagram
Section 1.9
Figure 1.5
24
Figure 1.4
Section 1.9
Figure 1.6
25
LOGIC GATES
OTHER
=xy
=xy
Section 2.8
26
EXAMPLE
Z= A +B
0
0
1
1
0
1
0
1
1
1
0
0
1
1
0
1
27
THANKS
28
We covered: