mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 05:19:11 +00:00 
			
		
		
		
	cxxrtl: Handle case of Bits < 4 in formatting of values
				
					
				
			This commit is contained in:
		
							parent
							
								
									c848d98d91
								
							
						
					
					
						commit
						6206a3af30
					
				
					 1 changed files with 4 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -796,7 +796,10 @@ std::ostream &operator<<(std::ostream &os, const value_formatted<Bits> &vf)
 | 
			
		|||
				buf += '0';
 | 
			
		||||
			while (!val.is_zero()) {
 | 
			
		||||
				value<Bits> quotient, remainder;
 | 
			
		||||
				std::tie(quotient, remainder) = val.udivmod(value<Bits>{10u});
 | 
			
		||||
				if (Bits >= 4)
 | 
			
		||||
					std::tie(quotient, remainder) = val.udivmod(value<Bits>{10u});
 | 
			
		||||
				else
 | 
			
		||||
					std::tie(quotient, remainder) = std::make_pair(value<Bits>{0u}, val);
 | 
			
		||||
				buf += '0' + remainder.template trunc<(Bits > 4 ? 4 : Bits)>().val().template get<uint8_t>();
 | 
			
		||||
				val = quotient;
 | 
			
		||||
			}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue