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.

Verilog doubt - sequential logic

Status
Not open for further replies.

pravi

Junior Member level 3
Joined
Sep 10, 2005
Messages
31
Helped
3
Reputation
6
Reaction score
1
Trophy points
1,288
Location
hassan
Activity points
1,530
verilog doubt

else
begin
previous<={previous[1:0],data};
seqfound<={previous==pattern_searched_for};
end
 

verilog doubt

What is your mean? NO syntax error in the code.
 

Re: verilog doubt

I think you are refering to the delay involved in generation of seqfound signal.

previous<={previous[1:0],data};
seqfound<={previous==pattern_searched_for};

When you change the value of previous signal, this value is available to seqfound expression in the next iteration of the flow. This is because you have declared the previous signal as reg. Try declaring it as wire. Hope that will solve your problem.
 

verilog doubt

It's maybe for sequence detection.
The register previous is to store input streem.
 

Re: verilog doubt

jnanabindu said:
I think you are refering to the delay involved in generation of seqfound signal.

previous<={previous[1:0],data};
seqfound<={previous==pattern_searched_for};

When you change the value of previous signal, this value is available to seqfound expression in the next iteration of the flow. This is because you have declared the previous signal as reg. Try declaring it as wire. Hope that will solve your problem.

As the non blocking assignments are used, the circuit should be a sequential logic, triggered by clock, so the changement in previous signal is available in next cycle.
If you want to describe a combitional logic, using blocking assignments, change the sensitive signals of the block.

previous =previous[1:0],data};
seqfound={previous==pattern_searched_for};

maybe:D
 

Re: verilog doubt

I think this is a sequence detector. The given code uses value of previous from the previous itteration in the current iteration loop. This leads to simulation mismatch before & after synthesis. Using the "=" is a solution but it is not recommended in HDL design. It is always better to use the "<=" if possible.
I think a better solution is to move the statement :
Code:
seqfound<={previous==pattern_searched_for};
outside the sequential statement context to a concuurent statement context.
Another good hint is to assign any variable within 1 & only one concurrent statement.
Regards,
Amraldo.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top