fall 2007, koç university
Post on 14-Jan-2016
55 Views
Preview:
DESCRIPTION
TRANSCRIPT
KU College of EngineeringElec 204: Digital Systems Design 1
Fall 2007, Koç University
Lecture 1
ELEC 204 Digital Systems Design
Serdar KozatCollege of EngineeringKoç University,Istanbul,Turkeyskozat@ku.edu.tr
KU College of EngineeringElec 204: Digital Systems Design 2
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 EngineeringElec 204: Digital Systems Design 3
• 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 EngineeringElec 204: Digital Systems Design 4
• 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 EngineeringElec 204: Digital Systems Design 5
• 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 EngineeringElec 204: Digital Systems Design 6
ELEC204Spring 2007 Calendar
Lab 1
Lab 2
Lab 3
Lab 4
Lab 5
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
Oct 1 Oct 2 Oct 3 Oct 4 Oct 5
Oct 8 Oct 9 Oct 10 Oct 11 Oct 12
Oct 15 Oct 16 Oct 17 Oct 18 Oct 19
Oct 22 Oct 23 Oct 24 Oct 25 Oct 26
Oct 29 Oct 30 Oct 31 Nov 1 Nov 2
Nov 5 Nov 6 Nov 7 Nov 8 Nov 9
Nov 12 Nov 13 Nov 14 Nov 15 Nov 16
Nov 19 Nov 20 Nov 21 Nov 22 Nov 23
Nov 26 Nov 27 Nov 28 Nov 29 Nov 30
Dec 3 Dec 4 Dec 5 Dec 6 Dec 7
Dec 10 Dec 11 Dec 12 Dec 13 Dec 14
Dec 17 Dec 18 Dec 19 Dec 20 Dec 21
Dec 24 Dec 25 Dec 26 Dec 27 Dec 28
Lectures on Tue & Thu (Eng Z16)
Lab Work
PS + Q on
Lab Midterm
Midterm
PS + Q
PS + Q
KU College of EngineeringElec 204: Digital Systems Design 7
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 don’t!!
• 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 EngineeringElec 204: Digital Systems Design 8
• 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 EngineeringElec 204: Digital Systems Design 9
• Advantages of digital systems:– Speed: today’s 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 EngineeringElec 204: Digital Systems Design 10
Digital ComputerMemory: stores programs, i/o dataDatapath: perform arithmetic and other data-processing operationsControl Unit: supervises the flow of informationI/O: places program into memoryCPU: executes program from memory instruction by instruction. Control unit manipulates datapath to execute instructions.
Processor: contains CPU, FPU and MMUFPU (Floating Point Unit) : perform f-p operationsMMU (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 EngineeringElec 204: Digital Systems Design 11
Digital Devices
• Gates: The most basic digital devices
• Any digital function can be realized using just these three kinds of gates.
KU College of EngineeringElec 204: Digital Systems Design 12
• 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 EngineeringElec 204: Digital Systems Design 13
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 EngineeringElec 204: Digital Systems Design 14
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 EngineeringElec 204: Digital Systems Design 15
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 EngineeringElec 204: Digital Systems Design 16
• 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
BZ
S
KU College of EngineeringElec 204: Digital Systems Design 17
• 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 = S’A + SB
KU College of EngineeringElec 204: Digital Systems Design 18
• Gate level logic diagram (schematic):
A
B
S
Z
KU College of EngineeringElec 204: Digital Systems Design 19
• HDL Program:
Library IEEE;Use IEEE.std_logic_1164.all;entity V1mux is
port (A,B,S : in STD_LOGIC; Z : out STD_LOGIC);
end V1mux;architecture V1mux_arch of V1mux isbegin
Z <= A when S=‘0’ else B;end V1mux_arch
architecture V1mux_gate_arch of V1mux isbegin
U1: INV(S, SN);U2: AND2(A,SN,ASN);U3: AND2(S,B,SB);U4: OR2(ASN,SB,Z);
end V1mux_gate_arch;
KU College of EngineeringElec 204: Digital Systems Design 20
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)
– 100112 = 1*16 + 0*8 + 0*4 +1*2 + 1*1 = 1910
ip
niirdD
1
MSB LSB
KU College of EngineeringElec 204: Digital Systems Design 21
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 EngineeringElec 204: Digital Systems Design 22
Positional Number System Conversions
• Base-r-to-decimal conversions:
– r: base/radix
– 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
ip
niirdD
1
KU College of EngineeringElec 204: Digital Systems Design 23
• 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 EngineeringElec 204: Digital Systems Design 24
Addition and Subtraction of Nondecimal Numbers
• Addition
101111000
X 190 10111110
Y 141 10001101
___+______________
X+Y 331 101001011
Cin/bin X Y Cout S Bout D
0 0 0 0 0 0 0
0 0 1 0 1 1 1
0 1 0 0 1 0 1
0 1 1 1 0 0 0
1 0 0 0 1 1 1
1 0 1 1 0 1 0
1 1 0 1 0 0 0
1 1 1 1 1 1 1
KU College of EngineeringElec 204: Digital Systems Design 25
• 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 EngineeringElec 204: Digital Systems Design 26
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.
Lecture 2
KU College of EngineeringElec 204: Digital Systems Design 27
• 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 EngineeringElec 204: Digital Systems Design 28
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 EngineeringElec 204: Digital Systems Design 29
Two’s 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: -(2n-1) – (2n-1-1)– A number is negative iff MSB is 1.– Zero (0) is positive, one extra negative number.– Decimal equivalent of two’s 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 EngineeringElec 204: Digital Systems Design 30
One’s Complement Representation
• One’s complement of D-D = 2n - 1 – D
1710 = 000100012
111011102 = -1710
KU College of EngineeringElec 204: Digital Systems Design 31
Two’s complement addition
-3 1101 -2 1110 -1 1111
+1 0001 +1 0001 +1 0001
-2 1110 -1 1111 0 10000
• Subtract n (add –n)– Add 16-n
– Surprisingly (?) 16-n is 4-bit
two’s complement of n,
that is (-n).
01
2
7-8-7
-1-2
3
addsubt
00000001
0111
10001001
1111
KU College of EngineeringElec 204: Digital Systems Design 32
Two’s 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
+ +6 0110
+11 1011 = -5
Overflow rule: Addn: if the sign of the addends’ are sameand the sign of the sum is different from addends’ sign.
KU College of EngineeringElec 204: Digital Systems Design 33
Binary Multiplication
• Unsigned binary multiplication– Shift and add multiplication
11 1011
x 13 1101
01011
00000
01011
1011
10001111
KU College of EngineeringElec 204: Digital Systems Design 34
• Two’s complement multiplication– Shift and two’s 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-negated1 00001111
KU College of EngineeringElec 204: Digital Systems Design 35
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 EngineeringElec 204: Digital Systems Design 36
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
top related