Beruflich Dokumente
Kultur Dokumente
Outline
Introduction Combinational logic Sequential logic Custom single-purpose processor design
Introduction
Processor
Digital circuit that performs a computation tasks Controller and datapath CCD General-purpose: variety of computation tasks Single-purpose: one particular lens computation task Custom single-purpose: non-standard task
Digital camera chip
A2D
CCD preprocessor
Pixel coprocessor
D2A
JPEG codec
Microcontroller
Multiplier/Accum
DMA controller
Display ctrl
Memory controller
UART
LCD ctrl
x 0 1
F 0 1
x y F
F=x Driver
F=xy AND
x 0 0 1 1
y 0 1 0 1
F 0 0 0 1
x y
F=x+y OR
x 0 0 1 1
y 0 1 0 1
F 0 1 1 1
x y F
F=xy XOR
x 0 0 1 1
y 0 1 0 1
F 0 1 1 0
x 0 1
F 1 0
x
y F
F = x Inverter
F = (x y) NAND
x 0 0 1 1
y 0 1 0 1
F 1 1 1 0
x y
F = (x+y) NOR
x 0 0 1 1
y 0 1 0 1
F 1 0 0 0
x
y F
F=x y XNOR
x 0 0 1 1
y 0 1 0 1
F 1 0 0 1
Truth tables
Are a common way of expressing binary functions
C) Output equations
y = a'bc + ab'c' + ab'c + abc' + abc
E) Logic Gates
a b c
y = a + bc
z a
00 0 0 1 0
bc
01 1 1
11 0 1
10 1 1
K(Karnaugh)-Map
z = ab + bc + bc
Combinational components
I(m-1) I1 I0 n S0 n-bit, m x 1 Multiplexor S(log m) n O I(log n -1) I0 log n x n Decoder O(n-1) O1 O0 A n n-bit Adder n carry sum less equal greater B n A n B n A n B
n-bit Comparator
O = A op B op determined by S.
Exercises
Design a 2-bit comparator (that compares two 2-bit words) with a single output less-than, using the combinational design technique. Start from a truth table, use K-maps to minimize logic and draw the final circuit. Design a 3x8 decoder. Start from a truth table, use Kmaps to minimize logic and draw the final circuit.
Sequential components
I n load clear n-bit Register n Q Q= 0 if clear=1, I if load=1 and clock=1, Q(previous) otherwise. Q = lsb - Content shifted - I stored in msb
shift
I
count
Q clear
n-bit Counter n
Q
Q= 0 if clear=1, Q(prev)+1 if count=1 and clock=1.
This implies
Defining a base for discrete time
Electronic phenomena evolve in the continuous time
10
A state
Condenses all the information regarding past inputs Indicates the current operating condition of a system
A transition
Occurs in consequence of an event
A change of the inputs or a clock event
11
12
13
a=0
a=0
I1
I0
I1 0 0 0 1 1 1 1 0
x 0 0 1 1
a=0
a=1
x=0
a=0
Exercise
Design a 3-bit counter that counts the following sequence: 1, 2, 4, 5, 7, 1, 2, etc. This counter has an output odd whose value is 1 when the current count value is odd. Use the sequential design technique we learned. Start from a state diagram, draw the state table, minimize the logic, and draw the final circuit.
16
Exercise
Four lights are connected to a decoder. Build a logic circuit that will blink the lights in the following order: 0, 2, 1, 3, 0, 2, .. Start from the state diagram, draw the state table, minimize the logic and draw the final circuit.
S1 Controller S2
3 4 Decoder
17
state register
functional units
18
FSM
Controls the evolution of the system Evolves based on events generated as results from the datapath
DP
Performs combinatorial operations Data is fed to operators according to controlling signals generated by the finite state machine
Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis
19
y_i
(b) desired functionality 0: int x, y; 1: while (1) { 2: while (!go_i); 3: x = x_i; 4: y = y_i; 5: while (x != y) { 6: if (x < y) 7: y = y - x; else 8: x = x - y; } 9: d_o = x; }
5:
8: x = x - y
6-J:
20
a=b
C: cond
!cond
next statement J:
loop-bodystatements
J: next statement
next statement
21
Datapath
5:
8: x = x - y
9: d
22
Controller
0000 1: 1
!1 !(!go_i)
Same structure as FSMD Replace complex actions or conditions with Boolean datapath configurations
x_i y_i
4:
y = y_i
0100
5: x!=y 6: x<y 7: y = y -x 6-J: !(x<y) 0110 !(x!=y)
Datapath
0101
8: x = x - y
!=
5: x!=y x_neq_y x_lt_y
<
6: x<y
subtractor
8: x-y
subtractor
7: y-x
1010 5-J:
1011 9: d_ld = 1
9: d d_o
d_ld
1100 1-J:
23
Controller
0000 0001 1:
!1 x_i y_i
1
2: !go_i 0010 2-J: 0011 x_sel = 0 3: x_ld = 1 y_sel = 0 4: y_ld = 1 5: 6:
Combinational logic
(b) Datapath
n-bit 2x1 n-bit 2x1
x_ld
y_ld x_neq_y x_lt_y d_ld 0100 0101
< 6: x<y
subtractor 8: x-y
subtractor 7: y-x
Q3 Q2 Q1 Q0 0110 State register I3 I2 I1 I0 x_lt_y=1 7: y_sel = 1 y_ld = 1 0111 1001 6-J: 1010 5-J: 1011 9:
9: d d_o
d_ld = 1
1100 1-J:
24
Q3
0 0 0 0 0 0 0 0 0 0 0 1 1 1
Q2
0 0 0 0 0 1 1 1 1 1 1 0 0 0
Q1
0 0 0 1 1 0 0 0 1 1 1 0 0 1
Q0
0 1 1 0 1 0 1 1 0 0 1 0 1 0
x_neq _y *
* * * * * 0 1 * * * * * *
x_lt_ y *
* * * * * * * 0 1 * * * *
go_i
* 0 1 * * * * * * * * * * *
I3
0 0 0 0 0 0 1 0 1 0 1 1 1 0
I2
0 0 0 0 1 1 0 1 0 1 0 0 0 1
I1
0 1 1 0 0 0 1 1 0 1 0 0 1 0
I0
1 0 1 1 0 1 1 0 0 1 1 1 0 1
x_sel
X X X X 0 X X X X X X 1 X X
y_sel
X X X X X 0 X X X X 1 X X X
x_ld
0 0 0 0 1 0 0 0 0 0 0 1 0 0
y_ld
0 0 0 0 0 1 0 0 0 0 1 0 0 0
d_ld
0 0 0 0 0 0 0 0 0 0 0 0 0 0
1
1 1 1 1
0
1 1 1 1
1
0 0 1 1
1
0 1 0 1
*
* * * *
*
* * * *
*
* * * *
1
0 0 0 0
1
0 0 0 0
0
0 0 0 0
0
0 0 0 0
X
X X X X
X
X X X X
0
0 0 0 0
0
0 0 0 0
1
0 0 0 0
25
datapath
registers
controller
state register
functional units
26
Exercise
Design a single-purpose processor that outputs Fibonacci numbers up to n places. Start with a function computing the desired result, translate it into a state diagram (FSMD), and sketch a probable datapath. Design a circuit that does the matrix multiplication of matrices A and B. Matrix A is 3x2 and matrix B is 2x3.
28
31
size of variable
Integer vs. Floating Point
32
replace the subtraction operation(s) with modulo operation in order to speed up program
GCD(42, 8) - 9 iterations to complete the loop x and y values evaluated as follows : (42, 8), (34, 8), (26,8), (18,8), (10, 8), (2,8), (2,6), (2,4), (2,2).
33
separate states
states which require complex operations (a*b*c*d) can be broken into smaller states to reduce hardware size
scheduling
organization of the operations in time
34
3:
4: 5:
merge state 2 and state 2J no loop operation in between them merge state 3 and state 4 assignment operations are independent of one another merge state 5 and state 6 transitions from state 6 can be done in state 5 eliminate state 5J and 6J transitions from each state can be done from state 7 and state 8, respectively eliminate state 1-J transition from state 1-J can be done directly from state 9
3:
5:
y = y_i !(x!=y)
x!=y
x<y 7: y = y -x
x>y 8: x = x - y
9:
d_o = x
9: 1-J:
35
Multi-functional units
ALUs support a variety of operations, it can be shared among operations occurring in different states (that is different moments in time)
36
State minimization
task of merging equivalent states into a single state
state equivalent if for all possible input combinations the two states generate the same outputs and transitions to the next same state
37
Summary
Custom single-purpose processors
Straightforward design techniques Can be built to execute algorithms Typically start with FSMD CAD tools can be of great assistance
38