Forum Discussion

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

nios performance

Hi all,

I have a piece of C-code which I have indicated below.

{

int idx_1, idx_2;

for( idx_1 = 0; idx_1 < 6; idx_1++)

{

for(idx_2 = 0; idx_2 < 16; idx_2++)

{

p->a[idx_1][idx_2] = q->b[idx_1][idx_2];

}

}

}

I ported the above code to NIOS-II/E no-cache processor. p is a hard coded pointer to a structure

i.e struct xyz *p = 0x00040000;

I performed verilog simulations on the above code.

I found that I need 65 clock cycles between two consecutive writes. Isn&#39;t this too large for just memory transfers? Is something incorrect with what I&#39;m doing?

Thanks,

Sridhar.

5 Replies

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

    Forgot to mention in earlier post, I&#39;m using an On chip memory using the SOPC-builder.

    Regards,

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

    I&#39;d recommend looking at the resulting assembly code to figure out whether the compiler is doing a good job or not. From your code snippet it&#39;s hard to tell since we don&#39;t know what types &#39;a&#39; and &#39;b&#39; are and how far apart they are in memory.

    You&#39;ve probably already checkd but make sure optimizations are on (Release configuration).

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

    Thanks Andrew.

    Any idea how I can view assembly code in IDE?

    a & b are 2-d arrays of unsigned int

    unsigned int a[6][16];

    Regards,

    Sridhar.

    --- Quote Start ---

    originally posted by queisser@Feb 21 2006, 12:27 PM

    i&#39;d recommend looking at the resulting assembly code to figure out whether the compiler is doing a good job or not. from your code snippet it&#39;s hard to tell since we don&#39;t know what types &#39;a&#39; and &#39;b&#39; are and how far apart they are in memory.

    you&#39;ve probably already checkd but make sure optimizations are on (release configuration).

    andrew

    <div align='right'><{post_snapback}> (index.php?act=findpost&pid=12851)

    --- quote end ---

    --- Quote End ---

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

    In IDE: Window -> Preferences -> Nios II Tab -> turn on "Generate objdump file"

    Then rebuild your project and look the .objdump file.

    Regards

    Luca

    --- Quote Start ---

    originally posted by sridhar.sr+feb 22 2006, 08:48 am--><div class='quotetop'>quote (sridhar.sr @ feb 22 2006, 08:48 am)</div>

    --- quote start ---

    thanks andrew.

    any idea how i can view assembly code in ide?

    a & b are 2-d arrays of unsigned int

    unsigned int a[6][16];

    regards,

    sridhar.

    <!--quotebegin-queisser@Feb 21 2006, 12:27 PM

    i&#39;d recommend looking at the resulting assembly code to figure out whether the compiler is doing a good job or not. from your code snippet it&#39;s hard to tell since we don&#39;t know what types &#39;a&#39; and &#39;b&#39; are and how far apart they are in memory.

    you&#39;ve probably already checkd but make sure optimizations are on (release configuration).

    andrew

    <div align='right'><{post_snapback}> (index.php?act=findpost&pid=12851)

    --- quote end ---

    --- Quote End ---

    <div align='right'><{post_snapback}> (index.php?act=findpost&pid=12869)</div>

    [/b]

    --- Quote End ---

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

    i think, your code can be presented as following

    {
           int idx_1, idx_2;
           
           for( idx_1 = 0; idx_1 < 6; idx_1++)
          {
                 for(idx_2 = 0; idx_2 < 16; idx_2++)
                 {
                       p->a =  q->b;
                  }
           }
    }

    so you have two multiplications and two sums plus memory copy