mirror of
				https://github.com/openhwgroup/cvw
				synced 2025-02-11 06:05:49 +00:00 
			
		
		
		
	Removed unnecessary pc reset logic from ifu and btb.
This commit is contained in:
		
							parent
							
								
									c6ed08ce12
								
							
						
					
					
						commit
						c98c0dd3e0
					
				| @ -50,7 +50,6 @@ module btb import cvw::*;  #(parameter cvw_t P, | ||||
| ); | ||||
| 
 | ||||
|   logic [Depth-1:0]        PCNextFIndex, PCFIndex, PCDIndex, PCEIndex, PCMIndex, PCWIndex; | ||||
|   logic [P.XLEN-1:0]        ResetPC; | ||||
|   logic                    MatchD, MatchE, MatchM, MatchW, MatchX; | ||||
|   logic [P.XLEN+3:0]        ForwardBTBPrediction, ForwardBTBPredictionF; | ||||
|   logic [P.XLEN+3:0]        TableBTBPredF; | ||||
| @ -70,12 +69,7 @@ module btb import cvw::*;  #(parameter cvw_t P, | ||||
|   assign PCMIndex = {PCM[Depth+1] ^ PCM[1], PCM[Depth:2]}; | ||||
|   assign PCWIndex = {PCW[Depth+1] ^ PCW[1], PCW[Depth:2]}; | ||||
| 
 | ||||
|   // must output a valid PC and valid bit during reset.  Because only PCF, not PCNextF is reset, PCNextF is invalid
 | ||||
|   // during reset.  The BTB must produce a non X PC1NextF to allow the simulation to run.
 | ||||
|   // While the mux could be included in IFU it is not necessary for the IROM/I$/bus.
 | ||||
|   // For now it is optimal to leave it here.
 | ||||
|   assign ResetPC = P.RESET_VECTOR[P.XLEN-1:0]; | ||||
|   assign PCNextFIndex = reset ? ResetPC[Depth+1:2] : {PCNextF[Depth+1] ^ PCNextF[1], PCNextF[Depth:2]};  | ||||
|   assign PCNextFIndex = {PCNextF[Depth+1] ^ PCNextF[1], PCNextF[Depth:2]};  | ||||
| 
 | ||||
|   assign MatchD = PCFIndex == PCDIndex; | ||||
|   assign MatchE = PCFIndex == PCEIndex; | ||||
|  | ||||
| @ -300,8 +300,8 @@ module ifu import cvw::*;  #(parameter cvw_t P) ( | ||||
|     mux2 #(P.XLEN) pcmux2(.d0(PC1NextF), .d1(NextValidPCE), .s(CSRWriteFenceM),.y(PC2NextF)); | ||||
|   else assign PC2NextF = PC1NextF; | ||||
| 
 | ||||
|   assign  PCNextF = {UnalignedPCNextF[P.XLEN-1:1], 1'b0}; // hart-SPEC p. 21 about 16-bit alignment
 | ||||
|   flopenl #(P.XLEN) pcreg(clk, reset, ~StallF, PCNextF, P.RESET_VECTOR[P.XLEN-1:0], PCF); | ||||
|   mux2 #(P.XLEN) pcresetmux({UnalignedPCNextF[P.XLEN-1:1], 1'b0}, P.RESET_VECTOR[P.XLEN-1:0], reset, PCNextF); | ||||
|   flopen #(P.XLEN) pcreg(clk, ~StallF | reset, PCNextF, PCF); | ||||
| 
 | ||||
|   // pcadder
 | ||||
|   // add 2 or 4 to the PC, based on whether the instruction is 16 bits or 32
 | ||||
| @ -315,8 +315,7 @@ module ifu import cvw::*;  #(parameter cvw_t P) ( | ||||
|   // an X.  This version of the code does not die because if CompressedF is an X it just defaults to the last
 | ||||
|   // option.  The above code would work, but propagates the x.
 | ||||
|   always_comb | ||||
|     if(reset) PCPlus2or4F = '0; | ||||
|     else if (CompressedF) // add 2
 | ||||
|     if (CompressedF) // add 2
 | ||||
|       if (PCF[1]) PCPlus2or4F = {PCPlus4F, 2'b00};  | ||||
|       else        PCPlus2or4F = {PCF[P.XLEN-1:2], 2'b10}; | ||||
|     else          PCPlus2or4F = {PCPlus4F, PCF[1:0]}; // add 4
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user