mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-31 11:42:30 +00:00 
			
		
		
		
	Added "blif -unbuf" feature
This commit is contained in:
		
							parent
							
								
									f7cf60b45c
								
							
						
					
					
						commit
						32dce4a870
					
				
					 1 changed files with 19 additions and 0 deletions
				
			
		|  | @ -40,6 +40,7 @@ struct BlifDumperConfig | ||||||
| 	bool param_mode; | 	bool param_mode; | ||||||
| 
 | 
 | ||||||
| 	std::string buf_type, buf_in, buf_out; | 	std::string buf_type, buf_in, buf_out; | ||||||
|  | 	std::map<RTLIL::IdString, std::pair<RTLIL::IdString, RTLIL::IdString>> unbuf_types; | ||||||
| 	std::string true_type, true_out, false_type, false_out; | 	std::string true_type, true_out, false_type, false_out; | ||||||
| 
 | 
 | ||||||
| 	BlifDumperConfig() : icells_mode(false), conn_mode(false), impltf_mode(false), gates_mode(false), param_mode(false) { } | 	BlifDumperConfig() : icells_mode(false), conn_mode(false), impltf_mode(false), gates_mode(false), param_mode(false) { } | ||||||
|  | @ -146,6 +147,13 @@ struct BlifDumper | ||||||
| 		{ | 		{ | ||||||
| 			RTLIL::Cell *cell = cell_it.second; | 			RTLIL::Cell *cell = cell_it.second; | ||||||
| 
 | 
 | ||||||
|  | 			if (config->unbuf_types.count(cell->type)) { | ||||||
|  | 				auto portnames = config->unbuf_types.at(cell->type); | ||||||
|  | 				f << stringf(".names %s %s\n1 1\n", | ||||||
|  | 						cstr(cell->getPort(portnames.first)), cstr(cell->getPort(portnames.second))); | ||||||
|  | 				continue; | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
| 			if (!config->icells_mode && cell->type == "$_NOT_") { | 			if (!config->icells_mode && cell->type == "$_NOT_") { | ||||||
| 				f << stringf(".names %s %s\n0 1\n", | 				f << stringf(".names %s %s\n0 1\n", | ||||||
| 						cstr(cell->getPort("\\A")), cstr(cell->getPort("\\Y"))); | 						cstr(cell->getPort("\\A")), cstr(cell->getPort("\\Y"))); | ||||||
|  | @ -279,6 +287,10 @@ struct BlifBackend : public Backend { | ||||||
| 		log("    -buf <cell-type> <in-port> <out-port>\n"); | 		log("    -buf <cell-type> <in-port> <out-port>\n"); | ||||||
| 		log("        use cells of type <cell-type> with the specified port names for buffers\n"); | 		log("        use cells of type <cell-type> with the specified port names for buffers\n"); | ||||||
| 		log("\n"); | 		log("\n"); | ||||||
|  | 		log("    -unbuf <cell-type> <in-port> <out-port>\n"); | ||||||
|  | 		log("        replace buffer cells with the specified name and port names with\n"); | ||||||
|  | 		log("        a .names statement that models a buffer\n"); | ||||||
|  | 		log("\n"); | ||||||
| 		log("    -true <cell-type> <out-port>\n"); | 		log("    -true <cell-type> <out-port>\n"); | ||||||
| 		log("    -false <cell-type> <out-port>\n"); | 		log("    -false <cell-type> <out-port>\n"); | ||||||
| 		log("        use the specified cell types to drive nets that are constant 1 or 0\n"); | 		log("        use the specified cell types to drive nets that are constant 1 or 0\n"); | ||||||
|  | @ -329,6 +341,13 @@ struct BlifBackend : public Backend { | ||||||
| 				config.buf_out = args[++argidx]; | 				config.buf_out = args[++argidx]; | ||||||
| 				continue; | 				continue; | ||||||
| 			} | 			} | ||||||
|  | 			if (args[argidx] == "-unbuf" && argidx+3 < args.size()) { | ||||||
|  | 				RTLIL::IdString unbuf_type = RTLIL::escape_id(args[++argidx]); | ||||||
|  | 				RTLIL::IdString unbuf_in = RTLIL::escape_id(args[++argidx]); | ||||||
|  | 				RTLIL::IdString unbuf_out = RTLIL::escape_id(args[++argidx]); | ||||||
|  | 				config.unbuf_types[unbuf_type] = std::pair<RTLIL::IdString, RTLIL::IdString>(unbuf_in, unbuf_out); | ||||||
|  | 				continue; | ||||||
|  | 			} | ||||||
| 			if (args[argidx] == "-true" && argidx+2 < args.size()) { | 			if (args[argidx] == "-true" && argidx+2 < args.size()) { | ||||||
| 				config.true_type = args[++argidx]; | 				config.true_type = args[++argidx]; | ||||||
| 				config.true_out = args[++argidx]; | 				config.true_out = args[++argidx]; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue