Even or Odd detection - A simple question

Discussion in 'Homework Help' started by bjerkset, Nov 9, 2009.

  1. bjerkset

    Thread Starter New Member

    Nov 8, 2009
    5
    0
    Good day fellows :)

    I am trying to design a combinational logic circuit which has four inputs (A,B,C,D) and one output ( say G), that is one iff the input is greater then one and is divisible by 2. The real problem for me is that the input is a decimal number, so i suspect that i will have to somehow convert this input to binary as a first step.

    I also have realized that if a binary number is divisible by 2, the least signifigant bit will be zero.

    I assume that i will have to impliment using a multiplexer of some sort but am really unsure beyond that point.

    Any help or ideas is grealy appreaciated.
     
  2. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Why don't you start by generating a truth table of your inputs and desired outputs?

    You've learned about truth tables, right?

    Then try to express the output in Boolean algebra, and simplify it.

    As far as decimal to binary - construct a truth table of all the possible bit combinations for a valid 4-bit decimal number, and another truth table of all the possible bit combinations for a valid 4-bit binary number. Then compare the two to determine what, if any, conversions you might need to make.

    Then show us your work.
     
  3. bjerkset

    Thread Starter New Member

    Nov 8, 2009
    5
    0
    Thanks for your help, ill certainly try what you have suggested, however something tells me there is an easier way.
     
  4. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    If you start with a truth table, you will then know what should happen with any possible input.

    Then you use Boolean logic to simplify it.

    It may take a while to go through the steps, but if done properly you will simplify the logic considerably.
     
  5. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    You have solved the problem. All you need is to tie an inverter to the LSB. Zero is an even number also ;)
     
  6. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    It is not a complete solution yet. Our OP must also determine whether the number is greater than 1.
     
  7. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    But in that case so will the LSB be one and not zero therfore not a even number. Or am I wrong?
     
  8. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    The LSB must be zero in order for the 4-bit number to be even.
    Additionally, at least one of the remaining bits must be non-zero to satisfy the "> 1" criteria.
     
  9. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    657
    That's a BIG hint.:)

    Also - four bit decimal numbers are just a subset of 4 bit binary numbers
     
  10. JDT

    Well-Known Member

    Feb 12, 2009
    658
    85
    Basically you have already answered it in your text.

    Greater than 1 - B+C+D
    Divisible by 2 - LSB = 0
    Then AND
    negate
     
  11. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Congratulations - you FAILED! :eek:

    Close, though.
     
  12. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
  13. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    If the "greater than one" check is skipped, the answer will be wrong; as >1 is a part of the problem statement.
     
  14. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    Signed or unsigned?

    Is the output high on an even number or an odd number? What about numbers between 1 and 3?
     
  15. JDT

    Well-Known Member

    Feb 12, 2009
    658
    85
    The fact that zero is also "even" is irrelevant as it is not greater than 1.

    iff = "if and only if"

    I should not have had the final negate though. Doh!

    Correct?
     
  16. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    In a 4-bit number? Can't say I've seen one; a range of -8 to 7 wouldn't have much utility. Since the problem statement did not include a sign, it would be safe to assume an unsigned number.

    High on an even number greater than 1, otherwise low.

    Answered above.
     
  17. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    Ok, I got the answer Sgt is looking for.

    test for >=1, then LSB=0:1?even
     
Loading...