mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 05:19:11 +00:00 
			
		
		
		
	memory_collect: do not truncate 'x from \INIT.
The semantics of an RTLIL constant that has less bits than its declared bit width is zero padding. Therefore, if the output of memory_collect will be used for simulation, truncating 'x from the end of \INIT will produce incorrect simulation results.
This commit is contained in:
		
							parent
							
								
									93d44bb9a6
								
							
						
					
					
						commit
						0c318e7db5
					
				
					 1 changed files with 0 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -184,9 +184,6 @@ Cell *handle_memory(Module *module, RTLIL::Memory *memory)
 | 
			
		|||
	mem->parameters["\\OFFSET"] = Const(memory->start_offset);
 | 
			
		||||
	mem->parameters["\\SIZE"] = Const(memory->size);
 | 
			
		||||
	mem->parameters["\\ABITS"] = Const(addr_bits);
 | 
			
		||||
 | 
			
		||||
	while (GetSize(init_data) > 1 && init_data.bits.back() == State::Sx && init_data.bits[GetSize(init_data)-2] == State::Sx)
 | 
			
		||||
		init_data.bits.pop_back();
 | 
			
		||||
	mem->parameters["\\INIT"] = init_data;
 | 
			
		||||
 | 
			
		||||
	log_assert(sig_wr_clk.size() == wr_ports);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue