mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-31 03:32:29 +00:00 
			
		
		
		
	Added EDIF backend support for multi-bit cell ports
This commit is contained in:
		
							parent
							
								
									1b159bc955
								
							
						
					
					
						commit
						6978f3a77b
					
				
					 1 changed files with 10 additions and 11 deletions
				
			
		|  | @ -111,7 +111,7 @@ struct EdifBackend : public Backend { | ||||||
| 		log_header("Executing EDIF backend.\n"); | 		log_header("Executing EDIF backend.\n"); | ||||||
| 
 | 
 | ||||||
| 		std::string top_module_name; | 		std::string top_module_name; | ||||||
| 		std::map<RTLIL::IdString, std::set<RTLIL::IdString>> lib_cell_ports; | 		std::map<RTLIL::IdString, std::map<RTLIL::IdString, int>> lib_cell_ports; | ||||||
| 		CellTypes ct(design); | 		CellTypes ct(design); | ||||||
| 		EdifNames edif_names; | 		EdifNames edif_names; | ||||||
| 
 | 
 | ||||||
|  | @ -150,12 +150,8 @@ struct EdifBackend : public Backend { | ||||||
| 				RTLIL::Cell *cell = cell_it.second; | 				RTLIL::Cell *cell = cell_it.second; | ||||||
| 				if (!design->modules_.count(cell->type) || design->modules_.at(cell->type)->get_bool_attribute("\\blackbox")) { | 				if (!design->modules_.count(cell->type) || design->modules_.at(cell->type)->get_bool_attribute("\\blackbox")) { | ||||||
| 					lib_cell_ports[cell->type]; | 					lib_cell_ports[cell->type]; | ||||||
| 					for (auto p : cell->connections()) { | 					for (auto p : cell->connections()) | ||||||
| 						if (p.second.size() > 1) | 						lib_cell_ports[cell->type][p.first] = GetSize(p.second); | ||||||
| 							log_error("Found multi-bit port %s on library cell %s.%s (%s): not supported in EDIF backend!\n", |  | ||||||
| 									RTLIL::id2cstr(p.first), RTLIL::id2cstr(module->name), RTLIL::id2cstr(cell->name), RTLIL::id2cstr(cell->type)); |  | ||||||
| 						lib_cell_ports[cell->type].insert(p.first); |  | ||||||
| 					} |  | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  | @ -198,12 +194,15 @@ struct EdifBackend : public Backend { | ||||||
| 			for (auto &port_it : cell_it.second) { | 			for (auto &port_it : cell_it.second) { | ||||||
| 				const char *dir = "INOUT"; | 				const char *dir = "INOUT"; | ||||||
| 				if (ct.cell_known(cell_it.first)) { | 				if (ct.cell_known(cell_it.first)) { | ||||||
| 					if (!ct.cell_output(cell_it.first, port_it)) | 					if (!ct.cell_output(cell_it.first, port_it.first)) | ||||||
| 						dir = "INPUT"; | 						dir = "INPUT"; | ||||||
| 					else if (!ct.cell_input(cell_it.first, port_it)) | 					else if (!ct.cell_input(cell_it.first, port_it.first)) | ||||||
| 						dir = "OUTPUT"; | 						dir = "OUTPUT"; | ||||||
| 				} | 				} | ||||||
| 				*f << stringf("          (port %s (direction %s))\n", EDIF_DEF(port_it), dir); | 				if (port_it.second == 1) | ||||||
|  | 					*f << stringf("          (port %s (direction %s))\n", EDIF_DEF(port_it.first), dir); | ||||||
|  | 				else | ||||||
|  | 					*f << stringf("          (port (array %s %d) (direction %s))\n", EDIF_DEF(port_it.first), port_it.second, dir); | ||||||
| 			} | 			} | ||||||
| 			*f << stringf("        )\n"); | 			*f << stringf("        )\n"); | ||||||
| 			*f << stringf("      )\n"); | 			*f << stringf("      )\n"); | ||||||
|  | @ -303,7 +302,7 @@ struct EdifBackend : public Backend { | ||||||
| 							char digit_str[2] = { "0123456789abcdef"[digit_value], 0 }; | 							char digit_str[2] = { "0123456789abcdef"[digit_value], 0 }; | ||||||
| 							hex_string = std::string(digit_str) + hex_string; | 							hex_string = std::string(digit_str) + hex_string; | ||||||
| 						} | 						} | ||||||
| 						*f << stringf("\n            (property %s (string \"%s\"))", EDIF_DEF(p.first), hex_string.c_str()); | 						*f << stringf("\n            (property %s (string \"%d'h%s\"))", EDIF_DEF(p.first), GetSize(p.second.bits), hex_string.c_str()); | ||||||
| 					} | 					} | ||||||
| 				*f << stringf(")\n"); | 				*f << stringf(")\n"); | ||||||
| 				for (auto &p : cell->connections()) { | 				for (auto &p : cell->connections()) { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue