BartlebyScrivener
Member level 5
- Joined
- Feb 8, 2012
- Messages
- 90
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Activity points
- 2,081
that guy from the url said:Frustrated at not knowing a good way to debug these errors, I beseeched Google to shed light on my ignorance, and Google did not disappoint.
Rather, embarrassingly the search result was an old version of the lecture slides for either ECE 337 or ECE 437 at Purdue !
The method (with some modifications I made) is as follows :
1. Under Simulation —> Runtime Options in Modelsim increase your Iteration Limit
2. Set Break points where you suspect the Combinational loop exists .
3. Step through your code at clock cycle (or half clock cycle to be safe) granularity
4. Now every line you step through is a part of the combinational loop.
Also, another Pro Tip my TA gave me was that, once you find the signal that is causing the loop, simply make it a register.
While that will get rid of your loop, it may throw of your timing so beware !
Code Verilog - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 input logic clk, input logic ce, input logic reset_n, input logic [0:N-1] i_request, // Active high Request vector output logic [0:N-1] o_grant); // One-hot Grant vector logic [0:N-1] l_priority; // One-hot Priority selection vector logic [0:N-1] l_carry; // Carry-bit between arbiter slices logic [0:N-1] l_intermediate; // Intermediate wire inside arbiter slice // Variable priority iterative arbiter slice generation. Final slice carry loops round. // ------------------------------------------------------------------------------------------------------------------ genvar i; generate for (i=0; i<N-1; i++) begin : PPE_SLICES or gate1 (l_intermediate[i], l_carry[i], l_priority[i]); and gate2 (o_grant[i], l_intermediate[i], i_request[i]); and gate3 (l_carry[i+1], l_intermediate[i], ~i_request[i]); end or gate1 (l_intermediate[N-1], l_carry[N-1], l_priority[N-1]); and gate2 (o_grant[N-1], l_intermediate[N-1], i_request[N-1]); and gate3 (l_carry[0], l_intermediate[N-1], ~i_request[N-1]); endgenerate // Round-Robin priority generation. // ------------------------------------------------------------------------------------------------------------------ always_ff@(posedge clk) begin if(~reset_n) begin l_priority[0] <= 1'b1; l_priority[1:N-1] <= 0; end else begin if(ce) begin l_priority <= |o_grant ? {o_grant[N-1], o_grant[0:N-2]} : l_priority; end end end
Code Verilog - [expand] 1 2 3 4 5 always_comb begin for(int i=0; i<NODES; i++) begin s_i_data_val[i] = s_i_data[i].valid; end end
I am reaching an iteration limit with my design under certain conditions using Modelsim. I have been looking on line and the only way I see people debugging this is to manually read through code and look for errors. My code is monsterous. Is there no other way to find out what is causing the failure?
It has made me think though, is it necessarily bad to have a lot of combinational logic in a design? SHould I be avoiding it, or should I just be more careful?!
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?