Detector of even numbers in logic circuit

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
24 replies · 7K views
Max0007
Messages
66
Reaction score
1

Homework Statement


I need to make a circuit that detects even numbers.
Need to find the equation for F when input A and B are both even.

Input A: Word of 5 -bit signed representation in complement 2.
Input B: Word of 3 -bit signed representation in complement 2.

Homework Equations


for B:
000 = 0 (even)
001 = 1
010 = 2 (even)
011 = 3
100 = -4 (even)
101 = -3
110 = -2 (even)
111 = -1

For A:
same as B but with 5 bits.

00000 = 0 (even)
00001 = 1
00010 = 2 (even)
00011 = 3
00100 = 4 (even)
00101 = 5
00110 = 6 (even)
00111 = 7
...
...
11111 = -1

The Attempt at a Solution



I am just wanting to know the steps on how I start this.

Do I do Karnaugh for both inputs then join both equation together?
 
Physics news on Phys.org
What feature of a number represented in binary (either unsigned or 2's complement) allows you to tell that it is odd or even? Don't need to convert it to decimal... There is something all even binary numbers have in common that allows you identify them as even.
 
lewando said:
What feature of a number represented in binary (either unsigned or 2's complement) allows you to tell that it is odd or even? Don't need to convert it to decimal... There is something all even binary numbers have in common that allows you identify them as even.
I realized that binary ending with a 0 = even and binary ending with 1 = odd.

So basically its F = /A/B ??
 
You are not interested in all of the binary digits of A or B. Just the least significant binary digit.
 
  • Like
Likes   Reactions: Max0007
lewando said:
You are not interested in all of the binary digits of A or B. Just the least significant binary digit.
How do I make my logic circuit to check only the least significant binary digit?
 
Max0007 said:
How do I make my logic circuit to check only the least significant binary digit?
if input B least significant bit = 0 then its an even number.
if input A least significant bit = 0 then its an even number.

If A and B = 0 then its an even number and F = 1

but how do I actually write this in an equation with gates?
 
Max0007 said:
if input B least significant bit = 0 then its an even number.
if input A least significant bit = 0 then its an even number.

If A and B = 0 then its an even number and F = 1

but how do I actually write this in an equation with gates?
Why do you have "If A and B = 0 then its an even number and F = 1" as a separate condition?

Why do you have the first two statements as independent statements? They are NOT true taken as stand-alone statements.

How do you combine all 3 statements into one statement?
 
  • Like
Likes   Reactions: Max0007
phinds said:
Why do you have "If A and B = 0 then its an even number and F = 1" as a separate condition?

Why do you have the first two statements as independent statements? They are NOT true taken as stand-alone statements.

How do you combine all 3 statements into one statement?
Sorry my english is not my primary language I did not meant to split it up in 2 condition, just that when A and B = 0 then the output is 1.
 
phinds said:
Why do you have "If A and B = 0 then its an even number and F = 1" as a separate condition?

Why do you have the first two statements as independent statements? They are NOT true taken as stand-alone statements.

How do you combine all 3 statements into one statement?
Here are my Kmap for input A and B.
 

Attachments

  • kmap1.jpg
    kmap1.jpg
    37.3 KB · Views: 881
  • kmap2.jpg
    kmap2.jpg
    33.6 KB · Views: 859
Max0007 said:
How do I make my logic circuit to check only the least significant binary digit?

Maybe this is the root of the problem. When you have to draw an actual circuit, how will you represent a 5-bit binary number? A 3-bit binary number? What will you draw?
 
phinds said:
You had it right in your statements and now you are complicating it. Why?
I don't know, but here the final equation:

F = /B0 * /A0
 
phinds said:
Really? How about when both numbers are odd?
if both numbers are odd it would output 0 since I am only checking the least significant bit. and the least significant bit in odd numbers will be 1. and 1 * 1 would output 0 since there are NOT gates in both inputs or am I wrong ?
 
Max0007 said:
if both numbers are odd it would output 0 since I am only checking the least significant bit. and the least significant bit in odd numbers will be 1. and 1 * 1 would output 0 since there are NOT gates in both inputs or am I wrong ?
Sorry, I got to thinking we were doing an adder output. You and lewando are both right and I'm wrong. Now *I* was over thinking it :smile:
 
phinds said:
Sorry, I got to thinking we were doing an adder output. You and lewando are both right and I'm wrong. Now *I* was over thinking it :smile:
No worries man, you helped me a lot today and these past days, I really appreciate it man. I just wish my teachers were a little bit better :(
 
phinds said:
Sorry, I got to thinking we were doing an adder output. You and lewando are both right and I'm wrong. Now *I* was over thinking it :smile:
one last thing :)
If an inverter has a 2 ns propagation delay , an AND logic gate has a 5 ns propagation delay and an OR gate has a 4ns delay , what is the maximum period required by the circuit in order to update the output F ?

would I just do 2ns x 2 sicne I have 2 inverter and 5ns x1 since I only have one then add up everything ? = 4+5=9ns ?
 
From a time-flow perspective, the inverters are operating in parallel of each other and the AND gate is in series with the inverters. You are correct to not consider a nonexistant OR gate. 9 ns would be incorrect. Rethink.
 
lewando said:
From a time-flow perspective, the inverters are operating in parallel of each other and the AND gate is in series with the inverters. You are correct to not consider a nonexistant OR gate. 9 ns would be incorrect. Rethink.
2+5= 7 then

I
 
lewando said:
Looks right!
how would I calculate it if I had 3 different gates in parallels?
 
lewando said:
The worst-case delay (longest) is dominant.
Nice awesome thanks.

I really learn a lot more here than in Class at the University so far.
:)
 
University for undergrad is often overly-difficult by design. You are wise to seek additional resources to complete your understanding. Keep up the good work!