KTU Online Placement Cell Registration
register now

Monday, January 16, 2017

Switching Theory and Logic Design Model Question with Answers


CS 203: Switching Theory and Logic Design
Time: 3 Hrs                                                                                                             Marks: 100
( Answer All Questions Each carries 3 Marks )

1.Perform the following conversions
2.What you mean by weighted code?
Weighted binary codes are those binary codes which obey the positional weight principle. Each position of the number represents a specific weight. Several systems of the codes are used to express the decimal digits 0 through 9. In these codes each decimal digit is represented by a group of four bits.
In the example below, 100101, which is a binary base 2 number, is converted to a decimal (base 10) number.100101 = Binary (base 2) number 543210 = positional weights (1 x 2^5) + (0 x 2^4) + (0 x 2^3) + (1 x 2^2) + (0 x 2^1) + (1 x 2^0) =32 + 0 + 0 + 4 + 0 + 1 = 3737base10 = decimal conversion Other weighted methods include BCD and 2421, each of which uses a similar formula to assign weights and convert to decimal
3. Add the following BCD numbers.
01100111 + 01010011 .
  1. What are the universal gates? Why they are called universal gate?
NAND and NOR gates are called universal gates because they can be used in place of all basic gates that AND ,OR and NOT.


( Answer any TWO, Each carries 9 Marks )

  1. Simplify the following Boolean functions, using four-variable maps:
a) F(w, x, y, z) = ∑ (1, 4, 5, 6, 12, 14, 15) ( 5 marks)
b) F(A, B, C, D) = ∑ (0, 1, 2, 4, 5, 7, 11, 15) (4 marks)
  1. Implement the following functions with NAND Gate F(x, y, z) = ∑ (0, 6)


  1. Minimize the function given below by Quine-McClusky method.
f (A,B,C,D) m(0, 5, 6, 7, 9,10,13,14,15)

Step 1: Form a table of functions of minterms according to the number of 1’s in each minterm as shown in Table E1.a

Step 2: Start pairing off each element of first group with the next, however since m0 has no 1’s, it and the next group of numbers with one 1’s are missing, therefore they cannot be paired off. Start by pairing elements of m5 with m7, m13, m14, and m6 with m7, m13, m14, and so on… If they pair off, write them in  the minterm that pair, i.e. m5 and m7 pair off 0101 andPa separate table and  0111 to produce 01×1, so in the next table E1.b under “minterm paired” we sign in front ofPenter “5, 7” and under “ABCD” we enter “01×1” and place a  5 and 7 in Table E1.a Note: Each minterm in a group must be compared with every minterm in the other .Pgroup even if either or both of them have already been checked
   Step 3: Now repeat the same procedure by pairing each element of a group with the elements of the next group for elements that have “x” in the same position. For example, “5,7” matches “13,15” to produce x1x1. These elements are Pplaced in table E1.c as shown, and the above elements in Table E1.b are  checked. (The elements that produce the same ABCD pattern are eliminated.) Since 9,13 and 10,14 in Table E1.b do not pair off, they are prime implicants and with m0, from E1.a, and (d) and (e) from E1.c are unpaired individuals. Therefore, it is possible to write the minimized SOP as a+b+c+d+r or f (A,B,C,D) ABCD ACD ACD BD BC Note: Check this result for Example 1 by Karnaugh map approach.

Table E1.b represents all possible two-square implicants and the literals that they eliminate, i.e. 9 (1001b) combined with 13 (1101b) produces 1×01. As a result, literal “B” is eliminated. Corresponding product is ACD . Since the only way of making an implicant that contains m9 is to combine it with m13, the implicant 9-13 is a prime one. The same rule applies to m10
Table E1.c represents all possible four-square implicants and the literals that they eliminate, i.e. 5 (0101b) combined with 7 (0111b) and 13 (1101b) and 15 (1111b) produces x1x1. As a result, literals “A” and “C” are eliminated. Corresponding product is BD.

