This repository contains the Verilog implementation of a simple microprocessor, built and tested using Vivado. The project includes modules for an ALU, register file, and a top-level control unit.
-
4-Bit Register File:
- Four general-purpose registers (
register1,register2,register3,register4) for storing operands. - Read and write operations controlled by
read_selandwrite_selsignals. - Reset functionality to initialize registers to default values.
- Four general-purpose registers (
-
Arithmetic Logic Unit (ALU):
- Performs 12 basic operations, including arithmetic, logic, and bit shifts.
- Supports addition, subtraction, multiplication, division, AND, OR, XOR, XNOR, and NOT.
-
Control Signals:
write_enable: Controls write-back to the register file.zero_flagandcarry_flag: Indicate zero results and carry conditions.
-
Timing Constraints:
- Proper constraints have been applied to ensure robust synthesis and timing closure.
- Constraints defined in
microprocessor_constraints.xdcfile, included in the repository.
The top-level module that integrates:
- Register File: For data storage and operand retrieval.
- ALU: For performing arithmetic and logic operations.
- Contains four 4-bit registers with default values assigned.
- Supports:
- Read: Two operands can be selected using
read_sel1andread_sel2. - Write: Data can be written to a specific register using
write_sel.
- Read: Two operands can be selected using
- Performs arithmetic and logic operations based on a 4-bit opcode (
alu_op):alu_opOperation Description 0000Add operand1 + operand20001Subtract operand1 - operand20010Multiply operand1 * operand20011Divide operand1 / operand20100AND operand1 & operand20101OR `operand1 0110XOR operand1 ^ operand20111XNOR ~(operand1 ^ operand2)1000NOT ~operand11001Right Shift operand1 >> 11010Left Shift operand1 << 1
A testbench (microprocessor_tb.v) is provided to verify functionality. It:
- Stimulates the microprocessor with various inputs.
- Verifies:
- Correct ALU operations.
- Proper register read and write-back behavior.
- Flag conditions (zero and carry).
-
Synthesis:
- The design was synthesized in Vivado to generate a gate-level netlist.
- Output netlist file:
microprocessor_design.
-
Reports:
- Timing Report: Pre-layout timing results are stored in
microprocessor_timing_report.txt. - Resource Utilization Report: FPGA resource usage is documented in
microprocessor_utilization_report.txt.
- Timing Report: Pre-layout timing results are stored in
-
Constraints:
- Timing and design constraints are defined in
microprocessor_constraints.xdc:- Clock period.
- Input/output delays.
- Reset setup requirements.
- Timing and design constraints are defined in
-
Pre-Layout STA:
- Timing analysis confirmed no setup or hold violations.
- Results verified for a clock period of
5.8 ns.