This folder contains the test benches for the following modules:
- 2D Convolution
- Matmul Compute Unit
- Matmul DPU Unit
- Matmul Sram
- Matmul Inmem
This is the simple script that generate matrixes of size 4 by 4, for testing Matmul.
cd fxmath
pip install fxmath
cd .. & cd matmul_dpu
python mult.py
Script generates 4 * 4 matrix with random value of max length of 8 bit. The matmul_dpu_tb.txt
is basically the file with all the input values of matrix. First 4 lines are of Matrix A, and second 4 lines are of Matrix B and so on.. output_dpu_tb.txt
file has the result values after multiplication. Each line has only single 25 bit value.
Each line has 32 bit number, because we want 8 bit number and matrix is 4 * 4 so, 8 * 4 = 32.
cd fxmath
pip install fxmath
cd .. & cd conv2D
python conv.py
This script is used to test the matmul compute unit. It generates random matrixes of size 4 by 4 and then multiplies them. The result is then compared with the result generated by the matmul compute unit. The 'mat_A.txt' and 'mat_B.txt' contains the 4 * 4 input matrixes.
cd fxmath
pip install fxmath
cd .. & cd matmul_computeUnit
python main.py -genInput=1
Now run the vivado simulation and make sure the 'results.txt' file from vivado/matmul compute unit is in same folder and than run following command
python main.py -compRes=1
This script is used to test the matmul SRAM & INMEM unit. just need to give the input and output files it will compare both and find erros if there
cd fxmath
pip install fxmath
cd .. & cd mm_inmem
Now run the vivado simulation and make sure the 'results.txt' file from vivado/matmul compute unit is in same folder and than run following command
python main.py -compRes=1