Notes
Notes
datatypes
literls
port connection
abstraction levels
heirachical modeling
system task and function
compile directives
task and function
clock generation
fork join
looping constructs
scalars and vectors
arrays
prodecdural blocks
delays constructs
primitives
operators
events
o datatypes
integer, reg , wire ,real, time ,realtime,tri wand wor
o reg [7:0]a;
integer b;
intital begin
a=-12 ;
b=-12 ;
$display(" a=%0d b=%0d ",a,b);
end
o real
DEAFULT SIZE - 64
ex:
module top;
real a;
real b ;
real c;
initial begin
a=10;
b= 3.0 ;
c=a/b; //
$display(" reuslt c=%0f ",c);//3.00
end
endmodule
time and realtime datatypes
which can able to store the current time in the varaibles
o tri a ;
module top;
tri a;
reg b ;
assign a=b?1'b1: 1'bz ;
endmodule
o real a;
a='d10;//2 ,10
reg [N*8-1:1] a;
a = NAME;
a ="NAME";
variable = <SIZE>'<RADIX><VALUE>;
ex:
reg [3:0]a;
//asssign value in octal
a=4'o1010;
//asssign value in hexa
a=4'ba;/wrong
a=4'ha;
a= 'ha;
a= 'h1;
o port connection
o abstraction levels
o heirarical modeling
implemeting bigger modules usin g smaller module
ex:
module tri(
input en;
input data_i;
inout data_o;
);
assign data_o=en? data_i:1'bz;
endmodule
system task
o $display,$monitor,$write,$strobe,$value$plusargs,$finish,$stop
o $display,$monitor,$write,$strobe
- all are used to print hte display statements
ex:
initial begin
a=100;
$strobe(" a=%0d ",a);//100
#1;
$strobe(" a=%0d ",a);//200
a=200;
#2;
$display(" a=%0d ",a);//200
end
o system function
- $time ,$realtime,$random,$urandom ,$urandom_range