计算 15 位输入中设置位数的电路
如何构建一个节省面积的电路,使用 4 输入 LUT(查找表)来计算 15 位输入中设置位的数量。 输出显然是 4 位(计数 0-15)。 有人声称可以使用 9 个 LUT。
How to build an area-efficient circuit that counts the number of set bits in 15-bit input using 4-input LUTs (look-up tables). The output is obviously 4-bit (counts 0-15). Some claim that it's possible to do using 9 LUTs.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
好吧,我会让你开始的。 您的第一层查找表将如下所示:
将其中的四个分布在您的十五位输入上,获取输出并将它们传递给两个新的查找表,如下所示:
...等等。 当然,您必须解决第一层中所有零和所有产生相同输出的问题。
我可能完全错了。
Well, I'll get you started. Your first layer of lookup tables will look like this:
Spread four of them across your fifteen-bit input, take the outputs and pass them through two new lookup tables that look like this:
... and so on. Of course, you're going to have to solve the problem of all zeroes and all ones producing the same output in the first layer.
And I may be totally wrong.
我可以在 10 时间内完成。它是第一个计数器级(4 个表),然后是带进位的 2 级加法器(3 和 3 个表)。
我怀疑有一种方法可以做得更好,因为我没有完全使用每个 LUT,但有时简单的设计值得额外的成本。 我尝试了其他方法,但仍然需要 10。
祝你作业顺利。 (:
I can do it in 10. It’s a first counter stage (4 tables), then a 2 stage adder with carry (3 and 3 tables).
I suspect there is a way to do better because I didn’t use each LUT completely, but sometimes a simple design is worth the extra cost. I tried other approaches and still needed 10.
Good luck on your homework. (:
下面是一些计算位数的 C 代码:
C 代码计算“1”位的数量。 您必须将其转换为您的硬件。
Here some C code that counts the number of bits:
C code to count the number of '1' bits. You'll have to convert this into your hardware.