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
How to not become crazy in dsp and asm ;)
8 posts
• Page 1 of 1
How to not become crazy in dsp and asm ;)
Almost every time i write a code in dsp or asm i have i first bad impression that nothing works !)
Then i place a DS or Asio out in my shematics and it begin to works !)
Very fast now to realize that !) Almost a reflex.
Now in asm i find a serious way to become crazy for a longer time !)
Crying that something is not right ! Copying and erasing every complex part of the code.
To have just the simplest movaps out,xmm0; not working !
Restarting the application...
Then i realize that the first thing to check is that all variable or input output have the exact same name.
I was using streamout done; But i completely forget that and the compilator say nothing when we use an undeclared variable like movaps out,xmm0 in this case... ...
Did you have other's thing that become a reflex to checks first when the code is not working ?
Then i place a DS or Asio out in my shematics and it begin to works !)
Very fast now to realize that !) Almost a reflex.
Now in asm i find a serious way to become crazy for a longer time !)
Crying that something is not right ! Copying and erasing every complex part of the code.
To have just the simplest movaps out,xmm0; not working !
Restarting the application...
Then i realize that the first thing to check is that all variable or input output have the exact same name.
I was using streamout done; But i completely forget that and the compilator say nothing when we use an undeclared variable like movaps out,xmm0 in this case... ...
Did you have other's thing that become a reflex to checks first when the code is not working ?
Last edited by Tepeix on Tue Mar 08, 2022 4:00 pm, edited 1 time in total.
- Tepeix
- Posts: 361
- Joined: Sat Oct 16, 2021 3:11 pm
Re: How to not become crazy in asm ;)
After about 7 years I can finally write small bits of DSP that actually work first time! Sometimes!
One thing I find useful for DSP is
The test output allows me to check any part of the code to see what’s going wrong.
In my view so much can be wrong and what’s right is tiny in comparison. That means it’s hard to offer advice, but I can say that experience is the key. I got quicker at finding my mistakes over time.
One thing I find useful for DSP is
- Code: Select all
streamout test;
test = counter;
The test output allows me to check any part of the code to see what’s going wrong.
In my view so much can be wrong and what’s right is tiny in comparison. That means it’s hard to offer advice, but I can say that experience is the key. I got quicker at finding my mistakes over time.
-
Spogg - Posts: 3358
- Joined: Thu Nov 20, 2014 4:24 pm
- Location: Birmingham, England
Re: How to not become crazy in dsp and asm ;)
Very good advice !)
If i have done that always using test to debug i will not have problem with other's syntax !
Now i get another despair.)
Trying to use cmp eax,4095; or any number.
if i assign a negative value to eax it will do like -1 is greater to 4095 !
So i try add eax,1; before cmp eax,4095. Not working..
inc [eax]; crash it !
eax come from xmm0. So i try to paddd xmm0,inc. Not working... ,)
Now i could transform xmm0 in a float with cvtdq2ps, use addps to add a float of 1.
Transform now in a int with cvtps2dq. So now eax must be 0 like xmm0.
But even like this cmp eax refuse to works...
So i suppose that we could not use a int value that was negative when using eax ???
Here's the code if some want to see.
If i have done that always using test to debug i will not have problem with other's syntax !
Now i get another despair.)
Trying to use cmp eax,4095; or any number.
if i assign a negative value to eax it will do like -1 is greater to 4095 !
So i try add eax,1; before cmp eax,4095. Not working..
inc [eax]; crash it !
eax come from xmm0. So i try to paddd xmm0,inc. Not working... ,)
Now i could transform xmm0 in a float with cvtdq2ps, use addps to add a float of 1.
Transform now in a int with cvtps2dq. So now eax must be 0 like xmm0.
But even like this cmp eax refuse to works...
So i suppose that we could not use a int value that was negative when using eax ???
Here's the code if some want to see.
- Attachments
-
- cmp eax with negative.fsm
- (52.17 KiB) Downloaded 641 times
- Tepeix
- Posts: 361
- Joined: Sat Oct 16, 2021 3:11 pm
Re: How to not become crazy in dsp and asm ;)
I’m not into ASM so I hope someone else can chip in…
-
Spogg - Posts: 3358
- Joined: Thu Nov 20, 2014 4:24 pm
- Location: Birmingham, England
Re: How to not become crazy in dsp and asm ;)
@Tepeix, towards the end of your ASM code there is an instruction
addps xmm0,inc;
addps adds floats, but inc is an integer (and so is xmm0). You have to use paddd instead of addps.
General comment regarding the topic: Yes, ASM has an extraordinary potential to drive you mad. Perhaps the worst errors are undeclared or doubly declared variables. Sometimes the code will execute as expected without problems, sometimes it will produce garbage, and sometimes it will crash Flowstone. Fortunately, these issues are highlighted in FS alpha codebox and thus easily avoided. I have made it a habit to check the more complex ASM codes in FS alpha.
addps xmm0,inc;
addps adds floats, but inc is an integer (and so is xmm0). You have to use paddd instead of addps.
General comment regarding the topic: Yes, ASM has an extraordinary potential to drive you mad. Perhaps the worst errors are undeclared or doubly declared variables. Sometimes the code will execute as expected without problems, sometimes it will produce garbage, and sometimes it will crash Flowstone. Fortunately, these issues are highlighted in FS alpha codebox and thus easily avoided. I have made it a habit to check the more complex ASM codes in FS alpha.
-
martinvicanek - Posts: 1328
- Joined: Sat Jun 22, 2013 8:28 pm
Re: How to not become crazy in dsp and asm ;)
Thanks !)
Correcting this line, now it works to compare negative integer.)
That incident make me falsely believe that compare with a negative eax was not possible !
That's a surprising bug. The paradox is that if the bug occurs the line that make it happen is supposed to be skip.
In my version 3.6. It's not possible to paddd xmm0,xmm1;
So i'm tempted to use addps if it works to not use a variable.
But now i know it could make some things not works..
Correcting this line, now it works to compare negative integer.)
That incident make me falsely believe that compare with a negative eax was not possible !
That's a surprising bug. The paradox is that if the bug occurs the line that make it happen is supposed to be skip.
In my version 3.6. It's not possible to paddd xmm0,xmm1;
So i'm tempted to use addps if it works to not use a variable.
But now i know it could make some things not works..
- Tepeix
- Posts: 361
- Joined: Sat Oct 16, 2021 3:11 pm
Re: How to not become crazy in dsp and asm ;)
Tepeix wrote:In my version 3.6. It's not possible to paddd xmm0,xmm1.
You can add eax,1; in 3.0.6
-
martinvicanek - Posts: 1328
- Joined: Sat Jun 22, 2013 8:28 pm
Re: How to not become crazy in dsp and asm ;)
Yes, but it's another case where i need to add in SSE 4 different integer.
But finally i check those code and find i use later another way.)
The idea was to calculate 1 index and 1 or 3 delay in the same variable.
And, that's not so much practical ,) But could have some use if some want the same delay for a stereo signal.
In first attempts i addps index and delay as integer. But finally it's possible to paddd with the index variable..
By the way, i never could do this without yours delays ! Thanks !!!)
So the idea is to write once, 2 channels and the same + 1 sample.
Then to read the array twice to get 2 stereo interpolated delay.
Well some "non-sense optimization" but i learn a lot trying this !)
But finally i check those code and find i use later another way.)
The idea was to calculate 1 index and 1 or 3 delay in the same variable.
And, that's not so much practical ,) But could have some use if some want the same delay for a stereo signal.
In first attempts i addps index and delay as integer. But finally it's possible to paddd with the index variable..
By the way, i never could do this without yours delays ! Thanks !!!)
So the idea is to write once, 2 channels and the same + 1 sample.
Then to read the array twice to get 2 stereo interpolated delay.
Well some "non-sense optimization" but i learn a lot trying this !)
- Attachments
-
- spDelay2.fsm
- (78.1 KiB) Downloaded 623 times
- Tepeix
- Posts: 361
- Joined: Sat Oct 16, 2021 3:11 pm
8 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 48 guests