A parameterizable Sequential Restoring Divider implemented in SystemVerilog and verified using the Cocotb Python verification framework. The design uses a finite state machine (FSM) to perform iterative restoring division, producing both quotient and remainder.
This project implements the restoring division algorithm as a sequential hardware design. Unlike combinational dividers, the operation is performed over multiple clock cycles using a finite state machine, making the design area-efficient and suitable for digital hardware implementations.
The divider is parameterized by operand width and supports configurable data sizes through a SystemVerilog parameter.
- Parameterizable operand width
- Sequential restoring division algorithm
- FSM-based control logic
- Quotient and remainder generation
- Active-low asynchronous reset
- Cocotb-based verification
- Exhaustive functional testing
rtl/
└── divider.sv
| Module | Description |
|---|---|
divider.sv |
Parameterized sequential restoring divider with FSM-based control |
The divider operates using a simple three-state finite state machine.
+------+
| IDLE |
+------+
|
i_start = 1
|
▼
+---------------+
| DIVIDING |
+---------------+
|
count == 0
|
▼
+----------+
| DONE |
+----------+
|
▼
IDLE
For each clock cycle, the divider performs the following operations:
- Shift the accumulator and dividend.
- Compare the accumulator with the divisor.
- Subtract the divisor if the accumulator is greater than or equal.
- Shift the quotient and insert the computed quotient bit.
- Repeat until all bits have been processed.
| Signal | Width | Description |
|---|---|---|
i_clk |
1 | System clock |
i_rstn |
1 | Active-low reset |
i_dividend |
D_WIDTH | Dividend |
i_divisor |
D_WIDTH | Divisor |
i_start |
1 | Starts division operation |
| Signal | Width | Description |
|---|---|---|
o_done |
1 | Operation complete flag |
o_quotient |
D_WIDTH | Computed quotient |
o_remainder |
D_WIDTH | Computed remainder |
The design is verified using the Cocotb framework.
tb/
└── test_divider.py
The testbench:
- Generates a clock and reset
- Starts a division operation
- Waits for the
o_donesignal - Reads the quotient and remainder
- Compares the hardware output against Python's integer division
quotient = dividend // divisor
remainder = dividend % divisorThe verification performs exhaustive testing for all valid input combinations.
For a 4-bit divider:
- Dividend: 0 – 15
- Divisor: 1 – 15 (division by zero excluded)
Every result is compared against the expected mathematical output.
Sequential-Restoring-Divider/
│
├── README.md
│
├── rtl/
│ └── divider.sv
│
└── tb/
└── test_divider.py
- SystemVerilog
- Cocotb
- Python
- Icarus Verilog
- GTKWave
This project demonstrates:
- RTL Design using SystemVerilog
- Sequential Arithmetic Circuit Design
- Restoring Division Algorithm
- FSM Design
- Parameterized Hardware Design
- Cocotb-Based Functional Verification
- Python-Driven Hardware Testing
- Exhaustive Verification Methodology
Potential enhancements include:
- Signed Division Support
- Non-Restoring Division Algorithm
- Radix-4 Divider
- Pipelined Divider Architecture
- UVM-Based Verification
- Synthesis and Timing Analysis