Beruflich Dokumente
Kultur Dokumente
Acknowledgement
The main part of the slides was adopted and modified from the original slides of Prof. Rudy Lauwereins, Vice president of IMEC, Leuven, Belgium with his permission.
1/2
Your instructor
B mn k thu t i n t tin h c
Office: C9-401 Email: pnnam-fet@mail.hut.edu.vn, phamngocnam@gmail.com Course email: dtsFET@gmail.com, password: hut12345678
Research:
FPGA, h nhng Tr tu nhn t o Embedded Systems and Reconfigurable Computing Lab
Education:
K37 i n t - HBK H n i (1997) Master v tr tu nhn t o 1999, i h c K.U. Leuven, v ng qu c B i h c K.U.
ti: Nh n d ng ch vi t tay
Ti n s k thu t chuyn ngnh i n t -tin h c, 9/ 2004, Leuven-IMEC, V ng Qu c B
ti: qu n l ch t l ph ng ti n tin ti n
ng d ch v trong cc ng d ng a
Course contents
Digital design Combinatorial circuits: without status Sequential circuits: with status Language based HW design: VHDL
1/4
Course contents
Digital design Combinatorial circuits: without status Sequential circuits: with status FSMD design: hardwired processors Language based HW design: VHDL
1/5
1/6
1/7
1/8
Course books
Mandatory:
Principles of Digital Design, Daniel D. Gajski, Prentice Hall, 1997, ISBN 0-13301144-5
References:
Douglas L. Perry, VHDL: Programming by Examples, McGraw-Hill, fourth Edition, 2002. Logic and Computer Design Fundamentals, M. Morris Mano & Charles R. Kime, Prentice Hall, 2nd edition, 2000, ISBN 0-13-016176-4 TS. Nguy n Nam Qun : Ton logic v K thu t s , Nh xu t b n khoa h c v k thu t, 2006
1/9
1/10
1/11
1/12
1/13
1/14
Exam
Close book Midterm exam: 30% Final exam: 70% Completing lab sessions and Homework is a must before taking the exam
1/15
1/16
1/17
Decimal
1234.56710=
11000+2100+310+41+50.1+60.01+70.001 1103+2102+3101+4100+510-1+610-2+710-3 r = radix (r = 10), d=digit (0 e d e 9), m = #digits before radix point (decimal point), n = #digits after decimal point
m 1
D!
di y r i
i! n
1/18
Binary
1011.0112=
18+04+12+11+00.5+10.25+10.125 123+022+121+120+02-1+12-2+12-3 r = radix (r = 2), d = digit (0 e d e 1), m = #digits before radix point (binary point), n = #digits after radix point
m 1
B!
d i y 2i
i! n
1/19
Octal
7654.328=
7512+664+58+41+30.125+20.015625 783+682+581+480+38-1+28-2 r = radix (r = 8), d = digit (0 e d e 7), m = #digits before radix point (octal point), n = #digits after radix point
m 1
O!
d i y 8i
i ! n
1/20
Hexadecimal
FEDC.7616=
154096+14256+1316+121+71/16+61/256 15163+14162+13161+12160+716-1+616-2 r = radix (r = 16), d = digit (0 e d e F), m = #digits before radix point (hexadecimal point), n = #digits after radix point
m 1
H!
d i y 16i
i ! n
1/21
1/22
Binary addition
Decimal addition
carry x y sum 010 8273 562 8835
Binary addition
carry x y sum
1/23
Binary subtraction
x y borrow
VHDL
result
1/24
Binary multiplication
1110 1101 1110
Multiplication by repeated add & shift: number of cycles = number of bits of multiplier Can be implemented in a faster way
1/25
Binary division
10111010 1110 1001010 1110 10010 0000 10010 1110 100 1110 1101
1/26
Division by repeated subtract & shift: number of cycles = number of bits of result Mostly done this way
1/27
SignSign-Magnitude representation
Each number consists of two parts : sign and magnitude Decimal example: +12310 (by convention also 123) and -12310 Binary: sign represented by MSB; 0 = positive, 1 = negative Binary example: 011002 = +1210 en 111002 = -1210 A sign-magnitude integer with n bits lies between -(2n-1-1) and +(2n-1-1) with two representations for 0: 000...0 en 100...0 Generic representation of a signmagnitude integer: B = <s,m>
1/28
s1=s2 yes
mr=0 sr=0
mr=m1-m2 sr=s1
mr=m1+m2 sr=s1
1/29
1/30
1/31
1/32
1/33
Negating a 2-complement number requires many more bit-flips than negating a sign-magnitude number: sign-magnitude is less power hungry than 2-complement
B2=B2+1
Sequential circuits VHDL
Br=B1+B2
End
The negation needed for the subtraction is done by taking the bit-complement of B2; the addition of the 1 is done by putting the LSB carry-in of the next addition to 1.
1/34
1/35
1/36
int
i !0 15
int
i !0
Fixed point
fix<i,f>: 1101.010 i = 4, f = 3 fix<i1,f1>+fix<i2,f2> = fix<i,f> and iemax(i1,i2)+1 & femax(f1,f2) fix(i1,f1)fix(i2,f2) = fix<i,f> and i=i1+i2 & f=f1+f2
15
fix
i !0
i1 , f1 " ?
frac
i !0
Floating point
float<m,e>: 0.110102^101 m = 5, e = 3
1/38
BCD
Binary Coded Decimal number
Decimal digit 0 1 2 3 4 5 6 7 8 9 BCD 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001
1/39
ASCII
American Standard Code for Information Interchange (7-bit code)
b3b2b1b0 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 000 NUL SOH STX ETX EOT ENQ ACK BEL BS HT LF VT FF CR SO SI 001 DLE DC1 DC2 DC3 DC4 NAK SYN ETB CAN EM SUB ESC FS GS RS US 010 SP ! # $ % & ( ) * + , . / 011 0 1 2 3 4 5 6 7 8 9 : ; < = > ? 100 @ A B C D E F G H I J K L M N O 101 P Q R S T U V W X Y Z [ \ ] ^ _ 110 a b c d e f g h i j k l m n o 111 p q r s t u V w x y z { | } ~ DEL
1/40
Logical gates
1/41
Logical gates
1/42
A2 (Identity element)
B has an identity element w.r.t. +, designated by 0 B has an identity element w.r.t. , designated by 1
A3 (Commutativity)
B is commutative w.r.t. +, i.o.w. x+y=y+x B is commutative w.r.t. , i.o.w. xy=yx
1/43
A6 (Cardinality bound)
There exist at least two different elements in B
1/44
1/45
OR operator
x 0 0 1 1 y 0 1 0 1 x+y 0 1 1 1
NOT operator
x 0 1 x 1 0
1/46
Logical gates
1/47
Theorem 2
x+1=1 Dual: x 0 = 0
Theorem 3: absorption
y x + x = x (priority: before +) Dual: (y + x) x = x
Theorem 4: involution
(x) = x
1/48
1/49
Logical gates
1/50
Boolean functions
What: expression in binary variables and the operators AND, OR, NOT Priority:
parenthesis NOT AND OR
Eg. F1=xy+xyz+xyz
F1=1 when x=1 and y=1 or when x=1, y=0 and z=1 or when x=0, y=1 and z=1; in all other cases F1=0 F1 consists of 3 AND-terms and 1 OR-term
1/51
Boolean functions
Realisation of F1=xy+xyz+xyz
x y z
F1
1/52
Boolean functions
Truth table for F1=xy+xyz+xyz
n variables 2n rows standard numbering
x y z
Row 0 1 2 3 4 5 6 7 x 0 0 0 0 1 1 1 1 y 0 0 1 1 0 0 1 1 z 0 1 0 1 0 1 0 1 F1 0 0 0 1 0 1 1 1
F1
1/53
Boolean functions
Building up a truth table using standard numbering:
X 0 0 0 0 1 1 1 1 Y 0 0 1 1 0 0 1 1 Z 0 1 0 1 0 1 0 1
1/54
Boolean functions
Truth table for F1=xy+xyz+xyz
numbering following the Gray code (two consecutive rows only differ in 1 variable)
x 0 0 0 0 1 1 1 1
y 0 0 1 1 1 1 0 0
z 0 1 1 0 0 1 1 0
F1 0 0 1 0 1 1 1 0
1/55
Boolean functions
Building up a truth table using the Gray code:
X 0 0 0 0 1 1 1 1 Y 0 0 1 1 1 1 0 0 Z 0 1 1 0 0 1 1 0
1/56
Boolean functions
Complement of a Boolean function
F1 =(xy+xyz+xyz) =(xy)(xyz)(xyz) (De Morgan) =(x+y)(x+y+z)(x+y+z) (De Morgan)
This gives us the opportunity to convert an ANDOR implementation in an OR-AND implementation (see next slide)
1/57
Boolean functions
Realisation as ANDOR: F1=xy+xyz+xyz Realisation as ORAND: F1=((x+y) (x+y+z) (x+y+z))
x y z
x y z
F1
F1
1/58
Boolean functions
Algebraic manipulation
F1=xy+xyz+xyz =xy+xyz+xyz+xyz (absorption) =xy+x(y+y)z+xyz (distributive) =xy+x1z+xyz (complement) (identity) =xy+xz+xyz =xy+xyz+xz+xyz (absorption) =xy+xz+(x+x)yz (distributive) (complement) =xy+xz+1yz =xy+xz+yz (identity) This alternative form is cheaper (see next slide) There does not exist a fixed rule to combine theorems to guarantee a cheaper result Further slides will present a non-algebraic method that always leads to the cheapest solution
1/59
Boolean functions
F1=xy+xyz+xyz F1=xy+xz+yz
x y z
x y z
F1
F1
1/60
Logical gates
1/61
Canonical form
How do we translate a truth table into a Boolean expression? Definition: a minterm is a Boolean function that is true in 1 row of the truth table and false elsewhere
Row 0 1 2 3 4 5 6 7 x 0 0 0 0 1 1 1 1 y 0 0 1 1 0 0 1 1 z 0 1 0 1 0 1 0 1 minterm xyz xyz xyz xyz xyz xyz xyz xyz Notation m0 m1 m2 m3 m4 m5 m6 m7
1/62
Canonical form
A 1-minterm is a minterm for which the function equals 1; a 0-minterm is a minterm for which the function equals 0 For F1=xy+xyz+xyz
Row x y 0 0 1 1 0 0 1 1 z 0 1 0 1 0 1 0 1 F1 0 0 0 1 0 1 1 1 1-minterm m3=xyz m5=xyz m6=xyz m7=xyz 0 1 2 3 4 5 6 7 0 0 0 0 1 1 1 1
Each Boolean function can be expressed as the sum of its 1-minterms : F1=xyz+xyz+xyz+xyz=m3+m5+m6+m7=7(3,5,6,7)
1/63
Canonical form
Dual definition: a maxterm is a Boolean function that is false in 1 row of the truth table and true elsewhere
Row
Sequential circuits VHDL
x 0 0 0 0 1 1 1 1
y 0 0 1 1 0 0 1 1
z 0 1 0 1 0 1 0 1
Notation M0 M1 M2 M3 M4 M5 M6 M7
0 1 2 3 4 5 6 7
1/64
Canonical form
A 0-maxterm is a maxterm for which the function equals 0; a 1-maxterm is a maxterm for which the function equals 1 For F1=xy+xyz+xyz
Row x y 0 0 1 1 0 0 1 1 z 0 1 0 1 0 1 0 1 F1 0 0 0 1 0 1 1 1 0-maxterm M0=x+y+z M1=x+y+z M2=x+y+z M4=x+y+z 0 1 2 3 4 5 6 7 0 0 0 0 1 1 1 1
Each Boolean function can be expressed as the product of its 0-maxterms: F1 =(x+y+z)(x+y+z)(x+y+z)(x+y+z) =M0M1M2M4=4(0,1,2,4)
1/65
Logical gates
1/66
1/67
Example 2
F3 =xyz+xyz+xyz+xyz+xyz =xyz+xyz+xyz+xyz+xyz+xyz+xyz =xy(z+z)+x(y+y)z+(x+x)yz+xyz =xy+xz+yz+xyz
1/68
A non-standard form in more than two layers may be cheaper Eg. F2=x(y+z)+yz
xyz
VHDL
F2
F2
Multiplier: O(en)
1/69
Multiplier: O(n2)
Logical gates
1/70
x 0 0 1 1
y 0 1 0 1
F0 0 0 0 0
F1 0 0 0 1
F2 0 0 1 0
F15 1 1 1 1
There exist 4 possible combinations for x and y and each combination can have a different functional value. Each function F(x,y) is hence characterized by 4 bits, i.e. the 4 functional values for xy, xy, xy and xy. With 4 bits 24th different patterns for truth table are possible. Hence, there are 24=16 different functions F(x,y) possible, i.e. all possible combinations of 4 bits.
1/71
1/72
1/73
1/74
1/75
Switching transistor
n-MOS transistor
Metal Drain
n+ p
n+
1/76
Switching transistor
n-MOS transistor
Infinite number of free electrons Vss Vss Vss Many free electrons n+ p D=Vss G=Vss Hardly any free electrons: no conducting path between Source and Drain n+
S=Vss
1/77
Switching transistor
n-MOS transistor
Vss
Sequential circuits VHDL
Vss Vcc
Vss
n+ p D=Vss G=Vcc
n+
S=Vss
1/78
Many free electrons attracted by positive gate voltage: conducting channel between Source and Drain
Switching transistor
p-MOS transistor
Digital design
D=Vss G=Vss
D=Vss G=Vcc
S=Vss
S=Vss
1/79
1/80
Vcc
x=1 x=0 x
F=0 F=1 F
x=1 x=0 x
F=1 F=0 F
Vss
1/81
x=0 x=1 x
F=0 F=1 F
x=0 x=1 x
F=0 F=1 F
Vss
1/82
Vss
x=0 x=1 x
y=0 y=1 y
y=1 y=0 y
x=1 x=0 x
Vss
1/83
x=1 x=0 x x=1 x=0 x F=0 F=1 F x=1 x=0 x y=1 y=0 y y=1 y=0 y F=0 F=1 F
Vss
1/84
y F
x Vss Vss
1/85
x x F F x y y
Vss
1/86
Vss
x=1 x=0 x
y=1 y=0 y
y y
0 0 1 1 0 0 1 1
F F
1 1 0 0 0 0 1 1
y Vss
1/87
Vss
Vcc y y
x F y
y Vss
y x y
1/88
Vss
1/89
x y z
Vss
1/90
1/91
1/92
Vss
z F
1/93
Vss
Implementation technologies
1/94
Implementation technologies
1/95
1/96
1/97
Margin
Output
1/98
Implementation technologies
1/99
1/100
1/101
Implementation technologies
1/102
Power dissipation
TTL dissipates continuously
P=VCC*ICC}10mW/gate 1 million gates: 10 KW!! Only used when high voltages or large currents are needed (busdrivers, )
1/103
Implementation technologies
1/104
Propagation delay
Rise time Fall time Rise time > Fall time 90% 50%
10%
VHDL
tPLH
1/105
tPHL
1/106
1/107
1/108
1/109
1/110
Custom design
Each transistor and each connection is designed individually as a set of rectangles. Excellent for optimal design of library elements that are re-used multiple times Companies design and sell such optimized libraries Has to be completely re-done each time technology changes (every 18 months!)
1/111
Faster design of more complex building blocks Silicon foundries design and sell such optimized libraries for their processing technology
Placement and routing
1/112
Placement
Routing
Timing simulation
Fabrication: n masks
Testing
1/113
1/114
Cheaper:
Only the last metallisation layer is project specific
1/115
Technology mapping
Placement
Routing
Timing simulation
Fabrication: 1 mask
1/116
Testing
1/117
FieldField-programmable design
Fuse programmable
One time customer programmable by selectively blowing fuses PLA: Programmable Logic Array PLD: Programmable Logic Device CPLD: Complex PLD
SRAM based
FPGA: Field Programmable Gate Array (see laboratory sessions)
Properties:
Excellent for prototypes Excellent for medium volumes (<100K pieces/year) For SRAM based: reconfiguration (static or dynamic) possible 2 Mgates @ 200 MHz (in 2000)
1/118
FieldField-programmable design
PLA
1/119
FieldField-programmable design
PLD
D
1/120
FieldField-programmable design
CPLD
O I/O I/O O
AND-OR Plane
AND-OR Plane
Switch matrix
AND-OR Plane
AND-OR Plane
O
1/121
I/O
I/O
FieldField-programmable design
XC95216
6 Functional blocks (36V18 each) Flash programmable
1/122
FieldField-programmable design
FPGA: XC40xx
Direct connections Routing via switching matrices Long lines I/O SM I/O SM I/O SM
I/O I/O SM
CLB
CLB
CLB
I/O
SM
SM
SM
SM
CLB
CLB
CLB
I/O
SM
SM
SM
SM
1/123
FieldField-programmable design
1/124
FieldField-programmable design
FPGA: Configurable Logic Block CLB
G FF GQ G
F FF FQ F
1/125
FieldField-programmable design
1/126
FieldField-programmable design
FPGA: Switching Matrix SM
Pass TOR
1/127
Technology mapping
Placement
Routing
Timing simulation
Downloading
1/128
Testing