0% found this document useful (0 votes)
14 views

USER DEFINED PRIMITIVE Verilog Codes

user defined primitive verilog codes

Uploaded by

mansi010504
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

USER DEFINED PRIMITIVE Verilog Codes

user defined primitive verilog codes

Uploaded by

mansi010504
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 17

USER DEFINED PRIMITIVE

1. And gate UDP

primitive andgate(y,a,b); module tb;


input a,b; reg a,b;
output y; wire y;

table andgate dut(y,a,b);


// a b : y;

0 ? : 0; initial begin
? 0 : 0; a=0 ; b =0;
1 1 : 1; #2;
endtable a=0 ; b=1;
endprimitive #2;

a=1 ; b=0;

time= 0 , a = 0 , b = 0 , y=0 #2;


time= 2 , a = 0 , b = 1 , y=0 a=1 ; b=1;
time= 4 , a = 1 , b = 0 , y=0
time= 6 , a = 1 , b = 1 , y=1 #2;

end

initial begin

$monitor("time=%d , a = %b , b = %b , y=%b "


, $time,a,b,y);

end

endmodule
2. OR gate UDP

primitive orgate(y,a,b); module tb;


input a,b; reg a,b;
output y; wire y;

table orgate dut(y,a,b);


//a b : y;

0 0 : 0; initial begin
? 1 : 1; a=0 ; b =0;
1 ? : 1; #2;
endtable a=0 ; b=1;
endprimitive #2;

a=1 ; b=0;

#2;

a=1 ; b=1;
time= 0 , a = 0 , b = 0 , y=0 #2;
time= 2 , a = 0 , b = 1 , y=1
time= 4 , a = 1 , b = 0 , y=1 end
time= 6 , a = 1 , b = 1 , y=1

initial begin

$monitor("time=%d , a = %b , b = %b , y=%b "


, $time,a,b,y);

end

endmodule
1. And gate UDP
USER DEFINED PRIMITIVE

1. And gate UDP


USER DEFINED PRIMITIVE

1. And gate UDP


1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy