forked from Github_Repos/cvw
		
	Switched to gshare from global history.
Fixed a few minor bugs.
This commit is contained in:
		
							parent
							
								
									8f4051543c
								
							
						
					
					
						commit
						1091dd10c1
					
				@ -89,4 +89,4 @@
 | 
			
		||||
 | 
			
		||||
`define TWO_BIT_PRELOAD "../config/busybear/twoBitPredictor.txt"
 | 
			
		||||
`define BTB_PRELOAD "../config/busybear/BTBPredictor.txt"
 | 
			
		||||
`define BPTYPE "BPGLOBAL" // BPGLOBAL or BPTWOBIT or BPGSHARE
 | 
			
		||||
`define BPTYPE "BPGSHARE" // BPGLOBAL or BPTWOBIT or BPGSHARE
 | 
			
		||||
 | 
			
		||||
@ -92,4 +92,4 @@
 | 
			
		||||
 | 
			
		||||
`define TWO_BIT_PRELOAD "../config/coremark/twoBitPredictor.txt"
 | 
			
		||||
`define BTB_PRELOAD "../config/coremark/BTBPredictor.txt"
 | 
			
		||||
`define BPTYPE "BPGLOBAL" // BPGLOBAL or BPTWOBIT or BPGSHARE
 | 
			
		||||
`define BPTYPE "BPGSHARE" // BPGLOBAL or BPTWOBIT or BPGSHARE
 | 
			
		||||
 | 
			
		||||
@ -88,4 +88,4 @@
 | 
			
		||||
 | 
			
		||||
`define TWO_BIT_PRELOAD "../config/rv32ic/twoBitPredictor.txt"
 | 
			
		||||
`define BTB_PRELOAD "../config/rv32ic/BTBPredictor.txt"
 | 
			
		||||
`define BPTYPE "BPGLOBAL" // BPGLOBAL or BPTWOBIT or BPGSHARE
 | 
			
		||||
`define BPTYPE "BPGSHARE" // BPGLOBAL or BPTWOBIT or BPGSHARE
 | 
			
		||||
 | 
			
		||||
@ -91,4 +91,4 @@
 | 
			
		||||
 | 
			
		||||
`define TWO_BIT_PRELOAD "../config/rv64ic/twoBitPredictor.txt"
 | 
			
		||||
`define BTB_PRELOAD "../config/rv64ic/BTBPredictor.txt"
 | 
			
		||||
`define BPTYPE "BPGLOBAL" // BPGLOBAL or BPTWOBIT or BPGSHARE
 | 
			
		||||
`define BPTYPE "BPGSHARE" // BPGLOBAL or BPTWOBIT or BPGSHARE
 | 
			
		||||
 | 
			
		||||
@ -91,4 +91,4 @@
 | 
			
		||||
 | 
			
		||||
`define TWO_BIT_PRELOAD "../config/rv64icfd/twoBitPredictor.txt"
 | 
			
		||||
`define BTB_PRELOAD "../config/rv64icfd/BTBPredictor.txt"
 | 
			
		||||
`define BPTYPE "BPGLOBAL" // BPGLOBAL or BPTWOBIT or BPGSHARE
 | 
			
		||||
`define BPTYPE "BPGSHARE" // BPGLOBAL or BPTWOBIT or BPGSHARE
 | 
			
		||||
 | 
			
		||||
@ -66,7 +66,7 @@ module bpred
 | 
			
		||||
 | 
			
		||||
  // Part 1 branch direction prediction
 | 
			
		||||
 | 
			
		||||
generate
 | 
			
		||||
  generate
 | 
			
		||||
    if (`BPTYPE == "BPTWOBIT") begin:Predictor
 | 
			
		||||
      twoBitPredictor DirPredictor(.clk(clk),
 | 
			
		||||
				   .reset(reset),
 | 
			
		||||
@ -91,7 +91,7 @@ generate
 | 
			
		||||
					  .UpdatePrediction(UpdateBPPredE));
 | 
			
		||||
    end else if (`BPTYPE == "BPGSHARE") begin:Predictor
 | 
			
		||||
 | 
			
		||||
      globalHistoryPredictor DirPredictor(.clk(clk),
 | 
			
		||||
      gsharePredictor DirPredictor(.clk(clk),
 | 
			
		||||
				   .reset(reset),
 | 
			
		||||
				   .*, // Stalls and flushes
 | 
			
		||||
				   .LookUpPC(PCNextF),
 | 
			
		||||
@ -102,7 +102,7 @@ generate
 | 
			
		||||
				   .PCSrcE(PCSrcE),
 | 
			
		||||
				   .UpdatePrediction(UpdateBPPredE));
 | 
			
		||||
    end 
 | 
			
		||||
endgenerate
 | 
			
		||||
  endgenerate
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  // this predictor will have two pieces of data,
 | 
			
		||||
 | 
			
		||||
@ -41,8 +41,13 @@ module gsharePredictor
 | 
			
		||||
   input logic [1:0] 	   UpdatePrediction
 | 
			
		||||
  
 | 
			
		||||
   );
 | 
			
		||||
   localparam int Depth = 2^k;
 | 
			
		||||
 | 
			
		||||
  logic [k-1:0] 	   GHRF, GHRD, GHRE;
 | 
			
		||||
  logic [k-1:0] 	   LookUpPCIndexD, LookUpPCIndexE;
 | 
			
		||||
  logic [k-1:0] 	   LookUpPCIndex, UpdatePCIndex;
 | 
			
		||||
  logic [1:0] 		   PredictionMemory;
 | 
			
		||||
  logic 		   DoForwarding, DoForwardingF;
 | 
			
		||||
  logic [1:0] 		   UpdatePredictionF;
 | 
			
		||||
  
 | 
			
		||||
  flopenr #(k) GlobalHistoryRegister(.clk(clk),
 | 
			
		||||
				     .reset(reset),
 | 
			
		||||
@ -51,18 +56,13 @@ module gsharePredictor
 | 
			
		||||
				     .q(GHRF));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  logic [k-1:0] 	   LookUpPCIndex, UpdatePCIndex;
 | 
			
		||||
  logic [1:0] 		   PredictionMemory;
 | 
			
		||||
  logic 		   DoForwarding, DoForwardingF;
 | 
			
		||||
  logic [1:0] 		   UpdatePredictionF;
 | 
			
		||||
  
 | 
			
		||||
  // for gshare xor the PC with the GHR 
 | 
			
		||||
  assign UpdatePCIndex = GHRE ^ UpdatePC[k-1:0];
 | 
			
		||||
  assign LookUpPCIndex = LookUpPC ^ GHRF[k-1:0];  
 | 
			
		||||
  assign UpdatePCIndex = GHRE ^ UpdatePC[k:1];
 | 
			
		||||
  assign LookUpPCIndex = GHRF ^ LookUpPC[k:1];  
 | 
			
		||||
  // Make Prediction by reading the correct address in the PHT and also update the new address in the PHT 
 | 
			
		||||
  // GHR referes to the address that the past k branches points to in the prediction stage 
 | 
			
		||||
  // GHRE refers to the address that the past k branches points to in the exectution stage
 | 
			
		||||
    SRAM2P1R1W #(Depth, 2) PHT(.clk(clk),
 | 
			
		||||
  SRAM2P1R1W #(k, 2) PHT(.clk(clk),
 | 
			
		||||
			 .reset(reset),
 | 
			
		||||
			 .RA1(LookUpPCIndex),
 | 
			
		||||
			 .RD1(PredictionMemory),
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user