Sie sind auf Seite 1von 36

Fall 2007, Ko University

ELEC 204 Digital Systems Design

Serdar Kozat
College of Engineering
Ko University,Istanbul,Turkey
skozat@ku.edu.tr

KU College of Engineering 1
Lecture 1 Elec 204: Digital Systems Design
Elec 204: Digital Systems Design

Text Book: M.M. Mano and C. R. Kime, Logic


and Computer Design Fundamentals, 3rd Edition
Updated, Prentice Hall.
Reference Book: J.F. Wakerly, Digital Design
Principles & Practices, Prentice Hall.
Teaching Assistants:
Burak Gorkemli, Osman Nuri Yogurtcu, Yasemin
Demir

KU College of Engineering 2
Elec 204: Digital Systems Design
Course Objectives:
ELEC204 is a course targeting electrical and computer
engineering students to build the fundamental digital
design and experimentation concepts.
In this course we will study
combinational logic circuit design techniques, sequential logic
circuits, registers and counters, memory, and state machines.
In parallel to lectures we will develop experimental
skills studying various digital design techniques during
our laboratory hours.
Our experimental setup will be based on Field Programmable
Gate Array (FPGA) structure, and we'll experience various
design tools.

KU College of Engineering 3
Elec 204: Digital Systems Design
Grading:
Lecture Part:
In class quizes (20%), midterm exam (35%), final exam (45%).
Lab Work Part:
Bi-weekly lab assignments (50%), lab midterm (20%), lab project (30%).
Elec 204 is a 4-credit course with the lecture part having 3 credits and the lab
work part having 1 credit. The lecture and lab work parts of the Elec 204 will
be graded separately. A passing final letter grade requires passing grades
from both the lecture and lab work parts. The lecture and lab work letter
grades will be combined (3 credits for the lecture and 1 credit for the lab work)
for the final letter grade.
Lab Work:
We have two hours assigned each week to perform our experimental work in
digital design lab. However student should do their preliminary study on their
lab assignments before hand so they can complete the experimental work
during the assigned lab hours. After completing the fundamental experiments
in the first half of the semester, each student will be required to pick a term
digital design project. Possible design projects will be announced by the
instructor. Students must attend all Lab works, missing 1/3 of the Lab work
will yield a fail grade for the Elec-204 course.
Web page: http://courses.eng.ku.edu.tr/elec204/
KU College of Engineering 4
Elec 204: Digital Systems Design
Academic Dishonesty
The students taking this course are expected to submit their own
work in all midterms, projects, homeworks and in class
quizes. Please be aware that, being a part of a dishonest plot
intentionally (for example, helping others cheat, doing others'
homeworks or lab work, giving your reports to others) will also be
considered as cheating. Disciplinary acts will be taken for the
students who are involved in academic dishonesties, and they will
not be offered any voluntary compensation.

Lecture Regulations
Students should attend all lectures. There will not be any form of
make-ups for in-class quizes.
Students who are late more than 15 minutes will not take in-class
quizes.
Disruptive talking, cell phone use, walking in&out during the
lecture, eating&drinking and any kind of distraction to the lecture
will not be allowed during the lecture.

KU College of Engineering 5
Elec 204: Digital Systems Design
ELEC204
Spring 2007 Calendar
M T W T F

Sep 17 Sep 18 Sep 19 Sep 20 Sep 21

Sep 24 Sep 25 Sep 26 Sep 27 Sep 28


Lab 1
Oct 1 Oct 2 Oct 3 Oct 4 Oct 5
PS + Q
Oct 8 Oct 9 Oct 10 Oct 11 Oct 12
Lab 2
Oct 15 Oct 16 Oct 17 Oct 18 Oct 19
PS + Q
Lectures on Tue & Thu (Eng Z16) Oct 22 Oct 23 Oct 24 Oct 25 Oct 26
Lab 3
Lab Work Oct 29 Oct 30 Oct 31 Nov 1 Nov 2

Nov 5 Nov 6 Nov 7 Nov 8 Nov 9


PS + Q on Midterm
Nov 12 Nov 13 Nov 14 Nov 15 Nov 16

