Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Boolean help. adder and subtractor

  1. Jan 26, 2004 #1
    A boolean circuit has 4 inputs, a, b, cin and K. when K=0, the circuit is an adder. When K=1, the ciruit is a subtractor. WHere do I start? [?]
     
  2. jcsd
  3. Jan 26, 2004 #2

    Hurkyl

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Depends on what you're trying to do and what you already know. I imagine you want the circuit for your adder/subtractor, right?

    There are lots of ways to go:

    You could build an adder, a subtractor, and a chooser circuit.

    You could make a truth table and build the circuit from that.

    You could analyze the difference between the circuits of an adder and a subtractor and hack it to provide the toggling capability.
     
  4. Jan 26, 2004 #3
    i'm not trying to make a REAL circuit, I just need to know the boolean equation and schematic. I already know what full adder and subtractor look like. I just don't know how to toggle between the two with a 4th input K.
     
  5. Jan 26, 2004 #4

    Hurkyl

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Well, my post still applies if you replace "circuit" with "formula".
     
  6. Jan 27, 2004 #5
    not helping
     
  7. Jan 27, 2004 #6
    The inputs a and b are they 1 bit or buses?
     
  8. Jan 27, 2004 #7

    Hurkyl

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Well, there are two cases, right?

    K is false and the formula gives the output of an adder
    or
    K is true and the formula gives the output of a subtractor
     
  9. Jan 27, 2004 #8
    still not helping. ur just restating my question. I already know there are 2 cases and that k=0 then it is an adder.
     
  10. Jan 27, 2004 #9

    chroot

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Consider the naive approach: multiplex the outputs of each, as Hurkyl said.

    A two-bit multiplexor looks like this:

    (m & s) | (n & ~s)

    where & is AND, | is OR, and ~ is NOT. m and n are the two inputs, and s is the select signal.

    Does this make sense?

    If you want to make the simplest possible formula, replace m and n with the formulas for a 1-bit adder and a 1-bit subtractor. Finally, do all the boolean simplification you can.

    Another approach would be to write out a truth table for the whole design -- a K-map -- and do the normal K-map stuff to get the equation.

    - Warren
     
  11. Jan 27, 2004 #10

    Hurkyl

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    There's something special about the way I restated your question; it's directly translatable into a formula!


    Is the same as

    (~K & (formula for adder)) | (K & (formula for subtractor))
     
  12. Jan 27, 2004 #11
    Thanks i kinda get it now. what is "~"?
     
  13. Jan 28, 2004 #12
    it is another way of saying not...
    ~a = !a = not(a)
     
  14. Jan 28, 2004 #13
    not is an inverter right?
     
  15. Jan 28, 2004 #14

    chroot

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Yes, it's an inverter. David, you seem to be completely unprepared to handle this problem. Why? Are you in a class where this was asked? Are you not paying any attention to the lectures?

    - Warren
     
  16. Jan 28, 2004 #15

    Janus

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Here, I'll give you a hint to get you started:

    Think "2's compliment subtraction"
     
  17. Jan 30, 2004 #16
    I have been paying attention in class. It is just that my prof. cares so much about me and the students about getting a job after grad. that he teaches some extra stuff that we're not suppose to learn in ece 204. I'm not sure if I should cuss him out or thank him.
     
  18. Jan 31, 2004 #17
    what is a weighted code (BCD related) and how does it relates to gray code?
     
  19. Jan 31, 2004 #18

    chroot

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    BCD is simply using three binary digits to encode each digit of a decimal number.

    Gray code is a kind of code that allows a system to count in binary by making only one bit toggle between numbers. You can think of as just a variation on the normal counting.

    I'm assuming that "weighted code" is what you and I would call "normal" (non-Gray) coding, though most people just call that "binary."

    For example, a three-bit Gray code is:

    000
    001
    011
    010
    110
    100
    101
    111
    ...
    ...

    - Warren
     
  20. Jan 31, 2004 #19
  21. Feb 2, 2004 #20
    My teacher uses 4 bit to describe a number in base ten. My teacher wrote something like 2421 on top of the 4 bits bcd. U have any idea what the hell is 2421? I'll ask my teach if u can't answer. He also went over 9's complement and self complement. Wtf... He went to loco.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Boolean help. adder and subtractor
Loading...