MMA-Sim: Bit-Accurate Reference Model of Tensor Cores and Matrix Cores