( Answer All Questions Each Carries 3 Marks )
  1. Explain binary subtractor.
                     Binary Subtractor is a decision making circuit that subtracts two binary numbers from each other, for example, X – Y to find the resulting difference between the two numbers.
  1. show the logic digram of SR flip-flop  with four NAND gate
The SR flip-flop, also known as a SR Latch, can be considered as one of the most basic sequential logic circuit possible. This simple flip-flop is basically a one-bit memory bistable device that has two inputs, one which will “SET” the device (meaning the output = “1”), and is labelled S and another which will “RESET” the device (meaning the output = “0”), labelled R.
  1. what are the differences of flip-flop and Latch?

  1. Implement  4:1 multiplexer
                 4-to-1 Multiplexer
A  4-to-1 multiplexer consists four data input lines as D0 to D3, two select lines as S0 and S1 and a single output line Y. The select lines S1 and S2 select one of the four input lines to connect the output line. The particular input combination on select lines selects one of input (D0 through D3) to the output.
The figure below shows the block diagram of a 4-to-1 multiplexer in which the multiplexer decodes the input through select line.
The truth table of a 4-to-1 multiplexer is shown below in which four input combinations 00, 10, 01 and 11 on the select lines respectively switches the inputs D0, D2, D1 and D3 to the output. That means when S1=0 and S0 =0, the output at Y is D0, similarly Y is D1 if the select inputs S1=0 and S0= 1 and so on. 


( Answer any TWO, Each carries 9 Marks )

  1. Explain how a look ahead adder speeds up the addition process.(9 marks)
A carry-Lookahead adder is a fast parallel adder as it reduces the propagation delay by more complex hardware, hence it is costlier. In this design, the carry logic over fixed groups of bits of the adder is reduced to two-level logic, which is nothing but a transformation of the ripple carry design.
This method makes use of  logic gates so as to look at the lower order bits of the augend and addend to see whether a higher order carry is to be generated or not
Consider the full adder circuit shown above with corresponding truth table. If we define two variables as carry generate Gi and carry propagate Pi then,
Pi = Ai ⊕ Bi
Gi = Ai Bi
The sum output and carry output can be expressed as
Si = Pi ⊕ Ci
C i +1 = Gi + Pi Ci
Where Gi is a carry generate which produces the carry when both Ai, Bi are one regardless of the input carry. Pi is a carry propagate and it is associate with the propagation of carry from Ci to Ci +1.
The carry output Boolean function of each stage in a 4 stage carry-Lookahead adder can be expressed as
C1 = G0 + P0 Cin
C2 = G1 + P1 C1
= G1 + P1 G0 + P1 P0 Cin
C3 = G2 + P2 C2
= G2 + P2 G1+ P2 P1 G0 + P2 P1 P0 Cin
C4 = G3 + P3 C3
= G3 + P3 G2+ P3 P2 G1 + P3 P2 P1 G0 + P3 P2 P1 P0 Cin
From the above Boolean equations we can observe that C4 does not have to wait for C3 and C2 to propagate but actually C4 is propagated at the same time as C3 and C2. Since the Boolean expression for each carry output is the sum of products so these can be implemented with one level of AND gates followed by an OR gate.
The implementation of three Boolean functions for each carry output (C2, C3 and C4) for a carry-Lookahead carry generator shown in below figure.
  1. a) Express the Boolean function F = A + B´C in a sum of minterms
The function has three variables, A, B and C. The first term A is missing two variables; therefore A = A(B+B’) = AB+AB’
This is still missing one variable C: A = (AB+AB’) (C+C’) = ABC+ABC’+AB’C+AB’C’
The second term B´C is missing one variable: B’C = B’C (A+A’) = AB’C+A’B’C
F = A+B’C = ABC+ABC’+AB’C+AB’C’ + AB’C+A’B’C
But AB´C appears twice, and according to theorem 1
F = ABC+ABC’+AB’C+AB’C’+A’B’C = m7+m6+m5+m4+m1 = Σ( 1,4,5,6,7)
  1. b) Describe the differences between PLA and PAL(5 mark)
  • PLA has both programmable AND and OR planes whereas PAL has only programmable AND planes and OR plane is fixed
  • PLA has more flexibility in the logic circuit function implementation than PAL
  • PAL is simpler to manufacture than PLA
  • PLA have reduced speed performance
  • PAL devices are manufactured in smaller size.
