What types of situations is assembly not fast enough, so you need a direct hardware / boolean logic solution?

空扰寡人 提交于 2019-12-07 12:22:46

问题


I have started to read through Art of Assembly, and in there is a section on boolean logic, which states:

Of course, it is much easier to specify a solution to a programming problem using languages like Pascal, C, or even assembly language than it is to specify the solution using boolean equations. Therefore, it is unlikely that you would ever implement an entire program using a set of state machines and other logic circuitry. Nevertheless, there are times when a hardware implementation is better. A hardware solution can be one, two, three, or more orders of magnitude faster than an equivalent software solution. Therefore, some time critical operations may require a hardware solution.

In what situations "are there times when a hardware implementation is better"?


回答1:


The graphics card in your computer would be an excellent example.

Encryption primitives built into the instruction set of your computer's CPU would be another.




回答2:


There are also special cases where the CPU doesn't have the instructions or the speed to perform specific calculations. One example would be the finite field math operations used on a Raid 6 setup, where Reed Solomon math operations are implemented in special hardware (although some parts of the correction algorithm may be implemented in firmware / software). CRC or other Reed Solomon type error correction codes are often implemented in hardware. Encryption was already mentioned, and AES encryption may have 10 hardware encoders operating in parallel.




回答3:


The Art of Assembly may touch a bit on the old-world, where hardware (7400, 4000 series) never failed, and software was "pure magic."

I think what the snippet is hinting at is Karnaugh Mapping. Put your logic elements into a grid, mark the inputs and output you want, do some gray-code analysis on it, and out pops the simplest logic gate combination to achieve the desired output. Easy to build, very fast, guaranteed to work, and no "magic" involved. To do the equivalent using the processors at that time was slow and cumbersome.



来源:https://stackoverflow.com/questions/27607499/what-types-of-situations-is-assembly-not-fast-enough-so-you-need-a-direct-hardw

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!