1
\$\begingroup\$

I'm doing my homework for digital logic in logisim. I need to make function solver for this function: f(x,y) = 6*y-8+x in 4bit arithmetic. Here is my solution but it is not working for some inputs. I don't know where I failed. I will be thankful if you can help me somehow :) Thanks

Solution: enter image description here

Edit: it is working, for example for 0000 for X, and 0101 for Y, but it is not working for 0000 and 1101. I need to get solution for function above

\$\endgroup\$
0

1 Answer 1

0
\$\begingroup\$

For one thing, you can't just use an OR port to subtract 8. The output of the OR port will always be 1, because one of its inputs is always 1. You're effectively ignoring the 4th bit of the multiplication and always put a 1 instead.

Besides that, if you are allowed to use an 6+ bit full adder that would simplify things of course. If I'm not mistaken, logisim also has a subtractor symbol that you could use for the -8 part. If you're not allowed to use these fancy components, you'll have to do something clever (for example, build them yourself - but there's an easier method).

Lastly, you mention you have to perform the operation in 4-bit arithmetic. By that, do you mean that inputs and outputs should have four bits, or only the inputs? Because if the first, you're calculating too much here; you have seven output bits.

\$\endgroup\$
2
  • \$\begingroup\$ I wanted to make some kind of check because if there are 2 "1" i need to carry one. i need to make it using only 4 bit adders and those things that i used sadly :/ only inputs has to be 4bit, outputs are 7bit because highest value is max 7bits \$\endgroup\$ Commented Jan 18, 2015 at 12:59
  • \$\begingroup\$ @user3478619 if you want to check for two 1, you'll want to use an AND port. The OR port checks for at least one 1. But you should also think about the scenario that the 4th bit from the multiplier is a 0 - then, you need to make the 5th bit a 0 (if it's a one), and the 4th bit a 1 (that is, subtract 16 and add 8). However, if the 5th bit is 0 as well, you'll need to subtract 32 and add 16 and 8, etc. Now it's your turn again - you know where the mistake is, we're not going to give you the full solution ;) \$\endgroup\$
    – user17592
    Commented Jan 18, 2015 at 13:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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