Anda di halaman 1dari 29

Digital Logic Design and Computer Architecture

Waqar Shahid
Instructor

Instructor:

Waqar Shahid

M.Sc Computer Engg from CASE 2007 B.Sc Elect Engg from UET Lahore 2002

Contact Details: +92-0302-8177897 (cell) waqar.shahid@mail.au.edu.pk dld_air_su09@yahoogroups.com (course yahoo group) N.B: lectures notes, Announcements, Assignments and Extra Reference Material would regularly be uploaded on yahoo group. It would also provide us a platform for your queries and problems

Introduction

This course is designed for undergraduate of Electrical Engineering students, it serves a basis for FPGA based design course and other graduate level courses such as Advance Computer Architecture and Advance Digital Design. The course would build concepts and fundamentals to the understand Modern Digital Computers. Starting from Logic gates to Computer Architecture design.

Reading Material

Suggested Text Book:

Logic and Computer Design Fundamentals (3rd Edition) by M. Morris Mano Verilog HDL by Samir Palnitkar 2nd Edition
Digital Design ( Morris Mano)

Reference Text:

Softwares:

Veriwell Simulator or Xilinx ISE Simulator

Grading Policy

20% Mid-Term 20% Lab 45% Final Exam 10% Assignments ( Zero for Copied or Late Assignment) 5% Quizzes (Best ones)

Overview of Chapter 1

Digital Systems and Computer Systems Information Representation Number Systems [binary, octal and hexadecimal] Arithmetic Operations Base Conversion Decimal Codes [BCD (binary coded decimal), parity] Gray Codes Alphanumeric Codes

Signal
An information variable represented by physical quantity.

Signal

For digital systems, the variable takes on discrete values. Two level, or binary values are the most prevalent values in digital systems. Binary values are represented abstractly by:

digits 0 and 1 words (symbols) False (F) and True (T) words (symbols) Low (L) and High (H) and words On and Off.

Binary values are represented by values or ranges of values of physical quantities

Digital System

Takes a set of discrete information inputs and discrete internal information (system state) and generates a set of discrete information outputs. Discrete Inputs Discrete Information Processing System

Discrete Outputs

System State

Types of Digital Systems

No state present

Combinational Logic System Output = Function(Input)

State present
State updated at discrete times => Synchronous Sequential System State updated at any time =>Asynchronous Sequential System State = Function (State, Input) Output = Function (State) or Function (State, Input)

A Digital Computer Example


Memory

CPU

Control unit

Datapath

Inputs: Keyboard, mouse, modem, microphone

Input/Output
Synchronous or Asynchronous?

Outputs: CRT, LCD, modem, speakers

Signal Examples Over Time


Time

Analog

Continuous in value & time Discrete in value & continuous in time Discrete in value & time

Digital Asynchronous

Synchronous

Signal Example Physical Quantity: Voltage


OUTPUT 5.0 HIGH 4.0 3.0 2.0
Threshold Region

INPUT HIGH

LOW

1.0
0.0 Volts

LOW

Number Systems Representation


Positive radix, positional number systems A number with radix r is represented by a string of digits: An - 1An - 2 A1A0 . A- 1 A- 2 A- m + 1 A- m in which 0 Ai < r and . is the radix point. The string of digits represents the power series:
(Number)r =

i=n-1

Ai

i=0

r )+(
i
+

j=-1

Aj

r)
j

j=-m
(Fraction Portion)

(Integer Portion)

Number System

Number Systems Examples


General Radix (Base) Digits 0 1 2 3 Powers of 4 Radix 5 -1 -2 -3 -4 -5 r 0 => r - 1 r0 r1 r2 r3 r4 r5 r -1 r -2 r -3 r -4 r -5 Decimal 10 0 => 9 1 10 100 1000 10,000 100,000 0.1 0.01 0.001 0.0001 0.00001 Binary 2 0 => 1 1 2 4 8 16 32 0.5 0.25 0.125 0.0625 0.03125

Number System

