- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is Static Prediction?
In a static prediction technique, the branch is ‘always taken’ or the branch is ‘always not-taken’ approaches. It can make static predictions by investigating particular attributes of the object code. In actual implementation, static predictions are either opcode-based, displacement-based, or based on a hint delivered by the compiler, as shown in the figure.
Opcode-based predictions are made by assuming that the branch will be ‘taken’ for certain opcodes and ‘not taken’ for others. This prediction technique is used, for instance, in the MC 88110 and PowerPC 601/603 processors. As shown in the table, shows how opcode-based prediction is accomplished in the MC 88110 (Motorola, 1991).
Static prediction as implemented in the MC 88110 (1993)
Instructions | |||
---|---|---|---|
Condition Specified | Bit 21 of the instr.code | Prediction | |
= 0 | 0 | Not Taken | |
≠0 | 1 | Taken | |
Bcnd (Branch Conditional) | >0 | 1 | Taken |
<0 | 0 | Not Taken | |
≥0 | 1 | Taken | |
≤0 | 0 | Not Taken | |
bb1 (Branch on bit set) | Taken | ||
bb0 (Branch on bit clear) | Not Taken |
This processor offers two kinds of conditional branches. The first called bcnd is used for arithmetic checks. The second called either bb1 (Branch on bit set) or bb0 (Branch on bit clear), is for Boolean checks. As shown in the table, for arithmetic checks the condition ≠0,>and ≥0 are assumed to be met and thus the prediction is ‘taken’. In contrast, the conditions =0,<0,and ≤0 give rise to a ‘not taken‘prediction, and bit 21 is reset.
Displacement-based predictions depend on the sign of the displacement. If D < 0, the prediction is ‘taken’, in the opposite case, D≥0, it is ‘not taken’. Here the underlying assumption is that a conditional branch with negative displacement is used as a loop-closing branch.
Finally, a static prediction can also be derived from a hint from the compiler. This kind of prediction is called compiler-directed prediction. In this case, the compiler predicts according to the kind of control construct compiled or user-delivered hint. The compiler’s prediction is indicated by setting or clearing a bit (called the predict bit) in the encoding of the conditional branch instruction.
For instance, in the PowerPC architecture bit, 10 of the encoding of conditional branches is the predict bit. When specified as such, the outcome of opcode-based and displacement-based prediction is reversed. Examples of processors using predict bits are the PowerPC 601 and PowerPC 603.
Another processor which makes use of compiler-directed predictions is the PA 8000. In this case, a compiler-directed prediction is an available option. If specified, it over-rules dynamic prediction on a page-by-page basis.
This remarkable solution enables the use of static prediction in programs recompiled for the PA 8000 if a higher predicated rate can be expected. On the other hand, older programs like library routines can carry on using dynamic prediction as to the default prediction method.
- Related Articles
- What is Fixed Prediction?
- What are Classification and Prediction?
- What is Static Allocation?
- What is static electricity?
- What are the schemes of Branch prediction?
- What is Static Type Checking?
- What are the types of Dynamic Branch Prediction?
- What is static binding in Java?
- What is static import in Java?
- What is static binding in C#?
- What is Static Testing & Testing Review?
- What is a static class in Java?
- What is a static class in C#?
- What is a static constructor in C#?
- What is a static polymorphism in C#?
