0% found this document useful (0 votes)
33 views

Lecture 3

Uploaded by

Muhammad Ali
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

Lecture 3

Uploaded by

Muhammad Ali
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 16

Logic and Computer Design Fundamentals

Chapter 1 – Digital
Computers and Information

Charles Kime & Thomas Kaminski


© 2004 Pearson Education, Inc.
Terms of Use
(Hyperlinks are active in View Show mode)
Overview

 Base Conversion
 Arithmetic Operations
 Decimal Codes
 Alphanumeric Codes

Chapter 1 2
Binary Arithmetic

 Binary Addition
 Binary Subtraction
 Binary Multiplication
 BCD Addition

Chapter 1 3
Binary Addition

Carries 0 0
Augend 01100 10110
Addend +10001 +10111
Sum
 Note: The 0 is the default Carry-In to the
least significant bit.

Chapter 1 4
Binary Subtraction

Borrows 0 0
Minuend 10110 10110
Subtrahend - 10010 - 10011
Difference
 Notes: The 0 is a Borrow-In to the least significant
bit. If the Subtrahend > the Minuend, interchange
and append a – to the result.

Chapter 1 5
Binary Multiplication

The binary multiplication table is simple:


00=0 | 10=0 | 01=0 | 11=1
Extending multiplication to multiple digits:
Multiplicand 1011
Multiplier x 101
Partial Products 1011
0000x
1011xx
Product 110111
Chapter 1 6
Binary Coded Decimal (BCD)

 The BCD code is the 8,4,2,1 code.


 This code is the simplest, most intuitive binary
code for decimal digits and uses the same
powers of 2 as a binary number, but only
encodes the first ten values from 0 to 9.
 Example: 1001 (9) = 1000 (8) + 0001 (1)
 How many “invalid” code words are there?
 What are the “invalid” code words?

Chapter 1 7
Warning: Conversion or Coding?

 Do NOT mix up conversion of a decimal


number to a binary number with coding
a decimal number with a BINARY
CODE. 
 1310 = 11012 (This is conversion) 
 13  0001|0011 (This is coding)

Chapter 1 8
BCD Arithmetic
 Given a BCD code, we use binary arithmetic to add the digits:
8 1000 Eight
+5 +0101 Plus 5
13 1101 is 13 (> 9)
 Note that the result is MORE THAN 9, so must be
represented by two digits!
 To correct the digit, add 6.
8 1000 Eight
+5 +0101 Plus 5
13 1101 is 13 (> 9)
+0110 so add 6
(Carry) 1 0011 leaving 3 + carry
0001 | 0011 Final answer (two digits)
 If the digit sum is > 9, add one to the next significant digit
Chapter 1 9
BCD Addition Example

 Add 2905BCD to 1897BCD showing


carries and digit corrections.
0
0001 1000 1001 0111
+ 0010 1001 0000 0101

Chapter 1 10
Error-Detection Codes

 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 (in most significant position) 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 word has odd parity if the number of 1’s
in the code word is odd.

Chapter 1 11
4-Bit Parity Code Example

 Fill in the even and odd parity bits:


Even Parity Odd Parity
Message - Parity Message - Parity
- 000 - 000
- 001 - 001
- 010 - 010
-011 - 011
- 100 - 100
- 101 - 101
- 110 - 110
- 111 - 111
 The codeword "1111" has even parity and the
codeword “0111" has odd parity. Both can be used
to represent 3-bit data.
Chapter 1 12
ASCII Character Codes

 American Standard Code for Information


Interchange
 This code is 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

Chapter 1 13
Chapter 1 14
Chapter 1 15
ASCII Properties

ASCII has some interesting properties:


 Digits 0 to 9 span Hexadecimal values 3016 to 3916 .
 Upper case A-Z span 4116 to 5A16 .
 Lower case a -z span 6116 to 7A16 .
• Lower to upper case translation (and vice versa)
occurs by flipping bit 6.

Chapter 1 16

You might also like