Special Powers of 2
210 (1024) is Kilo, denoted "K" 220 (1,048,576) is Mega, denoted "M" 230 (1,073, 741,824)is Giga, denoted "G"

Chapter 1

18

Positive Powers of 2

Useful for Base Conversion


Exponent Value 0 1 1 2 2 4 3 8 4 16 5 32 6 64 7 128 8 256 9 512 10 1024 Exponent Value 11 2,048 12 4,096 13 8,192 14 16,384 15 32,768 16 65,536 17 131,072 18 262,144 19 524,288 20 1,048,576 21 2,097,152

Chapter 1

19

Converting Decimal to Binary

Method 1

Example: Convert 62510 to N2

Subtract the largest power of 2 (see slide 14) that gives a positive remainder and record the power. Repeat, subtracting from the prior remainder and recording the power, until the remainder is zero. Place 1s in the positions in the binary result corresponding to the powers recorded; in all other positions place 0s.

Chapter 1

20

Commonly Occurring Bases


Name Binary Radix 2 Digits 0,1

Octal
Decimal

8
10

0,1,2,3,4,5,6,7
0,1,2,3,4,5,6,7,8,9

Hexadecimal

16

0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F

The six letters (in addition to the 10 integers) in hexadecimal represent:

Chapter 1

21

Numbers in Different Bases

Good idea to memorize!


Decimal (Base 10) 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 Binary (Base 2) 00000 00001 00010 00011 00100 00101 00110 00111 01000 01001 01010 01011 01100 01101 01110 01111 10000 Octal Hexa decimal (Base 8) (Base 16) 00 00 01 01 02 02 03 03 04 04 05 05 06 06 07 07 10 08 11 09 12 0A 13 0B 14 0C 15 0D 16 0E 17 0F 20 10

Chapter 1

22

Conversion Between Bases


Method 2
To convert from one base to another:

1) Convert the Integer Part


2) Convert the Fraction Part 3) Join the two results with a radix point

Chapter 1

23

Conversion Details

To Convert the Integral Part:


Repeatedly divide the number by the new radix and save the remainders. The digits for the new radix are the remainders in reverse order of their computation. If the new radix is > 10, then convert all remainders > 10 to digits A, B,

To Convert the Fractional Part:


Repeatedly multiply the fraction by the new radix and save the integer digits that result. The digits for the new radix are the integer digits in order of their computation. If the new radix is > 10, then convert all integers > 10 to digits A, B,
24

Chapter 1

Example: Convert 46.687510 To Base 2

Convert 46 to Base 2

Convert 0.6875 to Base 2:

Join the results together with the radix point:


25

Chapter 1

Additional Issue - Fractional Part

Note that in this conversion, the fractional part became 0 as a result of the repeated multiplications. In general, it may take many bits to get this to happen or it may never happen. Example: Convert 0.6510 to N2

0.65 = 0.1010011001001 The fractional part begins repeating every 4 steps yielding repeating 1001 forever!

Solution: Specify number of bits to right of radix point and round or truncate to this number.
26

Chapter 1

Checking the Conversion


To

convert back, sum the digits times their respective powers of r. From the prior conversion of 46.687510 1011102 = 132 + 016 +18 +14 + 12 +01 = 32 + 8 + 4 + 2 = 46 0.10112 = 1/2 + 1/8 + 1/16 = 0.5000 + 0.1250 + 0.0625 = 0.6875
Chapter 1 27

Octal (Hexadecimal) to Binary and Back

Octal (Hexadecimal) to Binary:

Restate the octal (hexadecimal) as three (four) binary digits starting at the radix point and going both ways.
Group the binary digits into three (four) bit groups starting at the radix point and going both ways, padding with zeros as needed in the fractional part. Convert each group of three bits to an octal (hexadecimal) digit.

Binary to Octal (Hexadecimal):

Chapter 1

28

Octal to Hexadecimal via Binary

Convert octal to binary. Use groups of four bits and convert as above to hexadecimal digits. Example: Octal to Binary to Hexadecimal 6 3 5 . 1 7 7 8

Why do these conversions work?


29

Chapter 1

Anda mungkin juga menyukai