1
$set_values


$set_values places values into the storage elements of a Verilog-XL 
design. You can use it to set storage elements to an initial value at the 
beginning of simulation, or to place the values into the storage elements 
once the simulation has started.


You can designate the storage elements individually or by scope. If you 
designate the storage elements by scope, $set_values will traverse the 
heirarchy below that scope and set all the storage elements in it.


1.1	
Invoking $set_values


$set_values is a Verilog-XL system task, so it can be invoked from the 
command line, or in a Verilog prodedural block. Here is the syntax of the 
invocation.


    $set_values("value", <<storage elements>,>?, <<module pairs>,>?);


"value" is a string that can contain a binary value 
(including Xs and Zs) or the keyword "random".


<storage elements> is a comma seperated list of identifiers which 
point to legal storage elements. $set_values will place value into each of 
these storage elements.


<module pairs> are made up of a module identifier and a selection 
string. 


The module identifier designates the top module of a hierarchy. 


The selection string tells $set_values which types of storage elements 
receive value. You can specify that only register datatypes should receive 
value, or sequential UDP's or both. Memories are not supported by 
module pairs.


The selection string is case insenstitive and has the following possible 
values:


o	"u"	Only change sequential UDPs.

o	"r"	Only change register data types.

o	"ur" or "ru"	Change both.


If you don't specify a selection string, $set_values will assume "ur".


1.1.1
Size mismatches


If you try to store value into an element of a different width the following 
will happen:


o	If value is smaller than the element, value will be right justified 
        and the left part of the element will be 0 filled.


o	If value is wider than the element, then the left part of value will 
        be truncated.


1.2	
Examples


The following examples illustrate some $set_values usages:


Interactively set all the register data types in mod1 to 2:

		  C1> $set_values("10", mod1, "r");


Set reg big_val to 0xAz:

		$set_values("xxxx1010zzzz", big_val);


Randomize all the register data types in module data_mod:

		$set_values("random", data_mod, "r");


Interactively clear register PC and all the UDP's in module cpu:

		 C1> $set_values("0", PC, cpu, "u");


Clear all the registers and udps in module uart:

			$set_values("0",uart);

