top of page

Verilog Keywords and Cheat Sheet:

​

1. `and`:
   - Explanation: Performs a logical AND operation on inputs and produces an output.
   - Example: `wire out = a & b;`

2. `always`:
   - Explanation: Defines a block of code that executes continuously or triggered by specific events.
   - Example: `always @(posedge clk) begin /* Statements */ end`

3. `assign`:
   - Explanation: Specifies the continuous assignment of a value to a net or variable.
   - Example: `assign out = a & b;`

4. `begin`:
   - Explanation: Marks the beginning of a block of statements or the start of a procedural block.
   - Example: `begin /* Statements */ end`

5. `buf`:
   - Explanation: Instantiates a buffer that propagates the input signal to the output signal.
   - Example: `buf buffer_inst (.A(in), .Z(out));`

6. `bufif0`:
   - Explanation: Instantiates a buffer that propagates the input signal to the output signal if the control signal is low.
   - Example: `bufif0 buffer_inst (.A(in), .Z(out), .EN(enable));`

7. `bufif1`:
   - Explanation: Instantiates a buffer that propagates the input signal to the output signal if the control signal is high.
   - Example: `bufif1 buffer_inst (.A(in), .Z(out), .EN(enable));`

8. `case`:
   - Explanation: Provides a conditional branching structure based on the value of an expression.
   - Example: `case (sel) 2'b00: out = a; 2'b01: out = b; default: out = c; endcase`

9. `cmos`:
   - Explanation: Declares a CMOS transistor primitive.
   - Example: `cmos transistor_inst (.D(input), .G(gate), .S(source), .B(bulk));`

10. `deassign`:
    - Explanation: Unassigns a value from a net or variable, allowing it to assume its normal behavior.
    - Example: `deassign data;`

11. `default`:
    - Explanation: Specifies the default case in a conditional branching structure.
    - Example: `case (sel) 2'b00: out = a; 2'b01: out = b; default: out = c; endcase`

12. `defparam`:
    - Explanation: Assigns a value to a module parameter outside the module definition.
    - Example: `defparam MyModule.PARAM = 10;`

13. `disable`:
    - Explanation: Disables a named block or task, preventing it from being executed.
    - Example: `disable block_name;`

14. `else`:
    - Explanation: Specifies an alternative branch of code to execute when a preceding condition is false.
    - Example: `if (condition) begin /* Statements when condition is true */ end else begin /* Statements when condition is false */ end`

15. `endattribute`:
    - Explanation: Marks the end of an attribute block.
    - Example: `(* attribute_name = "value" *)`

16. `end`:
    - Explanation: Marks the end of a block, module, or procedural construct.
    - Example: `endmodule`

17. `endcase`:
    - Explanation: Marks the end of a case statement.
    - Example: `endcase`

18. `endfunction`:
    - Explanation: Marks the end of a function definition.
    -

 Example: `endfunction`

19. `endprimitive`:
    - Explanation: Marks the end of a primitive definition.
    - Example: `endprimitive`

20. `endmodule`:
    - Explanation: Marks the end of a module definition.
    - Example: `endmodule`

21. `endtable`:
    - Explanation: Marks the end of a table definition.
    - Example: `endtable`

22. `endtask`:
    - Explanation: Marks the end of a task definition.
    - Example: `endtask`

23. `event`:
    - Explanation: Declares an event variable that can be triggered by signal events.
    - Example: `event event_name;`

24. `for`:
    - Explanation: Initiates a loop that repeats a specific number of times or iterates over a range.
    - Example: `for (i = 0; i < 10; i = i + 1) begin /* Loop body */ end`

25. `force`:
    - Explanation: Assigns a value to a net or variable for simulation purposes, overriding normal behavior.
    - Example: `force data = 8'b10101010;`

26. `forever`:
    - Explanation: Initiates an infinite loop that continues indefinitely.
    - Example: `forever begin /* Loop body */ end`

27. `fork`:
    - Explanation: Creates parallel processes or threads within a procedural block.
    - Example: `fork begin /* Process 1 */ end, begin /* Process 2 */ end; join;`

28. `function`:
    - Explanation: Defines a function that performs a specific computation and returns a value.
    - Example: `function [7:0] adder(input [7:0] a, b); /* Function body */ endfunction`

29. `highz0`:
    - Explanation: Represents a high-impedance state (Z) for a signal with a weak pull-down strength.
    - Example: `wire [7:0] data = highz0;`

30. `highz1`:
    - Explanation: Represents a high-impedance state (Z) for a signal with a weak pull-up strength.
    - Example: `wire [7:0] data = highz1;`

31. `if`:
    - Explanation: Evaluates a condition and executes statements based on the result.
    - Example: `if (condition) begin /* Statements when condition is true */ end else begin /* Statements when condition is false */ end`

32. `initial`:
    - Explanation: Specifies a block of code to execute at the beginning of simulation.
    - Example: `initial begin /* Initial block statements */ end`

33. `inout`:
    - Explanation: Declares a port that can be used for both input and output operations.
    - Example: `inout wire io_pin;`

34. `input`:
    - Explanation: Declares a port used for input to the module or block.
    - Example: `input wire [7:0] data;`

35. `integer`:
    - Explanation: Declares a variable of integer data type.
    - Example: `integer count;`

36. `join`:
    - Explanation: Synchronizes and waits for all parallel processes or threads created by the fork statement to complete.
    - Example: `join;`

37. `large`:
    - Explanation: Specifies a large delay for a path in a timing analysis.
    - Example: `(* large *)`

38. `medium`:
    - Explanation: Specifies a medium delay for a path in a timing analysis.
    - Example

: `(* medium *)`

39. `module`:
    - Explanation: Defines a module, which is a building block of a Verilog design.
    - Example: `module MyModule (input a, output b); /* Module body */ endmodule`

40. `nand`:
    - Explanation: Performs a logical NAND operation on inputs and produces an output.
    - Example: `wire out = ~(a & b);`

​

bottom of page