Thursday, April 30, 2009

System Tasks

Verilog provides standard system tasks for certain routine operations. Operations such as displaying on the screen, monitoring values of nets, stopping, and finishing are done by system task. Other tasks are listed in Verilog manuals provided by simulator vendor.

Saturday, April 25, 2009

Strings

Strings can be stored in reg. The width of the register variables must be large enough to hold the string. Each character in the string takes up 8 bits or 1 byte. If the width of the register is greater than the size of the string, Verilog fills bits to the left of the string with zeros. If the register width is smaller than the string width, Verilog truncates the leftmost bits of the string. It is always safe to declare a string that is slightly wider than necessary.

Monday, April 20, 2009

Parameters

Verilog allows constants to be defined in a module by the keyword parameter. Parameters cannot be used as variables. Parameter values for each module instance can be overridden individually at compile time. This allows the module instances to be customized. Parameters types and sizes can also be defined. Module definitions may be written in terms of parameters. Parameters values can be changed at module instantiation or by using the defparam statement.

Wednesday, April 15, 2009

Memories

In digital simulation one often needs to model register files, RAMs and ROMs. Memories are modeled in Verilog simply as a one dimensional array of registers. Each element of the array is known as an element or word is addressed by a single array index. Each word can be one or moiré bits. It is important to differentiate between n 1 bit registers and one n bit register. A particular word in memory is obtained by using the address as a memory array subscript.

Saturday, April 11, 2009

Arrays


Arrays are allowed in Verilog for reg, integer, time, real, real time and vector register data types. Multi dimensional arrays can also be declared with any number of dimensions. Arrays of nets can also be used to connect ports of generated instances. Each element of the array can be used in the same fashion as a scalar or vector net. For multi dimensional arrays indexes need to be provided for each dimension.

Monday, April 6, 2009

Integer

An integer is a general purpose register data type used for manipulating quantities. Integers are declared by the keyword integer. Although it is possible to use reg as a general purpose variable, it is more convenient to declare an integer variable for purposes such as counting. The default width for an integer is the host machine word size, which is implementation specific but is at least 32 bits.