DSPRelated.com
Forums

Extended precison (40 bit) memory operations

Started by sant...@isac.gov.in January 7, 2008
Dear all,
I am using a SHARC dsp (ADSP21020) with 1 MB X 40 bit
external data memory. I would like to use the complete
40bit memory to store and retrive the data. I had used
assembly and C and set the MODE1 (bit 16) to configure
the dsp for extended precision. However, it is using only
upper 32 bits for any variables (int , long int, float, long
double ). If i assign any register or variable
with 40 bits, for example
dm(i5,m5)=0xffff ffff ff; (compilation error)

*(int *)address=0xffff ffff aa;
(upper32 bits assigned to the addres, aa ignored)
*(float *)address= 0xffff ffff aa;
(upper32 bits assigned to the addres, aaignored)
*(long double *)=0xffff ffff aa; ( two words used, upper 32
bits, lower 8 bits ignore)

it uses only the upper 32 bits .. I would like to know what should be
done to use the lower
8bit of the 40 bits memory .
Can any one help me with a wrok arround or some example code.

regards,
Santanu
On Mon, 7 Jan 2008 s...@isac.gov.in wrote:

> Dear all,
> I am using a SHARC dsp (ADSP21020) with 1 MB X 40 bit
> external data memory. I would like to use the complete
> 40bit memory to store and retrive the data. I had used
> assembly and C and set the MODE1 (bit 16) to configure
> the dsp for extended precision. However, it is using only
> upper 32 bits for any variables (int , long int, float, long
> double ). If i assign any register or variable
> with 40 bits, for example
> dm(i5,m5)=0xffff ffff ff; (compilation error)
>
> *(int *)address=0xffff ffff aa;
> (upper32 bits assigned to the addres, aa ignored)
> *(float *)address= 0xffff ffff aa;
> (upper32 bits assigned to the addres, aaignored)
> *(long double *)=0xffff ffff aa; ( two words used, upper 32
> bits, lower 8 bits ignore)
>
> it uses only the upper 32 bits .. I would like to know what should be
> done to use the lower
> 8bit of the 40 bits memory .
> Can any one help me with a wrok arround or some example code.

You can't get those bits in integer mode. You can only read them in
floating point mode. To just move data around, you can use the PX
register. So you can say

px = r0;
dm(i5, m5) = px;

If you want to move 48 bits use pm bus instead.

But a direct reference will only transfer 32 bits for integers. It's in
the manual (see memory: external memory interfacing, page 5-35).

Patience, persistence, truth,
Dr. mike
On Tue, 8 Jan 2008 s...@isac.gov.in wrote:

> Dear Dr. Mike,
> Many thanks for your reply. I tried the way you suggested, however,
> I could only use
> D(i5,m5)=Px2; or D(i5,m5)=Px1; (D(i5,m5)=Px; -> compilation error)
> which also only allows the upper 32 bits of DM.
> Also, as the PM is PROM in my system, i am unable to use the PM for
> data manupulation. I was also wondering what the emulator might be
> doing while writing the lower 8 bits (as we can fill any data in all
> the 40 bits through the emulator).

the emulator may not reflect what the processor actually does. It uses
ram on a PC, and the important stuff will be right, but extra unused bits
may not be.

You can still use PM to access any where in ram you want. The difference
between PM and DM is the memory bus connected to the ram. Since the PM
address bus is small, you can't get everywhere, but the PM data bus is
the full 48 bits wide. So a PM(i5,m5)=PX should work.

Patience, persistence, truth,
Dr. mike
Dear Dr. Mike,
Many thanks for your reply. I tried the way you suggested, however,
I could only use
D(i5,m5)=Px2; or D(i5,m5)=Px1; (D(i5,m5)=Px; -> compilation error)
which also only allows the upper 32 bits of DM.
Also, as the PM is PROM in my system, i am unable to use the PM for
data manupulation. I was also wondering what the emulator might be
doing while writing the lower 8 bits (as we can fill any data in all
the 40 bits through the emulator).
Awaiting your reply.
regards,
Santanu
Quoting Mike Rosing :

> On Mon, 7 Jan 2008 s...@isac.gov.in wrote:
>
>> Dear all,
>> I am using a SHARC dsp (ADSP21020) with 1 MB X 40 bit
>> external data memory. I would like to use the complete
>> 40bit memory to store and retrive the data. I had used
>> assembly and C and set the MODE1 (bit 16) to configure
>> the dsp for extended precision. However, it is using only
>> upper 32 bits for any variables (int , long int, float, long
>> double ). If i assign any register or variable
>> with 40 bits, for example
>> dm(i5,m5)=0xffff ffff ff; (compilation error)
>>
>> *(int *)address=0xffff ffff aa;
>> (upper32 bits assigned to the addres, aa ignored)
>> *(float *)address= 0xffff ffff aa;
>> (upper32 bits assigned to the addres, aaignored)
>> *(long double *)=0xffff ffff aa; ( two words used, upper 32
>> bits, lower 8 bits ignore)
>>
>> it uses only the upper 32 bits .. I would like to know what should be
>> done to use the lower
>> 8bit of the 40 bits memory .
>> Can any one help me with a wrok arround or some example code.
>
> You can't get those bits in integer mode. You can only read them in
> floating point mode. To just move data around, you can use the PX
> register. So you can say
>
> px = r0;
> dm(i5, m5) = px;
>
> If you want to move 48 bits use pm bus instead.
>
> But a direct reference will only transfer 32 bits for integers. It's in
> the manual (see memory: external memory interfacing, page 5-35).
>
> Patience, persistence, truth,
> Dr. mike