Sie sind auf Seite 1von 11

By:-

Abhinav Vishnoi
Assistant Professor
Certain identifiers that start with the
`(backquote) character are compiler directives
A compiler directive, when compiled, remains
in effect through the entire compilation
process
Examples:
`define, `undef
`ifdef, `else, `endif
`default_nettype
`include
`resetall
timescale
`celldefine, `endcelldefine

`define, `undef
The `define directive is used for text substitution
Example:
`define MAX_BUS_SIZE 32
.
reg [`MAX_BUS_SIZE -1:0] AddReg;
The `undef directive removes the definition of a previously
defined text macro
Example:
`define WORD 16

wire [`WORD:1] Bus;
.
`undef WORD
`ifdef, `else and `endif
Example:
`ifdef WINDOWS
parameter WORD_SIZE=16;
`else
parameter WORD_SIZE=32;
`endif
// `else directive is optional with the `ifdef directive
`default_nettype
This directive used to specify the net type for implicit
net declarations, that is, for nets that are not declared
Example:
`default_nettype wand
`include
The `include compiler directive can be used to include
the contents of any file in-line
Example:
include ../../primitives.v
`resetall
This compiler directives resets all compiler
directives to their default value
For Example, this directive causes the default net
type to be wire
`resetall
`timescale
In verilog HDL model, all the delays are expressed in
terms of time units
The association of time units with actual time is done
using the timescale compiler directives
Syntax:
`timescale time_unit/time_precision
-Where the time_unit and time_precision is made up of
values from 1, 10, and 100
And
- Units form s, ms, us, ns, ps
Example:
timescale 1ns/100ps
module AndFun(Z, A, B);
output Z;
input A, B;
and #(5.22, 6.17) A1(Z,A,B);
endmodule
`celldefine and `endcelldefine
These two directives are used to mark a module as
a cell module
Example:
`celldefine
module FD1S3AX (D, CK, Z);

endmodule
endcelldefine
$display, $strobe, $monitor
These commands have the same syntax, and
display text on the screen during simulation.
$display and $strobe display once every time they
are executed, whereas $monitor displays every
time one of its parameters changes.
Syntax
$display ("format_string", par_1, par_2, ... );
$strobe ("format_string", par_1, par_2, ... );
$monitor ("format_string", par_1, par_2, ... );
$time, $stime, $realtime
These return the current simulation time as a 64-
bit integer, a 32-bit integer, and a real number,
respectively.
$reset, $stop, $finish
$reset resets the simulation back to time 0;
$stop halts the simulator and puts it in the
interactive mode where the user can enter
commands;
$finish exits the simulator back to the operating
system.

Das könnte Ihnen auch gefallen