1. Home
  2. /
  3. Verilog
  4. /
  5. Fibonacci Sequence

Fibonacci Sequence - Verilog Typing CST Test

Loading…

Fibonacci Sequence — Verilog Code

Generates first 10 Fibonacci numbers using registers and an array.

module Fibonacci(
	input clk,
	input reset,
	output reg [31:0] fib [0:9]
);

	integer i;

	always @(posedge clk or posedge reset) begin
		if(reset) begin
		fib[0] <= 0;
		fib[1] <= 1;
		end else begin
		for(i=2; i<10; i=i+1) begin
		fib[i] <= fib[i-1] + fib[i-2];
		end
		end
	end

endmodule

Verilog Language Guide

Verilog is a hardware description language (HDL) used to model, simulate, and design digital circuits such as CPUs, FPGAs, ASICs, and SoCs. Known for its C-like syntax, simplicity, and dominance in commercial chip design.

Primary Use Cases

  • ▸ASIC and SoC design
  • ▸FPGA development
  • ▸Digital logic design (ALUs, FSMs, DSP blocks)
  • ▸Processor architecture modeling
  • ▸Hardware simulation & verification

Notable Features

  • ▸C-like syntax (begin/end, if, case)
  • ▸Concurrent and procedural blocks
  • ▸Gate-level, RTL, and behavioral modeling
  • ▸Synthesizable hardware constructs
  • ▸Rich simulation capabilities

Origin & Creator

Developed in 1984 by Phil Moorby at Gateway Design Automation; standardized as IEEE 1364.

Industrial Note

Verilog powers most commercial semiconductor chips - including CPUs, GPUs, networking ASICs, and FPGA IP cores.

More Verilog Typing Exercises

Verilog Counter and Theme ToggleVerilog Simple AdditionVerilog FactorialVerilog Max of Two NumbersVerilog Array SumVerilog Even Numbers FilterVerilog String ConcatenationVerilog Conditional Counter IncrementVerilog Counter With Reset and Enable

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher