π Nanoprocessor (VHDL-Based Design)
A simple VHDL-based 8-bit nanoprocessor designed for implementation on Xilinx FPGA boards. This project supports basic instructions like MOVI, ADD, and JZR, and includes a test program to compute the sum of integers from 1 to 3.
π File Structure
nanoprocessor/
βββ nanoprocessor.xpr # Vivado project file
βββ nanoprocessor.srcs/ # Source directory
β βββ alu.vhd # Arithmetic Logic Unit
β βββ control_unit.vhd # Control Unit
β βββ datapath.vhd # Datapath Module
β βββ instruction_memory.vhd # ROM: Program Instructions
β βββ register_file.vhd # Register Bank
β βββ top.vhd # Top-Level Design
β βββ ... # Add other VHDL source files here
βββ nanoprocessor.sim/ # Simulation setup
β βββ testbench.vhd # Simulation testbench
β βββ waveform.wcfg # Optional waveform configuration
βββ README.md
βββ sum_program.asm # Assembly code example
β
Make sure to update the nanoprocessor.srcs/ section with your actual VHDL module filenames.
π§° Prerequisites Xilinx Vivado Design Suite (e.g., version 2019.1 or newer)
FPGA Board: e.g.,Basys 3
Optional: A UART interface or display modules for visual output
βοΈ Setup & Usage
- Clone the Repository bash Copy Edit git clone cd nanoprocessor
- Open in Vivado Launch Xilinx Vivado, then:
Go to File > Open Project
Select nanoprocessor.xpr
- Run Simulation Use Behavioral Simulation to test individual modules and the complete system.
Observe waveform results in .wcfg (optional).
- Synthesize & Implement Click Run Synthesis
Then Run Implementation
Finally, Generate Bitstream
- Hardware Verification Connect your FPGA development board.
Open Hardware Manager, connect to the device.
Program the FPGA with the generated bitstream.
Monitor outputs on LEDs, 7-segment displays, or UART.
π» Example Program: Sum of Integers 1 to 3 A simple program to compute 1 + 2 + 3 = 6 and store it in register R7.
assembly Copy Edit ; Goal: R7 = 1 + 2 + 3. R0 is always 0. ; R1 = 1, R2 = 2, R3 = 3, R7 = sum
MOVI R1, 1 ; R1 <- 1
MOVI R2, 2 ; R2 <- 2
MOVI R3, 3 ; R3 <- 3
MOVI R7, 0 ; R7 <- 0 (Initialize sum)
ADD R7, R1 ; R7 <- R7 + R1 (R7 = 0 + 1 = 1)
ADD R7, R2 ; R7 <- R7 + R2 (R7 = 1 + 2 = 3)
ADD R7, R3 ; R7 <- R7 + R3 (R7 = 3 + 3 = 6)
JZR R0, 7 ; Infinite loop to halt (R0 is always 0)
π This code is usually stored in your instruction ROM (instruction_memory.vhd) in binary or hex format.
