One dimensional cutting stock problem 1-d-csp_ a study on data dependent tri
Shannon’s Expansion Muxes and Encoders. Tri-State Buffers A tri-state buffer has one input x, one...
-
Upload
marsha-charles -
Category
Documents
-
view
221 -
download
0
Transcript of Shannon’s Expansion Muxes and Encoders. Tri-State Buffers A tri-state buffer has one input x, one...
Shannon’s Expansion
Muxes and Encoders
Tri-State Buffers
A tri-state buffer has one input x, one output f and one control line e Z means high impedance, i.e. no output at all
x f
e
x f
e = 0
e = 1x f
Equivalent circuits
normal tri-state buffer symbol
e x f
0 0 z
0 1 z
1 0 0
1 1 1
Other Types of Tri-State Buffers
x f
e
x f
e
x f
e
x f
e
active high, not inverted active high, inverted
active low, invertedactive low, not inverted
output is enabled (connected) when e = 1
output is enabled (connected) when e = 0
2x1 MUX Using Tri-State Buffers
Tri-state buffers can be used in place of SOP form Note – this is the one case where the output lines can just
be “tied together”
The control line s selects which buffer will pass its input
f w 0
w 1
s
Crossbar Switch
A crossbar switch connects any input to any output
A 2x2 crossbar connects 2 inputs to 2 outputs You can route each input straight thru, or cross them
When s = 0, y1 = x1 and y2 = x2 (no switching) When s = 1, y1 = x2 and y2 = x1 (switched)
x 1
x 2
y 1
y 2
s
2x2 Crossbar Switch Using MUXes
A 2x2 crossbar can be constructed from 2x1 MUXes
x 1 0
1
x 2 0
1
s
y 1
y 2
Using MUXes for Synthesis
MUXes are very significant combinational devices
MUXes are a key component of FPGAs (field programmable gate arrays) – to be discussed soon
MUXes can be used to synthesize any combinational logic function Makes use to Shannon's expansion
Shannon's Expansion
Any Boolean function f(w1,w2,…,wn) can be written in the form
f(w1,w2,…,wn) = w1' f(0,w2,…,wn) + w1 f(1,w2,…,wn)
w1 acts as the selector control input and it selects between
f(0,w2,…,wn) and f(1,w2,…,wn)
f(0,w2,…,wn) is called the cofactor of f with respect to w1'
f(1,w2,…,wn) is called the cofactor of f with respect to w1
Example: f(w1,w2,w3) = w1w2 + w1w3 + w2w3
w1' f(0,w2,w3) + w1 f(1,w2,w3) = w1' (w2w3) + w1 (w2 + w3)
MUXes Based on Shannon's Expansion
f(w1,w2,w3) = w1' (w2w3) + w1 (w2 + w3) is implemented using a 2x1 MUX as follows …
f
w 3
w 1 w 2
0
1
More Shannon's Expansion Examples
f(w1,w2,w3) = w1'w3' + w1w2 + w1w3
Expand on w1:
f(w1,w2,w3) = w1' f(0, w2,w3) + w1f(1,w2,w3) = w1' (w3') + w1(w2 + w3)
Use a 2x1 MUX
0
1
Same Example ….
f(w1,w2,w3) = w1'w3' + w1w2 + w1w3
Expand on both w1 and w2:
f(w1,w2,w3) = w1'w2'f(0,0,w3) + w1'w2f(0,1,w3) + w1w2'f(1,0,w3) + w1w2f(1,1,w3) = w1'w2'(w3') + w1'w2(w3') + w1w2'(w3)
+ w1w2(1)
Use a 4x1 MUX
Implementing Using Only MUXes
Shannon's expansion can be used to implement functions using MUXes exclusively
Example: f(w1,w2,w3) = w1w2 + w1w3 + w2w3
Use 2x1 MUXes only to implement this
Expanding on w1
f(w1,w2,w3) = w1'(w2w3) + w1(w2+w3+w2w3)
Let g = w2w3
Let h = w2+w3+w2w3
Example Continued …
f(w1,w2,w3) = w1'(g) + w1(h)
where g = w2w3
where h = w2+w3+w2w3
Expanding g on w2 givesg = w2'(0) + w2(w3)
Expanding h on w2 givesh = w2'(w3) + w2(1)
w 2
0 w 3
1
f
w 1
Last Example: Use Only a 4x1 MUX
Try this one: f(w1,w2,w3) = m(3,5,6,7)
f = w1'w2w3 + w1w2'w3 + w1w2w3' + w1w2w3
Use a 4x1 MUX by expanding on both w1 and w2
f = w1'w2'(0) + w1'w2(w3) + w1w2'(w3) + w1w2(1)
f
w1
0
w2
1
w3
Encoders
The opposite of decoding is encoding
Encoder encodes one-asserted information An 2n bit one-hot value is presented as input A binary encoded output of size n is the result
Example: input is 01000000 output is 110 (i.e. 6)7 6 5 4 3 2 1 0
2 n
inputs
w 0
w 2 n 1 –
y 0
y n 1 –
n outputs
4 to 2 Encoder
A 4 to 2 encoder encodes a 4 bit one-hot input into a 2 bit binary encoded output
w3 w2 w1 w0 y1 y0
0 0 0 1 0 0
0 0 1 0 0 1
0 1 0 0 1 0
1 0 0 0 1 1
y 0 y 1
w 1
w 0
w 2
w 3
Building Encoders
Notice that since the input is guaranteed to be one-hot, the design of an encoder is simple
y1 = w3 + w2
y0 = w3 + w1
Each output signal y is just the sum of the input signals that are asserted for the “on set” of y
These encoder types are called binary encoders
w3 w2 w1 w0 y1 y0
0 0 0 1 0 0
0 0 1 0 0 1
0 1 0 0 1 0
1 0 0 0 1 1
Priority Encoders
What if you can’t guarantee, or don’t want to guarantee, that the input is one-hot?
You can encode the input with the highest priority Priority can be assigned in many ways One priority scheme is to pick the input lines in order
according to position
Example: input is 01100100 output is 110 since line 6 is “more significant” than line 5 or line 2
What if input is 00000000? Compare to 00000001?
7 6 5 4 3 2 1 0
4 to 2 Priority Encoder
4 input lines (w3:w0) w3 has highest priority; w0 has lowest priority
2 output lines (y1:y0)
1 “valid” (z) output to determine if any line is active at all
w3 w2 w1 w0 y1 y0 z
0 0 0 0 x x 0
0 0 0 1 0 0 1
0 0 1 x 0 1 1
0 1 x x 1 0 1
1 x x x 1 1 1
Logic for Priority Encoders
Let i0 = w3'w2'w1'w0
i1 = w3'w2'w1
i2 = w3'w2
i3 = w3
Then y0 = i1 + i3y1 = i2 + i3
z = i0 + i1 + i2 + i3
same structure as one-hot encoder: sum of terms in the on set
w3 w2 w1 w0 y1 y0 z
0 0 0 0 x x 0
0 0 0 1 0 0 1
0 0 1 x 0 1 1
0 1 x x 1 0 1
1 x x x 1 1 1
74147 Priority Encoder
All inputs are active low
All outputs are active low 0110 is "9" 1110 is "1"