This repo contains my labs for SJTU EE0503. All implementations are under the directory src (src/main for soruce code, src/test for corresponding test code).
To run the tests, please first make sure that your current working directory is EE0503. Given test class named GEMMMTEST of package EE0503LAB, run the following command in your terminal to test your implementation
sbt "testOnly EE0503LAB.GEMMMTEST"If you would like to generate the digital waveform as well, then use
sbt "testOnly EE0503LAB.GEMMMTEST -- -DwriteVcd=1"-
Lab2implements a vector dot product machine with Finite State Machine (FSM). -
Lab3implements square matrix multiplication of matrix$A$ ,$B$, which is read from memory, and write the final result matrix $ C=A*B $ back to the memory. -
Lab4implements general matrix multiplication (GEMM) of matrix $A_{mk}$ and $B_{kn}$ in two different ways.
Lab4plus(packageLab4plus) implements GEMM using blocking technique. The size of each block is specified by thecfg.matSize, which is not necessarily a common divisor of$m$ ,$k$, and$n$ , thus, padding is integrated to solve corner cases during execution.
Lab4s(packageLab4s) uses a systolic array to realize matrix multiplication, which improves the throughput of the module greatly (more specifically, runtime of matrix multiplication is now$O(mk+kn+mn)$ , whereas in the previous implementation, it would be $O(mkn)$).