DSPRelated.com
Forums

AW: SHARC Circular Buffers in C, Software Interrupts

Started by Christoph Ripcke August 19, 2002
Hi Jaime,

all you want to know is written in manuals but here's a short hint.

circular buffers (buffer 7 example):

{
register unsigned int *I7 asm ( "i7" ); // index
register unsigned int *L7 asm ( "l7" ); // length of buffer
register unsigned int *B7 asm ( "b7" ); // base address of buffer
register unsigned int *M7 asm ( "m7" ); // modifier to use

/*
* what U want to do
*/
}

make sure that the compiler won't use the registers you use. In the compiler
setting tabs you can list those registers. For user software interrupts have a look at library function interrupt(f,s),
signal and raise. Last two are used for triggering software itnerrupts.

regards
Christoph -----Originalnachricht-----
Von: jaime_aranguren
An:
Gesendet: 18.08.2002 17:03
Betreff: [adsp] SHARC Circular Buffers in C, Software Interrupts

Hello,

Could please anyone give me information on how to use Circular
Buffers in C
for the SHARC?

Also need guidance on how to setup and use User Software Interrupts
(in C)
for the SHARC.

Using VDSP++ 2.0 for SHARC.

Thanks a lot

--

----------------
Jaime Andr Aranguren Cardona _____________________________________
Note: If you do a simple "reply" with your email client, only the author
of this message will receive your answer. You need to do a "reply all"
if you want your answer to be distributed to the entire group.

_____________________________________
About this discussion group:

To Join: Send an email to

To Post: Send an email to

To Leave: Send an email to

Archives: http://groups.yahoo.com/group/adsp

Other Groups: http://www.dsprelated.com/groups.php3 ">http://docs.yahoo.com/info/terms/



I have asked this question on this group before.
The response I got indicate that the C compiler does not have any
support for Circular Buffers. The macros (in macros.h) that let you
do this are antique and may not work as advertised.

Christoph's suggestion is pretty much inline assembly and isn't
direct support in C.

You are better off writing an assembly function for the routine or,
implement a modulo buffer in C - it won't be as elegant and certainly
doesn't use the hardware features, but may be more readable

Cheers
Bhaskar

--- In adsp@y..., Christoph Ripcke <CRipcke@m...> wrote:
> Hi Jaime,
>
> all you want to know is written in manuals but here's a short hint.
>
> circular buffers (buffer 7 example):
>
> {
> register unsigned int *I7 asm ( "i7" ); // index
> register unsigned int *L7 asm ( "l7" ); // length of buffer
> register unsigned int *B7 asm ( "b7" ); // base address of
buffer
> register unsigned int *M7 asm ( "m7" ); // modifier to use
>
> /*
> * what U want to do
> */
> }
>
> make sure that the compiler won't use the registers you use. In the
compiler
> setting tabs you can list those registers. > For user software interrupts have a look at library function
interrupt(f,s),
> signal and raise. Last two are used for triggering software
itnerrupts.
>
> regards
> Christoph > -----Originalnachricht-----
> Von: jaime_aranguren
> An: adsp@y...
> Gesendet: 18.08.2002 17:03
> Betreff: [adsp] SHARC Circular Buffers in C, Software Interrupts
>
> Hello,
>
> Could please anyone give me information on how to use Circular
> Buffers in C
> for the SHARC?
>
> Also need guidance on how to setup and use User Software Interrupts
> (in C)
> for the SHARC.
>
> Using VDSP++ 2.0 for SHARC.
>
> Thanks a lot
>
> --
>
> ----------------
> Jaime Andr Aranguren Cardona
> jaime.aranguren@i...
> jaime.aranguren@c... >
> _____________________________________
> Note: If you do a simple "reply" with your email client, only the
author
> of this message will receive your answer. You need to do a "reply
all"
> if you want your answer to be distributed to the entire group.
>
> _____________________________________
> About this discussion group:
>
> To Join: Send an email to adsp-subscribe@y...
>
> To Post: Send an email to adsp@y...
>
> To Leave: Send an email to adsp-unsubscribe@y...
>
> Archives: http://groups.yahoo.com/group/adsp
>
> Other Groups: http://www.dsprelated.com/groups.php3 > ">http://docs.yahoo.com/info/terms/



Hello,
Thanks for the reply. Which manuals do you refer to? The Appendix D of the
legacy tools? In macros.h there are only plain C macros, not real hardware
support for circular buffers. So, what could it be the performance
improvement???
Furthermore, as some registers can't be used by the compiler, that could damage
performance making it even worse.
Please, furhter examples, explanations and "personal design success stories" are
very welcomed.
I must clarify, I am working with ADSP-21160M, if it maybe makes a difference.
Best wishes,
JaaC
Christoph Ripcke wrote:Hi Jaime,

all you want to know is written in manuals but here's a short hint.

circular buffers (buffer 7 example):

{
register unsigned int *I7 asm ( "i7" ); // index
register unsigned int *L7 asm ( "l7" ); // length of buffer
register unsigned int *B7 asm ( "b7" ); // base address of buffer
register unsigned int *M7 asm ( "m7" ); // modifier to use

/*
* what U want to do
*/
}

make sure that the compiler won't use the registers you use. In the compiler
setting tabs you can list those registers. For user software interrupts have a look at library function interrupt(f,s),
signal and raise. Last two are used for triggering software itnerrupts.

regards
Christoph -----Originalnachricht-----
Von: jaime_aranguren
An:
Gesendet: 18.08.2002 17:03
Betreff: [adsp] SHARC Circular Buffers in C, Software Interrupts

Hello,

Could please anyone give me information on how to use Circular
Buffers in C
for the SHARC?

Also need guidance on how to setup and use User Software Interrupts
(in C)
for the SHARC.

Using VDSP++ 2.0 for SHARC.

Thanks a lot

--

----------------
Jaime Andr Aranguren Cardona _____________________________________
Note: If you do a simple "reply" with your email client, only the author
of this message will receive your answer. You need to do a "reply all"
if you want your answer to be distributed to the entire group.

_____________________________________
About this discussion group:

To Join: Send an email to

To Post: Send an email to

To Leave: Send an email to

Archives: http://groups.yahoo.com/group/adsp

Other Groups: http://www.dsprelated.com/groups.php3 ">http://docs.yahoo.com/info/terms/
_____________________________________
Note: If you do a simple "reply" with your email client, only the author of this
message will receive your answer. You need to do a "reply all" if you want your
answer to be distributed to the entire group.

_____________________________________
About this discussion group:

To Join: Send an email to

To Post: Send an email to

To Leave: Send an email to

Archives: http://groups.yahoo.com/group/adsp

Other Groups: http://www.dsprelated.com/groups.php3 ">http://docs.yahoo.com/info/terms/

Jaime Andr Aranguren Cardona



Hello,
Thanks for the advice. I have some questions.
- After asking several times, what has been your approach? Could you please
illustrate about that?
- Does Christoph's suggestion help to improve performance?
- I am aware that ciruclar buffers usage demands for register reserving to avoid
usage by the C compiler. How does that affect performance? Could you please
share experiences?
A final clarification: I am using ADSP-21160M (SIMD DSP), if it is relevant.
Cheers,
JaaC
bhaskar_thiagarajan wrote:I have asked this question on this group before.
The response I got indicate that the C compiler does not have any
support for Circular Buffers. The macros (in macros.h) that let you
do this are antique and may not work as advertised.

Christoph's suggestion is pretty much inline assembly and isn't
direct support in C.

You are better off writing an assembly function for the routine or,
implement a modulo buffer in C - it won't be as elegant and certainly
doesn't use the hardware features, but may be more readable

Cheers
Bhaskar

--- In adsp@y..., Christoph Ripcke wrote:
> Hi Jaime,
>
> all you want to know is written in manuals but here's a short hint.
>
> circular buffers (buffer 7 example):
>
> {
> register unsigned int *I7 asm ( "i7" ); // index
> register unsigned int *L7 asm ( "l7" ); // length of buffer
> register unsigned int *B7 asm ( "b7" ); // base address of
buffer
> register unsigned int *M7 asm ( "m7" ); // modifier to use
>
> /*
> * what U want to do
> */
> }
>
> make sure that the compiler won't use the registers you use. In the
compiler
> setting tabs you can list those registers. > For user software interrupts have a look at library function
interrupt(f,s),
> signal and raise. Last two are used for triggering software
itnerrupts.
>
> regards
> Christoph > -----Originalnachricht-----
> Von: jaime_aranguren
> An: adsp@y...
> Gesendet: 18.08.2002 17:03
> Betreff: [adsp] SHARC Circular Buffers in C, Software Interrupts
>
> Hello,
>
> Could please anyone give me information on how to use Circular
> Buffers in C
> for the SHARC?
>
> Also need guidance on how to setup and use User Software Interrupts
> (in C)
> for the SHARC.
>
> Using VDSP++ 2.0 for SHARC.
>
> Thanks a lot
>
> --
>
> ----------------
> Jaime Andr Aranguren Cardona
> jaime.aranguren@i...
> jaime.aranguren@c... >
> _____________________________________
> Note: If you do a simple "reply" with your email client, only the
author
> of this message will receive your answer. You need to do a "reply
all"
> if you want your answer to be distributed to the entire group.
>
> _____________________________________
> About this discussion group:
>
> To Join: Send an email to adsp-subscribe@y...
>
> To Post: Send an email to adsp@y...
>
> To Leave: Send an email to adsp-unsubscribe@y...
>
> Archives: http://groups.yahoo.com/group/adsp
>
> Other Groups: http://www.dsprelated.com/groups.php3 > ">http://docs.yahoo.com/info/terms/
_____________________________________
Note: If you do a simple "reply" with your email client, only the author of this
message will receive your answer. You need to do a "reply all" if you want your
answer to be distributed to the entire group.

