This project is a Verilog implementation of a custom CPU designed with the following features:
- Stack: A dedicated stack for function calls and interrupt handling.
- GPIO (General Purpose Input/Output): Interfaces to interact with external peripherals.
- Timer: A hardware timer for time-based operations.
- Interrupt Handling: Supports hardware and software interruptions.
- AVR Instructions: Compatible with a subset of AVR microcontroller instructions.
- Purpose: Manages function calls, returns, and interrupt handling.
- Depth: Configurable depth for handling multiple nested calls.
- Ports: Configurable number of input/output ports.
- Direction Control: Each GPIO pin can be individually set as input or output.
- Functionality: Provides time-based interrupts and periodic operations.
- Modes: Supports countdown and overflow modes.
- Configuration: Adjustable timer period and prescaler values.
- Interrupt Types: Hardware and software interrupts supported.
- Prioritization: Configurable interrupt priority levels.
- Interrupt Vector Table: Maps interrupt requests to their service routines.
- Supported Instructions: Implements a subset of the AVR instruction set, including arithmetic, logical, and branching instructions.
- Registers: Emulates AVR register file for compatibility.
The CPU architecture includes the following components:
- Instruction Fetch Unit: Fetches instructions from program memory.
- Instruction Decode Unit: Decodes instructions into control signals.
- Execution Unit: Executes instructions and performs arithmetic and logical operations.
- Memory Unit: Interfaces with program memory and data memory.
- Interrupt Controller: Handles interrupts and manages the interrupt vector table.
- GPIO Controller: Manages input and output through GPIO pins.
- Timer Module: Implements the timer functionality.
- Stack Unit: Manages the call stack and interrupt stack.
- Tools Required:
- Either:
- Verilog simulator (e.g., ModelSim, XSIM)
- Or:
- FPGA synthesis tool (e.g., Vivado, Quartus) and FPGA board for hardware implementation.
- Support for additional AVR instructions.