This document summarizes gate-level modeling in Verilog. It describes how circuits are specified using logic gates and their interconnections. It lists the 12 basic gate primitives recognized by Verilog and explains gate instantiation. Examples are provided to demonstrate gate-level modeling of half adders, full adders, and multiplexers. Gate delays can also be specified in Verilog.
This document summarizes gate-level modeling in Verilog. It describes how circuits are specified using logic gates and their interconnections. It lists the 12 basic gate primitives recognized by Verilog and explains gate instantiation. Examples are provided to demonstrate gate-level modeling of half adders, full adders, and multiplexers. Gate delays can also be specified in Verilog.
This document summarizes gate-level modeling in Verilog. It describes how circuits are specified using logic gates and their interconnections. It lists the 12 basic gate primitives recognized by Verilog and explains gate instantiation. Examples are provided to demonstrate gate-level modeling of half adders, full adders, and multiplexers. Gate delays can also be specified in Verilog.
This document summarizes gate-level modeling in Verilog. It describes how circuits are specified using logic gates and their interconnections. It lists the 12 basic gate primitives recognized by Verilog and explains gate instantiation. Examples are provided to demonstrate gate-level modeling of half adders, full adders, and multiplexers. Gate delays can also be specified in Verilog.
Download as PPT, PDF, TXT or read online from Scribd
Download as ppt, pdf, or txt
You are on page 1of 13
Gate-Level Modeling
A circuit is specified by its logic gates and their
interconnection. Verilog recognizes 12 basic gates as predefined primitives. Instantiation is similar to module instantiation. But no definition is required. Basic gates-primitives and or xor nand nor xnor buf not bufif1, bufif0 notif1, notif0 buf/not and/or (Multiple- input gates) (Multiple- output gates) b d c a b c a b a and 0 1 x z 0 0 0 0 0 1 0 1 x x x 0 x x x z 0 x x x or 0 1 x z 0 0 1 x x 1 1 1 1 1 x x 1 x x z x 1 x x nand 0 1 x z 0 1 1 1 1 1 1 0 x x x 1 x x x z 1 x x x nor 0 1 x z 0 1 0 x x 1 0 0 0 0 x x 0 x x z x 0 x x Truth Table tri-state gates: bufif1, bufif0, notif1, notif0 a b c notif0 (a, b, c) e.g. bufif1 (a, b, c) e.g. a b c xor 0 1 x z 0 0 1 x x 1 1 0 x x x x x x x z x x x x xnor 0 1 x z 0 1 0 x x 1 0 1 x x x x x x x z x x x x buf not input output input output 0 0 0 1 1 1 1 0 x x x x z x z x bufif0 control input 0 1 x z data 0 0 z L L input 1 1 z H H x x z x x z x z x x notif0 control input 0 1 x z data 0 1 z H H input 1 0 z L L x x z x x z x z x x x={0,1,z} L={0,z} H={1,z} bufif1,notif1 ?? Gate Instantiation of And/Or Gates wire OUT, IN1, IN2; // basic gate instantiations. and a1 (OUT, IN1, IN2); nand na1 (OUT, IN1, IN2); or or1 (OUT, IN1, IN2); nor nor1 (OUT, IN1, IN2); xor x1 (OUT, IN1, IN2); xnor nx1 (OUT, IN1, IN2);
// More than two inputs; 3 input nand gate nand na1_3inp (OUT, IN1, IN2, IN3); // gate instantiation without instance name and (OUT, IN1, IN2); // legal for primitive gates Array of Instances
and n_gate[3:0](OUT, IN1, IN2);
This is equivalent to the following 4 instantiations and n_gate0(OUT[0], IN1[0], IN2[0]); and n_gate1(OUT[1], IN1[1], IN2[1]); and n_gate2(OUT[2], IN1[2], IN2[2]); and n_gate3(OUT[3], IN1[3], IN2[3]);
Examples 1)Half Adder SUM=XY CARRY= X.Y module add_half ( sum, carry, x, y ); input x, y; output sum, carry; xor (sum, x, y); and (carry, x, y); endmodule 2)Full Adder(1bit) SUM=ABCin Cout=A.B+Cin(AB) module fullAdder1 ( sum, c_out, a, b, c_in ); input a, b, c_in; output sum, c_out; wire n1, n2, n3; xor (n1, a, b); xor (sum, n1, c_in); and (n2, n1, c_in); and (n3, a, b); or (c_out, n2, n3); endmodule n1 n2 n3 3) 4bit Full Adder