Saturday, 28 March 2015

DELAYS

Net Delay

module netdelay(x,y);

input x; 

output y; 

wire #2 nn; 

not (nn,x); 

buf y = x;  

endmodule

module tst_netdelay ;

reg x; 

wire y; 

netdelay nd(x,y); 

initial

begin

 x =1'b0; 

#6 x =~x; 

end

initial #20 $stop; 

endmodule

module to demonstrate different delays for rise and fall times on a net.

module netdelay1(x,y); 

input x; 

output y; 

wire #(2,1) nn; 

not (nn,x); 

y=nn;

endmodule

module tst_netdelay1; //test-bench 

reg x; 

wire y; 

netdelay1 nd(x,y); 

initial

begin

 x =1'b0; 

#6 x =~x; 

end

initial #20 $stop; 

endmodule

Gate Delay

module gade(a,a1,b,c,b1,c1);

input b,c,b1,c1; 

output a,a1; 

or #3gg1(a1,c1,b1); 

and #(2,1)gg2(a,c,b); 

endmodule

module tst_gade();//test-bench 

reg b,c,b1,c1; 

wire c,c1; 

gade ggde(a,a1,b,c,b1,c1); 

initial

begin

b =1'b0;c =1'b0;b1 =1'b0;c1=1'b0; 

end

always

begin

#5 b =1'b0;c =1'b0;b1 =1'b1;c1=1'b1; 

#5 b =1'b1;c =1'b1;b1 =1'b0;c1=1'b0; 

#5 b =1'b1;c =1'b0;b1 =1'b1;c1=1'b0; 

#5 b =1'b0;c =1'b1;b1 =1'b0;c1=1'b1; 

#5 b =1'b1;c =1'b1;b1 =1'b1;c1=1'b1; 

#5 b =1'b1;c =1'b1;b1 =1'b1;c1=1'b1; 

end

initial $monitor($time , " b= %b , c = %b , b1 = %b ,c1 = %b , a = %b ,a1 = %b" ,b,c,b1,c1,a,a1); 

initial #30 $stop; 

endmodule


No comments:

Post a Comment