Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

Suggestion for new extended code component

DSP related issues, mathematics, processing and techniques

Suggestion for new extended code component

Postby KG_is_back » Sat Apr 12, 2014 1:17 am

Current DSP code component is optimized to work for sse 4channel streams. Some instructions that would cause problems in mono4 and poly signals are ruled out from DSP code, but are still available in assembler primitive. I think it would be reasonable to have a separate "extended" DSP code component that would be able to process only mono (maybe mono4) signals and would contain several new functions reganding code branching and looping.
This article is both an suggestion for DSPR and a tutorial for users how to implement the stuff in assembler until it's implemented in the code component directly.

First of all "If else" instruction... the syntax would look like this:
Code: Select all

if(a,0) //a is a variable or conditional statement containing boolean mask
// 0-3 is an index of SSE channel to take the mask from
{
//code1
}
else
{
//code2
}

the assembly generated code would be
Code: Select all
movaps xmm0,a; //in case of statement this would be the statement calculation
movaps smIntVarTemp,xmm0;
push eax;
mov eax,smIntVarTemp[0]; //0-3 from the parameter;
cmp eax,0;
jz else1;

//code1

jmp skipelse1; //jmp is not implemented, so following code might be used instead:
// mov eax,0;cmp eax,0;jz elsecode1;
else1:

//code2

skipelse1:
pop eax;

The if else branching can currently be replaced by flag based statements, but conditional loops can't...
Conditional loops would be implemented in similar fashion...
while loop
Code: Select all
while (a,1)
{
//code
}

generated assembly:
Code: Select all
push eax;
while1:
movaps xmm0,a; //in case of statement this would be the statement calculation
movaps smIntVarTemp,xmm0;
mov eax,smIntVarTemp[1]; //0-3 from the parameter;
cmp eax,0;
jz notwhile1;


//code

jmp while1; //jmp is not implemented, so following code might be used instead:
// mov eax,0;cmp eax,0;jz while1;
notwhile1:
pop eax;


other branching like do-while loops are possible too...(I'm just too lazy to write them down at the time :oops: )
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Return to DSP

Who is online

Users browsing this forum: No registered users and 11 guests