Basics : Data types II

Integers

Integer is a register data type of 32 bits. The only difference of declaring it as integer is that, it becomes a signed value. When you declare it as a 32 bit register (array) it is an unsigned value. It is declared using the keyword integer.

Real Number

Real number can be declared using the keyword real. They can be assigned values as follows:
real VS;

VS = 1.234; // Decimal notation.
VS = 3e4; // Scientific notation.

Parameter

Parameters are the constants that can be declared using the keyword parameter. Parameters are in general used for customization of a design. Parameters are declared as follows:

parameter vs = 123; // vs is a constant with value 123.

Keyword defparam can be used to change a parameter value at module instantiation. Keyword localparam is usedd to declare local parameters, this is used when their value should not be changed.

Comments