79 std::vector<std::string> libfiles;
80 std::vector<RTLIL::Design*> libs;
81 bool flag_notypes =
false;
82 bool selected =
false;
85 for (argidx = 1; argidx <
args.size(); argidx++)
87 if (
args[argidx] ==
"-notypes") {
91 if (
args[argidx] ==
"-lib" && argidx+1 <
args.size()) {
92 libfiles.push_back(
args[++argidx]);
95 if (
args[argidx] ==
"-selected") {
103 log(
"Output filename: %s\n", filename.c_str());
105 for (
auto filename : libfiles) {
107 f.open(filename.c_str());
109 log_error(
"Can't open lib file `%s'.\n", filename.c_str());
111 Frontend::frontend_call(lib, &f, filename, (filename.size() > 3 && filename.substr(filename.size()-3) ==
".il") ?
"ilang" :
"verilog");
116 log_header(
"Continuing INTERSYNTH backend.\n");
118 std::set<std::string> conntypes_code, celltypes_code;
119 std::string netlists_code;
122 for (
auto lib : libs)
125 for (
auto module_it : design->
modules_)
130 if (module->get_bool_attribute(
"\\blackbox"))
144 log_error(
"Can't generate a netlist for a module with unprocessed memories or processes!\n");
146 std::set<std::string> constcells_code;
151 for (
auto wire_it : module->
wires_) {
154 celltypes_code.insert(
stringf(
"celltype !%s b%d %sPORT\n" "%s %s %d %s PORT\n",
158 netname(conntypes_code, celltypes_code, constcells_code, sigmap(wire)).c_str());
163 for (
auto cell_it : module->
cells_)
166 std::string celltype_code, node_code;
175 if (sig.
size() != 0) {
176 conntypes_code.insert(
stringf(
"conntype b%d %d 2 %d\n", sig.
size(), sig.
size(), sig.
size()));
183 if (param.second.bits.size() != 32) {
185 for (
int i = param.second.bits.size()-1; i >= 0; i--)
186 node_code += param.second.bits[i] ==
RTLIL::S1 ?
"1" :
"0";
191 celltypes_code.insert(celltype_code +
"\n");
192 netlists_code += node_code +
"\n";
195 if (constcells_code.size() > 0)
196 netlists_code +=
"# constant cells\n";
197 for (
auto code : constcells_code)
198 netlists_code += code;
199 netlists_code +=
"\n";
203 *f <<
stringf(
"### Connection Types\n");
204 for (
auto code : conntypes_code)
205 *f <<
stringf(
"%s", code.c_str());
206 *f <<
stringf(
"\n### Cell Types\n");
207 for (
auto code : celltypes_code)
208 *f <<
stringf(
"%s", code.c_str());
210 *f <<
stringf(
"\n### Netlists\n");
211 *f <<
stringf(
"%s", netlists_code.c_str());
213 for (
auto lib : libs)
std::string stringf(const char *fmt,...)
bool selected_module(RTLIL::IdString mod_name) const
void log_header(const char *format,...)
std::map< RTLIL::IdString, RTLIL::Wire * > wires_
static void frontend_call(RTLIL::Design *design, std::istream *f, std::string filename, std::string command)
std::map< RTLIL::IdString, RTLIL::Memory * > memories
void log_error(const char *format,...)
std::map< RTLIL::IdString, RTLIL::Const > parameters
void extra_args(std::ostream *&f, std::string &filename, std::vector< std::string > args, size_t argidx)
bool cell_known(RTLIL::IdString type)
bool cell_output(RTLIL::IdString type, RTLIL::IdString port)
bool selected_whole_module(RTLIL::IdString mod_name) const
static const char * id2cstr(const RTLIL::IdString &str)
void log_cmd_error(const char *format,...)
std::map< RTLIL::IdString, RTLIL::Process * > processes
std::map< RTLIL::IdString, RTLIL::Module * > modules_
std::map< RTLIL::IdString, RTLIL::Cell * > cells_
USING_YOSYS_NAMESPACE static PRIVATE_NAMESPACE_BEGIN std::string netname(std::set< std::string > &conntypes_code, std::set< std::string > &celltypes_code, std::set< std::string > &constcells_code, RTLIL::SigSpec sig)
void log(const char *format,...)
void setup_design(RTLIL::Design *design)
const std::map< RTLIL::IdString, RTLIL::SigSpec > & connections() const