Day 46: Combinational Circuits- Adders, Subtractors, Encoder, Decoder, Multiplexer, Demultiplexer

COMBINATIONAL CIRCUITS - Combinational circuits wo digital circuits hote hai jisme current input se hum output lete hain. Isme memory elements ko consider nahi kiya jata hai. Combinational Circuit mein kya output ayegi wo completely depend karti hai uski input values par. Basically the combinational circuits are as follows-
  1. Adders
  2. Subtractors
  3. Encoder
  4. Decoder
  5. Multiplexer
  6. Demultiplexer

Combinational circuits ko design karne ke liye there are following steps-
  • Problem ko clearly understand karna,
  • Then, input and output variables ko find out karna, konsi input value hai and konsi output value hai.
  • Then, input and output variables ko letters or symbols ki form mein assign karna.
  • I/O symbols ko represent karne ke liye Truth Table create karna.
  • Then, is truth table se boolean functions ko find karna.
  • Ab boolean expressions ko solve karna with the help of K-Maps, or Boolean Algebra theorems.
  • Then, finally draw diagram for the result.

  • Adders means jab hum 2 binary numbers ko add karte hain. 
  • We have already discussed about the binary number operations in last lectures. 
  • So, adders 2 types ke hote hain, half adder and full adder.
  • Half adder basically 2 bits ko add karta hai.
  • It can be 0+0, or 0+1, or 1+0, or 1+1, but it cannot be 1+0+1, or 0+0+1, or something like that because it adds only 2 bits.
  • Isme 2 input values hoti hai and 2 output values hoti hain, input values to 2 hi hongi because it is half-adder and output values 2 hongi which are Carry and Sum.
  • The Truth Table for half-adder is as follows-
  •  ASum Carry 

  • From truth table, we get the boolean functions which are -
  1. Carry = AB
  2. Sum = A'B + AB'
  • Now, design this by the logical gates simply.
  • Full-Adder basically adds 3 bits.
  • It can be 0+0+1, and so.
  • Isme 3 input values hoti hai because ye 3 bits ko add karta hai, so hum 3 input values dete hain, and 2 output values hoti hain, which are Carry and Sum.
  • The truth table of full-adder is as follows-
  •  ASum Carry 

  • From this truth table, we get,
  1. Carry = A'BC + AB'C + ABC
  2. Sum = A'B'C + ABC' + ABC
  • Now, simplify it with K-Maps and then draw the logical gates simply.

  • Subtractor means jab hum 2 binary numbers ko subtract karte hain.
  • Subtraction ke liye hum 2 methods use karte hain, as we have already discussed in previous lecture, the direct subtraction and the complement's method subtraction.
  • Agar hum complement's method se subtract karte hain, then subtraction is done using addition operation , and therefore the adder is used.
  • Subtractors are also of 2 types which are, half-Subtractor and full-Subtractor. 
  • Half-Subtractor 2 bits ko subtract karta hai.
  • It operates on only 2 bits.
  • So, isme 2 input values hoti hain and 2 output values, output values are, Borrow and Difference.
  • The Truth table of half-subtractor is as follows-
  •  ADifferenceBorrow 

  • From truth table, we get,
  1. Borrow = A'B 
  2. Difference = A'B + AB'
  • Now, simply draw it with the logical gates.

  • The full-subtractor subtracts 3 bits.
  • Isme 3 input values hoti hain, and 2 output values which are Borrow and Difference.
  • The truth table of full-subtractor is as follows-
  •  ADifference  Borrow

  • From truth table we get,
  1. Borrow = A'B'C + A'BC' + A'BC + ABC
  2. Difference = A'B'C + A'BC' + AB'C' + ABC
  • Now, solve this with K-Maps and then simply draw by logical gates.

  • Encoder ek device hai jisse hum use karte hain signals ko codes mein convert karne ke liye.
  • Then, uss code ko various purposes ke liye use kiya jata hai such as, compress the data to transmit, encryption, translate this code to another code, and many more.
  • Encoder mein 2n input values hoti hain and n output values.
  • Agar output code mein input code se less values hain, so usse encoder kaha jata hai.
  • Encoder mein jyada input values ko encode karke less output values ko generate kiya jata hai.
  • The binary-to-octal encoder is there in which hum binary se octal mein convert karenge, so the input values are 8, and output values are 3.
  • Ek time par only ek input line ki value 1 ho sakti hai.
  • Truth table of binary-to-octal is as follows-

  • d0d1d2d3 d4 d5 d6 d7 a2 a1 a0
    0 0

