What differs an FPGA to a CPU?

Was seeing some publications about the Blake cryptographic algorithm, which was one of the finalists of the SHA-3 competition, whose winner was Keccak.

Finally, in a specific excerpt from the book "the hash function BLAKE", at the beginning, it says:

Keccak offers acceptable performance in software, and excellent performance in hardware.

Source 1 Source 2 (Original, by NIST)

NIST could just as easily have stated that BLAKE offers excellent performance in software and acceptable performance in hardware; nowhere did NIST suggest that hardware is more important than software

Source

My question was to research how something can be fast in hardware and slow in software and mostly the other way around. All the sites that I found talk about such a FPGA (and also ASIC), this is also present in the text of NIST, in the competition of the SHA-3:

3.2 performance

NIST was fortunate to have a great depth of performance data on the five finalists that could also be compared with the performance data of the SHA-2 algorithms. This data included software implementations on many different kinds of Central Processing Units (CPUs), and hardware implementations in both Field Programmable Gate Arrays (FPGAs) and Application Specific Integrated Circuits (Asics). All this data made simple comparisons very difficult; most algorithms excelled on some platforms and lagged on others. However, a few patterns emerged from the performance data, which affected NIST's decision


Then we know that there are CPUs, FPGAs and ASICs. This was also already mentioned in other answers , that only thing I found in the OS, in "an attacker with GPU or FPGA may want to do this, but will have difficulty.".


What is the difference between running on a CPU and running on a FPGA? How can something be faster on software, CPU, than on an FPGA? What would be the difficulties of an FPGA being as fast as the CPU?

Author: Comunidade, 2017-06-12

1 answers

The main difference between a CPU (Central Processing Unity) and a FPGA (Field Programmable Gate Array) is flexibility in construction.

A common processor (CPU) processes instructions at the level of the operating system, and its assembly is principled in understanding the universal Machine Code of the particular architecture of the processor. Already an FPGA, it is not necessary to have a universal instruction interpreter, it can be dynamically shaped to an end specific, thus processing only one algorithm, type of instruction, etc.

When we mention processing hash by software, we remember that the instructions written in the given algorithm will always pass through the CPU, however, it will consider the response time of the same speed, the operating system, and all other factors that also use the CPU for other routine operations.

Different software, processing by hardware dedicated to that algorithm, in the case of a properly written FPGA, may have a higher performance compared to the CPU, since the FPGA is dedicated to only that type of processing, it will only wait for one input type, and only one output type will come out of it.

An FPGA chip can be consistent with multiple processing blocks (cores), and are configured and manipulated by the user. Therefore, it can be manipulated to perform operations uniforms in a short period of time. For the most part, a well-configured FPGA is always faster than a conventional processor.

In encryption, the dedicated use of a given algorithm within an FPGA can increase its performance exponentially (when well configured, also considering the quality of the chip), since the chip will be properly configured to process the instructions of that algorithm. Algorithms for FPGA are written in VHDL .

Here is an implementation of AES written in VHDL. you can take this code and configure it on your own FPGA.

Tl; dr

For short, the FPGA is a processor of instructions dedicated to one (or more) algorithms, written by the user himself. And because of this, it will process information faster than a conventional CPU, such as hashing of information, for example.

FPGA are moldable and flexible. CPU is universal, it will treat any instruction of Machine Code, and therefore, by aggregating everything, it will have a lower performance compared to the FPGA, this when comparing an algorithm dedicated to both.

What is the difference between running on a CPU and an FPGA?

The same explained above.

How can something be faster on software, CPU, than on an FPGA?

A bad implementation may be slower than that in a CPU in certain cases. In this, it is good to consider:

  • the processor you are comparing (the speed, quality, cache size);
  • the quality of the FGPU chip and its instruction size;
  • how the algorithm was written by software (CPU);
  • how the algorithm was written by hardware (FGPU).

In relation to what was quoted above, it is a matter of Environment and development. It's like asking like an algorithm written in language X may be better than in language Y.

What would be the difficulties of an FPGA being as fast as the CPU?

FPGA and CPU have different purposes from each other. The CPU aims to be something central, where all instructions are passed through it. The FPGA aims to be limited to only one purpose, written by the user. And in this also falls into the question of the environment of use, as well as the why of its use.


More information and benchmarks :

 3
Author: CypherPotato, 2019-07-29 20:24:50