OVP Forums - A community of assistance, help, questions, and answers.
  FAQFAQ    SearchSearch      RegisterRegister  ProfileProfile    Log in to check your private messagesLog in to check your private messages    Log inLog in
Instruction Count and Execution time
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Open Virtual Platforms Forum Index -> Ask a Question
View previous topic :: View next topic  
Author Message
ShyamShankar



Joined: 14 Jan 2015
Posts: 34
Location: Kalady

PostPosted: Mon Jun 15, 2015 7:19 am    Post subject: Instruction Count and Execution time Reply with quote

Hi,
I am using the ARM Cortex A9 model.
I have measured the instruction count and execution time, but am obtaining values extremely inaccurate.
The actual MIPS is nearly 200000. But the model has 100 MIPS by default.
Does this have anything to do with it??
Also since OVP is instruction accurate we can't provide the frequency.
Back to top
View user's profile Send private message
DuncGrah
OVP Technologist
OVP Technologist


Joined: 27 Feb 2008
Posts: 1656
Location: United Kingdom

PostPosted: Mon Jun 15, 2015 9:28 am    Post subject: Reply with quote

How do you know that the instruction count and execution time are "extremely inaccurate"?

This is an instruction accurate simulation that should be used to develop software. It can be used, to a certain degree, for measuring how well an application may execute given a certain CrossCompiler toolchain, C libraries and a given architecture. It cannot give you the cycle accurate results that you would obtain on real hardware.

You can change the processor nominal MIPS, please see the documentation "OVPsim and CpuManager User guide" (this is really a guide to the ICM API)
Back to top
View user's profile Send private message Visit poster's website
ShyamShankar



Joined: 14 Jan 2015
Posts: 34
Location: Kalady

PostPosted: Mon Jun 15, 2015 7:41 pm    Post subject: Reply with quote

I had simulated matrix multiplication of 20X20 square matrices. On the actual hardware I got the instruction count in the range of 30000. But in OVP I get values of 600000. Does the instruction count have anything to do with OVP being instruction accurate .
Thanks
Back to top
View user's profile Send private message
DuncGrah
OVP Technologist
OVP Technologist


Joined: 27 Feb 2008
Posts: 1656
Location: United Kingdom

PostPosted: Tue Jun 16, 2015 12:47 am    Post subject: Reply with quote

If you a looking at the instructions executed from starting execution of you application at the reset vector to finishing at exit() I would expect the same result on the hardware and OVP.

Are you sure the hardware and the OVP processor model you are using are the same configurations?
Is it the same binary file you are running in both cases?

In OVP are you using printf() to display results? How are you displaying the results on the hardware?
Back to top
View user's profile Send private message Visit poster's website
ShyamShankar



Joined: 14 Jan 2015
Posts: 34
Location: Kalady

PostPosted: Tue Jun 16, 2015 7:31 am    Post subject: Reply with quote

I am displaying the results on hardware and software using printf().
And no I don't think I am able to measure the instructions of the application code alone. I had posted this elsewhere in the forum.
Back to top
View user's profile Send private message
DuncGrah
OVP Technologist
OVP Technologist


Joined: 27 Feb 2008
Posts: 1656
Location: United Kingdom

PostPosted: Tue Jun 16, 2015 7:40 am    Post subject: Reply with quote

You are running the same binary in both cases?
Back to top
View user's profile Send private message Visit poster's website
LeeMoore
OVP Technologist
OVP Technologist


Joined: 27 Feb 2008
Posts: 635

PostPosted: Tue Jun 16, 2015 1:07 pm    Post subject: Reply with quote

Hi
I am a little confused. What are you actually printing ?
How are you obtaining the instruction count on the hardware ?

Lee
Back to top
View user's profile Send private message
ShyamShankar



Joined: 14 Jan 2015
Posts: 34
Location: Kalady

PostPosted: Tue Jun 16, 2015 7:56 pm    Post subject: Reply with quote

Thank you all for replying.
I am simulating programs like array sorting and matrix multiplictions using the ARM Cortex A9 on the ZYNQ ZC702 evaluation board. The tool I am using for simulating the programs on the board is Xilinx SDK.
And yes I am using the same binary in both cases.(I mean the same program code in both cases).
I guess the difference would be because I am counting the instruction for the entire execution in OVP rather than for the application code alone. Its been said that to count instructions in a particular section in OVP, professional tool is required.
But could you tell me why the execution time too is different. Since, in OVP frequency cannot be set, how can I achieve accurate execution time results?? Is it possible??
Back to top
View user's profile Send private message
ShyamShankar



Joined: 14 Jan 2015
Posts: 34
Location: Kalady

PostPosted: Tue Jun 16, 2015 8:11 pm    Post subject: Reply with quote

