What types of situations is assembly not fast enou

2019-05-05 09:20发布

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"?

3条回答
Explosion°爆炸
2楼-- · 2019-05-05 09:33

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楼-- · 2019-05-05 09:36

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.

查看更多
【Aperson】
4楼-- · 2019-05-05 09:39

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.

查看更多
登录 后发表回答