Reply by Jerry Avins May 30, 20052005-05-30
sandeep_mc81@yahoo.com wrote:

   ...

> Jerry, > > There are some modes used in the assembly of ADSP-218x to convert > between integer and fractional mode. > > The input to the subroutine is 32 bit number. The output is also a > 32-bit number.
Divided by 32.
> There is an instruction dis M_MODE which disables the > integer mode multiplication. Actually the input is normalised before > feeding to the MAC unit. The MAC operates on two 1.15 input format, > producing 2.30 which automatically left shifts to produce 1.31 output.
Doubling the sign bit? I'm confused, It's late.
> Before and after the MAC opeartion, the input/output is arithmetically > right shifted by 16 bits. Again there are couple of multiplications > done after this operation. > > Before the final result is output, the fractional mode is diasabled and > the result is arithmetically right shifted by 5 bits.
There's the /32.
> If u try to convert the input from Q15, the results do not match.
Match with what? Do you know the right answer? If so, what's the ratio?
> For EX: .5 is represented as 0x0004 0000 in Q19 format and the same is > repersentd as 0x0000 4000 in Q15 format. > > The same is the case with output format. I can not do it on a trail and
Trial, I presume ----^
> error basis becoz it would take a hell lot of time. The only way to do > it trace thro' the code.
Set up the MAC with only one non-zero coefficient, use two test inputs with only one bit set in each, and see what comes out. Whatever theory explains both results is likely to put you on the right track quickly.
> I hope this is sufficient.
Sufficient for what? I'm not in a position to trace the code; I don't have it, the assembler manual, nor the motivation. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by May 30, 20052005-05-30

