| Author |
Message |
bsdap
Guest
|
Posted:
Thu Nov 24, 2005 9:16 am Post subject:
Number of Cycles taken by Fixed Point program |
|
|
Hi All,
I wrote a code in floating point and then converted it to fixed point(3
bit). The final answers given by both the codes are found to be same. The
I tried executing both these codes on Visual DSP++ 4.0 simulator to chec
the reduction in cycles by Fixed point code. But to my surprise the fixe
point code took more cycles than the floating point code. I found that th
elementry opeations like multiplication, division etc took more cycles tha
the corresponding floating point operations.
I wonder why this should happen??
Can anyone please help me with this...
Thank you very much in Anticipation.
b.s.d. |
|
| Back to top |
|
 |
Jerry Avins
Guest
|
Posted:
Thu Nov 24, 2005 5:16 pm Post subject:
Re: Number of Cycles taken by Fixed Point program |
|
|
bsdap wrote:
| Quote: | Hi All,
I wrote a code in floating point and then converted it to fixed point(32
bit). The final answers given by both the codes are found to be same. Then
I tried executing both these codes on Visual DSP++ 4.0 simulator to check
the reduction in cycles by Fixed point code. But to my surprise the fixed
point code took more cycles than the floating point code. I found that the
elementry opeations like multiplication, division etc took more cycles than
the corresponding floating point operations.
I wonder why this should happen??
Can anyone please help me with this...
Thank you very much in Anticipation.
b.s.d.
|
Ask the designer of the hardware. I can't explain the behavior because
you give no indication of the processor type.
Jerry
--
Engineering is the art of making what you want from things you can get.
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ |
|
| Back to top |
|
 |
Guest
|
Posted:
Fri Nov 25, 2005 1:16 am Post subject:
Re: Number of Cycles taken by Fixed Point program |
|
|
A floating point DSP sometimes has floating point multipliers but not
fixed point.
Then, a compiler will sometimes convert fixed point to floating point,
use the floating point multiplier, and convert back to fixed point.
This takes longer.
As Jerry says, it is probably a question of what hardware there is, and
what the compiler tries to do with it.
Chris
======================
Chris Bore
BORES Signal Processing
www.bores.com |
|
| Back to top |
|
 |
BS
Guest
|
Posted:
Fri Nov 25, 2005 9:15 am Post subject:
Re: Number of Cycles taken by Fixed Point program |
|
|
chris_bore@yahoo.co.uk wrote:
| Quote: | A floating point DSP sometimes has floating point multipliers but not
fixed point.
Then, a compiler will sometimes convert fixed point to floating point,
use the floating point multiplier, and convert back to fixed point.
This takes longer.
As Jerry says, it is probably a question of what hardware there is, and
what the compiler tries to do with it.
Chris
======================
Chris Bore
BORES Signal Processing
www.bores.com
|
Does any one know any other way to evaluate the performance of the
Fixed point code other than the DSP simulator.
bs. |
|
| Back to top |
|
 |
bsdap
Guest
|
Posted:
Fri Nov 25, 2005 9:15 am Post subject:
Re: Number of Cycles taken by Fixed Point program |
|
|
| Quote: | A floating point DSP sometimes has floating point multipliers but not
fixed point.
Then, a compiler will sometimes convert fixed point to floating point,
use the floating point multiplier, and convert back to fixed point.
This takes longer.
As Jerry says, it is probably a question of what hardware there is, and
what the compiler tries to do with it.
Chris
======================
Chris Bore
BORES Signal Processing
www.bores.com
|
Hi,
Thank you very much for the replies.
I am extremely sorry I forgot to give the details.
Actually I am not using any hardware but simulating the code for Blackfi
processor (BF535) which is supposed to be a fixed point processor i
Visual DSP++ and that is why I am more concerned about the above query
The fixed point functions that I have used are all from the standard fixe
point library (dsp_fx).
Now can you please help me out.
B.S.D. |
|
| Back to top |
|
 |
Jerry Avins
Guest
|
Posted:
Fri Nov 25, 2005 5:16 pm Post subject:
Re: Number of Cycles taken by Fixed Point program |
|
|
bsdap wrote:
| Quote: | A floating point DSP sometimes has floating point multipliers but not
fixed point.
Then, a compiler will sometimes convert fixed point to floating point,
use the floating point multiplier, and convert back to fixed point.
This takes longer.
As Jerry says, it is probably a question of what hardware there is, and
what the compiler tries to do with it.
Chris
======================
Chris Bore
BORES Signal Processing
www.bores.com
Hi,
Thank you very much for the replies.
I am extremely sorry I forgot to give the details.
Actually I am not using any hardware but simulating the code for Blackfin
processor (BF535) which is supposed to be a fixed point processor in
Visual DSP++ and that is why I am more concerned about the above query.
The fixed point functions that I have used are all from the standard fixed
point library (dsp_fx).
Now can you please help me out.
B.S.D.
|
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.
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ |
|
| Back to top |
|
 |
Guest
|
Posted:
Sat Nov 26, 2005 1:16 am Post subject:
Re: Number of Cycles taken by Fixed Point program |
|
|
Any DSP can do a multiply and accumulate within a single cycle. A
floating point DSP can multiply and accumulate 2 floating point values
within one cycle. A fixed point 16 bit DSP does the same thing but with
two 16 bit values. To perform a multiply and accumulate of two floating
point values with a 16 bit DSP logically takes more time than with a
floating point DSP. Even a 32 bit DSP will take more time to do the
same operation. |
|
| Back to top |
|
 |
Jerry Avins
Guest
|
Posted:
Sat Nov 26, 2005 8:03 am Post subject:
Re: Number of Cycles taken by Fixed Point program |
|
|
jmoes@chello.nl wrote:
| Quote: | ... A
floating point DSP can multiply and accumulate 2 floating point values
within one cycle. A fixed point 16 bit DSP does the same thing but with
two 16 bit values.
|
I assume you have particular processors in mind. Certainly not all have
the data-bus and memory arrangements to fetch four operands in the same
cycle.
| Quote: | To perform a multiply and accumulate of two floating
point values with a 16 bit DSP logically takes more time than with a
floating point DSP. Even a 32 bit DSP will take more time to do the
same operation.
|
Logically but not in fact?
Jerry
--
Engineering is the art of making what you want from things you can get.
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ |
|
| Back to top |
|
 |
Guest
|
Posted:
Sat Nov 26, 2005 9:15 am Post subject:
Re: Number of Cycles taken by Fixed Point program |
|
|
I don't understand how you are comparing with floating point
operations, since floating point ops won't be supported by your
processor.
For most DSPs multiplication, addition etc. should take only 1 cycle if
you are working within the supported precision for data. So you need to
take care of the precision that is supported for the operations. e.g.
if 16-bit multiplication instruction is supported you can't do
32-multiplication in single cycle. Division would usually take many
more since most fixed point processors don't have a division circuit
and division is supported by algorithms using subtraction. |
|
| Back to top |
|
 |
bsdap
Guest
|
Posted:
Mon Nov 28, 2005 5:16 pm Post subject:
Re: Number of Cycles taken by Fixed Point program |
|
|
| Quote: |
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 simulato
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 th
simulator is selected for the BF535 DSP so it has to load all the setting
for the said DSP.
I am still confused why this would happen. I was just thinking whether th
issue is related to optimization of the code, but I am not sure.If it i
the issue related to optimization then what steps need to be followed?? O
if I have to use some Blackfin specific libraries (?) then from where I ca
get it??
Thanks again,
B.S.D. |
|
| Back to top |
|
 |
Jerry Avins
Guest
|
Posted:
Mon Nov 28, 2005 5:16 pm Post subject:
Re: Number of Cycles taken by Fixed Point program |
|
|
bsdap wrote:
| Quote: | 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.
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ |
|
| Back to top |
|
 |
Jerry Avins
Guest
|
Posted:
Tue Nov 29, 2005 5:16 pm Post subject:
Re: Number of Cycles taken by Fixed Point program |
|
|
bsdap wrote:
...
| Quote: | 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.
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ |
|
| Back to top |
|
 |
bsdap
Guest
|
Posted:
Tue Nov 29, 2005 5:16 pm Post subject:
Re: Number of Cycles taken by Fixed Point program |
|
|
| Quote: |
Hi Jerry,
First of all, a million thanks for replying my query and the guidance
The simulator timing is definitely related to real Hardware becaus
the
simulator is selected for the BF535 DSP so it has to load all th
settings
for the said DSP.
I am still confused why this would happen. I was just thinking whethe
the
issue is related to optimization of the code, but I am not sure.If i
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
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 assumptio
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 th
floating point because I could not figure out any floating point librar
in the simulator. But when I saw the Assembly output generated by th
compiler and while single stepping through it I found that for floatin
point arith it refers to some specific memory locations and executes a
assembly language code for respective operations which would do th
floating point calculation. For example I looked at floating poin
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 ki
(for ADSP BF535) from my friend and tried to execute the Fixed Poin
program on it. And there was not a big difference. The same results wer
shown again.
I dont know why this is happening. As you said may be something ver
simple but I am not able to catch it and that is the fact. :(
Thanks a lot,
B.S.D. |
|
| Back to top |
|
 |
bsdap
Guest
|
Posted:
Wed Nov 30, 2005 5:16 pm Post subject:
Re: Number of Cycles taken by Fixed Point program |
|
|
| Quote: | 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 poin
library
in the simulator. But when I saw the Assembly output generated by the
compiler and while single stepping through it I found that fo
floating
point arith it refers to some specific memory locations and execute
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 hardwar
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 result
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.
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
|
Well, thanks for the wishes...Jerry. And also for all the help.
B.S.D. |
|
| Back to top |
|
 |
|
|
|
|