From WikiChip
Verilog
Revision as of 09:30, 26 March 2018 by AleksandarK (talk | contribs)

Verilog is a hardware description and a verification language designed for describing, modeling and simulating digital circuits. It is used in early front-end IC design.

History

Verilog has a few iterations: Verilog 95, Verilog 2001, Verilog 2005 and SystemVerilog. All of the new revisions have added something new and useful. The latest update was a SystemVerilog(SV). It was declared that SV is a superset of Verilog, and it is backwards compatible with it. That means that all of Verilog code can be run in SystemVerilog simulators and design tools. Only thing that SV added is better Verification methodology like UVM and OVM style of testbenches.

Syntax

Verilog is a static, weakly typed style language similar to C in some aspects. It is case sensitive(meaning that there is difference between "a" and "A"), has preprocessor and has control flow keywords(allowing for if,else, for, while etc. statements to be implemented).

The basic look of every module is like the following:

module n //module name
  module n declaration //declaration of the ports
endmodule //ending

In Verilog, you use // to add commentary on the line you wish to high lite

Now we are going to make basic AND gate. First, we need to know how the AND gate looks, what it does and how it operates. When you need to know that about some other module, but you don't, easiest way around it is to google the module. But when you find code, don't copy it, but rather study it. Write down the characteristics of it and start building the module in your head.

AND gate takes A and B input and combines them into output Y, so based on that we do the following

module andgate (a, b, y); // module name
  input a, b; //input of the module
  output y; //module output
  assign y = a & b; //assigned operation of the module
endmodule

We can note a few thing from this example. First, at the end of each line, we use semicolon(;). And second, you may notice that there is assign operation which tells the module what to do. In this case, it told the module that y equaled the sum of a & b

File type

Verilog is usign .v file system or .sv if SystemVerilog is in question