Nov 19 Nov 20 Nov 21 Nov 22 Nov 23


Lab 4
Nov 26 Nov 27 Nov 28 Nov 29 Nov 30
Lab Midterm
Dec 3 Dec 4 Dec 5 Dec 6 Dec 7

Dec 10 Dec 11 Dec 12 Dec 13 Dec 14 Lab 5


Dec 17 Dec 18 Dec 19 Dec 20 Dec 21

Dec 24 Dec 25 Dec 26 Dec 27 Dec 28

KU College of Engineering 6
Elec 204: Digital Systems Design
0. Introduction

Analog vs Digital
Analog devices: process time varying signals that can
take on any value across a continuous range of
voltage, current or another metric.
Digital devices: so do they! But we can pretend that
they dont!!
Digital signal model: two discrete values 0 or 1,
(LOW/HIGH, FALSE/TRUE, negated/asserted, etc)
They have been around since 1940s and in
commercial use since 1960s.
KU College of Engineering 7
Elec 204: Digital Systems Design
One-analog gone digital systems:
Still pictures
Audio/Video recordings
Automobile carburetors
Telephone system
Advantages of digital systems:
Reproducibility of results
Ease of design (Logic design vs complex characteristics
of capacitors, transistors, etc)
Flexibility and functionality (eg: scrambling code)
Programmability: Digital design is carried out today
with Hardware Description Languages (HDLs). HDL
also comes with simulation and synthesis tools.
KU College of Engineering 8
Elec 204: Digital Systems Design
Advantages of digital systems:
Speed: todays digital devices are fast. Switch in less
than 10 picoseconds (10-12). Note: in vacuum light
travels ~1cm in 33 ps, the speed of light delay between
transistors has became a limiting factor.
Economy: Lots of functionality in a small space
Steadily advancing technology: you should consider
that in a few years there will be a faster, a cheaper or
otherwise a better technology.

KU College of Engineering 9
Elec 204: Digital Systems Design
Digital Computer
Memory: stores programs, i/o data
Datapath: perform arithmetic and
other data-processing operations
Control Unit: supervises the flow of
information
I/O: places program into memory
CPU: executes program from memory
instruction by instruction. Control
unit manipulates datapath to execute
instructions.
Processor: contains CPU, FPU and MMU
FPU (Floating Point Unit) : perform f-p operations
MMU (Memory Management Unit): layers of memory that helps
instruction fetching and data I/O. Internal/external cache (very fast),
RAM (between disk and cache)
KU College of Engineering 10
Elec 204: Digital Systems Design
Digital Devices

Gates: The most basic


digital devices
Any digital function
can be realized using
just these three kinds
of gates.

KU College of Engineering 11
Elec 204: Digital Systems Design
Flip-flop: stores either 0 or 1, the states can be
changed only at certain times determined by a
clock input
Combinational circuits: contain only AND, OR
and NOT gates
Sequential circuits: contain gates and flip-flops
The output depends on not only inputs but also the past
sequence of inputs that have been applied to it.

KU College of Engineering 12
Elec 204: Digital Systems Design
Electronic Aspects

Digital circuits deal with voltages and currents and


are built with analog components. We perform
digital abstraction only.

Electronic circuit design


ensures that logic gates
produce and recognize
logic signals that are
within the appropriate
range.

KU College of Engineering 13
Elec 204: Digital Systems Design
Software Aspects
In computer-aided design (CAD) various tools are
available today to improve productivity,
correctness and the quality of designs.
Ways of digital design in CAD:
Schematic entry: schematic diagrams to be drawn on
screen.
HDLs : Hardware description languages
Simulators: debug and check

KU College of Engineering 14
Elec 204: Digital Systems Design
Integrated Circuits
IC: a collection of one or more gates fabricated on
a single silicon chip
Small-scale integration (SSI) 1-20 gates
Medium-scale integration (MSI) 20-200 gates
Typically contain a functional building block, such as encoder,
counter,
Large-scale integration (LSI) 200-200,000 gates
Include memories, microprocessors, etc.
Very large-scale integration (VLSI)
Ics with over 1,000,000 transistors

