Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Interview question: Divide by 5

Status
Not open for further replies.

spartanthewarrior

Full Member level 2
Joined
Jun 13, 2007
Messages
122
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,296
Activity points
2,142
Hi All,

There is a question, which was asked by me.

Question Is:

You a flip-flop to which serial bits are coming as an input. At output you have too look for a combination of bits whether the number is divisibal by 5 or not.

The input stream don't have any limitation on number of bits.
 

did you get the answer? I have been trying to solve it but kinda stuck!
 

OP, if you would rephrase the question and give us an example, we can understand it better.
 

Say the old data is D_old
the incoming digit is D_i
the new data is D_old*2+D_i

Assume you know the value of D_old%5, say it is D_old_mod5

Then the new D_old_mod5 is (D_old_mod5*2 + D_i)%5

Now we can set the initial states as
D_old = 0, D_old_mod5 = 0, D_i =0;

begin the process, update D_old and D_old_mod5 using D_i in every cycle.
When D_old_mod5 is 0, output 1 as D_old is divided by 5
 

That is a start, but how can you retain the value of D_old_mod5 for the next cycle if you only have one flop?

I feel bad for whatever sap was given this poorly worded question in an interview. How unfair.
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top