Drawbacks of PLA †
  • PLA were hard to be implemented †
  • PLA reduced the speed performance of circuits. „
Advantage of PAL †
  • Simple to manufacturers † Less expensive †
  • Better performance „
Disadvantage of PAL †
  • Not flexible as compared PLA, because OR plane is fixed.
  1. a)Implement Full adder circuit using NAND gate only.(5 marks)
               Full Adder using NAND gate only
To construct a full adder circuit, we’ll need three inputs and two outputs. Since we’ll have both an input carry and an output carry, we’ll designate them as CINand COUT. At the same time, we’ll use S to designate the final Sum output. The resulting truth table is shown to the right.
This is looking a bit messy. It looks as if COUT may be either an AND or an OR function, depending on the value of A, and S is either an XOR or an XNOR, again depending on the value of A. Looking a little more closely, however, we can note that the S output is actually an XOR between the A input and the half-adder SUM output with B and CIN inputs. Also, the output carry will be true if any two or all three inputs are logic 1.
What this suggests is also intuitively logical: we can use two half-adder circuits. The first will add A and B to produce a partial Sum, while the second will add CINto that Sum to produce the final S output. If either half-adder produces a carry, there will be an output carry. Thus, COUT will be an OR function of the half-adder Carry outputs. The resulting full adder circuit is shown here
l18l17b) Use an 8-to-1 multiplexer to realize the function f(a, b, c, d) = P m(1, 5, 7, 8, 9, 13, 14), with b, c, and d as the control inputs.

( Answer any FOUR, Each carries 10 Marks )
  1. (a) Design a 4 but binary ripple counter using flip-flop that trigger on the
                          i) Positive edge transition
                          ii) Negative edge transition (10)
A ripple counter is an asynchronous counter where only the first flip-flop is clocked by an external clock. All subsequent flip-flops are clocked by the output of the preceding flip-flop. Asynchronous counters are also called ripple-counters because of the way the clock pulse ripples it way through the flip-flops.
The MOD of the ripple counter or asynchronous counter is 2n if n flip-flops are used. For a 4-bit counter, the range of the count is 0000 to 1111 (24-1). A counter may count up or count down or count up and down depending on the input control. The count sequence usually repeats itself. When counting up, the count sequence goes from 0000, 0001, 0010, … 1110 , 1111 , 0000, 0001, … etc. When counting down the count sequence goes in the opposite manner: 1111, 1110, … 0010, 0001, 0000, 1111, 1110, … etc.
The complement of the count sequence counts in reverse direction. If the uncomplemented output counts up, the complemented output counts down. If the uncomplemented output counts down, the complemented output counts up.
There are many ways to implement the ripple counter depending on the characteristics of the flip flops used and the requirements of the count sequence.
  • Clock Trigger: Positive edged or Negative edged
  • JK or D flip-flops
  • Count Direction: Up, Down, or Up/Down
Asynchronous counters are slower than synchronous counters because of the delay in the transmission of the pulses from flip-flop to flip-flop. With a synchronous circuit, all the bits in the count change synchronously with the assertion of the clock. Examples of synchronous counters are the Ring and Johnson counter.
It can be implemented using D-type flip-flops or JK-type flip-flops.
The circuit below uses 2 D flip-flops to implement a divide-by-4 ripple counter (2n = 22 = 4). It counts down.

  • Click on CLK (Red) switch and observe the changes in the outputs of the flip flops. The CLK switch is a momentary switch (similar to a door bell switch – normally off).
  • PR and CLR are both connected to VCC (set to 1)
  • The D flip flop clock has a rising edge CLK input. For example Q0 behaves as follows:
    • The D input value just before the CLK rising edge is noted (Q00).
    • When CLK rising edge occurs, Q0 is assigned the previously noted D value (Q00).
    • Thus, whenever a rising edge appears at the CLK of the D flip flop, the output Q changes state (or toggles).
  • The MOD or number of unique states of this 2 flip flop ripple counter is 4 (22).
  • Simulate and Breadboard the Ripple Counter circuit.
  • Truncated Ripple Counter is used if a MOD of less than 2n is required. For example, if you want to change the sequence from 3,2,1,0,3,2,1,0 … to 3,2,0,3,2,0

  1. design a synchronous sequential circuit whose state diagram is shown in Figure 13. The type of flip-flop to be use is J-K.