KU College of Engineering 15
Elec 204: Digital Systems Design
Programmable Logic Devices
ICs that can have their logic function programmed into
them after they are manufactured.
Digital Design Levels
A simple design example: two input multiplexer

A
Z
B

S
KU College of Engineering 16
Elec 204: Digital Systems Design
Truth table: S A B Z
0 0 0 0
0 0 1 0
0 1 0 1
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 0
1 1 1 1

Find the optimal equation:


Z = SA + SB

KU College of Engineering 17
Elec 204: Digital Systems Design
Gate level logic diagram (schematic):

A
Z
S

KU College of Engineering 18
Elec 204: Digital Systems Design
HDL Program:

Library IEEE; architecture V1mux_gate_arch of


Use IEEE.std_logic_1164.all; V1mux is
entity V1mux is begin
port (A,B,S : in STD_LOGIC; U1: INV(S, SN);
Z : out STD_LOGIC); U2: AND2(A,SN,ASN);
end V1mux; U3: AND2(S,B,SB);
architecture V1mux_arch of V1mux is U4: OR2(ASN,SB,Z);
begin end V1mux_gate_arch;
Z <= A when S=0 else B;
end V1mux_arch

KU College of Engineering 19
Elec 204: Digital Systems Design
1. Digital Information: Number Systems

Positional number systems:


D = d1 d0 . d-1 d-2 = d1101 + d0100 + d-110-1 + d-210-2
Here 10 is called base or radix.
General form: (r>1 integer)
p 1

MSB LSB
D i
d r
i n
i

100112 = 1*16 + 0*8 + 0*4 +1*2 + 1*1 = 1910

KU College of Engineering 20
Elec 204: Digital Systems Design
Octal and Hexadecimal Numbers
Base 8 and 16 provide convenient shorthand
representation for multi-bit numbers in a digital
system.
Octal digit 3-bit string (0-7)
Hexadecimal digit 4-bit string (0-9, A-F)
1000110011102 = 43168 = 8CE16
10.10110010112 = 010.101 100 101 1002 = 2.54548
= 0010.1011 0010 11002 = 2.B2C16
In hexadecimal systems 2 digits represent an 8-bit byte.

KU College of Engineering 21
Elec 204: Digital Systems Design
Positional Number System Conversions

Base-r-to-decimal conversions:
p 1

r: base/radix
D d r
i n
i
i

p: digits to the left of radix point


n: digits to the right of radix point
Eg:
436.58 = 4*82 + 3*81 + 6*80 + 5*8-1 = 286.62510

KU College of Engineering 22
Elec 204: Digital Systems Design
Decimal-to-base-r conversion:
179 / 2 = 89 remainder 1 (LSB)
/ 2 = 44 rem 1
/ 2 = 22 rem 0
/ 2 = 11 rem 0
/ 2 = 5 rem 1
/ 2 = 2 rem 1
/ 2 = 1 rem 0
/ 2 = 0 rem 1 (MSB)
Hence, 17910 = 101100112

KU College of Engineering 23
Elec 204: Digital Systems Design
Addition and Subtraction of Nondecimal
Numbers
Cin/bin X Y Cout S Bout D

Addition 0 0 0 0 0 0 0
0 0 1 0 1 1 1
101111000 0 1 0 0 1 0 1
X 190 10111110 0 1 1 1 0 0 0
1 0 0 0 1 1 1
Y 141 10001101 1 0 1 1 0 1 0
___+______________ 1 1 0 1 0 0 0
1 1 1 1 1 1 1
X+Y 331 101001011

KU College of Engineering 24
Elec 204: Digital Systems Design
Binary subtraction: (borrow, difference bits)

Bout 001111100
Minuend X 229 11100101
Subtrahend Y 46 00101110
_____________-_________________
Difference X-Y 183 10110111

Use binary subtraction to compare numbers. If X-Y


produces a borrow out at the most significant bit, then
X is less than Y.

KU College of Engineering 25
Elec 204: Digital Systems Design
Lecture 2

Representation of Negative Numbers

