next up previous
Next: Caching and Memory Hierarchy Up: Lecture Notes for CS210 Previous: Floating Point

Machine Instructions and Assembly Language

What do we want for a language to (directly) give instructions to a computer? Without knowing the exact program or programs which are going to be executed, we would like to express any conceivable program in a manner that is concise and allows the computer to execute the program quickly.

In order to express any program, very few instructions are necessary. For example, it is straight-forward to demonstrate that one does not need a multiplication instruction given an addition instruction and simple flow control. Similarly, one does not need an addition instruction given an increment instruction and simple flow control. However, if one were to design a computer without addition and multiplication instructions and used the increment instruction instead, then most programs would run very slowly. For example, calculating $1000 * 1000$ would take $1000000$ increment instructions and a similar number of instructions for flow control. To avoid such issues, we avoid having a completely minimal set of instructions and try to make sure common operations are either directly provided in the instruction set or can be efficiently built from the provided instructions.

On the other hand, we want to be careful choosing which instructions to add to the the instruction set. Recall the performance equation from the book.

\begin{eqnarray*}
\mathrm{Time} & = & (\char93  of instructions)(CPI)(clock cycle time) \\
\end{eqnarray*}



Adding more complex instructions often reduces the number of instructions for some instructions and increases the CPI. An unfortunate side-effect is that adding more complex instructions can increase the clock cycle time for all instructions even for programs not using these instructions. With this in mind, we try to restrict ourselves to instructions that can be executed quickly or can be broken up into chunks that can be spread over separate cycles (e.g. multiplication).


next up previous
Next: Caching and Memory Hierarchy Up: Lecture Notes for CS210 Previous: Floating Point
Jeffrey Considine 2001-05-01