<?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: Not able to perform Multiplication and Division operation of float variable variables in S12 / MagniV Microcontrollers</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Not-able-to-perform-Multiplication-and-Division-operation-of/m-p/628507#M13439</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rajkumar,&lt;BR /&gt;The standard MTRCKTSBNZVM128 code works with fractional numbers.&lt;BR /&gt;The S12Z do not have hardware support for floating point calculations and software emulation presents too big overhead – the multiplication and division operation of float variables will take hundreds/thousands of bus cycles.&lt;BR /&gt;Therefore the MLIB_Div_FLT() function is not implemented for MCUs without floating point hardware.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course, you may still multiply/divide floating variables by software emulation. In that case, you may simply use appropriate ANSI library (e.g. ansif.lib) and use standard “*” or “/” operands.&lt;BR /&gt;However, I am afraid that this will not work for motor control processing due to too big computing load.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="IEEE-754 Floating Point Library.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/7328i139C1223B7F4D3B0/image-size/large?v=v2&amp;amp;px=999" role="button" title="IEEE-754 Floating Point Library.png" alt="IEEE-754 Floating Point Library.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note:&lt;BR /&gt;1. Float is IEEE32, Double is IEEE32 optimized, Long Long is 32-bit&lt;BR /&gt;ANSI library: ansif.lib&lt;BR /&gt;Compiler options:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Float is IEEE32, Double is IEEE32 compliant, Long Long is 32-bit&lt;BR /&gt;ANSI library: ansifc.lib&lt;BR /&gt;Compiler options: -fp_compliant&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Float is IEEE32, Double is IEEE64 optimized, Long Long is 64-bit&lt;BR /&gt;ANSI library: ansidm.lib&lt;BR /&gt;Compiler options: -double_size=8 -bit64_code_gen mem&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. Float is IEEE32, Double is IEEE64 compliant, Long Long is 64-bit&lt;BR /&gt;ANSI library: ansidmc.lib&lt;BR /&gt;Compiler options: -fp_compliant -double_size=8 -bit64_code_gen mem&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it helps you.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have a great day,&lt;BR /&gt;Radek&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 08 Nov 2016 12:50:15 GMT</pubDate>
    <dc:creator>RadekS</dc:creator>
    <dc:date>2016-11-08T12:50:15Z</dc:date>
    <item>
      <title>Not able to perform Multiplication and Division operation of float variable variables</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Not-able-to-perform-Multiplication-and-Division-operation-of/m-p/628506#M13438</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am working with MagniV MTRCKTSBNZVM128 BLDC sensorless kit, (MCU part no S912ZVML12 MKH).&amp;nbsp;&lt;BR /&gt; &lt;/P&gt;&lt;P&gt;I want to perform Multiplication and Division operation on floating type variables, but getting below error.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="167108_167108.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/122447i3483896A4FBE650E/image-size/large?v=v2&amp;amp;px=999" role="button" title="167108_167108.PNG" alt="167108_167108.PNG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="error.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/6779iDE5454996A6D2FF1/image-size/large?v=v2&amp;amp;px=999" role="button" title="error.PNG" alt="error.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below library functions give output in range -1 to 1 which is not of use.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Trying with&amp;nbsp;&lt;STRONG&gt;MLIB_Div_FLT&lt;/STRONG&gt; library but getting error, function prototype not present.&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="167109_167109.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/122448i030B457CD2A8D252/image-size/large?v=v2&amp;amp;px=999" role="button" title="167109_167109.png" alt="167109_167109.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_3.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/6827iB14605BEFD829D6B/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_3.png" alt="pastedImage_3.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="167111_167111.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/122449i10BC2C4713B5077F/image-size/large?v=v2&amp;amp;px=999" role="button" title="167111_167111.png" alt="167111_167111.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_7.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/6912i0EED848ADFEDFD17/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_7.png" alt="pastedImage_7.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to know any method for performing &lt;STRONG&gt;MUL&lt;/STRONG&gt; and &lt;STRONG&gt;DIV&lt;/STRONG&gt; operation on Float type variables.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any other library which gives full range result?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Nov 2016 09:17:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Not-able-to-perform-Multiplication-and-Division-operation-of/m-p/628506#M13438</guid>
      <dc:creator>rajkumarwadhwan</dc:creator>
      <dc:date>2016-11-03T09:17:04Z</dc:date>
    </item>
    <item>
      <title>Re: Not able to perform Multiplication and Division operation of float variable variables</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Not-able-to-perform-Multiplication-and-Division-operation-of/m-p/628507#M13439</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rajkumar,&lt;BR /&gt;The standard MTRCKTSBNZVM128 code works with fractional numbers.&lt;BR /&gt;The S12Z do not have hardware support for floating point calculations and software emulation presents too big overhead – the multiplication and division operation of float variables will take hundreds/thousands of bus cycles.&lt;BR /&gt;Therefore the MLIB_Div_FLT() function is not implemented for MCUs without floating point hardware.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course, you may still multiply/divide floating variables by software emulation. In that case, you may simply use appropriate ANSI library (e.g. ansif.lib) and use standard “*” or “/” operands.&lt;BR /&gt;However, I am afraid that this will not work for motor control processing due to too big computing load.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="IEEE-754 Floating Point Library.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/7328i139C1223B7F4D3B0/image-size/large?v=v2&amp;amp;px=999" role="button" title="IEEE-754 Floating Point Library.png" alt="IEEE-754 Floating Point Library.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note:&lt;BR /&gt;1. Float is IEEE32, Double is IEEE32 optimized, Long Long is 32-bit&lt;BR /&gt;ANSI library: ansif.lib&lt;BR /&gt;Compiler options:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Float is IEEE32, Double is IEEE32 compliant, Long Long is 32-bit&lt;BR /&gt;ANSI library: ansifc.lib&lt;BR /&gt;Compiler options: -fp_compliant&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Float is IEEE32, Double is IEEE64 optimized, Long Long is 64-bit&lt;BR /&gt;ANSI library: ansidm.lib&lt;BR /&gt;Compiler options: -double_size=8 -bit64_code_gen mem&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. Float is IEEE32, Double is IEEE64 compliant, Long Long is 64-bit&lt;BR /&gt;ANSI library: ansidmc.lib&lt;BR /&gt;Compiler options: -fp_compliant -double_size=8 -bit64_code_gen mem&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it helps you.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have a great day,&lt;BR /&gt;Radek&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Nov 2016 12:50:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Not-able-to-perform-Multiplication-and-Division-operation-of/m-p/628507#M13439</guid>
      <dc:creator>RadekS</dc:creator>
      <dc:date>2016-11-08T12:50:15Z</dc:date>
    </item>
    <item>
      <title>Re: Not able to perform Multiplication and Division operation of float variable variables</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Not-able-to-perform-Multiplication-and-Division-operation-of/m-p/628508#M13440</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Radek,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;and software emulation presents too big overhead – the multiplication and division operation of float variables will take hundreds/thousands of bus cycles.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a little correction, optimized and fully IEEE754 compliant S12Z routines take about 100-100-300 bus cycles respectively for add-mul-div. Definitely not thousands and not at all hundreds.&amp;nbsp;Non -Z S12 and HC12 are bit slower with one major difference, lack of barrel shifter sometimes makes addition slower than division. Without barrel shifter&amp;nbsp;and instruction to calculate first bit set position normalization could take a lot when addends differ by orders of magnitude.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edward&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 31 Aug 2019 05:29:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Not-able-to-perform-Multiplication-and-Division-operation-of/m-p/628508#M13440</guid>
      <dc:creator>kef2</dc:creator>
      <dc:date>2019-08-31T05:29:06Z</dc:date>
    </item>
  </channel>
</rss>

