MatrixForge: A high-performance VHDL coprocessor designed for 3×3 matrix multiplication operations using a column-by-column processing approach with integrated control and processing units.
MatrixForge is a specialized hardware coprocessor implemented in VHDL that performs matrix multiplication on two 3×3 matrices. The system calculates the element-wise product of corresponding matrix positions column-by-column and accumulates the results to produce a single scalar output value.
MatrixForge computes the following operation:
Matrix A: Matrix B:
[255, 200, 100] [1, 0, -1]
[ 5, 46, 180] × [1, 0, -1] = -220
[100, 200, 300] [1, 0, -1]
Calculation: 255×1 + 5×1 + 100×1 + 200×0 + 46×0 + 200×0 + 100×(-1) + 180×(-1) + 300×(-1) = -220
MatrixForge consists of three main components working in synchronization:
- Data Registers: Two 3×3 integer arrays storing input matrices
- Instruction Registers: 15-element array of 16-bit instruction codes
- Result Register: Stores the final computation result
- Performs multiply-accumulate operations
- Manages data flow between registers and ALU
- Handles result accumulation and output
- Finite State Machine (FSM) implementation
- Instruction fetch, decode, and execution control
- Generates control signals for all system components
| Opcode | Instruction | Description |
|---|---|---|
0x0001 |
LOAD | Fetches operand from data registers to processing unit |
0x0002 |
MUL/ADD | Multiplies loaded values and accumulates result |
0x0003 |
STORE | Saves final result to destination register |
entity Coprocessor is
Port (
clk : in STD_LOGIC;
coprocessorResult : out INTEGER
);
end Coprocessor;entity RegisterFile is
Port (
clk : in STD_LOGIC;
pc : in INTEGER;
i, j : in INTEGER;
X_out, W_out : out INTEGER;
instruction : out STD_LOGIC_VECTOR(15 downto 0);
result : in INTEGER;
readData, regRead, regWrite : in STD_LOGIC
);
end RegisterFile;entity ProcessingUnit is
Port (
clk : in STD_LOGIC;
X_in, W_in : in INTEGER;
accout : out INTEGER;
writeResult, loadData, aluEnable : in STD_LOGIC
);
end ProcessingUnit;entity ControlUnit is
Port (
clk : in STD_LOGIC;
pc : buffer INTEGER;
i, j : buffer INTEGER;
instruction : in STD_LOGIC_VECTOR(15 downto 0);
readData, regRead, regWrite, aluEnable, writeResult, loadData : out STD_LOGIC
);
end ControlUnit;- Xilinx ISE Design Suite or compatible VHDL simulator
- Basic understanding of VHDL and digital design principles
MatrixForge/
├── Coprocessor.vhd # Top-level module
├── RegisterFile.vhd # Memory and register management
├── ProcessingUnit.vhd # Arithmetic operations
├── ControlUnit.vhd # FSM control logic
├── CoProcessor_TestBench.vhd # Simulation testbench
├── DigitalProject.xise # Xilinx project file
├── assets/ # Documentation images
├── ProjectDescription.pdf # Original specifications
└── Report.pdf # Detailed technical report
- Open Project: Load
DigitalProject.xisein Xilinx ISE - Synthesize: Run synthesis on the
Coprocessorentity - Simulate: Execute the
CoProcessor_TestBenchtestbench - Verify: Check that
coprocessorResultoutputs-220
Simulation Results:
- Signal: coprocessorResult
- Value: -220
- Status: PASS ✅
- Clock Frequency: Synchronous operation with configurable clock
- Latency: ~10 clock cycles for complete matrix operation
- Resource Utilization: Optimized for FPGA implementation
- Reset: Asynchronous reset capability
- Initialization: Load matrices into data registers
- Instruction Fetch: Control unit reads instruction from program memory
- Decode: Instruction decoded to determine operation type
- Execute: Processing unit performs multiply-accumulate operations
- Store: Final result written to output register
MatrixForge includes a comprehensive testbench (CoProcessor_TestBench.vhd) that:
- Initializes the system with test matrices
- Provides clock stimulus
- Verifies correct output computation
- Reports simulation results
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Here's how you can help:
- 🍴 Fork the repository
- 🌿 Create a feature branch (
git checkout -b feature/amazing-feature) - 💾 Commit your changes (
git commit -m 'Add amazing feature') - 📤 Push to the branch (
git push origin feature/amazing-feature) - 🔄 Open a Pull Request
- 👤 Author: Erfan Nourbakhsh
- 🌐 Project Link: https://github.com/erfan-nourbakhsh/MatrixForge
- 📝 Issues: Report bugs or request features
- 💼 LinkedIn: erfan-nourbakhsh
🎯 Successfully computes 3×3 matrix operations in hardware!
MatrixForge - Built with ❤️ for educational purposes in digital design and hardware programming



