Currently Being ModeratedFeb 7, 2013 12:12 PM (in response to cheezor)Re: Simple Multiplication Question
you're right, the problem lies in the number format of the DSP. Your 'counter' increments the least significant bit in the accumulator. The DSP fractional numbering format uses the MSB (most significant bit) as sign bit with the weighting -2^0 = -1.0 The following bits are weighted by the factors 2^-1 (1/2), 2^-2 (1/4) and so on. Doing a multiplication by the timer 'content' caused the input sample multiplied by 2^-24 if you copy (move) the register content a0 to one of the operand registers in advance. Just moving the incremented accumulator causes to copy the content of the accumulator a1 which is zero unless you incremented the counter 2^24 times.
So the phenomenon is clear to me, the result yields zero (000000) or an even _very_ small negative number FFFFFF (-2^-23, to calculate this is left as an exercise to the reader, just follow the rule given above :-)).
So in your case branching (i.e. muting the signal corresponding to the flag setting) is the only option I can see for the moment.
If you give a concise description of the problem you intend to solve I could probably help more.
Currently Being ModeratedFeb 9, 2013 1:35 PM (in response to clangen)Re: Simple Multiplication Question
Thanks for your response. I think my problem is that I dont have a very good grasp on the numbering format, but your explaination helps. From what you are saying, I'm assuming that the numbers are always in the range of -1 to 1.
Here is the code that I was using for the timer: https://www.dropbox.com/s/pdkfejzshz8bki9/Tutorial%2004%20-%20Timer.asm
I have been posting some beginner tutorials at Freestompboxes.org to hopefully get some more interest with this pedal. I just hope Im not explaining everything wrong. lol At least it will give people a starting point with some really simple programs.
Anyways, the code in that link just has the timer set up. I basically start off with a counter value and decrement that on every interupt until the value is equal to 0. Then I flip the bit I was talking about in my previous post and reset the counter value and the cycle continues all over again. If I understood your post correctly, couldn't I just flip a different bit to achieve a value of 1? Thus making the multiplying the signal by the flag value a viable option?
Is there a good tutorial for the fractional numberin format that I could read up on? I feel like this is the area that is really holding me back from making more complex programs.
Currently Being ModeratedFeb 12, 2013 6:05 AM (in response to cheezor)Re: Simple Multiplication Question
reviewing your code was not that easy. I can ee the timer checking the accumulator content for zero but not the influence on the audio signal. Anyways there are two other possibilities to mute the signal by flipping a bit:
1.) Flip the sign bit, this is corresponding the guard bits in accumulator a2 correspinding to bit 23 in the operand registers. Be careful not to change bit 47 in the accumulator since this is _not_ the sign bit - this is inherent in the accumulator guard bits.
The result is the same as moving -1.0 to any of those registers. Afterwards the polarity should be inverted in the accumulator by the 'neg a' instruction. Note that writing ~1.0 = 0.9999998 to a register is done by flipping _all_ bits except the sign bit, but maybe the right polarity of the output signal isn't an issue for your application.
2.) Use the flipped bit to control writing 0.9999998 or 0.0000000 corresponding to 1.0 and 0.0 correspondingly. This is really annoying but the DSP can handle control istructions much worse than a microcontroller. Code branches are relatively unusual in DSP algorithms compared to the tight MAC loops this architecture was designed for. It is possible to code conditional code execution but this is more nasty than on ARM or even 8051. We can have conditional code execution but only for BRxx and Jxx (or BRSxx and JSxx for subroutines) where xx is corersponding to the status register flag settings combinations.
In each case have a try with the Symphony Studio simulator for first. Small items like this can be observed conveniently by changing the register numbering formats from fractional, interger and hexadecimal on the fly.
Have fun checking the DSP563xx architecture with the simulator,