Theory

  1. Why Constraints are required?
    1. Constraints make sure that inputs applied to the design are valid.
    1. Constraints make sure that we focus each test on a specific feature of the design.
  1. Failure cause
    1. Conflicting constraints
    1. Some non rand variable used in constraints
    1. vsim top -solvefailtestcase -solvefaildebug=2
  1. What is the significance of new() in randc ?
    1. If we use pkt=new, it will reset the randc behavior.
  2. Can we write constraints inside a module? If not why?
    1. Constraints are dynamic in nature. Module is static in nature.
  1. What are all the types of constraints? Explain those.
    1. Simple constraints
    1. Distribution constraints
    1. Implication constraints
    1. If-else constraints
    1. Iterative constraints
    1. Variable ordering constraints
    1. Soft constraints
    1. Uniqueness constraints
    1. Inline constraints
  1. What is an in-line constraint? Examples of In-Class constraints?
    1. Constraints used inside generator or sequence at the time of transaction randomize is called in-line constraint.
  1. What is uniqueness constraints?
    1. Constraints that generate unique values to the variables inside the unique set
  1. What are distribution constraints?
    1. Constraints that are used to constraint a variable value based on the weightage.
  1. What are iterative constraints?
    1. Used for applying constraints on arrays using foreach construct.
  1. How will you assign range of values to a variable?
    1. {[a:b]}
  1. What is inverted inside?
    1. It is used for negative constraints
    1. Constraining values outside the range

Easy

MEDIUM

  1. Question variation: 5-1’s and 5-0’s repeating pattern

Difficult

7       0       0       0

11     27     0       0

57     63     92     0

107   117   290   700

  1. Write a constraint to generate two dynamic arrays such that array1 size = [6:9], array2 size = array1 size. Array 1 should be assembled in ascending order while array2 should have all the values picked from array1
  1. Write a constraint on a 4 bit variable such that the probability of values being the same on the lower two bits have only 5% chance
  1. write a constraint for generating leap years
  1. a. Matrix size should be randomized with only odd numbered square matrix. b. Each sub square matrix should have only one max element and rest less than max and can be repetitive c. Max elements of each square sub matrix should be unique, mean no two sub matrix should have same max element d. Constraint Should scale up to any size of limited by 32 bit
  1. Write a constraint for a 10 bit variable so that; -> 10% of the time 1 bit in en is high -> 10% of the time 2 bits in en are high … -> 10% of the time all 10 bits in en are high.
  1. Write a constraint to generate a number which has binary all 1s grouped together
  1. Write a constraint to randomly map elements from an array into N non-empty queues
  1. write code so each element from input_array appears in output_queues, no output queue should be empty
  1. The dynamic array size should be 300 and the elements in it can be 0,1,2,3,4,5. Each element should occur atleast 40 times in the array. Also, there shouldn’t be 0’s consecutively.
  1. Write a constraint for distinct adjacent element (adjacent elements should not be the same) in a 2d array (specifically for the boundary elements size of 2d array is mxm where m can be any integer)
  2. Write a constraint for a 2d array such that it has a unique max value in each row and that max value should not be equal to any other max value in other rows
  1. Generate a parameterized array whose values are equal to a Magic square using constraints
  1. How to write a constraint to generate a random value of 10 bits as 1 and no two bits should be next to each other. This should be written without using $countones.
  1. Write SV constraint to limit sum of odd elements of an array to be 30 and sum of even elements to be 60
  1. Write constraint for number to be power of 4.
  1. Write a constraint that generates Add, mul, sub, nop instructions. Such that no Add instruction is repeated in 3 clock cycles and sub is not repeated in the last 3 valid instructions. Nop is not a valid instruction
  1. Write a SV constraint to generate 2 3×3 matrices s.t the min value in each matrix is unique
  1. Write a SV constraint for a tic tac toe game. Matrix size is 3×3.
  1. Write a constraint for square matrix and then rotate 90 counter clock wise
  2. Say you have 4 instructions: ADD, SUB, MUL, NOP.
  1. They execute in X cycles, Y cycles, Z cycles, and 1 cycle respectively.
    1. How would you generate a constraint to inject these into a design so that two like instructions don’t overlap during the same period of time
    1. Bonus: Is there a way you could generate this without using SV constraints
  1. Write system verilog constraints for the eight queens problem? Write system verilog constraints for the Knight’s tour problem.
Course Registration