Verilog data types are common keywords used to declare variables. All verilog datatypes are 4-state ie, X , Z , 1 & 0 . They are further divided into two categories; reg and wire . The most commonly used keywords are given below.
integer
real
realtime
reg
time
wire
trireg
tri
triand
trior
tri1
tri0
uwure
wand
wor
/* 1. reg (register): - Default value: 1'bx (unknown) for each bit in the reg. 2. wire (net): - Default value: z (high impedance or floating). 3. integer: - Default value: 32'bx (unknown 32-bit value). 4. real (floating-point): - Default value: 1.0 / 0.0 (NaN or Not a Number). 5. time (special integer type for simulation time): - Default value: 64'bx (unknown 64-bit value). */
/* 1. reg (register): - Default width: 1 bit (can be extended to multi-bit vectors). 2. wire (net): - Default width: 1 bit (can be extended to multi-bit vectors). 3. integer: - Default width: 32 bits. 4. real (floating-point): - Default width: 64 bits (IEEE 754 double precision). 5. time (special integer type for simulation time): - Default width: 64 bits. */
module top; //reg (register): reg A; //wire (net): wire B; //integer: integer C; //real (floating-point): real D; //time (special integer type for simulation time): time E; initial begin $display("Reg : %0d",A); $display("Wire : %0d",B); $display("Integer : %0d",C); $display("Real : %0d",D); $display("Time : %0d",E); end endmodule
module top; //reg (register): reg A; //wire (net): wire B; //integer: integer C; //real (floating-point): real D; //time (special integer type for simulation time): time E; initial begin $display("Reg : %0d",$bits(A)); $display("Wire : %0d",$bits(B)); $display("Integer : %0d",$bits(C)); $display("Real : %0d",$bits(D)); $display("Time : %0d",$bits(E)); end endmodule
module top; integer A; initial begin A = $urandom; A[31] = 0; $display("A : %0d", A); A[31] = 1; $display("A : %0d", A); end endmodule