mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-31 19:52:31 +00:00 
			
		
		
		
	opt_clean: Fix module keep rules.
- wires with keep attribute now force a module to be kept - presence of $memwr and $meminit cells no longer forces a module to be kept
This commit is contained in:
		
							parent
							
								
									9a4f420b4b
								
							
						
					
					
						commit
						2ab350a7b0
					
				
					 1 changed files with 9 additions and 4 deletions
				
			
		|  | @ -55,7 +55,12 @@ struct keep_cache_t | |||
| 		if (!module->get_bool_attribute(ID::keep)) { | ||||
| 		    bool found_keep = false; | ||||
| 		    for (auto cell : module->cells()) | ||||
| 			if (query(cell, true /* ignore_specify */)) { | ||||
| 			if (query(cell, true /* ignore_specify_mem */)) { | ||||
| 			    found_keep = true; | ||||
| 			    break; | ||||
| 			} | ||||
| 		    for (auto wire : module->wires()) | ||||
| 			if (wire->get_bool_attribute(ID::keep)) { | ||||
| 			    found_keep = true; | ||||
| 			    break; | ||||
| 			} | ||||
|  | @ -65,12 +70,12 @@ struct keep_cache_t | |||
| 		return cache[module]; | ||||
| 	} | ||||
| 
 | ||||
| 	bool query(Cell *cell, bool ignore_specify = false) | ||||
| 	bool query(Cell *cell, bool ignore_specify_mem = false) | ||||
| 	{ | ||||
| 		if (cell->type.in(ID($memwr), ID($meminit), ID($assert), ID($assume), ID($live), ID($fair), ID($cover))) | ||||
| 		if (cell->type.in(ID($assert), ID($assume), ID($live), ID($fair), ID($cover))) | ||||
| 			return true; | ||||
| 
 | ||||
| 		if (!ignore_specify && cell->type.in(ID($specify2), ID($specify3), ID($specrule))) | ||||
| 		if (!ignore_specify_mem && cell->type.in(ID($memwr), ID($meminit), ID($specify2), ID($specify3), ID($specrule))) | ||||
| 			return true; | ||||
| 
 | ||||
| 		if (cell->has_keep_attr()) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue