Constraint inside multiple queues lead to solver timeout

Hi,

Now I have an inline constraint as below


assert(req.randomization with {
    req.operation inside {INSTRUCTION_RANGE_1, INSTRUCTION_RANGE_2, INSTRUCTION_RANGE_3}
})

and INSTRUCTION_RANGE_1/2/3 are queues of X86 instruction enumeration


operation_e INSTRUCTION_RANGE_1[$] = {PMULLD, PMULDQ};
operation_e INSTRUCTION_RANGE_2[$] = {PABSB, PABSW, PABSD};
operation_e INSTRUCTION_RANGE_3[$] = {PALIGNR};

the problem is the constraint solver would timeout in this form (I set the timer as 180 sec);
but if I combine these three queues in INSTRUCTION_RANGE_4 as


operation_e INSTRUCTION_RANGE_4[$] = {PMULLD, PMULDQ, PABSB, PABSW, PABSD, PALIGNR}

and constraint as


req.operation inside {INSTRUCTION_RANGE_4};

there’s no such timeout issue, is there any explanation on this? I’m not sure whether it’s vendor related or something else.

Thanks.

In reply to yhswarm:

With a few more lines of code, you could provide a complete example which demonstrates your issues.

The below code works fine on all 4 simulators on EDA Playground, with no performance issues. Perhaps there is something else in your code which is causing your problem.


typedef enum {PMULLD, PMULDQ, PABSB, PABSW, PABSD, PALIGNR} operation_e;

class instruction;
  rand operation_e operation;
  
  function new();
  endfunction
  
endclass

module testbench;
  operation_e INSTRUCTION_RANGE_1[$] = {PMULLD, PMULDQ};
  operation_e INSTRUCTION_RANGE_2[$] = {PABSB, PABSW, PABSD};
  operation_e INSTRUCTION_RANGE_3[$] = {PALIGNR};
  operation_e INSTRUCTION_RANGE_4[$] = {PMULLD, PMULDQ, PABSB, PABSW, PABSD, PALIGNR};

  instruction req;
  
  initial begin
    req = new();
    
    repeat (50) begin
      if (!req.randomize() with {
        operation inside {INSTRUCTION_RANGE_1, INSTRUCTION_RANGE_2, INSTRUCTION_RANGE_3};
      }) $display("Error randomizing req");
      else $display("req.operation is %s", req.operation.name());
    end
  end

endmodule

In reply to cgales:

Hi,

Thanks for your reply, the whole code is confidential and is stored locally, and the constraint block do have a bunch of other randomizations, I’ll try to figure this out in some other way.