HDLbits
Browse Problems

RTL Design Patterns/Branch Prediction

CS450 Gshare Branch Predictor

hard
branch-predictiongsharehistory-table

XOR the seven-bit PC and history to select a counter. Predict taken when its high state bit is one. Train the selected entry by saturating increment/decrement. Asynchronously reset every entry to 01 and history to zero. On misprediction, recover history; recovery takes priority over a simultaneous prediction.