hardware-design

Definition

Verilog

Verilog is a hardware description language used to model and implement digital circuits.

It describes hardware structure and behaviour at different abstraction levels.

Example

AND gate

A simple AND gate can be described as:

module and_gate (
  input  a,
  input  b,
  output y
);
  assign y = a & b;
endmodule

2x2 matrix multiplication

A simple 2x2 matrix multiplication can be described as:

module matmul_2x2 (
  input  [7:0] a00, a01, a10, a11,
  input  [7:0] b00, b01, b10, b11,
  output [15:0] c00, c01, c10, c11
);
  assign c00 = a00 * b00 + a01 * b10;
  assign c01 = a00 * b01 + a01 * b11;
  assign c10 = a10 * b00 + a11 * b10;
  assign c11 = a10 * b01 + a11 * b11;
endmodule