ΣSigmaStudio Ask AI Русский Log in

Cycle counter in SC58x sharc

Processors & DSP macci77 Apr 12, 2016 00:00 4 replies Original on forum ↗
Thread Summary

Thread Summary

The user asked how to see the value of the EMUCLK cycle counter in real time when using Crosscore for the Sc58x. The solution provided was to use the CCES library functions for cycle counting, including the `START_CYCLE_COUNT` and `STOP_CYCLE_COUNT` macros. However, the user encountered compiler errors with CCES 2.2.0 and resorted to using assembly code to read the EMUCLK register directly. A working project was provided to help resolve the issue.
AI Generated Content
Subscribe
macci77 Question
Apr 12, 2016 00:00

When using Crosscore for Sc58x, I understand the EMUCLK register is the cycle counter.

How can I see its value in real time?

ADIApproved Reply
Apr 12, 2016 00:00

Hello,

CCES library provides functions to measure cycle counts. This internally uses the EMUCLK register

#include <cycle_count.h>

//Include the preprocessor switch ‘DO_CYCLE_COUNTS’ in the compiler preprocessor settings

//Declare variables of the type cycle_t

cycle_t start_count1,final_count1;

START_CYCLE_COUNT(start_count1);

<code/ data access for which the cycle count has to be measured>

STOP_CYCLE_COUNT(final_count1,start_count1);

//The cycle count will be stored in the variable final_count1, print the value of the variable if required

Check the ‘CCES Help’ for complete information on the different ways to measure cycle count.

Let me know if this works

Regards,

Mahesh

macci77 Reply
Apr 13, 2016 00:00

Thanks

I tried that for some time, but the compiler isn’t too happy. I am using CCES 2.2.0

I get this when I put in the code:

And from the red line under the var, start_count1 – I get this: Invalid redeclaration of 'START_CYCLE_COUNT(start_count1)'

From the yellow line under the MACRO I get: Statement has no effect 'START_CYCLE_COUNT(start_count1)'

So if you have an idea of how to deal with this I will very much appreciate it. In the mean time I am using assembly:

asm ("%0 = EMUCLK;" : "=d" (cycleStart));

ADIApproved Reply
Apr 19, 2016 00:00

Hello,

I have attached a working project which can be used for measuring the cycle counts.

Let me know if this helps

Regards,

Mahesh

EZAdministrator Reply
Aug 2, 2018 00:00

This question has been assumed as answered either offline via email or with a multi-part answer. This question has now been closed out. If you have an inquiry related to this topic please post a new question in the applicable product forum.

Thank you,
EZ Admin