_____________________________________
About this discussion group:

To Join: Send an email to

To Post: Send an email to

To Leave: Send an email to

Archives: http://groups.yahoo.com/group/adsp

Other Groups: http://www.dsprelated.com/groups.php3 ">http://docs.yahoo.com/info/terms/

Jaime Andr Aranguren Cardona


Hi Bhaskar,

I don not recommend inline assembly, I recommend to hold hand on how the
compiler uses the CPU registers. the only "inline" is the guidance for the
compiler to name register to make it readable. After the register var
declaration you can continue with plain C and make it as readable as you
like to.

regards
Christoph

P.S.: I know it was silly to declare length and modify register and
pointers. Best regards from copy 'n paste

-----Originalnachricht-----
Von: bhaskar_thiagarajan
An:
Gesendet: 19.08.2002 20:44
Betreff: [adsp] Re: SHARC Circular Buffers in C, Software Interrupts

I have asked this question on this group before.
The response I got indicate that the C compiler does not have any
support for Circular Buffers. The macros (in macros.h) that let you
do this are antique and may not work as advertised.

Christoph's suggestion is pretty much inline assembly and isn't
direct support in C.

You are better off writing an assembly function for the routine or,
implement a modulo buffer in C - it won't be as elegant and certainly
doesn't use the hardware features, but may be more readable

Cheers
Bhaskar

--- In adsp@y..., Christoph Ripcke <CRipcke@m...> wrote:
> Hi Jaime,
>
> all you want to know is written in manuals but here's a short hint.
>
> circular buffers (buffer 7 example):
>
> {
> register unsigned int *I7 asm ( "i7" ); // index
> register unsigned int *L7 asm ( "l7" ); // length of buffer
> register unsigned int *B7 asm ( "b7" ); // base address of
buffer
> register unsigned int *M7 asm ( "m7" ); // modifier to use
>
> /*
> * what U want to do
> */
> }
>
> make sure that the compiler won't use the registers you use. In the
compiler
> setting tabs you can list those registers. > For user software interrupts have a look at library function
interrupt(f,s),
> signal and raise. Last two are used for triggering software
itnerrupts.
>
> regards
> Christoph > -----Originalnachricht-----
> Von: jaime_aranguren
> An: adsp@y...
> Gesendet: 18.08.2002 17:03
> Betreff: [adsp] SHARC Circular Buffers in C, Software Interrupts
>
> Hello,
>
> Could please anyone give me information on how to use Circular
> Buffers in C
> for the SHARC?
>
> Also need guidance on how to setup and use User Software Interrupts
> (in C)
> for the SHARC.
>
> Using VDSP++ 2.0 for SHARC.
>
> Thanks a lot
>
> --
>
> ----------------
> Jaime Andr Aranguren Cardona
> jaime.aranguren@i...
> jaime.aranguren@c... >
> _____________________________________
> Note: If you do a simple "reply" with your email client, only the
author
> of this message will receive your answer. You need to do a "reply
all"
> if you want your answer to be distributed to the entire group.
>
> _____________________________________
> About this discussion group:
>
> To Join: Send an email to adsp-subscribe@y...
>
> To Post: Send an email to adsp@y...
>
> To Leave: Send an email to adsp-unsubscribe@y...
>
> Archives: http://groups.yahoo.com/group/adsp
>
> Other Groups: http://www.dsprelated.com/groups.php3 > ">http://docs.yahoo.com/info/terms/
_____________________________________
Note: If you do a simple "reply" with your email client, only the author
of this message will receive your answer. You need to do a "reply all"
if you want your answer to be distributed to the entire group.

_____________________________________
About this discussion group:

To Join: Send an email to

To Post: Send an email to

To Leave: Send an email to

Archives: http://groups.yahoo.com/group/adsp

Other Groups: http://www.dsprelated.com/groups.php3 ">http://docs.yahoo.com/info/terms/