FWD Skill Zone
  • home
  • Power Electronics
    • Breadboard Power Supply
    • Variable Power Supply
    • DC to DC Boost Converter
  • Robotics
    • Braccio Robotic Arm
    • Voice-activated robotic arm
    • Smart Robot Car
    • Short Range Radar System
  • Machine Learning
    • Deep Learning
    • Transfer Learning
  • Arduino
    • Arduino 101
    • Arduino 102
    • Arduino 103
  • VHDL
    • Intro to VHDL
    • 2 to 4 Binary Decoder
    • 3 to 8 Binary Decoder
    • Universal Shift Register
  • Verilog
    • Intro to Verilog
    • Verilog Construction
    • Verilog Examples
  • Educational Links
  • Contact us
  • home
  • Power Electronics
    • Breadboard Power Supply
    • Variable Power Supply
    • DC to DC Boost Converter
  • Robotics
    • Braccio Robotic Arm
    • Voice-activated robotic arm
    • Smart Robot Car
    • Short Range Radar System
  • Machine Learning
    • Deep Learning
    • Transfer Learning
  • Arduino
    • Arduino 101
    • Arduino 102
    • Arduino 103
  • VHDL
    • Intro to VHDL
    • 2 to 4 Binary Decoder
    • 3 to 8 Binary Decoder
    • Universal Shift Register
  • Verilog
    • Intro to Verilog
    • Verilog Construction
    • Verilog Examples
  • Educational Links
  • Contact us

Verilog Construction - Behavioral Modeling

Verilog Module ​

A Verilog ​module is encapsulated inside the keyword "module" and "endmodule". It includes the inputs and outputs of the system and the description of the design behavior.
Example1: Pre-2001 Verilog style
The example below shows the pre-2001 Verilog style that uses the following syntax:
module <moduleName> (port_list); 
     // port definitions
     // behavior description
endmodule

Picture
Line #1 shows single line comment
Line #2 shows keyword "module", module name, and a port            name & direction. 
Line #3 shows remaining port name definitions.

Line #5 shows internal signal declaration

Line #8 thru 10 show the behavioral description 

Line # 12 shows the keyword "endmodule"

Example2: Post-2001 Verilog style
Example 2 shows the post-2001 Verilog style the uses the following constructs; (in this tutorial we will be using the post-2001 Verilog style.)
​module <moduleName> (<port_list and port_definitions>); 
     // behavior description
endmodule
Picture
Post-2001 Verilog allows the port name, direction, and type to be decolored together.  
​
- Each port needs to have a user-defined name.
- ​The port directions are declared to be one of the three types: input, output, or inout.
- A port can take on any of the data types, but only wires, registers, and integers are synthesizable.


Verilog Module ​Continuous Assignments

In Verilog, a continuous assignment is used to assign a value onto a wire. When the model is described using continuous assignments, each lines of code represent the behavior of the system. Therefore, each lines of code are executed concurrently. The order of the assignments does not matter. Any change in any of the right-hand-side (inputs) will immediately change a left-hand-side (output).
Example3: Continuous Assignments.
​Example 3 shows modeling combinational logics using continuous assignments.

​Let's use an arbitrary logical expression:
F = (A.B) + (A.C) + (B.C)
Here, three AND gates will be connected to an OR gate
therefore, we need three internal wires. Let's name them
AB, AC, and BC and these nets will be of "wire" data type.
Picture
Picture
Line #1 thru 4 show block comments

Line #5 shows the post-2001 Verilog style of port name, direction, and type declaration.

Line #9, internal signal definition of type wire

Line #12 thru 16 describe the behavior the logical expression F = (A.B) + (A.C) + (B.C)

 
Example4: Truth Table Implementation with Continuous Assignment.
​Example 4 shows modeling combinational logics using continuous assignments and direct interpretation of a truth table. This method is not cost effective as it uses more logic devices than example 3. Therefore, the truth table should be simplified using a K-map and the simplified logical expression should be used. However, this example is only demonstrating the capabilities of Verilog Hardware Description Language.
Picture

​Line #1 thru 16 uses the block comment to describe the problem statement and the truth table.

We can use only expressions resulting a logic "1" output to create an SOP expression. Therefore, we can use line #10, 12, 13, and 14 for the SOP equation.

​Line #18 and 19 show the port name, direction, and type declaration.

Line #22 implements the behavior of the module using continuous assignment and logical operators.
​
Next >> Verilog Examples​
Back << Intro to Verilog

PAGE TAGS AutoCAD CAD CATIA Digital Logic Matlab VHDL Links Programming Django Python


Next >> Verilog Examples​
Back << Intro to Verilog
  • home
  • Power Electronics
    • Breadboard Power Supply
    • Variable Power Supply
    • DC to DC Boost Converter
  • Robotics
    • Braccio Robotic Arm
    • Voice-activated robotic arm
    • Smart Robot Car
    • Short Range Radar System
  • Machine Learning
    • Deep Learning
    • Transfer Learning
  • Arduino
    • Arduino 101
    • Arduino 102
    • Arduino 103
  • VHDL
    • Intro to VHDL
    • 2 to 4 Binary Decoder
    • 3 to 8 Binary Decoder
    • Universal Shift Register
  • Verilog
    • Intro to Verilog
    • Verilog Construction
    • Verilog Examples
  • Educational Links
  • Contact us