Post Go back to editing

Error result of FIR after down-sampler in sigmastudio

Software Version: sigmastudio V4.6 / CCES 2.11

ADSP-21569      Sigmastudio V4.6      CCES 2.11

Question1:

I set up the following schematic with blocksize 64 in sigmastudio.

TB source provide a pulse(1,sixty-three zeros/sixty-four zeros/sixty-four zeros...16 blocks and 1024 samples;'/' Split the output of each block) at blocksize 64.

Down-sampler1 reduce the blocksize to 2.The output of down-sampler is (1,0/0,0/0,0/0,0...16 blocks and 32 samples).

FIR (accelerator) filter coefficients are 1,2,3,4,5....100(100 orders).

And the module ‘test’ print the output of FIR filter is 1,2/0,0/0,0/0,0/0,0/5,6....The correct result must be 1,2/3,4/5,6....(16 blocks and 32 samples).

Is that the FIR filter in sigmastudio can't used in multiple sampleing rates schematic?

Is there any highly effective approach to solve this problem?

Final goal:

Filtering is performed at the low sampling rate(1.5k), and then it is raised back to the original sampling rate(48k).

With less FIR order and computation to complete the processing of the low frequency part.

#include "adi_ss_extmod.h"
#define BLOCKSIZE 64
#define NBLOCKS
void BPROCESS_TBsource(SSBlockAlgo *pBlkAlgoInfo)
{
	uint32_t 	i, sample, blockSize,*debugPara;
	float32_t 	*pInput,*pOutput;

	blockSize 	= pBlkAlgoInfo->pInputs[0].pBlockProperties->nBlockSize;
	pInput 		= pBlkAlgoInfo->pInputs[0].pSamples;
	pOutput		= pBlkAlgoInfo->pOutputs[0].pSamples;
	debugPara 	= (uint32_t *)(pBlkAlgoInfo->pParam);

	static float32_t x[1024]={1};

	if(debugPara[0]==16)
	{
		for(sample=0;sample<0;sample++)
		{
			pOutput[sample]=x[debugPara[0]*blockSize+sample];
		}
		for(sample=0;sample<64;sample++)
		{
			pOutput[sample]=0;
		}
	}
	for(sample=0;sample<blockSize;sample++)
	{
		pOutput[sample]=x[debugPara[0]*blockSize+sample];
	}
	debugPara[0]++;
}

void INIT_TBsource(SSBlockAlgo *pBlkAlgoInfo)
{
}

#include <stdio.h>
#include <string.h>
#include <math.h>
#include "adi_ss_extmod.h"

void BPROCESS_LRtest(SSBlockAlgo *pBlkAlgoInfo)
{
	uint32_t 	i, sample, blockSize,*debugPara;
	float32_t 	*pInput,*pOutput;

	blockSize 	= pBlkAlgoInfo->pInputs[0].pBlockProperties->nBlockSize;
	pInput 		= pBlkAlgoInfo->pInputs[0].pSamples;
	pOutput 	= pBlkAlgoInfo->pOutputs[0].pSamples;
	debugPara	= (uint32_t *)(pBlkAlgoInfo->pParam);

	if(debugPara[0]==16)
		return;

	for(sample=0;sample<blockSize;sample++)
	{
		printf("%f\n",pInput[sample]);
	}
	debugPara[0]++;
}

void INIT_LRtest(SSBlockAlgo *pBlkAlgoInfo)
{
	printf("\nTEST BEGIN.\n");
}

Question2:

Down-sampler32(with Anti-alias) require 2 MCPS.And Up-sampler32(Enable filter) require 12 MCPS.Why are they so different in MCPS.



Supplement the node output in the problem.
[edited by: ZTB at 12:18 PM (GMT -5) on 16 Dec 2022]
Parents Reply Children
  • Thank you for your reply.

    I konw the function of anti-aliasing,but still turn it off for clearly verify the result of fir filter at low sampling rate.

    Revalidate the schematic like you said.The blocksize of schematic is 64.Switch1 ouput1 continuously.

    The coefficients of fir filter is 0.001:0.001:0.5.

    LRtest1 output is shown in the following figure with blocksize=2.

    Change the position of LRtest1 to output the result of fir filter.

    Put the output of down-sampler into matlab as follows.

    clc;clear;
    b=0.001:0.001:0.5;
    x=[-0.000007,-0.099471,-0.605067,-0.693815,-0.693815,-0.693815,-0.693815,-0.693815];
    y=filter(b,1,x);

    We could get the result which is different from the output of fir filter in sigmastudio.

  • Sorry for the delay we were on vacation last week. I am investigating this behavior and get back to you soon. 
    May I know what is the initial value of   debugPara? is it zero?

  • Yes.I initialize debugPara[0] to zero when I build the dll in sigmastudio.

  • Could you please confirm which FIR filter you are using from SigmaStudio?

  • My SigmaStudio version is 4.6.

  • Hi,

    The minimum block size supported in SigmaStudio is 8 which is mainly for loop unrolling to achieve Beter optimization of different DSP algorithms. Since we used down sampler to reduce the block size the algorithm code not generating right output. 

    Also, the FIR and IIR Filter what you have mentioned is using Hardware FIR and IIR accelerator and the default window size set to 64 (block size), so the output response is not matching. We can use the software FIR with minimum block size of 4, since this algorithm process 4 samples at a time.

    We will analyze for any algorithm level change can be made to handle different block size and update it in future SigmaStudio release. Reducing block size may lead to higher the processing MIPS.

    You can use the sample schematic (1 sample processing) if your algorithms operating at less sample.

     

    Thanks.

  • Thank you very much for your answer.I have a clear understanding of the problem now.