int main(int argc, char *argv[]) { if (argc < 2) { std::cerr << "You should provide a file name." << std::endl; return -1; } file = argv[1]; std::string module_name; evl_wires wires; evl_components comps; if(!parse_evl_file(argv[1], module_name, wires, comps)) return -1; evl_wires_table wires_table = make_wires_table(wires); netlist nl; if(!nl.create(wires, comps, wires_table)) return -1; //netlist nl(wires, comps, wires_table); std::string nl_file = std::string(argv[1])+".netlist"; nl.save(nl_file, module_name); //save the netlist for Project 3 nl.simulate(1000); // simulate 1000 cycles for Porject 4 //project 2 main function /* std::string evl_file = argv[1]; evl_tokens tokens; evl_statements statements; if (!extract_tokens_from_file(evl_file, tokens)) { return -1; } display_tokens(std::cout, tokens); if (!store_tokens_to_file(evl_file+".tokens", tokens)) { return -1; } if(!group_tokens_into_statements(statements, tokens)){ return -1; } display_statements(std::cout, statements); if(!store_statements_to_file(evl_file+".syntax", statements)){ return -1; } */ return 0; }
int main(int argc, char *argv[]) { if (argc < 2) { std::cerr << "You should provide a file name." << std::endl; return -1; } // std::cout << argv[1] << std::endl; std::ifstream input_file(argv[1]); if (!input_file) { std::cerr << "I can't read " << argv[1] << "." << std::endl; return -1; } evl_wires wires; evl_components components; evl_modules module_name; if (!parse_evl_file(argv[1], module_name, wires, components)) { std::cerr << "theres is an error in parsing " << argv[1] << "." << std::endl; return -1; } evl_wires_table wires_table = make_wires_table(wires); // create output file std::string output_file_name = argv[1]; output_file_name += ".netlist"; //std::cout <<"main"<< std::endl; //std::cout << output_file_name <<std::endl; std::ofstream output_file(output_file_name.c_str()); if (!output_file) { std::cerr << "I can't write " << output_file_name << "." << std::endl; return -1; } netlist netlist_1; if (!netlist_1.create(wires, components)) { return -1; } netlist_1.netlist_write(output_file, components, module_name); //std::cout << argv[1] << ": Info" << ": Ports " << ports.size() //<< ", Components " << netlist_1.components_count << ", Assigns 0" << std::endl; /*std::cout << argv[1] << ": Info: build module " << ": " << components.size()<< " gates, " << netlist_1.nets_list.size() << " nets, " << netlist_1.pin_count << " pins." << std::endl; std::cout << argv[1] << ": Info: Tokens have been written into file: " << output_file_name << std::endl; std::cout<<std::endl;*/ }