mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-03 21:09:12 +00:00 
			
		
		
		
	Check base-n literals only contain valid digits
This commit is contained in:
		
							parent
							
								
									64ccbf8510
								
							
						
					
					
						commit
						0491042849
					
				
					 1 changed files with 3 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -104,6 +104,9 @@ static void my_strtobin(std::vector<RTLIL::State> &data, const char *str, int le
 | 
			
		|||
	} else {
 | 
			
		||||
		int bits_per_digit = my_ilog2(base-1);
 | 
			
		||||
		for (auto it = digits.rbegin(), e = digits.rend(); it != e; it++) {
 | 
			
		||||
			if (*it > (base-1) && *it < 0xf0)
 | 
			
		||||
				log_error("Digit larger than %d used in in base-%d constant at %s:%d.\n",
 | 
			
		||||
					base-1, base, current_filename.c_str(), get_line_num());
 | 
			
		||||
			for (int i = 0; i < bits_per_digit; i++) {
 | 
			
		||||
				int bitmask = 1 << i;
 | 
			
		||||
				if (*it == 0xf0)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue