Q- Implement a basic ALU which performs the operations of logical AND, logical OR, ADD, SUBRACT depending on the values of S1 & S0
Ans: We need to use an ADDER, AND gate, OR gate and some MUXes to implement the above function. We select the functions using the two variables S0 & S1 as:
S1 S0 F (S0, S1)
0 0 AND
0 1 OR
1 0 ADD A & B
1 1 SUBTRACT B FROM A
Firstly we’ll select one out of two logical operations and one out of two arithmetic operations using 2 to 1 MUX and then we select one out of 2 already selected operations and get the result.