|
|
|
|
|
|
|
|
|
|
|
|
Register
|
|
|
Registers are unsigned variables with the value 0, 1, z, or x. |
|
|
|
|
|
Syntax reg variable_name [=initial_value]; |
|
|
|
|
|
Specifies the initial value for the declared variable. If this specification is omitted, the initial value of the declared variable is x (unknown). |
|
|
|
|
|
|
|
|
|
|
|
Example : Register
|
|
|
|
|
|
1 program reg_t {
2 // Declare
3 reg i;
4 // Declare and init value
5 reg [7:0] j = 8'b10xZ_01zX;
6 // Declare multiple and assign
7 reg [7:0] m,n,o,p = 100;
8 // Print all the values
9 printf("value of i %b\n",i);
10 printf("value of j %b\n",j);
11 printf("value of m %b\n",m);
12 printf("value of n %b\n",n);
13 printf("value of o %b\n",o);
14 printf("value of p %b\n",p);
15
16 }
You could download file reg_t.vr here
|
|
|
|
|
|
Simulation : Register
|
|
|
|
|
|
value of i x
value of j 10xz01zx
value of m xxxxxxxx
value of n xxxxxxxx
value of o xxxxxxxx
value of p 01100100
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Copyright © 1998-2014 |
Deepak Kumar Tala - All rights reserved |
Do you have any Comment? mail me at:deepak@asic-world.com
|
|