mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-03 21:09:12 +00:00 
			
		
		
		
	fix bugs in handling last id in hdlname to scopename conversion
This commit is contained in:
		
							parent
							
								
									d640157ec4
								
							
						
					
					
						commit
						a5ba1d2eba
					
				
					 2 changed files with 11 additions and 3 deletions
				
			
		| 
						 | 
					@ -341,8 +341,10 @@ std::vector<IdString> parse_hdlname(const O* object)
 | 
				
			||||||
		path.push_back("\\" + item);
 | 
							path.push_back("\\" + item);
 | 
				
			||||||
	if (path.empty() && object->name.isPublic())
 | 
						if (path.empty() && object->name.isPublic())
 | 
				
			||||||
		path.push_back(object->name);
 | 
							path.push_back(object->name);
 | 
				
			||||||
	if (!path.empty() && !(object->name.isPublic() || object->name.begins_with("$paramod") || object->name.begins_with("$abstract")))
 | 
						if (!path.empty() && !(object->name.isPublic() || object->name.begins_with("$paramod") || object->name.begins_with("$abstract"))) {
 | 
				
			||||||
		path.pop_back();
 | 
							path.pop_back();
 | 
				
			||||||
 | 
							path.push_back(object->name);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	return path;
 | 
						return path;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -378,7 +378,10 @@ static void extract_fsm(RTLIL::Wire *wire)
 | 
				
			||||||
	fsm_cell->parameters[ID::NAME] = RTLIL::Const(wire->name.str());
 | 
						fsm_cell->parameters[ID::NAME] = RTLIL::Const(wire->name.str());
 | 
				
			||||||
	fsm_cell->attributes = wire->attributes;
 | 
						fsm_cell->attributes = wire->attributes;
 | 
				
			||||||
	if(fsm_cell->attributes.count(ID::hdlname)) {
 | 
						if(fsm_cell->attributes.count(ID::hdlname)) {
 | 
				
			||||||
		fsm_cell->attributes[ID(scopename)] = fsm_cell->attributes[ID::hdlname];
 | 
							auto hdlname = fsm_cell->get_hdlname_attribute();
 | 
				
			||||||
 | 
							hdlname.pop_back();
 | 
				
			||||||
 | 
							fsm_cell->set_hdlname_attribute(hdlname);
 | 
				
			||||||
 | 
							fsm_cell->set_string_attribute(ID(scopename), fsm_cell->get_string_attribute(ID::hdlname));
 | 
				
			||||||
		fsm_cell->attributes.erase(ID::hdlname);
 | 
							fsm_cell->attributes.erase(ID::hdlname);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	fsm_data.copy_to_cell(fsm_cell);
 | 
						fsm_data.copy_to_cell(fsm_cell);
 | 
				
			||||||
| 
						 | 
					@ -390,7 +393,10 @@ static void extract_fsm(RTLIL::Wire *wire)
 | 
				
			||||||
	wire->name = stringf("$fsm$oldstate%s", wire->name.c_str());
 | 
						wire->name = stringf("$fsm$oldstate%s", wire->name.c_str());
 | 
				
			||||||
	module->wires_[wire->name] = wire;
 | 
						module->wires_[wire->name] = wire;
 | 
				
			||||||
	if(wire->attributes.count(ID::hdlname)) {
 | 
						if(wire->attributes.count(ID::hdlname)) {
 | 
				
			||||||
		wire->attributes[ID(scopename)] = wire->attributes[ID::hdlname];
 | 
							auto hdlname = wire->get_hdlname_attribute();
 | 
				
			||||||
 | 
							hdlname.pop_back();
 | 
				
			||||||
 | 
							wire->set_hdlname_attribute(hdlname);
 | 
				
			||||||
 | 
							wire->set_string_attribute(ID(scopename), wire->get_string_attribute(ID::hdlname));
 | 
				
			||||||
		wire->attributes.erase(ID::hdlname);
 | 
							wire->attributes.erase(ID::hdlname);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue