7.2. C Language Semantics and Parallelism
Understanding the semantics of a given programming language allows the programmer to predict what each line of code will do during the design process and (equally important) to trace the observed failure of that code during debugging. (In fact, there would be little benefit to using a C syntax if we did not also obey the standard C semantics.) The result, however, is that the compiler is limited to performing operations in parallel only if it can guarantee the results will be the same as the sequential execution.
To generate efficient hardware from C language, then, the programmer should understand how to express detectable parallelism in the original algorithm and in the C statements used to describe that algorithm. As with any kind of optimization, the best approach is to design the algorithm in the simplest and most straightforward manner possible and then iteratively refine the C code for the desired performance.
This chapter helps you understand how to predict and control parallelizing within a single process by describing how computation is performed in hardware and how parallelism is extracted from C language. In the following three chapters we will present a specific example of how these techniques may be used to accelerate an actual design, and in later chapters we'll present other opportunities for expressing parallelism at the system level.