Results 1 to 2 of 2

Thread: Timing calculation help!

  1. #1
    Join Date
    Mar 2014
    Posts
    8
    Rep Power
    1

    Post Timing calculation help!

    Hi, I'm new to nios. I'm writing an app to calculate position of a moving point.

    S = S0 - v*t.

    I need help to implement the t value.
    I'm thinking of using for loop

    for (t=0;t<1000;t++) {
    S = S0 - v*t;
    }

    As I understand, each t increase will be equivalent to 1 clock cycle so it will be 20ns (my clock is 50MHz). So if I want t to calculate in second I must do it like this:

    S = S0 - v*t*20/1000,000,000

    Is it usable or I must use timer interval core?

  2. #2
    Join Date
    Jun 2013
    Location
    The Netherlands
    Posts
    440
    Rep Power
    1

    Default Re: Timing calculation help!

    I have some limited experience with NIOS, so what I write is a more general answer.
    Having said that, you need to look into the cycle count of each operation. This one line of code actually does three things:
    1. multiply v and t
    2. substract that result from S0
    3. store that result in S

    Then you need to know the types of the inputs and results. Floating point arithmetic may take longer than integer calculations.
    Then you need to know how much of those 3 steps are run in one cycle. Generally the store comes "free" with any other operation, i.e. it does not have a cost in cycles. On top of this the compiler may do some compiler magic so you don't exactly know the cycle count until you take a look at the assembler code, or write your own assembly code. As long as you know the cycle count you can calculate the time it takes to execute one loop iteration (the a loop also takes instructions, unless it is unrolled).

Similar Threads

  1. Reg Slack calculation
    By kharthik in forum Quartus II and EDA Tools Discussion
    Replies: 1
    Last Post: August 5th, 2014, 10:17 AM
  2. Replies: 5
    Last Post: December 13th, 2012, 09:57 AM
  3. Critical Warning: Timing requirements for slow timing model timing analysis were not
    By sivachaitanya in forum Quartus II and EDA Tools Discussion
    Replies: 9
    Last Post: December 8th, 2011, 10:33 PM
  4. Critical Warning: Timing requirements for slow timing model timing analysis were not
    By hjwy111 in forum Quartus II and EDA Tools Discussion
    Replies: 6
    Last Post: December 15th, 2009, 09:34 PM
  5. Classic Timing Analyzer: tsu calculation backwards?
    By JohnG300C in forum Quartus II and EDA Tools Discussion
    Replies: 6
    Last Post: August 21st, 2008, 12:32 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •