0
\$\begingroup\$

I'm building a 16-bit ALU that needs to be able to perform logical AND, OR, add, subtract and rotate one bit to the left.

I need to have addition and subtraction operate with different op codes through a mux. Right now I have my addition and subtraction going through the same output in my full adder.

Here's my 1-bit ALU slice. I'm wondering how I can alter it so I can have subtraction be it's own operation.

enter image description here

\$\endgroup\$
4
  • \$\begingroup\$ What are you confused about? \$\endgroup\$
    – user253751
    Oct 12 '20 at 17:09
  • \$\begingroup\$ I want to be able to have a separate output going into my 8:1 mux for subtraction. Right now I just have addition and subtraction going into the same mux input, but I need to have addition be op code 010, which is what it is now, but I need subtraction to be op code 110. \$\endgroup\$
    – Matt L.
    Oct 12 '20 at 17:27
  • \$\begingroup\$ Subtraction is just addition after taking the 2's complement of the subtrahend. And it looks like you already have all the pieces needed to implement 2's complement. \$\endgroup\$
    – The Photon
    Oct 12 '20 at 17:31
  • \$\begingroup\$ Just connect the ALU output to two MUX inputs. That's literally all. \$\endgroup\$ Oct 12 '20 at 18:52
0
\$\begingroup\$

I need to have addition be op code 010, which is what it is now, but I need subtraction to be op code 110

The output of the adder should split and go to both the '010' input and the '110' input. The op code value should also be used for additional logic gates that configure the adder for adding or subtracting.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.