# How many instructions can be executed per sample in SigmaDSP?

Document created by BrettG on Feb 12, 2013Last modified by BrettG on May 30, 2013
Version 4Show Document

# Calculating IPS (Instructions Per Sample)

The number of instructions that can be executed per sample depends on three things:

• The core frequency of the SigmaDSP you are using (as you have it configured in your system)
• The size of the program memory of the SigmaDSP you are using
• The audio sample rate of your system

The simple equation to calculate the number of instructions that can be execute per sample is:

Instructions per sample = Core frequency of DSP / Audio sample rate

Typically, IPS (instructions per sample) must be less than or equal to the size (in words) of program memory. The reason for this is that all of the instruction codes need to be stored in program memory.

However, the ADAU1781 is a special case because it has a a relatively small program memory (512 words) but it can execute up to 1024 instructions per sample at a 48 kHz sample rate. So, in order to use more than 512 instructions per sample in the ADAU1781, algorithms utilizing subroutines are required. These are generally referred to as "optimized" algorithms in SigmaStudio, because they use fewer program memory words than the number of instructions they execute.

# Table of SigmaDSPs and corresponding IPS at different sample rates

Here is a table showing the IPS for each SigmaDSP product at different sample rates.

ProductMaximum DSP core frequency (MHz)IPS @ 48 kHz***IPS @ 96 kHz***IPS @ 192 kHz***

* The ADAU1781 can execute 1024 instructions per sample at 48 kHz, but its program memory only holds 512 instruction codes

** The ADAU1772 does not technically have a SigmaDSP core, but rather a filter engine, which always runs at 192 kHz

*** "IPS @48 kHz" means "Instructions per sample at normal 48 kHz sample rates or lower, depending on the master clock frequency."

"IPS @96 kHz" means "Instructions per sample at double-rate 96 kHz sample rates or lower, depending on the master clock frequency."

"IPS @192 kHz" means "Instructions per sample at quad-rate 192 kHz sample rates or lower, depending on the master clock frequency."

# Checking the number of instructions used in a SigmaStudio project

The number of instructions per sample required by a given project can be found in the compiler_output.txt file that is generated after the Link-Compile-Download or Link-Compile-Connect functions are executed. The compiler_output.txt file can be found in a subfolder where the project file is stored on the hard drive.

The path is typically: Project Folder / IC #_Project Name / net_list_out2

Here is an example with the AD1940:

The compiler_output.txt file contains different information depending on the SigmaDSP used, but the important number to note is the one labeled Instructions or MIPS:

In the example above (using the AD1940), you can see that 23 instructions (the highlighted number) are being used in the project. This is within the limit of 1536 IPS @ 48 kHz, 768 IPS @ 96 kHz, and 384 IPS @ 192 kHz, so this project could run at any sample rate.

Important! Note that the compiler does not have knowledge of the sample rate, so you have to check to make sure the number of instructions is within the allowed limit.

Go to View - Output, or press Ctrl+4 to see the Output window.

The output window will be blank until you compile the project.

Once you compile the project, you will see a detailed listing of the algorithms used, and the total instructions required by the project. This example uses an ADAU1761.

Note that 667 instructions are being used in this project. If you refer to the table earlier in this FAQ, we can see that the ADAU1761 can execute 1024 IPS @ 48 kHz, but only 512 IPS @ 96 kHz. Therefore, this project will run at a 48 kHz sample rate, but it will not run at 96 kHz.

# Errors due to over-sized programs in systems with 96 kHz or 192 kHz sample rates

So, it is important to check the compiler output in order to make sure that the required number of instructions will fit what is available in the DSP for your desired sample rate. If you attempt to run a program that is outside of the allowable bounds, then errors will occur.

For example, if an ADAU1761 was set up to run at 96 kHz and the program shown above was downloaded to it (with 667 instructions), then the effective rate of the system would be cut in half, since only every other sample would be processed by the DSP (with alternating samples being ignored entirely). This would have the effect of cutting the bandwidth in half, and also shifting the frequency of every frequency-dependent algorithm in the DSP by a factor of 2. In order to run this example program correctly, the user would need to lower the sample rate down to 48 kHz so the full 667 instructions could be executed within the span of a single audio frame.