.                      From the state diagram, we can generate the state table shown in Table 9. Note that there is no output section for this circuit. Two flip-flops are needed to represent the four states and are designated Q0Q1. The input variable is labelled x.
In the first row of Table 11, we have a transition for flip-flop Q0 from 0 in the present state to 0 in the next state. In Table 10 we find that a transition of states from 0 to 0 requires that input J = 0 and input K = X. So 0 and X are copied in the first row under J0 and K0 respectively. Since the first row also shows a transition for the flip-flop Q1 from 0 in the present state to 0 in the next state, 0 and X are copied in the first row under J1 and K1. This process is continued for each row of the table and for each flip-flop, with the input conditions as specified in Table 10.
The simplified Boolean functions for the combinational circuit can now be derived. The input variables are Q0, Q1, and x; the output are the variables J0, K0, J1 and K1. The information from the truth table is plotted on the Karnaugh maps shown in Figure 14.

  1. a) Design a mod 6 asynchronous up counter using T flip-flop(6 marks)
Normal binary counter counts from 0 to 2N – 1, where N is the number od bits/flip-flops in the counter. In some cases, we want it to count to numbers other than 2N – 1. This can be done by allowing the counter to skip states that are normally part of the counting sequence. There are a few methods of doing this. One of the most common methods is to use the CLEAR input on the flip-flops.
In the example above, we have a MOD-6 counter. Without the NAND gate, it is a MOD-8 counter. Now, with the NAND gate, the output from the NAND gate is connected to the asynchronous CLEAR inputs of each flip-flop. The inputs to the NAND gate are the outputs of the B and C flip-flops. So, all the flip-flops will be cleared when B = C = 1 (1102 = 610 ). When the counter goess from state 101 to state 110, the NAND output will immediately clear the counter to state 000. Once the flip-flops have been cleared, the B = C = 1 condition no longer exists and the NAND output goes back to high. The counter will therefore count from 000 to 101, and for a very short period of time, be in state 110 before the counter is cleared. This state is called the temporary state and the counter usually only remains in a temporary state for a few nanoseconds. We can essentially say that the counter skips 110 and 111 so that it goes only six different states; thus, it is a MOD-6 counter. We also have to note that the temporary state causes a spike or glitch on the output waveform of B. This glitch is very narrow and will not normally be a problem unless it is used to drive other circuitry outside the counter. The 111 state is the unused state here. In a state machine with unused states, we need to make sure that the unused states do not cause the system to hang, ie. no way to get out of the state. We don’t have to worry about this here because even if the system does go to the 111 state, it will go to state 000, a valid state) on the next clock pulse.

  1. b) Differentiate between combinational and sequential circuits (4 marks)
Combinational Logic CircuitsSequential Logic Circuits
Output is a function of the present inputs (Time Independent Logic).Output is a function of clock, present inputs and the previous states of the system.
Do not have the ability to store data (state).Have memory to store the present states that is sent as control input (enable) for the next operation.
It does not require any feedback. It simply outputs the input according to the logic designed.It involves feedback from output to input that is stored in the memory for the next operation.
Used mainly for Arithmetic and Boolean operations.Used for storing data (and hence used in RAM).
Logic gates are the elementary building blocks.Flip flops (binary storage device) are the elementary building unit.
Independent of clock and hence does not require triggering to operate.Clocked (Triggered for operation with electronic pulses).
Example: Adder [1+0=1; Dependency only on present inputs i.e., 1 and 0].Example: Counter [Previous O/P +1=Current O/P; Dependency on present input as well as previous state].

  1. Design BCD counter using JK flip-flop
