在硬件级别上如何实现转变? [英] How are shifts implemented on the hardware level?
问题描述
当要转移的数目未知时,如何在硬件级别实现移位?
How are bit shifts implemented at the hardware level when the number to shift by is unknown?
我无法想象每个转移电路都有单独的电路可以移位的数字(在64位计算机上需要64个移位电路),也不能想象这是一个移位循环(在64位计算机上最多需要64个移位周期)。两者之间是某种妥协还是巧妙的技巧?
I can't imagine that there would be a separate circuit for each number you can shift by (that would 64 shift circuits on a 64-bit machine), nor can I imagine that it would be a loop of shifts by one (that would take up to 64 shift cycles on a 64-bit machine). Is it some sort of compromise between the two or is there some clever trick?
推荐答案
该电路称为 桶形移位器-基本上是多路复用器的负载。每个地址位需要移位一层,因此一个8位的桶形移位器需要三位来表示要移位多少,因此需要三层复用器。
The circuit is called a "barrel shifter" - it's a load of multiplexers basically. It has a layer per address-bit-of-shift-required, so an 8-bit barrel shifter needs three bits to say "how much to shift by" and hence 3 layers of muxes.
这是来自 http://www.globalspec.com/reference/55806/203279/chapter-9-additional-circuit-designs :
这篇关于在硬件级别上如何实现转变?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!