mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-31 11:42:30 +00:00 
			
		
		
		
	Merge pull request #1416 from YosysHQ/mmicko/frontend_binary_in
Open aig frontend as binary file
This commit is contained in:
		
						commit
						0d27ffd4e6
					
				
					 4 changed files with 10 additions and 6 deletions
				
			
		|  | @ -285,6 +285,8 @@ end_of_header: | ||||||
| 		} | 		} | ||||||
| 		else if (c == 'c') { | 		else if (c == 'c') { | ||||||
| 			f.ignore(1); | 			f.ignore(1); | ||||||
|  | 			if (f.peek() == '\r') | ||||||
|  | 				f.ignore(1); | ||||||
| 			if (f.peek() == '\n') | 			if (f.peek() == '\n') | ||||||
| 				break; | 				break; | ||||||
| 			// Else constraint (TODO)
 | 			// Else constraint (TODO)
 | ||||||
|  | @ -1056,13 +1058,15 @@ struct AigerFrontend : public Frontend { | ||||||
| 			} | 			} | ||||||
| 			break; | 			break; | ||||||
| 		} | 		} | ||||||
| 		extra_args(f, filename, args, argidx); | 		extra_args(f, filename, args, argidx, true); | ||||||
| 
 | 
 | ||||||
| 		if (module_name.empty()) { | 		if (module_name.empty()) { | ||||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||||
| 			char fname[_MAX_FNAME]; | 			char fname[_MAX_FNAME]; | ||||||
| 			_splitpath(filename.c_str(), NULL /* drive */, NULL /* dir */, fname, NULL /* ext */); | 			_splitpath(filename.c_str(), NULL /* drive */, NULL /* dir */, fname, NULL /* ext */); | ||||||
| 			module_name = fname; | 			char* bn = strdup(fname); | ||||||
|  | 			module_name = RTLIL::escape_id(bn); | ||||||
|  | 			free(bn); | ||||||
| #else | #else | ||||||
| 			char* bn = strdup(filename.c_str()); | 			char* bn = strdup(filename.c_str()); | ||||||
| 			module_name = RTLIL::escape_id(bn); | 			module_name = RTLIL::escape_id(bn); | ||||||
|  |  | ||||||
|  | @ -439,7 +439,7 @@ void Frontend::execute(std::vector<std::string> args, RTLIL::Design *design) | ||||||
| FILE *Frontend::current_script_file = NULL; | FILE *Frontend::current_script_file = NULL; | ||||||
| std::string Frontend::last_here_document; | std::string Frontend::last_here_document; | ||||||
| 
 | 
 | ||||||
| void Frontend::extra_args(std::istream *&f, std::string &filename, std::vector<std::string> args, size_t argidx) | void Frontend::extra_args(std::istream *&f, std::string &filename, std::vector<std::string> args, size_t argidx, bool bin_input) | ||||||
| { | { | ||||||
| 	bool called_with_fp = f != NULL; | 	bool called_with_fp = f != NULL; | ||||||
| 
 | 
 | ||||||
|  | @ -489,7 +489,7 @@ void Frontend::extra_args(std::istream *&f, std::string &filename, std::vector<s | ||||||
| 				next_args.insert(next_args.end(), filenames.begin()+1, filenames.end()); | 				next_args.insert(next_args.end(), filenames.begin()+1, filenames.end()); | ||||||
| 			} | 			} | ||||||
| 			std::ifstream *ff = new std::ifstream; | 			std::ifstream *ff = new std::ifstream; | ||||||
| 			ff->open(filename.c_str()); | 			ff->open(filename.c_str(), bin_input ? std::ifstream::binary : std::ifstream::in); | ||||||
| 			yosys_input_files.insert(filename); | 			yosys_input_files.insert(filename); | ||||||
| 			if (ff->fail()) | 			if (ff->fail()) | ||||||
| 				delete ff; | 				delete ff; | ||||||
|  |  | ||||||
|  | @ -94,7 +94,7 @@ struct Frontend : Pass | ||||||
| 	virtual void execute(std::istream *&f, std::string filename, std::vector<std::string> args, RTLIL::Design *design) = 0; | 	virtual void execute(std::istream *&f, std::string filename, std::vector<std::string> args, RTLIL::Design *design) = 0; | ||||||
| 
 | 
 | ||||||
| 	static std::vector<std::string> next_args; | 	static std::vector<std::string> next_args; | ||||||
| 	void extra_args(std::istream *&f, std::string &filename, std::vector<std::string> args, size_t argidx); | 	void extra_args(std::istream *&f, std::string &filename, std::vector<std::string> args, size_t argidx, bool bin_input = false); | ||||||
| 
 | 
 | ||||||
| 	static void frontend_call(RTLIL::Design *design, std::istream *f, std::string filename, std::string command); | 	static void frontend_call(RTLIL::Design *design, std::istream *f, std::string filename, std::string command); | ||||||
| 	static void frontend_call(RTLIL::Design *design, std::istream *f, std::string filename, std::vector<std::string> args); | 	static void frontend_call(RTLIL::Design *design, std::istream *f, std::string filename, std::vector<std::string> args); | ||||||
|  |  | ||||||
|  | @ -471,7 +471,7 @@ void abc9_module(RTLIL::Design *design, RTLIL::Module *current_module, std::stri | ||||||
| 			log_error("ABC: execution of command \"%s\" failed: return code %d.\n", buffer.c_str(), ret); | 			log_error("ABC: execution of command \"%s\" failed: return code %d.\n", buffer.c_str(), ret); | ||||||
| 
 | 
 | ||||||
| 		buffer = stringf("%s/%s", tempdir_name.c_str(), "output.aig"); | 		buffer = stringf("%s/%s", tempdir_name.c_str(), "output.aig"); | ||||||
| 		ifs.open(buffer); | 		ifs.open(buffer, std::ifstream::binary); | ||||||
| 		if (ifs.fail()) | 		if (ifs.fail()) | ||||||
| 			log_error("Can't open ABC output file `%s'.\n", buffer.c_str()); | 			log_error("Can't open ABC output file `%s'.\n", buffer.c_str()); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue