Verilog: Hardware Description Language
Verilog: Hardware Description Language
About Verilog
Along with VHDL, Verilog is among the most widely used HDLs. Main differences:
VHDL was designed to support system-level design and specification. Verilog was designed primarily for digital hardware designers developing FPGAs and ASICs.
VHDL
Provides some high-level constructs not available in Verilog (user defined types, configurations, etc.).
Verilog
Provides comprehensive support for low-level digital design Not available in native VHDL Range of type definitions and supporting functions (called packages) needs to be included.
3
Specifying Connectivity
There are two alternate ways of specifying connectivity:
Positional association The connections are listed in the same order add A1 (c_out, sum, a, b, c_in); Explicit association May be listed in any order add A1 (.in1(a), .in2(b), .cin(c_in), .sum(sum), .cout(c_out));
9
11
module using_wire (A, B, C, D, f); input A, B, C, D; output f; wire f; // net f declared as wire assign f = A & B; assign f = C | D; endmodule
12
module using_wired_and (A, B, C, D, f); input A, B, C, D; output f; wand f; // net f declared as wand assign f = A & B; assign f = C | D; endmodule
13
module using_supply_wire (A, B, C, f); input A, B, C; output f; supply0 gnd; supply1 vdd; nand G1 (t1, vdd, A, B); xor G2 (t2, C, gnd); and G3 (f, t1, t2); endmodule
14
Other differences:
In arithmetic expressions, An integer is treated as a 2s complement signed integer. A reg is treated as an unsigned quantity. General rule of thumb reg used to model actual hardware registers such as counters, accumulator, etc. integer used for situations like loop counting.
16
module simple_counter (clk, rst, count); input clk, rst; output count; reg [31:0] count;
always @(posedge clk) begin if (rst) count = 32b0; else count = count + 1; end endmodule
17
When integer is used, the synthesis system often carries out a data flow analysis of the model to determine its actual size.
Example: wire [1:10] A, B; integer C; C = A + B;