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,201
1,809
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,201
1,809
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,936
1,229
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,201
1,809
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,936
1,229
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,201
1,809
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,012
681
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
87

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

File size:
2.3 KB
Views:
107
11. SgtWookie Expert

Jul 17, 2007
22,201
1,809
Congratulations - you FAILED!

Close, though.

May 11, 2009
5,936
1,229
13. SgtWookie Expert

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

14. thatoneguy Expert

Feb 19, 2009
6,349
732
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
87
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,201
1,809
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.