# help with ALU circuit

#### Henskie

Joined Nov 5, 2007
1
I need to design a logicworks circuit and hardware circuit that is an ALU and meets the following requirements
Inputs a and B and does the below functions and A and B are both 4 bit bumbers
Subtract A − B
and A AND B (bitwise AND)
or A OR B (bitwise OR)
nand A NAND B (bitwise NAND)
nor A NOR B (bitwise NOR)
SetLessThan 0001 if A < B, 0000 otherwise
SetGreaterThan 0001 if A > B, 0000 otherwise
The logical functions (and, or, nand, nor) are all bitwise. Cout is irrelevant

I can only use 74x153 multiplexers but I can use any AND or other functions but no more multiplexers

I figure if I can get the logic down I can design the circuit but the logic is hazy for me

#### Papabravo

Joined Feb 24, 2006
14,831
Each of those functions can be reduced to a boolean equation. That would be a good place to start. Do them all in parallel and select the output that you want with the mutiplexer. Is the problem that you can't write down the boolean equations or the truth tables for addition and subtraction?

#### Jetskileo

Joined Nov 12, 2007
1
I have the same assignment and I am also having problems with it. I understand how a multiplexer works and how a ripple adder works. I could build a 4 bit ripple adder for the addition and one that inputs the two's complement for the subtraction, then I could use a multiplexer to select which output to use based on the select inputs. I am only allowed to use two multiplexers and have to build the circuit and implement it it though and this circuit seems like it would be too big to fit on a proto board to build each adder/subtractor/and/or.. on its own. Is it possible to do these functions with the multiplexer? if so can you point me in the right direction? How would I build the equation to do this with a multiplexer? Thanks

#### Papabravo

Joined Feb 24, 2006
14,831
I suppose it depends entirely on the size of the proto board. The multiplexer by itself cannot perform the functions required of an adder and a subtractor.

For Henskie
The half-adder, used for the first stage has two inputs, A and B for the operands, and produces two outputs one for the sum and one for the carry.

The full-adder, used for the remaining stages, has three inputs, A and B for the operands and Ci for the carry in. It produces the same two outputs as the half adder.

The sum bit is always the exclusive OR of the inputs. I leave it to you to work out the boolean equation for the carry output.