Thursday, November 13, 2025

 Things to prepare : 

byte wise sorting a queue in system Verilog 

reverse a fifo

constraints related 


1. Few questions on writing constraints for certain scenarios. 2. FSM for number divisible by 3 3. UVM subscriber, sequences, TLM ports and FIFO. 4. write code for random number generation for given distribution and ranges. 5. byte addressing in an integer memory system. 6. constrain for non-overlapping segment-addresses generation. 7. Explain any testbench architecture you have worked on. 8. Lots of simple questions to test SystemVerilog and OOP concepts.



1.  have a 7 bit par_groups. Every time I randomize, I need to pick 3 groups that are unique and less than 32. Below is an example on how I did it.

Is there an better way to do it? This does not scale well. If I need to pick 15 unique groups from 32, this becomes a not so good solution.


Ans 

class example1;
 
  rand bit [6:0] par_groups; // why is this size different?
  rand bit[4:0] group[3];
 
  constraint group_c{unique {group};}
 
  constraint par_groups_c{par_groups inside {group};}
 
  function void post_randomize();
    $display("group = %p", group);
  endfunction  
 
endclass

No comments:

Post a Comment