A Verilog module has three main parts:
- Module declaration – Name and port list
- Port definitions – Input/output specifications
- Module body – The actual hardware description
module module_name (
// Port list
input wire clk,
input wire rst_n,
input wire [7:0] data_in,
output reg [7:0] data_out
);
// Internal signals
wire [7:0] internal_wire;
reg [7:0] internal_reg;
// Module body: logic, instantiations, etc.
assign internal_wire = data_in;
always @(posedge clk) begin
data_out <= internal_wire;
end
endmodule