2-4. Spiral 2-4 Function synthesis with: Muxes (Shannon's Theorem) Memories
2-4.2 Learning Outcomes I can implement logic for any truth table by using Shannon's theorem to decompose the function to create two smaller functions and a 2-to- mux I can recursively apply Shannon's theorem k times to decompose any size truth table to arrive at 2 k smaller functions and a 2 k -to- mux I can implement logic for any truth table by using a memory as a look-up table I understand how to determine the necessary dimensions of the memory I understand how to reinterpret input combinations as address inputs to determine the correct row to place the desired output
2-4.3 Function Synthesis Techniques Given a combination function (i.e. truth table or other description) what methods can we use to arrive at a circuit? Karnaugh maps Sum of minterms / Produce of maxterms Neither of these scale well to larger number of inputs Now we will see a few others X Z P Primes between -7
2-4.4 Implementing functions with muxes SHANNON'S THEOREM
2-4.5 Simplify This Given F(x,y,z) = x yz + y z, simplify F(,y,z) = then simplify F(,y,z) = Given G(a,b,c,d) = bd + ab cd + ac d G(,,c,d) =
2-4.6 2-to- Mux: Another View Old Views: I I S -bit wide 2-to- mux (I ) S IN IN if(s==) = IN else = IN New View: We can show the function of a 2-to- mux as a splitter where the variable 's' decides which input passes upwards s I I
z 2-4.7 3-bit Prime Number Function X Z P X Z P F OFF-set x y ON-set z Primes between -7 Truth Table z if(z==) output else output I I S
2-4.8 Function Implementation w/ Muxes Implementing a function using muxes relies is based on Shannon s expansion theorem which states: F(X,X 2,,X n ) = X F(,X 2,,X n ) + X F(,X 2,,X n ) X can be pulled out of F if we substitute an appropriate constant and qualify it with X or X Now recall a 2-to- mux can be built as: F = S I + S I Comparing the two equations, Shannon s theorem says we can use X as our select bit to a 2-to- mux with F(,X 2, X n ) as input of our mux and F(,X 2,,X n ) as input
2-4.9 Binary Decision Trees & Muxes Z F F(x,y,z) X Z F Z F F(,y,z) F(,,z) Z F F(,,z) x y z F(,y,z) F(,y,z) F(,,z) F(,,z) F(,,z) F(,,z) F(x,y,z) Z F F(,y,z) Z F F(,,z) Z F x y z F(x,y,z) F(,y,z) F(,y,z) F(,,z) F(,,z) F(,,z) F(,,z) F(,,z)
2-4. Splitting on X We can use smaller muxes by breaking the truth table into fewer disjoint sets This increases the amount of logic at the inputs though Break the truth table into groups based on some number (k) of MSB s For each group, describe F as a function of the n-k LSB s X Z F I I S X Put the k MSB s on the selects F
2-4. Splitting on X We can use smaller muxes by breaking the truth table into fewer disjoint sets This increases the amount of logic at the inputs though Break the truth table into groups based on some number (k) of MSB s For each group, describe F as a function of the n-k LSB s X Z F y xor z (y z + yz ) (y + z) Z Z I I S X Put the k MSB s on the selects F
2-4.2 Implement G X Z G y I G y xor z I S X
2-4.3 Shannon s Theorem F(X,X 2,,X n ) = X F(,X 2,,X n ) + X F(,X 2,,X n ) Now recall a 2-to- mux can be built as: F = S I + S I Comparing the two equations, Shannon s theorem says we can use X as our select bit to a 2-to- mux with F(,X 2, X n ) as input of our mux and F(,X 2,,X n ) as input We can recursively apply Shannon s theorem to pull out more variables: F(X,X 2,,X n ) = X X 2 F(,,,X n ) + X X 2 F(,,,X n ) + X X 2 F(,,,X n ) + X X 2 F(,,,X n ) +
2-4.4 Additional Logic Muxes allow us to break a function into some number of smaller, disjoint functions Use MSB s to choose which small function we want By including the use of inverters we can use a mux with n- select bits (given a function of n-var s) Break the truth table into groups of 2 rows For each group, put F in terms of: z, z,, or X Z F z z z F (z) F (z) F 2 (z) F 3 (z) F(x,y,z) can be broken into several disjoint functions z z z D D D 2 D 3 S S x y Put the n- MSB s on the selects F
2-4.5 More Practice X Z G D z D D 2 G z' D 3 S S x y
2-4.6 As Far as We like We can take this tactic all the way down and use ONL a mux to implement any function Connect the input variables to the select bits of the mux The output of the mux is the output of the function Whatever the output should be for each input value, attach that to the input of the mux X Z F D D D 2 D 3 D 4 D 5 D 6 D 7 S 2 S S x y z F
2-4.7 Splitting on Z F We can always rearrange our variables if it helps make the function simpler to implement x y z X Z F Z X F F z x y z F
2-4.8 Implementing Logic Functions We can use muxes to implement any arbitrary logic function Choose one variable to split the large function into two smaller functions: f(,x2,x3, ) and f(,x2,x3, ) A 2-to- mux will produce the output bit and the chosen "split" variable will be the select Implement f(,x2,x3, ) using any known method and connect it to input of the 2-to- mux Implement f(,x2,x3, ) using any known method and connect it to input of the 2-to- mux
2-4.9 Implementing an Initial State Since the NSL is just a combinational function of the current state and inputs, we can use Shannon's theorem (i.e. muxes)to find an implementation rather than K-Maps S NSL (Next State Logic) Q (t) Q (t) D D SM (State Memory) PRE D Q Q (t) OFL (Output Function Logic) CLK CLR RESET PRE D Q Q (t) A CLK CLK CLR RESET Current State Feedback
2-4.2 Example Implement D & D using 2-to- muxes with S as the select Current State State Q Q State Next State S = S = Q*= D Q*= D State Q* =D Q* =D G G G G G G G G G G G G Output A Q xnor Q I Q xor Q I I S S D Q xnor Q Q xnor Q I S S D D = Q xnor Q (Since both inputs are xnor, we don't need the mux)
2-4.2 Example 2 Implement D and D using (2) 4-to- muxes with Q,Q as the selects Current State Next State S = S = Output State Q Q State Q * Q * State Q * Q * SSG MTG MSG SS MS MT N/A X d d X d d d d d MT MS MS MS SS SS D S D anything D D 2 D 3 S S D anything D D 2 D 3 S S D Q Q Q Q
2-4.22 Example 3 L Implement D using a mux L OFF P= H ON P= H Current State Next State H L = H L = H L = H L = Symbol Q Sym. Q* Sym. Q* Sym. Q* Sym. Q* OFF ON OFF OFF X d ON ON ON OFF X d Note: The State Value, Q forms the Pump output (i.e. when we want the pump to be on and othewise) Due to don't care: Option : H'L' Option 2: L' I D Option : H' Option 2: H'+L' I S Q
2-4.23 Example 4 Implement D using a mux. Current State Do a K-Map for each column separately since the mux splits them Next State X = X = State Q2 Q Q State* D2 D D State* D2 D D Z Sinit Sinit S S Sinit S S S S S S S S S S Outp ut Q2 + Q I D Q2+(Q xnor Q) I S X
2-4.24 Summary Shannon's theorem allows us to decompose an ARBITRARIL large function into many smaller functions This allows a method that can scale for a function with many variables It is at the heart of many computer algorithms that will find logic implementation given highlevel descriptions of a function
2-4.25 Using a LookUp-Table to implement a function MEMORIES
2-4.26 Memories as Look-Up Tables One major application of memories in digital design is to use them as LUT s (Look- Up Tables) to implement logic functions Given a logic function use a memory to hold all the possible answers and feed the inputs of the function to the address inputs to look-up the answer
2-4.27 Implementing Functions w/ Memories 8x Memory 8x Memory X Z F Z X A A A 2 2 3 4 5 6 X,,Z inputs look up the correct answer A A A 2 2 3 4 5 6 7 7 Arbitrary Logic Function D F D
2-4.28 Implementing Functions w/ Memories 8x2 Memory 8x2 Memory X C i C o S C i X A A A 2 2 A A A 2 2 3 4 5 6 3 4 5 6 7 7 Full Adder D D D D C o S ++ =
2-4.29 Example Implement D & D using a memory Current State Next State State Q Q State Q* Q* S = S = Stat e Q* Q* G G G G G G Q Q S 8x2 Memory A A A 2 2 3 4 5 G G G G G G 6 7 D D D D
2-4.3 Example 2 L Implement D using a memory L OFF P= H ON P= H Current State Next State H L = H L = H L = H L = Symbol Q Sym. Q* Sym. Q* Sym. Q* Sym. Q* OFF ON OFF OFF X d ON ON ON OFF X d L H Q 8x Memory A A A 2 2-3 4 5 6 7 - D D
2-4.3 Example 3 Implement D and D using a memory 8x2 Memory Current State Next State S = S = Output State Q Q State Q * Q * State Q * Q * SSG MTG MSG SS MS MT Q Q S A A A 2 2 - - N/A X d d X d d d d d 3 MT MS MS MS SS SS 4 5 - - 6 7 D D D D
2-4.32 4x4 Multiplier Example Determine the dimensions of the memory that would be necessary to implement a 4x4-bit unsigned multiplier with inputs X[3:] and [3:] and outputs P[??:] (Question: How many bits are needed for P). 2 3 X X X2 X3 A A A2 A3 A4 A5 A6 A7 2 2 33 ROM Example:... X 3 X 2 X X = 3 2 = 255 P = X * = 2 * = 2 = P7 P
2-4.33 Implementing Functions w/ Memories To implement a function w/ n-variables and m outputs Just place the output truth table values in the memory Memory will have dimensions: 2 n rows and m columns Still does not scale terribly well (i.e. n-inputs requires memory w/ 2 n outputs) But it is easy and since we can change the contents of memories it allows us to create "reconfigurable" logic This idea is at the heart of FPGAs