Signed-Magnitude System/Representation:
MSB: sign bit, 0: plus, 1: minus
010101012 = +8510 110101012 = -8510
011111112 = +12710 111111112 = -12710
000000002 = +010 100000002 = -010
n-bit signed integer lies within (2n-1-1) through +(2n-1-1)
with two representations of zero.

KU College of Engineering 26
Elec 204: Digital Systems Design
Signed-magnitude adder
If signs are same
add magnitudes, sign is same
else
compare magnitudes
subtract smaller from the larger
sign is sign of larger

Signed-magnitude subtractor
Change the sign of subtrahend, perform addition

KU College of Engineering 27
Elec 204: Digital Systems Design
Complement Number Systems

Taking the complement is more difficult than


changing the sign, but in complement system
add/subt are easier.
Radix complement: rn D
where D is an n-digit number
If D is between 1 and rn-1
then D complement is between rn-1 and rn- (rn-1) = 1
When D=0, D complement id rn (n+1) digits, hence D
complement is also 0.
KU College of Engineering 28
Elec 204: Digital Systems Design
Twos Complement
Radix complement for binary numbers
D: n bit binary number
( D) = 2n D = (2n-1) D + 1

1710 = 000100012 00002


11101110 1111
+_______1 +___1
111011112 = -1710 100002

The range of representable numbers: -(2 n-1) (2n-1-1)


A number is negative iff MSB is 1.
Zero (0) is positive, one extra negative number.
Decimal equivalent of twos complement number is computed in
the same way for unsigned except MSB is (-2n-1), not (2n-1).
Sign extension property: extend MSB for (n+1) bit number from n
bit number
0110 = 00110 (5 bit), 1010 = 11010 (5 bit)
KU College of Engineering 29
Elec 204: Digital Systems Design
Ones Complement Representation

Ones complement of D
-D = 2n - 1 D
1710 = 000100012
111011102 = -1710

KU College of Engineering 30
Elec 204: Digital Systems Design
Twos complement addition

-3 1101 -2 1110 -1 1111


+1 0001 +1 0001 +1 0001
-2 1110 -1 1111 0 10000

0000
Subtract n (add n) 1111 0001
subt -1 0 1
Add 16-n -2 2 add
Surprisingly (?) 16-n is 4-bit 3

twos complement of n,
-7 -8 7 0111
that is (-n). 1001 1000

KU College of Engineering 31
Elec 204: Digital Systems Design
Twos complement subtraction
1 cin 1
+4 0100 0100 +3 0011 0011
- +3 0011 1100 - -4 1100 0011
+1 10001 +7 0111
Overflow
If the result exceeds the range of the number system
+5 0101
Overflow rule:
+ +6 0110 Addn: if the sign of the addends are same
+11 1011 = -5 and the sign of the sum is different from
addends sign.
KU College of Engineering 32
Elec 204: Digital Systems Design
Binary Multiplication

Unsigned binary multiplication


Shift and add multiplication
11 1011
x 13 1101
01011
00000
01011
1011
10001111
KU College of Engineering 33
Elec 204: Digital Systems Design
Twos complement multiplication
Shift and twos complement addition except for the last
step. Remember MSB represent (-2n-1)
-5 1011
x 3 1101
0000 initial partial product, which is zero.
1011
11011 partial product
0000
111011 partial product
1011
11100111
0101 shifted-and-negated
1 00001111

KU College of Engineering 34
Elec 204: Digital Systems Design
Binary division

Shift and subtract with unsigned numbers


No other easy way.
So for signed numbers, take care of signs and
perform shift-and-subtract

KU College of Engineering 35
Elec 204: Digital Systems Design
BCD: Binary-Coded Decimal
0-9 encoded with their 4-bit unsigned binary representation
(0000 1001). The codewords (1010 1111) are not used.
8-bit byte represent values from 0 to 99.
BCD Addition:
Carry 1 1
448 0100 0100 1000
+ 489 0100 1000 1001
937 Sum 1001 1101 10001
Add 6 + 0110 + 0110
BCD sum 1 0011 1 0111
BCD result 1001 0011 0111

KU College of Engineering 36
Elec 204: Digital Systems Design

Das könnte Ihnen auch gefallen