<?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>8-bit MicrocontrollersのトピックRe: 64-bit HC08 integer math routines here</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/64-bit-HC08-integer-math-routines-here/m-p/167339#M10783</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Curt,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While the AN1219 code is relatively efficient, I notice that the Pack() and Unpack() function are certainly not.&amp;nbsp; In fact, the four calls seem to require a total of about 9000 cycles, compared with 3500+ cycles for the 32 x 16 division function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that the latter figure could be improved somewhat with the allocation of zero page RAM, and further improvement with the use of instructions applicable to zero page RAM, probably a total saving of about 500 cycles.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, the situation is simplified if a structure is created, to hold the results during the calculation.&amp;nbsp; The quantities can then be directly written to the required locations within the structure, and directly read back at the completion of the calculation.&amp;nbsp; The inline assembly code portion extensively uses indexed addressing. As a result, the code that previously required a total of about 12k cycles, now requires about 3500.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When this code is extended to 64 x 32 division, the number of cycles required is about 11k.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mac&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 30 Mar 2009 03:55:49 GMT</pubDate>
    <dc:creator>bigmac</dc:creator>
    <dc:date>2009-03-30T03:55:49Z</dc:date>
    <item>
      <title>64-bit HC08 integer math routines here</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/64-bit-HC08-integer-math-routines-here/m-p/167338#M10782</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I needed to do some 64-bit integer math for a project I'm doing.&amp;nbsp; I looked around and found a paper that describes a method sort of like long division and has some source in Pascal.&amp;nbsp; The paper is&amp;nbsp;"Multiple-length&amp;nbsp;Division Revisited: a Tour of the Minefield" by Brinch&amp;nbsp;Hansen, June 1994.&amp;nbsp; Here is a link to the paper:&amp;nbsp;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fbrinch-hansen.net%2Fpapers%2F1994b.pdf" rel="nofollow" target="_blank"&gt;http://brinch-hansen.net/papers/1994b.pdf&lt;/A&gt;.&amp;nbsp; The problem is, the calcs I need to make took about 500ms.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Next I took to assembly code from AN1219, "M68HC08 Integer Math Routines" (&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.freescale.com%2Ffiles%2Fmicrocontrollers%2Fdoc%2Fapp_note%2FAN1219.pdf%3Ffsrch%3D1" rel="nofollow" target="_blank"&gt;http://www.freescale.com/files/microcontrollers/doc/app_note/AN1219.pdf?fsrch=1&lt;/A&gt;).&amp;nbsp; This has a 32-bit by 16-bit divide that I ported to inline assembly.&amp;nbsp; I extrapolated that code to produce a 64-bit by 32-bit divide.&amp;nbsp; There are some multiply and right shift routines there as well.&amp;nbsp; With this version of code, I was able to do the same calcs in 16.9ms (better).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's not the pretties code but I hope others might find the attached code useful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Curt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Mar 2009 04:28:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/64-bit-HC08-integer-math-routines-here/m-p/167338#M10782</guid>
      <dc:creator>CurtThompson</dc:creator>
      <dc:date>2009-03-27T04:28:48Z</dc:date>
    </item>
    <item>
      <title>Re: 64-bit HC08 integer math routines here</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/64-bit-HC08-integer-math-routines-here/m-p/167339#M10783</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Curt,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While the AN1219 code is relatively efficient, I notice that the Pack() and Unpack() function are certainly not.&amp;nbsp; In fact, the four calls seem to require a total of about 9000 cycles, compared with 3500+ cycles for the 32 x 16 division function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that the latter figure could be improved somewhat with the allocation of zero page RAM, and further improvement with the use of instructions applicable to zero page RAM, probably a total saving of about 500 cycles.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, the situation is simplified if a structure is created, to hold the results during the calculation.&amp;nbsp; The quantities can then be directly written to the required locations within the structure, and directly read back at the completion of the calculation.&amp;nbsp; The inline assembly code portion extensively uses indexed addressing. As a result, the code that previously required a total of about 12k cycles, now requires about 3500.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When this code is extended to 64 x 32 division, the number of cycles required is about 11k.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mac&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Mar 2009 03:55:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/64-bit-HC08-integer-math-routines-here/m-p/167339#M10783</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2009-03-30T03:55:49Z</dc:date>
    </item>
    <item>
      <title>Re: 64-bit HC08 integer math routines here</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/64-bit-HC08-integer-math-routines-here/m-p/167340#M10784</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Mac.&amp;nbsp; I admit that I am a lacky when it comes to assembly.&amp;nbsp; I'm sure others will find what you supplied useful too.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Curt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Mar 2009 10:22:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/64-bit-HC08-integer-math-routines-here/m-p/167340#M10784</guid>
      <dc:creator>CurtThompson</dc:creator>
      <dc:date>2009-03-30T10:22:44Z</dc:date>
    </item>
  </channel>
</rss>