A binary coded decimal (BCD) is a serial digital counter that counts ten digits .And it resets for every new clock input. As it can go through 10 unique combinations of output, it is also called as “Decade counter”. A BCD counter can count 0000, 0001, 0010, 1000, 1001, 1010, 1011, 1110, 1111, 0000, and 0001 and so on.
A 4 bit binary counter will act as decade counter by skipping any six outputs out of the 16 (24) outputs. There are some available ICs for decade counters which we can readily use in our circuit, like 74LS90. It is an asynchronous decade counter.
The above figure shows a decade counter constructed with JK flip flop. The J output and K outputs are connected to logic 1. The clock input of every flip flop is connected to the output of next flip flop, except the last one.
The output of the NAND gate is connected in parallel to the clear input ‘CLR’ to all the flip flops. This ripple counter can count up to 16 i.e. 24.

Decade Counter Operation

When the Decade counter is at REST, the count is equal to 0000. This is first stage of the counter cycle. When we connect a clock signal input to the counter circuit, then the circuit will count the binary sequence. The first clock pulse can make the circuit to count up to 9 (1001). The next clock pulse advances to count 10 (1010).
Then the ports X1 and X3 will be high. As we know that for high inputs, the NAND gate output will be low. The NAND gate output is connected to clear input, so it resets all the flip flop stages in decade counter. This means the pulse after count 9 will again start the count from count 0.
  1. Draw and explain 4 bit Johnson counter. Draw the timing diagram also.
A Johnson counter is a modified ring counter, where the inverted output from the last flip flop is connected to the input to the first. The register cycles through a sequence of bit-patterns. The MOD of the Johnson counter is 2n if n flip-flops are used. The main advantage of the Johnson counter counter is that it only needs half the number of flip-flops compared to the standard ring counter for the same MOD.
It can be implemented using D-type flip-flops (or JK-type flip-flops).
  • Enable the flips flops by clicking on the RESET (Green) switch. The RESET switch is a on/off switch (similar to a room light switch)
  • Click on CLK (Red) switch and observe the changes in the outputs of the flip flops. The CLK switch is a momentary switch (similar to a door bell switch – normally off).
  • The D flip flop clock has a rising edge CLK input. For example Q1 behaves as follows:
    • The D input value just before the CLK rising edge is noted (Q0).
    • When CLK rising edge occurs, Q1 is assigned the previously noted D value (Q0).
  1. a) what is race condition? How it can be avoided?(5 marks)
A race condition is a result of poor design for a latch or flip-flop. It denotes a condition in which the data and clock are changing at the same time and the result depends on which one wins.
In rare cases the data can be exactly on the threshold between a 0 and 1 and when the clock changes, the output actually stays between a 0 and 1 for a while (for example in a 5V system the output may stay around 2.5 volts for a short time (microseconds, maybe). When this happens the output is said to be ‘metastable’. This could have serious effects on the operation of the system and worse, could be virtually impossible to duplicate and thus very hard to find and fix.
This same problem can exist at inputs to a logic gate and produce unwanted ‘glitches’.
In order to prevent these design flaws, the designer needs to do a ‘worst case timing analysis’ on all the logic. This analysis uses propagation delays, rise and fall times, threshold points, etc. to calculate timings. He must do both minimum and maximum times for each device and choose the worst case combinations. In a large system this can be very time consuming but there are tools to aid in this analysis.
Power gating is used to simply turn the clock on and off (or gate the clock) to sections of logic that aren’t in use for periods of time. This results in a reduction in power.

  1. b) Implement a JK flip-flop with a T flip-flop and a minimal AND-OR-NOT network. Let us assume that the complements of J, K and Q signals are available. Draw the logic diagram to show your design.(5 marks)

Load disqus comments


Follow us on Facebook
Powered by: KTU Online