mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-31 11:42:30 +00:00 
			
		
		
		
	add flatten -nocleanup option
This commit is contained in:
		
							parent
							
								
									7f7ad87b7b
								
							
						
					
					
						commit
						5db1765bee
					
				
					 1 changed files with 11 additions and 1 deletions
				
			
		|  | @ -349,6 +349,10 @@ struct FlattenPass : public Pass { | |||
| 		log("    -separator <char>\n"); | ||||
| 		log("        Use this separator char instead of '.' when concatenating design levels.\n"); | ||||
| 		log("\n"); | ||||
| 		log("    -nocleanup\n"); | ||||
| 		log("        Don't remove unused submodules, leave a flattened version of each\n"); | ||||
| 		log("        submodule in the design.\n"); | ||||
| 		log("\n"); | ||||
| 	} | ||||
| 	void execute(std::vector<std::string> args, RTLIL::Design *design) override | ||||
| 	{ | ||||
|  | @ -360,6 +364,8 @@ struct FlattenPass : public Pass { | |||
| 		if (design->scratchpad.count("flatten.separator")) | ||||
| 			worker.separator = design->scratchpad_get_string("flatten.separator"); | ||||
| 
 | ||||
| 		bool cleanup = true; | ||||
| 
 | ||||
| 		size_t argidx; | ||||
| 		for (argidx = 1; argidx < args.size(); argidx++) { | ||||
| 			if (args[argidx] == "-wb") { | ||||
|  | @ -378,6 +384,10 @@ struct FlattenPass : public Pass { | |||
| 				worker.separator = args[++argidx]; | ||||
| 				continue; | ||||
| 			} | ||||
| 			if (args[argidx] == "-nocleanup") { | ||||
| 				cleanup = false; | ||||
| 				continue; | ||||
| 			} | ||||
| 			break; | ||||
| 		} | ||||
| 		extra_args(args, argidx, design); | ||||
|  | @ -414,7 +424,7 @@ struct FlattenPass : public Pass { | |||
| 		for (auto module : topo_modules.sorted) | ||||
| 			worker.flatten_module(design, module, used_modules, worker.separator); | ||||
| 
 | ||||
| 		if (top != nullptr) | ||||
| 		if (cleanup && top != nullptr) | ||||
| 			for (auto module : design->modules().to_vector()) | ||||
| 				if (!used_modules[module] && !module->get_blackbox_attribute(worker.ignore_wb)) { | ||||
| 					log("Deleting now unused module %s.\n", log_id(module)); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue