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

Why performance counters don’t start counting right away #17

Closed
Liyang131313 opened this issue Jan 22, 2019 · 1 comment
Closed

Why performance counters don’t start counting right away #17

Liyang131313 opened this issue Jan 22, 2019 · 1 comment
Labels
Type:Question Questions

Comments

@Liyang131313
Copy link

Hello, I would like to ask, why the program has been executed for a while during the simulation process, and the performance counters will start working. Instead of starting work immediately during system startup.
Is it because the firmware code is being executed? Does the performance counter work require firmware? If the firmware code is not executing, what is the operation, causing the performance counters to not start working immediately?

2019-01-17 07-10-03
2019-01-17 07-19-13
@zarubaf @Razer6 @wallento

@vogelpi
Copy link
Contributor

vogelpi commented May 27, 2019

Hi @Liyang131313 ,
the behavior of the performance counters PCCR_q[0] - PCCR_q[10] are controlled by the two registers:

  • PCER: the performance counter enable register has one bit per counter to decide if that particular counter is enabled (1) or disabled (0). This register is mapped to TSELECT @ CSR 0x7a0.

  • PCMR: the performance counter mode select register has two bits

    • Bit 0 globally enables (1) or disables (0) all performance counters,
    • Bit 1 globally controls whether the counters should saturate (1) or overflow (0).

    The PCMR is mapped to TDATA1 @ CSR 0x7a1.

After a reset, all counters are disabled (PCER = '0, but PCMR = 2'h3). Your program first writes 2 to the PCER meaning the instruction counter in PCER_q[1] is enabled. In addition, your program is writing 3 to the PCMR.

Consequently, only PCER_q[1], i.e., the instruction counter, should be active, which is what you can see in the traces.

Best regards,
Pirmin

@imphil imphil closed this as completed May 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type:Question Questions
Projects
None yet
Development

No branches or pull requests

3 participants