Jump to content

unexpected behavior of incisiv with disable in for loop


Recommended Posts

Hi,

I am very new to this forum, so please pardon any decorum that i may have violated.

Here is the reference code : 

always @(posedge clk or negedge resetn)
begin
  if(~resetn)
  begin
    for(int j=0; j<64; j++)
      enable_data[j] <= 1'b1;
  end
  else
  begin
    if(data_accepted) 
      begin: ENABLE_DATA_BLOCK
         -> event_1;
         for (int k=0; k<64; k++)
           begin
              -> event_2;
              if (enable_data[k] && queue_pos_available[k])
                 begin
                     -> event_3;
                     enable_data [k] <=0;
                     -> event_4;
                     disable ENABLE_DATA_BLOCK;
                 end
           end // for loop
       end // if(data_accepted)
   end // else block
end // always...

While running the above code in incisiv (version incisiv/15.20.016) i am facing the following issue:
with all the condition being true that is data_accepted=1, enable_data[k]=1 and queue_pos_available[k]=1
enable_data[k] is not taking the assignment 0. event_3 and event_4 both are triggering. 

I ran the code by removing disable to break and the code ran correctly. So, i think there is a problem by using disable. I can't go with this fix as break is not synthesisable. My lint-run is not passing with the change of break

Thinking that there is a problem with the use of disable, i tried breaking the loop by setting the loop variable to its maximum value as:
.
.
.
if (enable_data[k] && queue_pos_available[k])
                 begin
                     -> event_3;
                     enable_data [k] <=0;
                     -> event_4;
                     k=64;  // i am using blocking statement as i wanted to break the loop immediately.
                 end
.
.

I want to add a point that the code is running fine with VCS and modelsim simulators. 

If any-one can direct me of what can be the issue here, it will be of real help. 
Thanks for your time.
 

Regards,

Shubham verma

Link to comment
Share on other sites

there are a few points to add here

 

1. since this a specific request for a particular tool please raise a request with your vendor 

2. fork/disable etc are subject process control and are very close to grey area's of the vlog spec and/or races - so you might see differences in behviour

3. a much better solution than to disable the block are one of the two following:

a) recode the for loop to a while loop 

>for (int k=0; k<64; k++)

int k=0; int flag=1;

while(k<64 && flag) do k++; ....  // set flag to break done

or 

B) wrap the for loop in a task and then terminate the task with a "return" upon the condition instead of a break

 

/uwe

Link to comment
Share on other sites

Hi uwe,

Thanks for your reply.

Please find my replies: 

On 1/16/2017 at 2:14 PM, uwes said:

. since this a specific request for a particular tool please raise a request with your vendor 

 

- i am trying to take the issue to incisiv team. My intention to ask here was to familiarize with any similarity anyone has faced

On 1/16/2017 at 2:14 PM, uwes said:

a much better solution than to disable the block are one of the two followi

i tried to use while loop but the issue seems to persist. I am trying different solutions to see if i am able to get ahead.

I will update if i found a way.

 

Thanks,

Shubham Verma 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...