diff --git a/sw/applications/example_matadd/main.c b/sw/applications/example_matadd/main.c index 5e4069a2b..80fdb6555 100644 --- a/sw/applications/example_matadd/main.c +++ b/sw/applications/example_matadd/main.c @@ -30,16 +30,17 @@ int main() int N = WIDTH; int M = HEIGHT; uint32_t errors = 0; - unsigned int instr, cycles, ldstall, jrstall, imstall; + unsigned int instr, cycles; + + //enable mcycle csr + CSR_CLEAR_BITS(CSR_REG_MCOUNTINHIBIT, 0x1); CSR_WRITE(CSR_REG_MCYCLE, 0); //execute the kernel matrixAdd(m_a, m_b, m_c, N, M); - CSR_READ(CSR_REG_MCYCLE, &cycles) ; - - //stop the HW counter used for monitoring + CSR_READ(CSR_REG_MCYCLE, &cycles); errors = check_results(m_c, N, M); diff --git a/sw/applications/example_matfadd/main.c b/sw/applications/example_matfadd/main.c index e9eac70f0..ab2191bdf 100644 --- a/sw/applications/example_matfadd/main.c +++ b/sw/applications/example_matfadd/main.c @@ -117,11 +117,14 @@ int main() int N = WIDTH; int M = HEIGHT; uint32_t errors = 0; - unsigned int instr, cycles, ldstall, jrstall, imstall; + unsigned int instr, cycles; //enable FP operations CSR_SET_BITS(CSR_REG_MSTATUS, (FS_INITIAL << 13)); + //enable mcycle csr + CSR_CLEAR_BITS(CSR_REG_MCOUNTINHIBIT, 0x1); + CSR_WRITE(CSR_REG_MCYCLE, 0); //execute the kernel