Site Search

Introduction

It's "Poki".
It's been half a year since I joined the company.
Looking back, I dealt with the C language when I was in college.
I had a hard time understanding the concept of parallelism in HDL languages.
This time, I would like to think about such sequential processing and parallel processing!

Sequential processing

Sequential processing is a one-by-one process.

The following example is serial processing.

 

The initial values are A = 0 , B = 0 , C = 0

1. A = A + 1

2. B = B + 2

3. C = A + B

 

1. → 2. → 3. Calculate in order!

 

Let's do it!

Figure 1: Sequential Processing Flowchart

 

A = B = C = 0 as the first condition.

The value of A is increased by 1 in processing 1 and 1. (A = 1, B = 0, C = 0)

The value of B is increased by 2 in processing 2 and 2. (A = 1, B = 2, C = 0)

In processes 3 and 3, the value obtained by adding A and B to C is substituted. (A = 1, B = 2, C = 3)

 

Since there are three instructions, 1., 2., and 3., processing was performed three times.

 

What 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

Find the value of C as before.

 

In parallel processing, 1., 2., and 3. are calculated simultaneously in one process.

So in process 1

1. The value of A is increased by 1

2. The value of B increases by 2

3. C is assigned the sum of A and B,

is done.



Now, suddenly there is a problem.

What are the values of A , B , and C when this process is completed once?



The answer is A = 1 , B = 2 , C = 0 !

 

No, C = 3, right?

I had a hard time understanding this.

Let's see why C = 3 is not true.

Difference between serial and parallel processing

Figure 1 above shows the flow of computation for sequential processing.

I think that the value after processing is easy to understand because it is processed one by one from the top.

 

Next, as shown in Fig. 1, Fig. 2 shows the flow of calculation when performing parallel processing.

Figure 2: Parallel Processing Flowchart

 

Figure 2 is a flow chart when the process is performed three times in the same way as the sequential process.

 

In parallel processing, at the stage of processing 1, that is, in the state of A = 0 , B = 0 , C = 0

C = 0 to compute C = A + B.

 

If we continue to process 2, we get C = 3.

A and B have A = 2 and B = 4 respectively.

 

Furthermore, if processing 3 is performed in the same way as for sequential processing,

A = 3 , B = 6 , C = 6 , and all the values are different from the result of the previous sequential processing.

1., 2., and 3. are processed at the same time.

It's about doing everything in step!

 

Even though we are doing the same calculation, the way of thinking is completely different from the previous sequential processing!



The flow of this serial processing and parallel processing is combined, and I answered C = 3 in the previous problem.

 

By the way, when writing in Verilog, non-blocking assignment is parallel processing,

Blocking assignments are recognized as serial operations.

For more information, please read the article posted by a senior.

"Difference between blocking and non-blocking logic synthesis in Verilog grammar"

at the end

When I first joined the company, I thought that parallel processing was "multiple serial processes that were parallelized."

However, if you try to perform parallel processing with the idea of sequential processing like C language,

The values are completely different as shown in the example.

 

This time it was a simple example, but the actual circuit to be handled is more complicated.

I once again felt that the HDL language must be written with this difference in mind.

Today's POINT

Sequential processing is a method of processing one process at a time

Parallel processing is a method of processing multiple processes at the same time