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.

Conditional statement in SV for loop

Status
Not open for further replies.

surisingh

Member level 1
Member level 1
Joined
Jun 14, 2007
Messages
32
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Visit site
Activity points
1,499
Hi,
I need to implement one logic in System verilog. Here is the snippet of code:

for(int i=0; i<max_count; i++) begin
if(aid_queue == bid_queue[bid_count] && queue_index != i) begin
queue_index = i;
end

Here initially queue_index is high value, say 32'hFFFFFFFF, I need to search the entire aid_queue for the particular value.
once the value is found, i am setting the queue index to that index, say the matching index is 5.

When next time this loop encountered, I need to search the entire aid_queue EXCEPT the queue index 5. Now if the
value matches and the queue index is 7, next time i have to search the entire queue EXCEPT the queue index 5 AND 7 and so on...

How can I do that in SV using just for and if loop.

Thanks
Suri
 

Obviously, the used indices have to be remembered in a bit array.

The real problem is beyond the simple behavioral coding question. Although you can describe the intended behaviour in HDL, e.g. System Verilog, it may be effectively impossible to synthesize it in parallel logic with reasonable effort.
 

Can you explain why you have the requirement to implement with just a for and if loop? Does your code need to be synthesizable? Are you allowed to add more registers? When you say "the next time the loop is encountered" what kind of loop is this loop nested in?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top