Martin Blume wrote:
> "Jerry Avins" schrieb > > > > > > I have been given the ADSP-218x assembly code module. The > > > task is to identify the input format and output format of > > > the module. > > > [...] > > > ( I can not share the code) > > > > > > > OK: you can't share the code. Can you at least share an > > opcode or two? > > > I have only the slightest knowledge of assembler, but I guess > the instructions where the input | output is marshalled > would be nice to see; these shouldn't be so terribly worthwhile to > protect (unless the original author came up with a very clever way > to store data in less memory or to be > able to work with it faster). > And if you are so keen to know what it is, you'll have to > share a little bit of knowledge and/or money, no? > > > > > Are internal operations integer, or float? Is there any > > conversion? (To convert between integer and float in > > assembler, what would you do? Does the code do anything > > like that?) Are there otherwise unexplained shifts > > that might hint at fixed-point format not directly > > supported by machine instructions? > > > > Play detective. > > > You could look at the code as black box and feed it known > input (known values and known format) and look at what > comes out. You already revealed that it computes a log, > so the output should be known (value), from that you can > guess the format. > > > The best way is to actually understand the algorithm > sound theoretical advice :-) ... > > > (oy, veh)! > ... combined with practical sympathy :-) > > > The broad outline will probably come clear first. By > > refining your understanding to include the details, you > > will know the formats. > > > > HTH > Martin
Jerry, There are some modes used in the assembly of ADSP-218x to convert between integer and fractional mode. The input to the subroutine is 32 bit number. The output is also a 32-bit number. There is an instruction dis M_MODE which disables the integer mode multiplication. Actually the input is normalised before feeding to the MAC unit. The MAC operates on two 1.15 input format, producing 2.30 which automatically left shifts to produce 1.31 output. Before and after the MAC opeartion, the input/output is arithmetically right shifted by 16 bits. Again there are couple of multiplications done after this operation. Before the final result is output, the fractional mode is diasabled and the result is arithmetically right shifted by 5 bits. If u try to convert the input from Q15, the results do not match. For EX: .5 is represented as 0x0004 0000 in Q19 format and the same is repersentd as 0x0000 4000 in Q15 format. The same is the case with output format. I can not do it on a trail and error basis becoz it would take a hell lot of time. The only way to do it trace thro' the code. I hope this is sufficient. Thanks Sandeep
Reply by Martin Blume May 27, 20052005-05-27
"Jerry Avins" schrieb
> > > > I have been given the ADSP-218x assembly code module. The > > task is to identify the input format and output format of > > the module. > > [...] > > ( I can not share the code) > > > > OK: you can't share the code. Can you at least share an > opcode or two? >
I have only the slightest knowledge of assembler, but I guess the instructions where the input | output is marshalled would be nice to see; these shouldn't be so terribly worthwhile to protect (unless the original author came up with a very clever way to store data in less memory or to be able to work with it faster). And if you are so keen to know what it is, you'll have to share a little bit of knowledge and/or money, no?
> > Are internal operations integer, or float? Is there any > conversion? (To convert between integer and float in > assembler, what would you do? Does the code do anything > like that?) Are there otherwise unexplained shifts > that might hint at fixed-point format not directly > supported by machine instructions? > > Play detective. >
You could look at the code as black box and feed it known input (known values and known format) and look at what comes out. You already revealed that it computes a log, so the output should be known (value), from that you can guess the format.
> The best way is to actually understand the algorithm
sound theoretical advice :-) ...
> (oy, veh)!
... combined with practical sympathy :-)
> The broad outline will probably come clear first. By > refining your understanding to include the details, you > will know the formats. >
HTH Martin
Reply by Jerry Avins May 27, 20052005-05-27
sandeep_mc81@yahoo.com wrote:
> Hi, > > I have been given the ADSP-218x assembly code module. The task is to > identify the input format and output format of the module. Basically > this module calculates the logarithm of a number. It takes a 32-bit > number and outputs the 32-bit number.( I can not share the code) > > How does one identify the formats in such cases ? > Generally what one should look forward in identifying the formats in > the assembly code. > > i.e the input format could be Q15, Q14, Q19, Q20.... and output format > could be Q2, Q3, ... > > Thanks > Sandeep
OK: you can't share the code. Can you at least share an opcode or two? Are internal operations integer, or float? Is there any conversion? (To convert between integer and float in assembler, what would you do? Does the code do anything like that?) Are there otherwise unexplained shifts that might hint at fixed-point format not directly supported by machine instructions? Play detective. The best way is to actually understand the algorithm (oy, veh)! The broad outline will probably come clear first. By refining your understanding to include the details, you will know the formats. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by bhooshaniyer May 27, 20052005-05-27
> ><sandeep_mc81@yahoo.com> wrote in message >news:1117185355.958928.33770@g14g2000cwa.googlegroups.com... >> Hi, >> >> I have been given the ADSP-218x assembly code module. The task is to >> identify the input format and output format of the module. Basically >> this module calculates the logarithm of a number. It takes a 32-bit >> number and outputs the 32-bit number.( I can not share the code) >> >> How does one identify the formats in such cases ? >> Generally what one should look forward in identifying the formats in >> the assembly code. >> >> i.e the input format could be Q15, Q14, Q19, Q20.... and output format >> could be Q2, Q3, ... >> >> Thanks >> Sandeep >> > >If you can't share the code, we can't share our techniques :-) > > >
Cmon John, dont be so harsh. Now Sandeep, why dont you give us a peek? :-) --Bhooshan This message was sent using the Comp.DSP web interface on www.DSPRelated.com
Reply by John Smith May 27, 20052005-05-27
<sandeep_mc81@yahoo.com> wrote in message
news:1117185355.958928.33770@g14g2000cwa.googlegroups.com...
> Hi, > > I have been given the ADSP-218x assembly code module. The task is to > identify the input format and output format of the module. Basically > this module calculates the logarithm of a number. It takes a 32-bit > number and outputs the 32-bit number.( I can not share the code) > > How does one identify the formats in such cases ? > Generally what one should look forward in identifying the formats in > the assembly code. > > i.e the input format could be Q15, Q14, Q19, Q20.... and output format > could be Q2, Q3, ... > > Thanks > Sandeep >
If you can't share the code, we can't share our techniques :-)
Reply by May 27, 20052005-05-27
Hi,

I have been given the ADSP-218x assembly code module. The task is to
identify the input format and output format of the module. Basically
this module calculates the logarithm of a number. It takes a 32-bit
number and outputs the 32-bit number.( I can not share the code)

How does one identify the formats in such cases ?
Generally what one should look forward in identifying the formats in
the assembly code.

i.e the input format could be Q15, Q14, Q19, Q20.... and output format
could be Q2, Q3, ...

Thanks
Sandeep