Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable mcycle in matadd examples #413

Merged
merged 1 commit into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions sw/applications/example_matadd/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
5 changes: 4 additions & 1 deletion sw/applications/example_matfadd/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down