Here, d0 to d7 are 8 input values and a0 to a2 are 3 output values.

From above truth table, the output functions a0, a1, and a2 -
  1. a0 = d1+ d3+ d5 + d7
  2. a1 = d2+ d3+ d6+ d7
  3. a2 = d4+ d5+ d6+ d7
a0, a1, and a2 output equations find karne ke liye, 
hum dekhenge ki konsi input values par a0 ki value and input value 1 hoti hain, So, jab a0 ki value 1 hoti hai then d1 ki hi value 1 hoti hai, so d1 and then next jab a0 ki value 1 hoti hai then d3 ki value 1 so d3, and so on.

So, aise hi above equations bani hai.

From these equations, we can draw the logical gates easily.

  • Decoder basically ek combinational circuit hota hai jo ki n input values ko 2n output values mein convert karta hai.
  • It is opposite to encoder.
  • Encoder mein 2n input values ko n output values mein convert kiya jata hai, and decoder mein n input values ko 2n output values mein convert kiya jata hai.
  • Decoders are used in - memory for multitasking, system alerts in alarm systems. 
  • Jaise humne 8 to 3 encoder ko understand kiya tha, now 3 to 8 decoder is there.
  • It is called 3 line to 8 line decoder because it has 3 inputs and 8 ouputs.
  • The truth table for 3 to 8 decoder is as follows-

  • a2 a1 a0 Logic Function d0d1d2d3 d4 d5 d6 d7 
    a2'a1'a0' 10
    a2'a1'ao 0 0
    a2'a1a0 0

  • Truth Table mein logic functions hain, so hum iska logic gates diagram simply bana lenge.
  • Usually decoders takes their input values from the ouput of counters or registers.

  • Multiplexer ek digital switch hota hai, jise MUX kaha jata hai.
  • MUX ka kaam hota hai bahut saare input signals ko output se connect karna.
  • Isme bahut saare inputs ko combine karke only one output ko generate kiya jata hai.
  • It is many to one process.
  • It has data select inputs which determine which data source is connected to the output.
  • The 4 to 1 multiplexer-

  • Multiplexer
           4 to 1 Multiplexer

  • The Truth Table of the above multiplexer is as follows-
  • S1S0

  • The logical diagram of 4 to 1 multiplexer is as follows-
logic diagram of multiplexer 4 to 1
Logic Diagram of 4 to 1 multiplexer

  • There can be different types of multiplexers as-
  1. 2 to 1
  2. 4 to 1
  3. 8 to 1
  4. 16 to 1
  5. 32 to 1, and many more.
  • Multiplexers ke data select inputs ko find out karne ke liye, 
  • Agar 2n input lines hain, then n data select lines hongi, means,
  • 2 to 1 multiplexer mein 1 data select input hoga. 21 = 2.
  • 4 to 1 multiplexer mein 2 data select input honge. 22 = 4.
  • 8 to 1 multiplexer mein 3 data select input honge. 23 = 8.
  • 16 to 1 multiplexer mein 4 data select input honge, and 24 = 16
  • 32 to 1 multiplexer mein 5 data select input honge. 25 = 32.

  • Demuliplexer ek device hota hai, jisse DMUX kehte hain.
  • It takes one input and then it generates multiple outputs.
  • DMUX performs opposite operation to that of MUX.
  • Multiplexer multiple inputs ko ek output mein generate karta hai, then uske receiving side DMUX hota hai jo ki wo output ko as input leta hai and then usse multiple outputs mein convert karta hai.
  • The 1 to 4 DMUX is as follows-

  • Demultiplexer
    1 to 4 Demultiplexer

  • The Truth Table of the above demultiplexer is as follows-
  • DataS1 S0 Y0 Y1 Y2 Y3 

  • The logical diagram of 1 to 4 demultiplexer is as follows-
logical diagram demultiplexer 1 to 4
Logic Diagram of 1 to 4 Demultiplexer