mirror of
				https://github.com/openhwgroup/cvw
				synced 2025-02-11 06:05:49 +00:00 
			
		
		
		
	shifter bug fix
- roli not passing unless I keep the MSB (instead of inverting) of truncated offset
This commit is contained in:
		
							parent
							
								
									77fc40149f
								
							
						
					
					
						commit
						f85c1058ff
					
				@ -36,7 +36,7 @@ module shifter (
 | 
				
			|||||||
  output logic [`XLEN-1:0]     Y);                          // Shifted result
 | 
					  output logic [`XLEN-1:0]     Y);                          // Shifted result
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  logic [2*`XLEN-2:0]      z, zshift;                       // Input to funnel shifter, shifted amount before truncated to 32 or 64 bits
 | 
					  logic [2*`XLEN-2:0]      z, zshift;                       // Input to funnel shifter, shifted amount before truncated to 32 or 64 bits
 | 
				
			||||||
  logic [`LOG_XLEN-1:0]    amttrunc, offset;                // Shift amount adjusted for RV64, right-shift amount
 | 
					  logic [`LOG_XLEN-1:0]    amttrunc, offset, CondOffsetTrunc;                // Shift amount adjusted for RV64, right-shift amount
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Handle left and right shifts with a funnel shifter.
 | 
					  // Handle left and right shifts with a funnel shifter.
 | 
				
			||||||
  // For RV32, only 32-bit shifts are needed.   
 | 
					  // For RV32, only 32-bit shifts are needed.   
 | 
				
			||||||
@ -129,9 +129,11 @@ module shifter (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  // Opposite offset for right shifts
 | 
					  // Opposite offset for right shifts
 | 
				
			||||||
  assign offset = Right ? amttrunc : ~amttrunc;
 | 
					  assign offset = Right ? amttrunc : ~amttrunc;
 | 
				
			||||||
 | 
					  if (`XLEN == 64) assign CondOffsetTrunc = (W64 & Rotate) ? {{1'b0}, offset[4:0]} : offset;
 | 
				
			||||||
 | 
					  else assign CondOffsetTrunc = offset;
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  // Funnel operation
 | 
					  // Funnel operation
 | 
				
			||||||
  assign zshift = z >> offset;
 | 
					  assign zshift = z >> CondOffsetTrunc;
 | 
				
			||||||
  assign Y = zshift[`XLEN-1:0];    
 | 
					  assign Y = zshift[`XLEN-1:0];    
 | 
				
			||||||
endmodule
 | 
					endmodule
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user