<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Fractional Arithmetic in Classic/Legacy CodeWarrior</title>
    <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Fractional-Arithmetic/m-p/192134#M4887</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;This Application Note is not for CodeWarrior tools.&lt;/DIV&gt;&lt;DIV&gt;Extract of the AN:&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="3"&gt;&lt;/FONT&gt;&lt;P&gt;&lt;FONT size="3"&gt;This application note describes the process of preparing standard 16-bit, bit-exact algorithms so that they compile for the Freescale DSP56300 family of processors using the DSP56300 C compiler from TASKING, Inc.&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;In CodeWarrior Processor Expert provides some beans for all DSP Function&amp;amp; Math Library:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;Array Function Library,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;Digital Signal Processing Library,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;Fractionnal Math Library,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;Matrix Math Library,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;Trigonometric Function Library,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;Vector Math Library.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Some example are delivered on the installation using them.&lt;/DIV&gt;&lt;DIV&gt;Please have a look to the folder:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; \Stationery\Processor_Expert_Examples\TestApplications\Signal&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Hope this will help you.&lt;/DIV&gt;&lt;DIV&gt;Regards&lt;/DIV&gt;&lt;DIV&gt;Pascal&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 Feb 2008 16:44:24 GMT</pubDate>
    <dc:creator>trytohelp</dc:creator>
    <dc:date>2008-02-21T16:44:24Z</dc:date>
    <item>
      <title>Fractional Arithmetic</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Fractional-Arithmetic/m-p/192133#M4886</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm having the hardest time wraping my brain around Fractional data types.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I need to convert integers, such as the values returned from the ADC,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and floats, such as 0.3835545, to Fract16 values.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the application note an1772.pdf I found these to be almost useful...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#define _CI(X) *(INT )&amp;amp;(X) /* Convert to int */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#define _CPI(X) (INT *)(X) /* Convert to pointer to int */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#define _CLI(X) *(long int *)&amp;amp;(X) /* Convert to long */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#define _CF(X) *(_fract *)&amp;amp;(X) /* Convert to fractional */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#define _CPF(X) (_fract *)(X) /* Convert to pointer to fract. */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#define _CLF(X) *(long _fract *)&amp;amp;(X) /* Convert to long fract.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;except there is no definition of _fract.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does anyone have working macros to do this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for any help&lt;/SPAN&gt;&lt;BR /&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Feb 2008 02:29:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Fractional-Arithmetic/m-p/192133#M4886</guid>
      <dc:creator>DaveB</dc:creator>
      <dc:date>2008-02-21T02:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: Fractional Arithmetic</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Fractional-Arithmetic/m-p/192134#M4887</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;This Application Note is not for CodeWarrior tools.&lt;/DIV&gt;&lt;DIV&gt;Extract of the AN:&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="3"&gt;&lt;/FONT&gt;&lt;P&gt;&lt;FONT size="3"&gt;This application note describes the process of preparing standard 16-bit, bit-exact algorithms so that they compile for the Freescale DSP56300 family of processors using the DSP56300 C compiler from TASKING, Inc.&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;In CodeWarrior Processor Expert provides some beans for all DSP Function&amp;amp; Math Library:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;Array Function Library,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;Digital Signal Processing Library,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;Fractionnal Math Library,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;Matrix Math Library,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;Trigonometric Function Library,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;Vector Math Library.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Some example are delivered on the installation using them.&lt;/DIV&gt;&lt;DIV&gt;Please have a look to the folder:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; \Stationery\Processor_Expert_Examples\TestApplications\Signal&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Hope this will help you.&lt;/DIV&gt;&lt;DIV&gt;Regards&lt;/DIV&gt;&lt;DIV&gt;Pascal&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Feb 2008 16:44:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Fractional-Arithmetic/m-p/192134#M4887</guid>
      <dc:creator>trytohelp</dc:creator>
      <dc:date>2008-02-21T16:44:24Z</dc:date>
    </item>
    <item>
      <title>Re: Fractional Arithmetic</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Fractional-Arithmetic/m-p/192135#M4888</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;Thanks Pascal.&lt;BR /&gt;In \Stationery\Processor_Expert_Examples\DemoApplications\56F8300_DemoBoard\Voice_Recorder_Demo&lt;BR /&gt;I found this macro ...&lt;BR /&gt;#define FRAC16(x) ((Frac16)((x) &amp;lt; 1 ? ((x) &amp;gt;= -1 ? (x)*0x8000 : 0x8000) : 0x7FFF))&lt;BR /&gt;used to convert the float FIR Coefficients to Fract16.&lt;BR /&gt;This example also just stores the ADC values as type Frac16.&lt;BR /&gt;If you were to us the Library funct mult to multiply an ADC integer of 8192 time the Frac16 representation&lt;BR /&gt;of 0.25 (also 8192) would the result be 2048 or 67108864 which would not fit in a Frac16?&lt;BR /&gt;&lt;BR /&gt;What I'm trying to do is multiply a float Hanning window coefficient by the sampled ADC values, before doing&lt;BR /&gt;an FFT on the samples.&lt;BR /&gt;&lt;BR /&gt;I'm obviously still not getting something.&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;Message Edited by DaveB on &lt;SPAN class="date_text"&gt;2008-02-21&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;12:17 PM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Feb 2008 01:16:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Fractional-Arithmetic/m-p/192135#M4888</guid>
      <dc:creator>DaveB</dc:creator>
      <dc:date>2008-02-22T01:16:37Z</dc:date>
    </item>
    <item>
      <title>Re: Fractional Arithmetic</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Fractional-Arithmetic/m-p/192136#M4889</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The compiler has some intinsic functions.&lt;/DIV&gt;&lt;DIV&gt;These function are using Fractional too and can be used for math functions.&lt;/DIV&gt;&lt;DIV&gt;Please refer to the Targeting_56800E.pdf manual.&lt;/DIV&gt;&lt;DIV&gt;There is a chapter named Inline Assembly Language and Intrinsics - 10.&lt;/DIV&gt;&lt;DIV&gt;There a lot of functions for multiplication depending of your want to do.&lt;/DIV&gt;&lt;DIV&gt;Can you please have look at them ?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;For instance:&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;L_mult&lt;BR /&gt;Multiply two 16-bit fractional values generating a signed 32-bit fractional result. Saturates&lt;BR /&gt;only for the case of 0x8000 x 0x8000.&lt;BR /&gt;Assumptions&lt;BR /&gt;OMR’s SA bit was set to 1 at least three cycles before this code, that is, saturation on data&lt;BR /&gt;ALU results enabled.&lt;BR /&gt;Prototype&lt;BR /&gt;Word32 L_mult(Word16 sinp1, Word16 sinp2)&lt;BR /&gt;Example&lt;BR /&gt;short s1 = 0x2000;/* 0.25 */&lt;BR /&gt;short s2 = 0x2000;/* 0.25 */&lt;BR /&gt;long result;&lt;BR /&gt;result = L_mult(s1,s2);&lt;BR /&gt;// Expected value of result: 0.0625 = 0x08000000&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Pascal&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Feb 2008 18:51:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Fractional-Arithmetic/m-p/192136#M4889</guid>
      <dc:creator>trytohelp</dc:creator>
      <dc:date>2008-02-26T18:51:57Z</dc:date>
    </item>
    <item>
      <title>Re: Fractional Arithmetic</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Fractional-Arithmetic/m-p/192137#M4890</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Thanks Pascal, I seem to have it working now.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Feb 2008 02:26:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Fractional-Arithmetic/m-p/192137#M4890</guid>
      <dc:creator>DaveB</dc:creator>
      <dc:date>2008-02-27T02:26:05Z</dc:date>
    </item>
    <item>
      <title>Re: Fractional Arithmetic</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Fractional-Arithmetic/m-p/192138#M4891</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;your welcome.&lt;/DIV&gt;&lt;DIV&gt;Don't hesitate to contact us.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Pascal&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Feb 2008 03:17:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Fractional-Arithmetic/m-p/192138#M4891</guid>
      <dc:creator>trytohelp</dc:creator>
      <dc:date>2008-02-27T03:17:07Z</dc:date>
    </item>
  </channel>
</rss>

