This project demonstrates the implementation of a 4-bit adder in Verilog using three different modelling styles: behavioral, dataflow, and structural. Each implementation is accompanied by a corresponding testbench for simulation and verification.
βββ behavioural/ β βββ 4-bit adder behavioural.png # Simulation waveform β βββ adder_behavioural.v # Verilog code - Behavioral modeling β βββ testbench_behavioural.v # Testbench for behavioral model
βββ dataflow/ β βββ 4-bit adder dataflow.png # Simulation waveform β βββ adder_dataflow.v # Verilog code - Dataflow modeling β βββ testbench_dataflow.v # Testbench for dataflow model
βββ structural/ β βββ 4-bit adder structural.png # Simulation waveform β βββ adder_structural.v # Verilog code - Structural modeling β βββ testbench_structural.v # Testbench for structural model
βββ README.md # Project overview and usage instructions βββ adder.pdf # Lab report documentation
Each Verilog file implements a 4-bit binary adder which performs the addition of two 4-bit inputs and produces a 4-bit sum and a carry-out. The testbenches apply a set of inputs and verify the correctness of the outputs via simulation.
- Behavioral Modeling: High-level description using procedural blocks.
- Dataflow Modeling: Describes the flow of data using continuous assignments.
- Structural Modeling: Builds the adder by interconnecting lower-level components like full adders.
- Clone the repository.
- Use any Verilog simulator (like ModelSim, XSIM, Icarus Verilog).
- Compile and simulate the testbench files:
iverilog -o test_behavioural testbench_behavioural.v adder_behavioural.v vvp test_behavioural
Replace filenames to simulate other modeling styles. π References
Digital Design by M. Morris Mano
Verilog HDL by Samir Palnitkar
π€ Author
Madhu Krishnan A P