Introduction
My name is "Poki".
It has been half a year since I joined the company.
Looking back, I had a hard time understanding the concept of parallel processing in
HDL language since I had dealt with C language in my university days.
This time, I would like to think about such sequential processing and parallel processing!
Sequential Processing
Sequential processing is a method of processing one at a time in sequence.
The following is an example of sequential processing.
The initial values are A = 0 , B = 0 , C = 0 and
1. A = A + 1
2. B = B + 2
3. C = A + B
The calculations are performed sequentially from 1. to 2. to 3!
Let's give it a try!
Figure 1 : Flowchart of sequential Processing
The first condition is that A = B = C = 0.
Process 1, 1. increases the value of A by 1. ( A = 1 , B = 0 , C = 0 )
Process 2, 2. increases the value of B by 2. ( A = 1 , B = 2 , C = 0 )
Process 3, 3. C is assigned the value obtained by adding A and B. ( A = 1 , B = 2 , C = 3 )
Since there are three instructions, 1., 2., and 3., processing is performed three times.
How about parallel processing?
Parallel Processing
Initial values are A = 0 , B = 0 , C = 0
1. A = A + 1
2. B = B + 2
3. C = A + B
As before, the value of C is obtained.
In parallel processing, 1., 2., and 3. are computed simultaneously in a single operation.
In other words, in process 1,
1. the value of A is increased by 1
2. the value of B is increased by 2
3. the value obtained by adding A and B is assigned to C,
The three operations are performed.
Now, here is a sudden problem.
What are the values of A, B, and C at the end of this process?
The answer is A = 1, B = 2, and C = 0!
No, C = 3, right?
I had a hard time understanding this.
Let's see why C ≠ 3.
Difference between Sequential and Parallel Processing
Figure 1 shows the flow of computation in sequential processing.
The values after processing are easy to understand because they are processed one by one from the top.
Next, as in Figure 1, Figure 2 shows the calculation flow for parallel processing.
Figure 2: Flowchart of Parallel Processing
Figure 2 shows the flowchart when processing is done three times in the same way as in sequential processing.
In parallel processing, at the stage of processing 1, that is, with A = 0, B = 0, and C = 0
C = 0 in order to compute C = A + B.
If we continue with process 2, we get C = 3,
A and B are A = 2 and B = 4, respectively.
If process 3 is performed in the same way as sequential processing, we obtain
A = 3, B = 6, C = 6, and all the values are different from the result of the sequential processing described above.
The fact that processes 1., 2., and 3. are performed simultaneously means that all the processes are performed in step with each other,
This means that all the operations are performed in parallel!
Although we are performing the same calculations, the concept is completely different from the sequential processing described earlier!
This is why I answered C = 3 in the previous question, because the flow of sequential processing and parallel processing are the same.
Incidentally, when writing in Verilog, non-blocking assignment is done in parallel processing,
blocking assignment is recognized as a sequential process.
For more details, please refer to the article by one of my senpai.
Verilog HDL : Difference between blocking and non-blocking logic synthesis
In closing
When I joined the company, I thought that parallel processing was "a number of sequential processes in parallel.
However, if you try to perform parallel processing based on the concept of sequential processing like C language, the values are completely different as shown in the example,
The value is completely different as shown in the example.
This was a simple example, but the actual circuit is much more complex.
I felt again that the HDL language must be written with this difference in mind.
POINT
Sequential processing is a method of sequentially processing one process at a time.
Parallel processing is a method to process multiple processes at the same time
A New Engineer's Blush Blog Article List