By execution time, I mean is there a way by which I can measure the execution time of the application on the processor model. Excluding the execution time of the model platform simulation.
I want to know the the amount of time it would take for the code to run on the given processor.
Back to top
View user's profile Send private message
ShyamShankar



Joined: 14 Jan 2015
Posts: 34
Location: Kalady

PostPosted: Tue Jun 16, 2015 10:03 pm    Post subject: Reply with quote

I am also hoping the same for instruction count. Is there a way by which I can measure the number of instructions that are executed for the application code alone( when running on the given processor). Rather than including the instructions for initiating the OVP model.
I mean can I count the number of instructions in the application code??
Back to top
View user's profile Send private message
LeeMoore
OVP Technologist
OVP Technologist


Joined: 27 Feb 2008
Posts: 635

PostPosted: Tue Jun 16, 2015 10:29 pm    Post subject: Reply with quote

Hi

Can i ask again, what are you printing ?

Please show the code for the printf() call and how the arguments are calculated

Thx
Lee
Back to top
View user's profile Send private message
DuncGrah
OVP Technologist
OVP Technologist


Joined: 27 Feb 2008
Posts: 1656
Location: United Kingdom

PostPosted: Wed Jun 17, 2015 4:16 am    Post subject: Reply with quote

The OVP simulation will accurately execute an application binary in the same number of instructions as on the processor hardware. The fact that you have such a difference in the instruction counts makes me think that you are not running the same binary!
The difference you see could be explained if you are compiling the source code in two different ways for the two targets, are you?
If for the hardware you are compiling so that hardware instructions are being used for the maths and for OVP you are compiling without this option so that software libraries are being used you would see the result you see.

So, again, are you running the same binary? Or two different binaries (the result of compilation and linking using a CrossCompiler)?

What is the output from the Xilinx SDK? Can an elf file be generated?
Do you run the SDK connected to the Xilinx board and get your printf output within the SDK?
Back to top
View user's profile Send private message Visit poster's website
ShyamShankar



Joined: 14 Jan 2015
Posts: 34
Location: Kalady

PostPosted: Wed Jun 17, 2015 8:54 pm    Post subject: Reply with quote

Hi Mr Lee,
This is the application code that I am running on the board and also on OVP
#include <stdio>
int main()
{
int m=35;
int n=35;
int p=35;
int q=35;
int c;
int d;
int k;
int sum;
int first[35][35];
int second[35][35];
int multiply[35][35];

sum=0;
for ( c = 0 ; c < m ; c++ )
for ( d = 0 ; d < n ; d++ )
{ first[c][d]=1;
second[c][d]=1;
multiply[c][d]=0;
}

for ( c = 0 ; c < m ; c++ )
{
for ( d = 0 ; d < q ; d++ )
{
for ( k = 0 ; k < p ; k++ )
{
sum = sum + first[c][k]*second[k][d];
}
multiply[c][d] = sum;
sum = 0;
}
}

printf("Product of entered matrices:-\n");
for ( c = 0 ; c < m ; c++ )
{
for ( d = 0 ; d < q ; d++ )
printf("%d\t", multiply[c][d]);
printf("\n");
}
return 0;
}
Back to top
View user's profile Send private message
ShyamShankar



Joined: 14 Jan 2015
Posts: 34
Location: Kalady

PostPosted: Wed Jun 17, 2015 9:03 pm    Post subject: Reply with quote

Mr DuncGrah,
I am getting the output in Xilinx SDK itself and am running the same on Xilinx SDK.
As far as the binary is concerned, I am running the file obtained by compilation in Xilinx SDK on the board.
And in OVP I am running that obtained by compiling on the ARM Cortex A9 Cross Compiler toolchain obtained from Sourcery CodeBench.
Back to top
View user's profile Send private message
DuncGrah
OVP Technologist
OVP Technologist


Joined: 27 Feb 2008
Posts: 1656
Location: United Kingdom

PostPosted: Wed Jun 17, 2015 11:07 pm    Post subject: Reply with quote

You are running two different binary files!
I expect different options are used when compiling (these may just be the default options of the cross compilers being used), so that the code running on the OVP processor includes C software library implementations of some of the hardware instructions used int he SDK implementation. So that explains the large difference in instructions executed, different instruction streams are being used!
Can you obtain the options that are being used in the Xilinx SDK, such as hardware instructions to use?

What is loaded onto the hardware board? Is a file directly downloaded using a debugger?

Can the Xilinx SDK generate an elf file? You may be able to use this directly with the OVP processor. However, we may need to provide a new semihost library to support the printf to the host stdout.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Open Virtual Platforms Forum Index -> Ask a Question All times are GMT - 8 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Information regarding OVP © 2008-2022 Imperas Software