Question: Write a simulation code ( program ) for 1 - bit ALU, which performs AND, OR , Add and Sub operations. 1 - bit ALU
Write a simulation code program for bit ALU, which performs AND, OR Add and Sub
operations.
bit ALU should have subcomponents: input ANDOR gates, bit full adder, x mux and
x mux. These subcomponents should be implemented with a function each.
Suggested steps to complete the code:
Write a simulation functions for AND gate and OR gate, eg
int ANDgate int a int b
int ORgate int a int b
Write a simulation function for the fulladder. eg
int fulladder int a int b int cin, int &cout
Write a simulation function for the x mux, eg
int muxxint x int x int sel
Write a simulation function for the x mux, eg
int muxxint x int x int x int x string sel
Write a simulation function for the bitALU, eg
int ALUbit int a int b int Binv, int cin, string op int &cout
Write a driver module main function and test your bit ALU for correctness with all
possible input value combinations total cases to test
The driver should display input values and the corresponding output values for each
test case, ie
a b cin Binv op result cout
cases for AND
cases for OR
cases for Add
cases for Sub
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
