Gate Level Modeling
Gate Level Modeling |
Although the circuit behaviour in verilog is normally specified using assignment statements, in some cases modeling the circuit using primitive gates is done to make sure that the critical sections of circuit is most optimally laid out.
Verilog has built in primitives like gates, transmission gates, and switches to model gate level simulation. To see how the gate level simulation is done we will write the Verilog code that that we used for comparator circuit using primitive gates.
|
This example does the same fuction as the previous example, but we have used primitive gates in this example
Explanation |
The primitive
not (x_, x);
creates a not gate with x as input and x_ as output. All primitives has at least two parameters. The first parameter is output and other parameters are input. The statement
and(p, x,y);
creates an AND gate with two inputs and one output.
You can simulate the code with same stimulus that we did in the previous example, which is reproduced here.
|
And it produces the same output
x=0,y=0,z=1
x=1,y=0,z=0
x=1,y=1,z=1
x=0,y=1,z=0
In the next page we will learn about User Defined Primitives ( UDP).