ΣSigmaStudio Ask AI Русский Log in

Please help to check the asm code correct or not for SIMD?

Processors & DSP AmmonMneg Dec 17, 2019 00:00 1 replies Original on forum ↗
Subscribe
AmmonMneg Question
Dec 17, 2019 00:00

Fullscreen
BusMixer Code(asm).txt
Download

.section /dm seg_dmda;
INPUT[M]
+---------------------+
| ch1 pre mixing src |
+---------------------+
| ch2 pre mixing src |
+---------------------+
| ch1 Post mixing src |
+---------------------+
| ch2 Post mixing src |
+---------------------+
| ch3 pre mixing src |
+---------------------+
| ch4 pre mixing src |
+---------------------+
| ch3 Post mixing src |
+---------------------+
| ch4 Post mixing src |
+---------------------+
:
+---------------------+
| chN-1 pre mixing src|
+---------------------+
| chN pre mixing src |
+---------------------+
| chN-1 Postmixing src|
+---------------------+
| chN Post mixing src |
+---------------------+

OUTPUT[L]
+----------------+
| Bus1 mixing out|
+----------------+
| Bus2 mixing out|
+----------------+
:
+----------------+
| BusN mixing out|
+----------------+

.section /pm seg_dmda;
pLIB_COEF[L]
+---------------------+
| Bus1 ch1 send gain |
+---------------------+
| Bus1 ch2 send gain |
+---------------------+
:
| Bus1 chN send gain |
+---------------------+
| Bus2 ch1 send gain |
+---------------------+
| Bus2 ch2 send gain |
+---------------------+
:
| Bus2 chN send gain |
+---------------------+
.
.
+---------------------+
| BusN ch1 send gain |
+---------------------+
| BusN ch2 send gain |
+---------------------+
:
| BusN ch2 send gain |
+---------------------+

.section /dm seg_dmda;
DATA[L]
+----------------+
| Bus1 Postflag |
+----------------+
| Bus2 Postflag |
+----------------+
:
+----------------+
| BusN Postflag |
+----------------+

0:post off, 1:post on
bit32 bit0
word= [ch32][ch31]?��chM][chM-1]?��ch2][ch1]
M?32

function:
for(BusNum=0;BusNum<MaxBus;BusNum++)
{
Bus[BusNum] =0;
for(ch=0;ch<MaxCh;ch++)
{
if(postflag[BusNum][ch]==1) ch[ch]=post_input[ch]*sendGain[BusNum][ch];
else ch[ch]=pre input[ch]*sendGain[BusNum][ch];
Bus[BusNum] += ch[ch];
}
}

-----------------------------------------------*/
.section/pm seg_pmco;
//-----------------------------------------------------------------------
_parts_BusMIX:
entry;

/* save_reg */ //Scratch r0,r1,r2,r4,r8,r12
puts = r3;
r0 = i1; //pLIB_INPUT
puts = r0;
r0 = i3; //pLIB_OUTPUT
puts = r0;
puts = mode1;

/* set_reg */
//===============================//Ammon,20191214
//pLIB_INPUT = r4; //i1 Pointer for INPUT
//pLIB_OUTPUT = r8; //i3 Pointer for OUTPUT
//pLIB_DATA = r12; //i13 Pointer for DATA
//r0 = dm(1,i6); //r0 Register for Mixing LoopCounter:M
//r1 = dm(2,i6); //r1 Register for Channel LoopCounter:L/2

pLIB_INPUT = r4; //i1 Pointer for InputBuffer
pLIB_OUTPUT = r8; //i3 Pointer for OutputBuffer
pLIB_COEF = r12; //i13 Pointer for channel Send Gain
pLIB_DATA = dm(1,i6); //i4 Pointer for PostFalg
r0 = dm(2,i6); // Register for Loo1Counter,ChannelCount(26)
r1 = dm(3,i6); // Register for Loo2Counter, BusCount
//===============================//Ammon,20191214

bit set mode1 PEYEN ; //SIMD
flush cache;

lcntr=r1, do SWMTXL2 until lce; //BusCount loop
pLIB_INPUT = r4; //init. Pointer for INPUT
r12 = r12 - r12; //r12=0;
r3 = dm(pLIB_DATA,2); //r3=channel PostFlag,pLIB_DATA[Bus(1)_Postflag,Bus(2)_Postflag...Bus(n)Postflag]
f12 = f12 - f12; //Ammon,20191214, init. mixing:f12=0

bit set mode1 BDCST1; //for loading input source (r&s),Ammon,20191214, what is the purpose of this code?
lcntr=r0, do SWMTXL1 until lce; //mixing Channel count loop
f4=pm(pLIB_COEF,2); //Ammon,20191214, f4=send gain ,pLIB_COEF[Bus1_ch(1)sendgain,Bus1_ch(2)sendgain....Bus1_ch(n)sendgain, Bus2_ch(1)sendgain...]
btst r3 by r12, f2 = dm(pLIB_INPUT,2); //Ammon,20191214, Pre input source
f3 = dm(pLIB_INPUT,2); //Ammon,20191214, Post Input Source pLIB_INPUT[Pre Input1,Post Input1,Pre Input2,Post Input2.....]
f5 = f2*f4; //Ammon,20191214, Pre Input*SendGain
f8= f3*f4; //Ammon,20191214, Post Input*SendGain
if not sz f12 = f12 + f8; //if post flag ==1 then mixing Pre Input*SendGain
if sz f12 = f12 + f5; //if post flag ==0 then mixing Post Input*SendGain
SWMTXL1: r12 = r12 + 1; //bit tst position 0->1->2->,,,->30->31, //Ammon,20191214,Each bus should have no more than 32 channels for mixing
bit clr mode1 BDCST1;

SWMTXL2:dm(pLIB_OUTPUT,2) = f12; //mixing output

bit clr mode1 PEYEN; //SISD
nop;

/* load_reg */
mode1 = gets(1);
i3 = gets(2);
i1 = gets(3);
r3 = gets(4);
alter(4);

flush cache;
exit;
_parts_BusMIX.end:

who can help to check the code if it is correct or not for runing in SIMD mode? thank you very much !

dsp&processors

ADIApproved Reply
Dec 27, 2019 00:00

Hi,

Sorry for the delay in response.

I've taken a look at your code and could see that you have SIMD enabled. However, with this we cannot conclude whether SIMD is applied or not. In order to comment better on this can you share the below information?

1. Which processor are you referring to?
2. Does your code run on CCES or VDSP?

Meanwhile, I would also suggest you to take a look at the SHARC Programming Reference Manual for information on SIMD mode. The link for downloading the manual is given below.
www.analog.com/.../ADSP-2136x_2137x_214xx_pgr_rev2.4.pdf

Regards,
Anand Selvaraj.