mirror of
				https://github.com/openhwgroup/cvw
				synced 2025-02-11 06:05:49 +00:00 
			
		
		
		
	format + min/max structural mux
This commit is contained in:
		
							parent
							
								
									0d0d3b981e
								
							
						
					
					
						commit
						b394e343f6
					
				| @ -47,8 +47,8 @@ module zbb #(parameter WIDTH=32) ( | |||||||
|   byteUnit #(WIDTH) bu(.A(A), .ByteSelect(B[0]), .ByteResult(ByteResult)); |   byteUnit #(WIDTH) bu(.A(A), .ByteSelect(B[0]), .ByteResult(ByteResult)); | ||||||
|   ext #(WIDTH) ext(.A(A), .ExtSelect({~B[2], {B[2] & B[0]}}), .ExtResult(ExtResult)); |   ext #(WIDTH) ext(.A(A), .ExtSelect({~B[2], {B[2] & B[0]}}), .ExtResult(ExtResult)); | ||||||
| 
 | 
 | ||||||
|   assign MaxResult = (lt) ? B : A; |   mux2 #(WIDTH) maxmux(A, B, lt, MaxResult); | ||||||
|   assign MinResult = (lt) ? A : B; |   mux2 #(WIDTH) minmux(B, A, lt, MinResult); | ||||||
| 
 | 
 | ||||||
|   // ZBB Result select mux
 |   // ZBB Result select mux
 | ||||||
|   mux5 #(WIDTH) zbbresultmux(CntResult, ExtResult, ByteResult, MinResult, MaxResult, ZBBSelect, ZBBResult); |   mux5 #(WIDTH) zbbresultmux(CntResult, ExtResult, ByteResult, MinResult, MaxResult, ZBBSelect, ZBBResult); | ||||||
|  | |||||||
| @ -246,13 +246,11 @@ module controller( | |||||||
|   assign ALUSrcBD = BaseALUSrcBD | BALUSrcBD; |   assign ALUSrcBD = BaseALUSrcBD | BALUSrcBD; | ||||||
|   assign SubArithD = BaseSubArithD | BSubArithD; // TRUE If B-type or R-type instruction involves inverted operand
 |   assign SubArithD = BaseSubArithD | BSubArithD; // TRUE If B-type or R-type instruction involves inverted operand
 | ||||||
|    |    | ||||||
| 
 |  | ||||||
|   assign CSRZeroSrcD = InstrD[14] ? (InstrD[19:15] == 0) : (Rs1D == 0); // Is a CSR instruction using zero as the source?
 |   assign CSRZeroSrcD = InstrD[14] ? (InstrD[19:15] == 0) : (Rs1D == 0); // Is a CSR instruction using zero as the source?
 | ||||||
|   assign CSRWriteD = CSRReadD & !(CSRZeroSrcD & InstrD[13]);            // Don't write if setting or clearing zeros
 |   assign CSRWriteD = CSRReadD & !(CSRZeroSrcD & InstrD[13]);            // Don't write if setting or clearing zeros
 | ||||||
|   assign SFenceVmaD = PrivilegedD & (InstrD[31:25] ==  7'b0001001); |   assign SFenceVmaD = PrivilegedD & (InstrD[31:25] ==  7'b0001001); | ||||||
|   assign FenceD = SFenceVmaD | FenceXD; // possible sfence.vma or fence.i
 |   assign FenceD = SFenceVmaD | FenceXD; // possible sfence.vma or fence.i
 | ||||||
|    |    | ||||||
| 
 |  | ||||||
|   // ALU Decoding is lazy, only using func7[5] to distinguish add/sub and srl/sra
 |   // ALU Decoding is lazy, only using func7[5] to distinguish add/sub and srl/sra
 | ||||||
|   assign sltuD = (Funct3D == 3'b011);  |   assign sltuD = (Funct3D == 3'b011);  | ||||||
|   assign subD = (Funct3D == 3'b000 & Funct7D[5] & OpD[5]);  // OpD[5] needed to distinguish sub from addi
 |   assign subD = (Funct3D == 3'b000 & Funct7D[5] & OpD[5]);  // OpD[5] needed to distinguish sub from addi
 | ||||||
| @ -268,7 +266,6 @@ module controller( | |||||||
|       assign sltD = (Funct3D == 3'b010 & (~(Funct7D[4]) | ~OpD[5])) ; |       assign sltD = (Funct3D == 3'b010 & (~(Funct7D[4]) | ~OpD[5])) ; | ||||||
|     end else assign sltD = (Funct3D == 3'b010); |     end else assign sltD = (Funct3D == 3'b010); | ||||||
| 
 | 
 | ||||||
|     //assign SubArithD = (ALUOpD) & (subD | sraD | sltD | sltuD | (`ZBS_SUPPORTED & (bextD | bclrD)) | (`ZBB_SUPPORTED & (andnD | ornD | xnorD))); // TRUE for R-type subtracts and sra, slt, sltu, and any B instruction that requires inverted operand
 |  | ||||||
|   end else begin: bitmanipi |   end else begin: bitmanipi | ||||||
|     assign ALUSelectD = Funct3D; |     assign ALUSelectD = Funct3D; | ||||||
|     assign ALUSelectE = Funct3E; |     assign ALUSelectE = Funct3E; | ||||||
| @ -314,7 +311,7 @@ module controller( | |||||||
|   //  The comparator handles both signed and unsigned branches using BranchSignedE
 |   //  The comparator handles both signed and unsigned branches using BranchSignedE
 | ||||||
|   //  Hence, only eq and lt flags are needed
 |   //  Hence, only eq and lt flags are needed
 | ||||||
|   //  We also want comparator to handle signed comparison on a max/min bitmanip instruction
 |   //  We also want comparator to handle signed comparison on a max/min bitmanip instruction
 | ||||||
|   assign BranchSignedE = (~(Funct3E[2:1] == 2'b11) & BranchE) | BComparatorSignedE ; |   assign BranchSignedE = (~(Funct3E[2:1] == 2'b11) & BranchE) | BComparatorSignedE; | ||||||
|   assign {eqE, ltE} = FlagsE; |   assign {eqE, ltE} = FlagsE; | ||||||
|   mux2 #(1) branchflagmux(eqE, ltE, Funct3E[2], BranchFlagE); |   mux2 #(1) branchflagmux(eqE, ltE, Funct3E[2], BranchFlagE); | ||||||
|   assign BranchTakenE = BranchFlagE ^ Funct3E[0]; |   assign BranchTakenE = BranchFlagE ^ Funct3E[0]; | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user