UNIT-5 Part 1
UNIT-5 Part 1
Unit-V
Hardware Description Language: VERILOG
Unit-V:
Hardware Description Language: Introduction to Verilog as HDL-gate
level, behavioral level and structural level modeling of logic circuits.
Verilog Operators
SIMULATION :
It is The Process of applying inputs and verifying the Outputs.
SYNTHESIS:
Translation of the debugged design into the corresponding
hardware circuit (using an FPGA or an ASIC) is called
"synthesis."
Programming Language
Interface(PLI)
PLI provides an active interface to a compiled Verilog module.
The interface adds a new dimension to working with Verilog
routines from a C platform.
The key functions of the interface are as follows:
One can read data from a file and pass it to a Verilog module as
input. Such data can be test vectors or other input data to the
module.
Similarly, variables in Verilog modules can be accessed and
their values written to output devices.
Delay values, logic values, etc., within a module can be accessed
and altered.
Blocks written in C language can be linked to Verilog modules.
Keywords
The keywords define the language constructs.
A keyword signifies an activity to be carried out, initiated, or
terminated.
As such, a programmer cannot use a keyword for any purpose
other than that it is intended for.
All keywords in Verilog are in small letters and require to be
used as such (since Verilog is a case- sensitive language).
All keywords appear in the text in New Courier Bold-type
letters.
Examples
module-signifies the beginning of a module definition.
endmodule-signifies the end of a module definition.
begin-signifies the beginning of a block of statements.
end -signifies the end of a block of statements.
if -signifies a conditional activity to be checked
while-signifies a conditional activity to be carried out.
Identifiers
Any program requires blocks of statements, signals, etc., to be
identified with an attached nametag. Such nametags are identifiers.
It is good practice for us to use identifiers, closely related to the
significance of variable, signal, block, etc., concerned.
This eases understanding and debugging of any program.
e.g., clock, enable, gate_1, . . .
There are some restrictions in assigning identifier names.
All characters of the alphabet or an underscore can be used as the
first character. Subsequent characters can be of alphanumeric type,
or the underscore (_), or the dollar ($) sign
for example
name, _name. Name, name1, name_$, . . .all these are allowed
as identifiers
name aa not allowed as an identifier because of the blank
( “name” and “aa” are interpreted as two different identifiers)
$name not allowed as an identifier because of the presence of
“$” as the first character.
1_name not allowed as an identifier, since the numeral “1” is
the first character
@name not allowed as an identifier because of the presence
of the character “@”.
A+b not allowed as an identifier because of the presence of
the character “+”
White Space Characters
Blanks (\b), tabs (\t) and newlines (\n) are the white space
characters in Verilog.
In any design description, the white space characters are included
to improve readability.
Functionally, they separate legal tokens. They are introduced
between keywords, keyword and an identifier, between two
identifiers, between identifiers and operator symbols, and so on.
White space characters have significance only when they appear
inside strings
Comments
It is a healthy practice to comment a design description liberally –
as with any other program.
Comments are incorporated in two ways. A single line comment
begins with “//” and ends with a new line
for example
module d_ff (Q, dp, clk); //This is the design description of a D
flip-flop.
//Here Q is the output.
// dp is the input and clk is the clock.
One can incorporate multiline comments also without resorting to
“//” at every line.
For such multiline comments “/*” signifies the beginning of a
comment and “*/” its end.
All lines appearing between these two symbol combinations are
together treated as a single block comment
for example
module d_ff (Q, dp, clk);
/* This module forms the design description of a d_flip_flop wherein
Q is the output of the flip-flop ,
dp is the data input and
clk the clock input*/
Multiline comments cannot be nested. For example, the
following comment is not valid.
/* The following forms the design description of a D flip-flop
/*which can be modified to form other types of flip-flops*/ with
clock and data inputs.*/
A valid alternative can be as follows:-
/* The following forms the design description of a D flip-flop
(which can be modified to form other types of flip-flops) with
clock and data inputs */
Numbers
Frequently numbers need to be specified in a design description. Logic
status of signal lines, buses, delay values, and numbers to be loaded in
registers are examples.
The numbers can be of integer type or real type.
1. Integer Numbers
2. Real Numbers
Integer Numbers
Integers can be represented in two ways.
In the first case it is a decimal number- signed or unsigned
an unsigned number is automatically taken as a positive number.
Some examples of valid number representations of this category
are given below:
2
25
253
-253