Author Archive

Array Constraint Write a constraint for an array of numbers such that the size of array ranges from 6 to 15 elements, and even index locations should have odd numbers and odd index locations should have even numbers, numbers rage is between 16 to 127 In order to address the given constraints for an array, […]

Hi everyone, Thank you for your support! In our constraint articles, I’ve discussed an efficient way to determine whether a number is even or odd. Understanding this concept can greatly help when writing constraints that involve generating even, odd, or numbers divisible by specific values like 4 or 8. Let’s break it down: Even Number: […]

In order to achieve the requested constraint, we first need to understand the difference between rand and randc variables. Rand: By defining a variable as rand, it becomes an active variable when you randomize the object created for the class where the variable is defined. While randomizing, it will take possible values that obey the […]

When using the randc keyword in SystemVerilog, a variable is declared to have cyclic randomization behavior. This means the variable will not repeat a value until it has cycled through all possible values within its range. SystemVerilog internally keeps track of the values that have been generated for randc variables to ensure uniqueness. To maintain […]

Constraint for a variable i) on every 2nd randomization the value should be the reverse of the previous value ii) otherwise the value ranges from 500 to 10,000 First, let’s clarify the constraint. We want a variable’s value to range from 500 to 10,000 on every odd randomization. Additionally, on every odd randomization, the value […]

In order to solve the above constraints, we first need to understand what a palindrome number is. A palindrome number is a number that reads the same forwards and backwards. For example, 121 and 1331 are palindrome numbers because they remain the same when their digits are reversed. As it is not possible or very […]