Verilog #3: Pre-Define Library In Verilog Programming

February 22, 2026

 

Hello Robonesians, if we compare Verilog HDL programming with VHDL programming, there are quite striking differences in terms of pre-defined libraries and the way both manage built-in resources.

 

3.1 Differences in the Concept of “Library” between VHDL and Verilog

VHDL has an explicit library system, namely “library” and “use”, with several pre-defined packages such as “ieee.std_logic_1164.all”, “ieee.numeric_std.all”, and so on. Each design must usually define the use of these libraries at the beginning of the code.

Verilog traditionally does not have the concept of explicit library declarations like in VHDL. Basic features such as signal types (wire, reg), logical operators, and programming constructs are readily available without the need for the keywords “use” or “import”.

This means, in Verilog programming:

  • We simply write “moduleendmodule” without mentioning the library, and all the basic constructs are ready to use.
  • The concept of a large pre-defined library is not as strict or formal as in VHDL programming.

 

3.2 Built-in Primitives in Verilog Programming

In Verilog programming, there is no pre-defined library like in VHDL programming, but there are built-in primitives whose function is similar to the standard components in the VHDL library.

 

Some examples of built-in primitive gates:

In addition, there are also switch-level modeling primitives such as “nmos”, “pmos”, and “cmos,” although they are rarely used in modern digital system design.

A complete discussion of predefined primitives in Verilog programming will be covered in a separate article. Please read the article titled ” Primitives in Verilog Programming”.

 

3.3 Libraries Provided by Vendors (Intellectual Property, IP)

Although in standard Verilog programming there is no known built-in library (Pre-Defined library) like in VHDL programming, in industrial practice, FPGA chip vendors (such as: AMD xilinx, Intel/Altera, Lattice, or Microchip) or IP core vendors provide “library files” in the form of a collection of modules in Verilog code format that are ready to use (For example for FIFO, PLL, memory, multiplier, DLL, and so on).

 

Examples of using external files:

The vendor’s library (IP) files are often stored in a dedicated project directory or Verilog program file (with the extension “.v”) that can be included into the Verilog program code using the “include” keyword. This “include” keyword is not for use as “library management” as in VHDL programming, but simply “text inclusion” like “#include” in C or C++.

From discussion points 3.1, 3.2, and 3.3, we can conclude that:

  • Verilog does not have a pre-defined library system like VHDL, but provides built-in primitives that can be used directly without library declaration.
  • For advanced functions, libraries are usually provided by FPGA/ASIC vendors in the form of additional Verilog files, not standard packages like in VHDL.

 

3.4 Comparison of Library & Resource Management between VHDL vs Verilog

Table 1 shows a comparison of VHDL programming with Verilog regarding library and resource management.

 

Table 1. Comparison of Libraries in VHDL vs. Verilog

 

From table 1 above, we can conclude that:

  • VHDL is more strict and formal: it requires declarations libraryand usefor all external resources, suitable for projects that prioritize rigor design.
  • Verilog is more concise: it does not require library declarations for basic components, but there is no built-in library management system for complex components; management is done using files or manual includes.

 

3.5 Example of a Comparison Program between VHDL and Verilog

Below are two examples of simple digital system design code with the same goal. Program 1 is written in VHDL, and Program 2 is written in Verilog, so we can see clearly:

  • How the code structure differs.
  • How does the use of libraries differ?

 

As an example, we will design a “4-bit synchronous counter” with synchronous reset.

Program 1: VHDL program code (4-bit synchronous counter)

Program 1 Explanation (VHDL):

  • Must declare ieee and use libraries to be able to use the std_logic package and unsigned data types in digital system design programs.
  • Data types like unsigned come from the numeric_std package, not the default.
  • There is a separation of entity (port definition) and architecture (behavior).

 

Program 2: Verilog program code (4-bit synchronous counter)

Program Explanation 2 (Verilog):

  • There is no library declaration.
  • Simple data types (reg or wire) are immediately available.
  • The ports and behavior of a digital system are usually combined into one module block.
  • Verilog program code is shorter than VHDL program code.

 

Table 2 provides a complete head-to-head comparison of steps & Complexity between VHDL programming and Verilog programming.

 

Table 2. Comparison of Steps & Complexity between VHDL and Verilog

 

This comparison informs us that VHDL programming is well-suited for developing digital system projects that prioritize type safety and explicit documentation. Verilog programming, on the other hand, is more suitable for digital system projects that focus on design speed, such as FPGA development at the prototyping level.

 

Author

Taufiq Dwi Septian Suyadhi

Degrees from electronics and industrial engineering. Enthusiast on electronics, embedded systems, and robotics. Motivation: “Never ending learning and sharing valuable knowledge to the others”.

Leave a Reply

Post Related

error: Content is protected !!