在有32位/ 16位部门的处理部64位/ 32位除法 [英] 64/32-bit division on a processor with 32/16-bit division

查看:312
本文介绍了在有32位/ 16位部门的处理部64位/ 32位除法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我处理器,小的16位微控制器,无FPU和整数运算只有16/16分裂和32/16师这两者需要18个周期。目前我使用的是一个非常缓慢的软件程序(〜7500次)做64/32分裂。有没有办法使用这些分裂引擎来计算64/32师?类似于如何我已经使用的16×16乘法器和加法器来计算32×32乘法?我使用的是C,但可以用它如何可以做到的......我希望的目标 - 的任何一般性解释工作;(如果它在所有可能的)200个周期

My processor, a small 16-bit microcontroller with no FPU and integer math only has 16/16 division and 32/16 division which both take 18 cycles. At the moment I'm using a very slow software routine (~7,500 cycles) to do 64/32 division. Is there any way to use these division engines to calculate a 64/32 division? Similar to how I'm already using the 16x16 multiplier and adder to calculate 32x32 multiplies? I'm using C but can work with any general explanation on how it can be done... I'm hoping to target <200 cycles (if it's at all possible.)

推荐答案

请参阅黑客的喜悦,多字师(页140-145)。

See "Hacker's Delight", multiword division (pages 140-145).

的基本概念(回到克努特),是认为你的问题的基础-65536项。然后你有一个4位由2位划分问题,有2/1位划分为原始的。

The basic concept (going back to Knuth) is to think of your problem in base-65536 terms. Then you have a 4 digit by 2 digit division problem, with 2/1 digit division as a primitive.

在C code是在这里: HTTP:// WWW .hackersdelight.org / HD codetxt / divmnu.c.txt

The C code is here: http://www.hackersdelight.org/hdcodetxt/divmnu.c.txt

这篇关于在有32位/ 16位部门的处理部64位/ 32位除法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