Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
12 years ago

clock cycles consumed by NIOSII C code

Hello,

I have a design implemented in NIOS processor. I am using DE1 board.

I want to calculate the performance/clock cycles consumed by my C code from some specified instruction to some specified instruction.

How can I do that.

Please help.

5 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,

    Please verify my procedure. I added a Interval Timer in Qsys. Regenerated the system and burned the new compiled .sof file.

    In NIOSII, i enabled hal.enable_gprof, assigned hal.sys_clk_timer & hal.timestamp_timer to timer in Qsys.

    Included PERF_BEGIN(0x5020,1); & PERF_END(0x5020,1); before and after the part of code I want to examine.

    Built the project and Run as NIOS II Hardware.

    But I am not getting anything on my console window. It was built successfully but finally NIOSII console remain all blank.

    I need to urgently come out of this.

    Please help
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    None of the changes you listed would have affected the console output. Are you able to single step through your code and see the printf()'s being executed?

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    If the code and data is read from tightly coupled memory it is possible to calculate the number of cycles from the object code.

    Except the dynamic branch prediction causes significant randomisation.

    Any data or instruction cache tranfsers will cause significant variations - even if you are counting the actual clock cycles.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hello everyone,

    Thank a lot. With all your help and guidance, I successfully implemented my project design.

    I finally calculated the performance using performance counter in Qsys.

    Regards,

    Anuj Agrawal