简体   繁体   English

仅用与非门合成左移 1 位?

[英]Synthesizing Shift left by 1 with just NAND gates?

I have an algorithm that performs division of 2 64-bit unsigned integers using C bitwise operators (<<, &, ^, |, ~) in a loop.我有一个算法,它在循环中使用 C 按位​​运算符(<<、&、^、|、~)执行 2 个 64 位无符号整数的除法。

Now I would like to eliminate shift left << operator completely to understand how this is done as I can already synthesize AND, OR, XOR, NOT using NAND gates.现在我想完全消除 shift left << 运算符以了解这是如何完成的,因为我已经可以合成 AND、OR、XOR,而不是使用 NAND 门。

Is it possible to perform left shift by 1 with JUST NAND gates too?是否也可以使用 JUST NAND 门执行左移 1? I have read a little about flip-flops in electronics but I'm implementing this in pure software just to understand it.我已经阅读了一些关于电子触发器的内容,但我只是为了理解它而在纯软件中实现它。

I want to avoid using << or >> operators completely and do not want to use existing arithmetic operators from any computer language including assembly.我想完全避免使用 << 或 >> 运算符,并且不想使用任何计算机语言(包括汇编)中的现有算术运算符。

In hardware, you can implement left shift by 1 without any logic gates at all.在硬件中,您可以在没有任何逻辑门的情况下实现左移 1。 Just wire the data lines like so:只需像这样连接数据线:

左移一位

If you want something more generic, you could implement a barrel shifter .如果你想要更通用的东西,你可以实现一个桶形移位器 This can be synthesised from multiplexers:这可以从多路复用器合成:

桶形移位器
(source: books24x7.com ) (来源: books24x7.com

which in turn can be synthesised from NAND gates.反过来可以从与非门合成。

Here is a comprehensive master's thesis on the subject: Barrel Shifter Design, Optimization, and Analysis .这是一篇关于该主题的综合硕士论文: 桶形移位器设计、优化和分析

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM