DSPRelated.com
Forums

Number of Cycles taken by Fixed Point program

Started by bsdap November 24, 2005
bsdap wrote:
>>On a Blackfin, fixed-point math will be much faster that floating point. > > >>Software floating point is very slow compared to single-cycle fixed >>point, and addition takes longer than multiplication. Is your simulator > > >>timing related to real hardware? >> >>Jerry >>-- >>Engineering is the art of making what you want from things you can get. >>����������������������������������������������������������������������� >> > > > Hi Jerry, > First of all, a million thanks for replying my query and the guidance. > The simulator timing is definitely related to real Hardware because the > simulator is selected for the BF535 DSP so it has to load all the settings > for the said DSP. > I am still confused why this would happen. I was just thinking whether the > issue is related to optimization of the code, but I am not sure.If it is > the issue related to optimization then what steps need to be followed?? Or > if I have to use some Blackfin specific libraries (?) then from where I can > get it?? > Thanks again, > B.S.D.
Well then, how does the how does the simulator handle floating-point arithmetic? It cannot execute it, so the compiler would have to have used a floating-point library. What does the linker tell you? Have you looked at the assembly output from the compiler? Something simple is happening, but you're making at least one assumption that keeps you from seeing it. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
>> >> Hi Jerry, >> First of all, a million thanks for replying my query and the guidance.
>> The simulator timing is definitely related to real Hardware because
the
>> simulator is selected for the BF535 DSP so it has to load all the
settings
>> for the said DSP. >> I am still confused why this would happen. I was just thinking whether
the
>> issue is related to optimization of the code, but I am not sure.If it
is
>> the issue related to optimization then what steps need to be followed??
Or
>> if I have to use some Blackfin specific libraries (?) then from where I
can
>> get it?? >> Thanks again, >> B.S.D. > >Well then, how does the how does the simulator handle floating-point >arithmetic? It cannot execute it, so the compiler would have to have >used a floating-point library. What does the linker tell you? Have you >looked at the assembly output from the compiler? > >Something simple is happening, but you're making at least one assumption
>that keeps you from seeing it. > >Jerry >-- >Engineering is the art of making what you want from things you can get. >����������������������������������������������������������������������� >
Hello Jerry, Thanks for the reply. I think the simulator for a fixed point DSP processor simulates the floating point because I could not figure out any floating point library in the simulator. But when I saw the Assembly output generated by the compiler and while single stepping through it I found that for floating point arith it refers to some specific memory locations and executes an assembly language code for respective operations which would do the floating point calculation. For example I looked at floating point multiplication part. It looks something like this. ===== __float32_mul SSYNC ; [ -- SP ] = ( R7:4 , P5:3 ) ; R7 = R0 ^ R1 ; P0 = R7 ; R4 = 0 ; R2 = R0 << 0x1 ; R3 = R1 << 0x1 ; CC = R2 == R4 ; IF CC JUMP RETURN_MULTZERO ; CC = R3 == R4 ; IF CC JUMP RETURN_MULTZERO ; R2 = R2 >> 24 ; R3 = R3 >> 24 ; R4 = 127 ( X ) ; R5 = R2 + R3 ; R5 = R5 - R4 ; P1 = R5 ; R4 <<= 0x1 ; CC = R4 < R5 ; IF CC JUMP OVERFLOW ; ===== Being unfamilier to assembly I could understand very little of it. Also after the last posting I could manage to get an emulator hardware kit (for ADSP BF535) from my friend and tried to execute the Fixed Point program on it. And there was not a big difference. The same results were shown again. I dont know why this is happening. As you said may be something very simple but I am not able to catch it and that is the fact. :( Thanks a lot, B.S.D.
bsdap wrote:

   ...

> Hello Jerry, > > Thanks for the reply. > I think the simulator for a fixed point DSP processor simulates the > floating point because I could not figure out any floating point library > in the simulator. But when I saw the Assembly output generated by the > compiler and while single stepping through it I found that for floating > point arith it refers to some specific memory locations and executes an > assembly language code for respective operations which would do the > floating point calculation. For example I looked at floating point > multiplication part. It looks something like this. > > ===== > __float32_mul > > SSYNC ; > [ -- SP ] = ( R7:4 , P5:3 ) ; > R7 = R0 ^ R1 ; > P0 = R7 ; > R4 = 0 ; > R2 = R0 << 0x1 ; > R3 = R1 << 0x1 ; > CC = R2 == R4 ; > IF CC JUMP RETURN_MULTZERO ; > CC = R3 == R4 ; > IF CC JUMP RETURN_MULTZERO ; > R2 = R2 >> 24 ; > R3 = R3 >> 24 ; > R4 = 127 ( X ) ; > R5 = R2 + R3 ; > R5 = R5 - R4 ; > P1 = R5 ; > R4 <<= 0x1 ; > CC = R4 < R5 ; > IF CC JUMP OVERFLOW ; > > ===== > Being unfamilier to assembly I could understand very little of it. > > Also after the last posting I could manage to get an emulator hardware kit > (for ADSP BF535) from my friend and tried to execute the Fixed Point > program on it. And there was not a big difference. The same results were > shown again. > I dont know why this is happening. As you said may be something very > simple but I am not able to catch it and that is the fact. :( > Thanks a lot,
That's a lot of instructions compared to a single-cycle fixed-point multiply, even accounting for setup. (There must be even more code that includes the jump targets and call-and-return code.) That it doesn't show in the timing is strange. Good luck tracking it down. Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
>bsdap wrote: > > ... > >> Hello Jerry, >> >> Thanks for the reply. >> I think the simulator for a fixed point DSP processor simulates the >> floating point because I could not figure out any floating point
library
>> in the simulator. But when I saw the Assembly output generated by the >> compiler and while single stepping through it I found that for
floating
>> point arith it refers to some specific memory locations and executes
an
>> assembly language code for respective operations which would do the >> floating point calculation. For example I looked at floating point >> multiplication part. It looks something like this. >> >> ===== >> __float32_mul >> >> SSYNC ; >> [ -- SP ] = ( R7:4 , P5:3 ) ; >> R7 = R0 ^ R1 ; >> P0 = R7 ; >> R4 = 0 ; >> R2 = R0 << 0x1 ; >> R3 = R1 << 0x1 ; >> CC = R2 == R4 ; >> IF CC JUMP RETURN_MULTZERO ; >> CC = R3 == R4 ; >> IF CC JUMP RETURN_MULTZERO ; >> R2 = R2 >> 24 ; >> R3 = R3 >> 24 ; >> R4 = 127 ( X ) ; >> R5 = R2 + R3 ; >> R5 = R5 - R4 ; >> P1 = R5 ; >> R4 <<= 0x1 ; >> CC = R4 < R5 ; >> IF CC JUMP OVERFLOW ; >> >> ===== >> Being unfamilier to assembly I could understand very little of it. >> >> Also after the last posting I could manage to get an emulator hardware
kit
>> (for ADSP BF535) from my friend and tried to execute the Fixed Point >> program on it. And there was not a big difference. The same results
were
>> shown again. >> I dont know why this is happening. As you said may be something very >> simple but I am not able to catch it and that is the fact. :( >> Thanks a lot, > >That's a lot of instructions compared to a single-cycle fixed-point >multiply, even accounting for setup. (There must be even more code that >includes the jump targets and call-and-return code.) That it doesn't >show in the timing is strange. Good luck tracking it down. > >Jerry >-- >Engineering is the art of making what you want from things you can get. >&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295; >
Well, thanks for the wishes...Jerry. And also for all the help. B.S.D.