Faculty of Computer and Information Technology
Subject: Computer Architecture - CS312 & CSC 323
Semester: Spring 2025
Instructor: Dr. Khaled Elshafey,
TAs: Nada Emad, Ahmed ElDafrawy, Farah Ashraf
Lab 2: Combinational and Sequential Circuits
Logic gates review:
Steps to create logic circuit:
1- Define the Problem (number of Inputs & Outputs)
2- Create a truth table listing all possible input combinations and the corresponding output
values.
3- Write the Boolean Expression using Minterms (SOP) or Maxterms (POS) to derive the
equation from the truth table.
4- Draw the Logic Circuit Diagram
Minterms (mj – Sum of Products) = Maxterms (Mj – Product of Sum)
Minterms and maxterms are used to design digital circuits through Sum of Products (SOP) and
Product of Sums (POS) forms. These representations help in simplifying Boolean expressions
and implementing logic circuits using AND, OR, and NOT gates.
Example 1: For the Boolean variables A = 0, B = 1 and C = 0 obtain the minterm and
maxterm for the variables.
Solution:
Given the values of Boolean variables as: A = 0, B = 1 and C = 0
Minterms = A’BC’ while Maxterms= A + B’ + C
Decoder:
A decoder is a combinational circuit that converts binary-coded inputs into a unique set of
outputs. It is commonly used in digital electronics to activate one specific output line based on
the binary input value.
- Used in RAM and ROM to select memory locations.
Multiplexer
Half Adder:
- A half adder adds two single-bit binary numbers and produces a Sum (S) and a Carry
(Cout).
- It does not consider a carry input from a previous stage.
- Sum = A ⊕ B - Carry = A AND B
Full Adder:
A full adder adds three binary digits:
• A, B (input bits to be added)
• Cin (Carry-in from a previous addition stage)
• SUM = (A XOR B) XOR Cin = (A ⊕ B) ⊕ Cin
• CARRY-OUT = A AND B OR Cin(A XOR B) = A.B + Cin(A ⊕ B)
4-Bit Adder
4-Bit Adder-Subtractor
Subtractor: A + (B’ +1)
ROM
Exercises
1. Implement the function f(w1,w2,w3) = ∑m(0, 1, 3, 4, 6, 7) by using a 3-to-8
binary decoder and an OR gate.
2. Implement the following function using a Multiplexer.
𝐹 (𝐴, 𝐵, 𝐶) =Σ(1, 2, 6, 7)
A B C F
0 0 0 0
0 0 1 1
0 1 0 1
0 1 1 0
1 0 0 0
1 0 1 0
1 1 0 1
1 1 1 1
3. A combinational circuit is specified by the following three Boolean functions:
F1( A, B, C) = Σ ( 2, 4, 7)
F2( A, B, C) = Σ ( 0, 3)
F3( A, B, C) = Σ ( 0, 2, 3, 4, 7)
Implement the circuit with a decoder construction. You can use extra logic
gates connected to the decoder outputs. Use block diagram for the decoder.
4. Design a combinational circuit with three inputs and one output. The output
is equal to logic-1 when the binary value of the input is less than 3. The output
is logic-0 otherwise
5. Design a 3-input, 1-output Majority Circuit: A majority circuit outputs 1 when at
least two of the three inputs are 1. Design the Boolean expression for this circuit.
A B C F Boolean Expression: F=AB+AC+BC
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 1
1 1 1 1
6. Design a combinational circuit with three inputs x , y and z ,and three outputs
A,B and C
When the input is 0, 1, 2, or 3 the output is one greater than input
When the binary input is 4,5,6,7, the binary output is one less than the input.
X Y Z A B C
0 0 0 0 0 1
0 0 1 0 1 0
0 1 0 0 1 1
0 1 1 1 0 0
1 0 0 0 1 1
1 0 1 1 0 0
1 1 0 1 0 1
1 1 1 1 1 0
A = YZ + XY + XZ B = X’Y’Z + X’YZ’ + XY’Z’ + XYZ
Z = C’
And draw the full circuit.
7. Implement a full-adder circuit using a decoder.
Solution:
We can use X as a carry and the two bits will be Y and Z and Carry and Sum will be
shown as in the following table
We can obtain the minterms of each
output as the following:
- 𝐶(𝑥, 𝑦, 𝑧) =∑(3, 5, 6, 7)
- 𝑆(𝑥, 𝑦, 𝑧) = ∑ (1, 2, 4, 7)
8. Find a ROM-based circuit implementation for:
f(a,b,c) = a’b’ + abc
g(a,b,c) = a’b’c’ + ab + bc
h(a,b,c) = a’b’ + c
Solution:
f(a,b,c) = a’b’c’+a’b’c+ abc >> Minterm (0,1,7)
g(a,b,c) = a’b’c’ + abc + abc’ + abc+ a’bc >> Minterm (0,3,6,7)
h(a,b,c) = a’b’ c+ a’b’c’+ab c+a’b’c + a’bc + ab’c >> Minterm (0,1,3,5,7)