@yowasp/yosys 0.57.141-dev.973 → 0.57.985
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/gen/bundle.js +1 -1
- package/gen/resources-yosys.js +4 -4
- package/gen/yosys.core.wasm +0 -0
- package/package.json +2 -2
package/gen/bundle.js
CHANGED
|
@@ -5443,7 +5443,7 @@ function instantiate(getCoreModule, imports, instantiateCore = WebAssembly.insta
|
|
|
5443
5443
|
var yosys = new Application(() => import("./resources-yosys.js"), instantiate, "yowasp-yosys");
|
|
5444
5444
|
var runYosys = yosys.run.bind(yosys);
|
|
5445
5445
|
var commands = { "yosys": runYosys };
|
|
5446
|
-
var version = "0.57.
|
|
5446
|
+
var version = "0.57.985";
|
|
5447
5447
|
export {
|
|
5448
5448
|
Exit,
|
|
5449
5449
|
commands,
|
package/gen/resources-yosys.js
CHANGED
|
@@ -160,7 +160,7 @@ export const filesystem = {
|
|
|
160
160
|
},
|
|
161
161
|
"kernel": {
|
|
162
162
|
"binding.h": "/* -*- c++ -*-\n * yosys -- Yosys Open SYnthesis Suite\n *\n * Copyright (C) 2012 Claire Xenia Wolf <claire@yosyshq.com>\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n *\n */\n\n#ifndef BINDING_H\n#define BINDING_H\n\n#include \"kernel/rtlil.h\"\n\nYOSYS_NAMESPACE_BEGIN\n\nstruct RTLIL::Binding\n{\n\t// Represents a bind construct.\n\t//\n\t// The target of the binding is represented by target_type and\n\t// target_name (see comments above the fields).\n\n\tBinding(RTLIL::IdString target_type,\n\t RTLIL::IdString target_name);\n\n\tvirtual ~Binding() {}\n\n\t// Return a string describing the binding\n\tvirtual std::string describe() const = 0;\n\nprotected:\n\t// May be empty. If not, it's the name of the module or interface to\n\t// bind to.\n\tRTLIL::IdString target_type;\n\n\t// If target_type is nonempty (the usual case), this is a hierarchical\n\t// reference to the bind target. If target_type is empty, we have to\n\t// wait until the hierarchy pass to figure out whether this was the name\n\t// of a module/interface type or an instance.\n\tRTLIL::IdString target_name;\n\n\t// An attribute name which contains an ID that's unique across binding\n\t// instances (used to ensure we don't apply a binding twice to a module)\n\tRTLIL::IdString attr_name;\n};\n\nYOSYS_NAMESPACE_END\n\n#endif\n",
|
|
163
|
-
"bitpattern.h": "/*\n * yosys -- Yosys Open SYnthesis Suite\n *\n * Copyright (C) 2012 Claire Xenia Wolf <claire@yosyshq.com>\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n *\n */\n\n#ifndef BITPATTERN_H\n#define BITPATTERN_H\n\n#include \"kernel/log.h\"\n#include \"kernel/rtlil.h\"\n\nYOSYS_NAMESPACE_BEGIN\n\nstruct BitPatternPool\n{\n\tint width;\n\tstruct bits_t {\n\t\tstd::vector<RTLIL::State> bitdata;\n\t\tmutable Hasher::hash_t cached_hash;\n\t\tbits_t(int width = 0) : bitdata(width), cached_hash(0) { }\n\t\tRTLIL::State &operator[](int index) {\n\t\t\treturn bitdata[index];\n\t\t}\n\t\tconst RTLIL::State &operator[](int index) const {\n\t\t\treturn bitdata[index];\n\t\t}\n\t\tbool operator==(const bits_t &other) const {\n\t\t\tif (run_hash(*this) != run_hash(other))\n\t\t\t\treturn false;\n\t\t\treturn bitdata == other.bitdata;\n\t\t}\n\t\t[[nodiscard]] Hasher hash_into(Hasher h) const {\n\t\t\tif (!cached_hash)\n\t\t\t\tcached_hash = run_hash(bitdata);\n\t\t\th.eat(cached_hash);\n\t\t\treturn h;\n\t\t}\n\t};\n\tpool<bits_t> database;\n\n\tBitPatternPool(RTLIL::SigSpec sig)\n\t{\n\t\twidth = sig.size();\n\t\tif (width > 0) {\n\t\t\tbits_t pattern(width);\n\t\t\tfor (int i = 0; i < width; i++) {\n\t\t\t\tif (sig[i].wire == NULL && sig[i].data <= RTLIL::State::S1)\n\t\t\t\t\tpattern[i] = sig[i].data;\n\t\t\t\telse\n\t\t\t\t\tpattern[i] = RTLIL::State::Sa;\n\t\t\t}\n\t\t\tdatabase.insert(pattern);\n\t\t}\n\t}\n\n\tBitPatternPool(int width)\n\t{\n\t\tthis->width = width;\n\t\tif (width > 0) {\n\t\t\tbits_t pattern(width);\n\t\t\tfor (int i = 0; i < width; i++)\n\t\t\t\tpattern[i] = RTLIL::State::Sa;\n\t\t\tdatabase.insert(pattern);\n\t\t}\n\t}\n\n\tbits_t sig2bits(RTLIL::SigSpec sig)\n\t{\n\t\tbits_t bits;\n\t\tbits.bitdata = sig.as_const().bits();\n\t\tfor (auto &b : bits.bitdata)\n\t\t\tif (b > RTLIL::State::S1)\n\t\t\t\tb = RTLIL::State::Sa;\n\t\treturn bits;\n\t}\n\n\tbool match(bits_t a, bits_t b)\n\t{\n\t\tlog_assert(int(a.bitdata.size()) == width);\n\t\tlog_assert(int(b.bitdata.size()) == width);\n\t\tfor (int i = 0; i < width; i++)\n\t\t\tif (a[i] <= RTLIL::State::S1 && b[i] <= RTLIL::State::S1 && a[i] != b[i])\n\t\t\t\treturn false;\n\t\treturn true;\n\t}\n\n\tbool has_any(RTLIL::SigSpec sig)\n\t{\n\t\tbits_t bits = sig2bits(sig);\n\t\tfor (auto &it : database)\n\t\t\tif (match(it, bits))\n\t\t\t\treturn true;\n\t\treturn false;\n\t}\n\n\tbool has_all(RTLIL::SigSpec sig)\n\t{\n\t\tbits_t bits = sig2bits(sig);\n\t\tfor (auto &it : database)\n\t\t\tif (match(it, bits)) {\n\t\t\t\tfor (int i = 0; i < width; i++)\n\t\t\t\t\tif (bits[i] > RTLIL::State::S1 && it[i] <= RTLIL::State::S1)\n\t\t\t\t\t\tgoto next_database_entry;\n\t\t\t\treturn true;\n\tnext_database_entry:;\n\t\t\t}\n\t\treturn false;\n\t}\n\n\tbool take(RTLIL::SigSpec sig)\n\t{\n\t\tbool status = false;\n\t\tbits_t bits = sig2bits(sig);\n\t\tfor (auto it = database.begin(); it != database.end();)\n\t\t\tif (match(*it, bits)) {\n\t\t\t\tfor (int i = 0; i < width; i++) {\n\t\t\t\t\tif ((*it)[i] != RTLIL::State::Sa || bits[i] == RTLIL::State::Sa)\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tbits_t new_pattern;\n\t\t\t\t\tnew_pattern.bitdata = it->bitdata;\n\t\t\t\t\tnew_pattern[i] = bits[i] == RTLIL::State::S1 ? RTLIL::State::S0 : RTLIL::State::S1;\n\t\t\t\t\tdatabase.insert(new_pattern);\n\t\t\t\t}\n\t\t\t\tit = database.erase(it);\n\t\t\t\tstatus = true;\n\t\t\t\tcontinue;\n\t\t\t} else\n\t\t\t\t++it;\n\t\treturn status;\n\t}\n\n\tbool take_all()\n\t{\n\t\tif (database.empty())\n\t\t\treturn false;\n\t\tdatabase.clear();\n\t\treturn true;\n\t}\n\n\tbool empty()\n\t{\n\t\treturn database.empty();\n\t}\n};\n\nYOSYS_NAMESPACE_END\n\n#endif\n",
|
|
163
|
+
"bitpattern.h": "/*\n * yosys -- Yosys Open SYnthesis Suite\n *\n * Copyright (C) 2012 Claire Xenia Wolf <claire@yosyshq.com>\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n *\n */\n\n#ifndef BITPATTERN_H\n#define BITPATTERN_H\n\n#include \"kernel/log.h\"\n#include \"kernel/rtlil.h\"\n\nYOSYS_NAMESPACE_BEGIN\n\n/**\n * This file implements BitPatternPool for efficiently storing and querying\n * sets of fixed-width 2-valued logic constants compressed as \"bit patterns\".\n * A bit pattern can have don't cares on one or more bit positions (State::Sa).\n *\n * In terms of logic synthesis:\n * A BitPatternPool is a sum of products (SOP).\n * BitPatternPool::bits_t is a cube.\n *\n * BitPatternPool does not permit adding new patterns, only removing.\n * Its intended use case is in analysing cases in case/match constructs in HDL.\n */\nstruct BitPatternPool\n{\n\tint width;\n\tstruct bits_t {\n\t\tstd::vector<RTLIL::State> bitdata;\n\t\tmutable Hasher::hash_t cached_hash;\n\t\tbits_t(int width = 0) : bitdata(width), cached_hash(0) { }\n\t\tRTLIL::State &operator[](int index) {\n\t\t\treturn bitdata[index];\n\t\t}\n\t\tconst RTLIL::State &operator[](int index) const {\n\t\t\treturn bitdata[index];\n\t\t}\n\t\tbool operator==(const bits_t &other) const {\n\t\t\tif (run_hash(*this) != run_hash(other))\n\t\t\t\treturn false;\n\t\t\treturn bitdata == other.bitdata;\n\t\t}\n\t\t[[nodiscard]] Hasher hash_into(Hasher h) const {\n\t\t\tif (!cached_hash)\n\t\t\t\tcached_hash = run_hash(bitdata);\n\t\t\th.eat(cached_hash);\n\t\t\treturn h;\n\t\t}\n\t};\n\tpool<bits_t> database;\n\n\tBitPatternPool(RTLIL::SigSpec sig)\n\t{\n\t\twidth = sig.size();\n\t\tif (width > 0) {\n\t\t\tbits_t pattern(width);\n\t\t\tfor (int i = 0; i < width; i++) {\n\t\t\t\tif (sig[i].wire == NULL && sig[i].data <= RTLIL::State::S1)\n\t\t\t\t\tpattern[i] = sig[i].data;\n\t\t\t\telse\n\t\t\t\t\tpattern[i] = RTLIL::State::Sa;\n\t\t\t}\n\t\t\tdatabase.insert(pattern);\n\t\t}\n\t}\n\n\t/**\n\t * Constructs a pool of all possible patterns (all don't-care bits)\n\t */\n\tBitPatternPool(int width)\n\t{\n\t\tthis->width = width;\n\t\tif (width > 0) {\n\t\t\tbits_t pattern(width);\n\t\t\tfor (int i = 0; i < width; i++)\n\t\t\t\tpattern[i] = RTLIL::State::Sa;\n\t\t\tdatabase.insert(pattern);\n\t\t}\n\t}\n\n\t/**\n\t * Convert a constant SigSpec to a pattern. Normalize Yosys many-valued\n\t * to three-valued logic.\n\t */\n\tbits_t sig2bits(RTLIL::SigSpec sig)\n\t{\n\t\tbits_t bits;\n\t\tbits.bitdata = sig.as_const().bits();\n\t\tfor (auto &b : bits.bitdata)\n\t\t\tif (b > RTLIL::State::S1)\n\t\t\t\tb = RTLIL::State::Sa;\n\t\treturn bits;\n\t}\n\n\t/**\n\t * Two cubes match if their intersection is non-empty.\n\t */\n\tbool match(bits_t a, bits_t b)\n\t{\n\t\tlog_assert(int(a.bitdata.size()) == width);\n\t\tlog_assert(int(b.bitdata.size()) == width);\n\t\tfor (int i = 0; i < width; i++)\n\t\t\tif (a[i] <= RTLIL::State::S1 && b[i] <= RTLIL::State::S1 && a[i] != b[i])\n\t\t\t\treturn false;\n\t\treturn true;\n\t}\n\n\t/**\n\t * Does cube sig overlap any cube in the pool?\n\t * For example:\n\t * pool({aaa}).has_any(01a) == true\n\t * pool({01a}).has_any(01a) == true\n\t * pool({011}).has_any(01a) == true\n\t * pool({01a}).has_any(011) == true\n\t * pool({111}).has_any(01a) == false\n\t */\n\tbool has_any(RTLIL::SigSpec sig)\n\t{\n\t\tbits_t bits = sig2bits(sig);\n\t\tfor (auto &it : database)\n\t\t\tif (match(it, bits))\n\t\t\t\treturn true;\n\t\treturn false;\n\t}\n\n\t/**\n\t * Is cube sig covered by a cube in the pool?\n\t * For example:\n\t * pool({aaa}).has_all(01a) == true\n\t * pool({01a}).has_any(01a) == true\n\t * pool({01a}).has_any(011) == true\n\t * pool({011}).has_all(01a) == false\n\t * pool({111}).has_all(01a) == false\n\t */\n\tbool has_all(RTLIL::SigSpec sig)\n\t{\n\t\tbits_t bits = sig2bits(sig);\n\t\tfor (auto &it : database)\n\t\t\tif (match(it, bits)) {\n\t\t\t\tfor (int i = 0; i < width; i++)\n\t\t\t\t\tif (bits[i] > RTLIL::State::S1 && it[i] <= RTLIL::State::S1)\n\t\t\t\t\t\tgoto next_database_entry;\n\t\t\t\treturn true;\n\tnext_database_entry:;\n\t\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Remove cube sig from the pool, splitting the remaining cubes. True if success.\n\t * For example:\n\t * Taking 011 out of pool({01a}) -> pool({010}), returns true.\n\t * Taking 011 out of pool({010}) does nothing, returns false.\n\t */\n\tbool take(RTLIL::SigSpec sig)\n\t{\n\t\tbool status = false;\n\t\tbits_t bits = sig2bits(sig);\n\t\tfor (auto it = database.begin(); it != database.end();)\n\t\t\tif (match(*it, bits)) {\n\t\t\t\tfor (int i = 0; i < width; i++) {\n\t\t\t\t\tif ((*it)[i] != RTLIL::State::Sa || bits[i] == RTLIL::State::Sa)\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tbits_t new_pattern;\n\t\t\t\t\tnew_pattern.bitdata = it->bitdata;\n\t\t\t\t\tnew_pattern[i] = bits[i] == RTLIL::State::S1 ? RTLIL::State::S0 : RTLIL::State::S1;\n\t\t\t\t\tdatabase.insert(new_pattern);\n\t\t\t\t}\n\t\t\t\tit = database.erase(it);\n\t\t\t\tstatus = true;\n\t\t\t\tcontinue;\n\t\t\t} else\n\t\t\t\t++it;\n\t\treturn status;\n\t}\n\n\t/**\n\t * Remove all patterns. Returns false if already empty.\n\t */\n\tbool take_all()\n\t{\n\t\tif (database.empty())\n\t\t\treturn false;\n\t\tdatabase.clear();\n\t\treturn true;\n\t}\n\n\tbool empty()\n\t{\n\t\treturn database.empty();\n\t}\n};\n\nYOSYS_NAMESPACE_END\n\n#endif\n",
|
|
164
164
|
"cellaigs.h": "/*\n * yosys -- Yosys Open SYnthesis Suite\n *\n * Copyright (C) 2012 Claire Xenia Wolf <claire@yosyshq.com>\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n *\n */\n\n#ifndef CELLAIGS_H\n#define CELLAIGS_H\n\n#include \"kernel/yosys.h\"\n\nYOSYS_NAMESPACE_BEGIN\n\nstruct AigNode\n{\n\tIdString portname;\n\tint portbit;\n\tbool inverter;\n\tint left_parent, right_parent;\n\tvector<pair<IdString, int>> outports;\n\n\tAigNode();\n\tbool operator==(const AigNode &other) const;\n\t[[nodiscard]] Hasher hash_into(Hasher h) const;\n};\n\nstruct Aig\n{\n\tstring name;\n\tvector<AigNode> nodes;\n\tAig(Cell *cell);\n\n\tbool operator==(const Aig &other) const;\n\t[[nodiscard]] Hasher hash_into(Hasher h) const;\n};\n\nYOSYS_NAMESPACE_END\n\n#endif\n",
|
|
165
165
|
"celledges.h": "/* -*- c++ -*-\n * yosys -- Yosys Open SYnthesis Suite\n *\n * Copyright (C) 2012 Claire Xenia Wolf <claire@yosyshq.com>\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n *\n */\n\n#ifndef CELLEDGES_H\n#define CELLEDGES_H\n\n#include \"kernel/yosys.h\"\n#include \"kernel/sigtools.h\"\n\nYOSYS_NAMESPACE_BEGIN\n\nstruct AbstractCellEdgesDatabase\n{\n\tvirtual ~AbstractCellEdgesDatabase() { }\n\tvirtual void add_edge(RTLIL::Cell *cell, RTLIL::IdString from_port, int from_bit, RTLIL::IdString to_port, int to_bit, int delay) = 0;\n\tbool add_edges_from_cell(RTLIL::Cell *cell);\n};\n\nstruct FwdCellEdgesDatabase : AbstractCellEdgesDatabase\n{\n\tSigMap &sigmap;\n\tdict<SigBit, pool<SigBit>> db;\n\tFwdCellEdgesDatabase(SigMap &sigmap) : sigmap(sigmap) { }\n\n\tvoid add_edge(RTLIL::Cell *cell, RTLIL::IdString from_port, int from_bit, RTLIL::IdString to_port, int to_bit, int) override {\n\t\tSigBit from_sigbit = sigmap(cell->getPort(from_port)[from_bit]);\n\t\tSigBit to_sigbit = sigmap(cell->getPort(to_port)[to_bit]);\n\t\tdb[from_sigbit].insert(to_sigbit);\n\t}\n};\n\nstruct RevCellEdgesDatabase : AbstractCellEdgesDatabase\n{\n\tSigMap &sigmap;\n\tdict<SigBit, pool<SigBit>> db;\n\tRevCellEdgesDatabase(SigMap &sigmap) : sigmap(sigmap) { }\n\n\tvoid add_edge(RTLIL::Cell *cell, RTLIL::IdString from_port, int from_bit, RTLIL::IdString to_port, int to_bit, int) override {\n\t\tSigBit from_sigbit = sigmap(cell->getPort(from_port)[from_bit]);\n\t\tSigBit to_sigbit = sigmap(cell->getPort(to_port)[to_bit]);\n\t\tdb[to_sigbit].insert(from_sigbit);\n\t}\n};\n\nYOSYS_NAMESPACE_END\n\n#endif\n",
|
|
166
166
|
"celltypes.h": "/*\n * yosys -- Yosys Open SYnthesis Suite\n *\n * Copyright (C) 2012 Claire Xenia Wolf <claire@yosyshq.com>\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n *\n */\n\n#ifndef CELLTYPES_H\n#define CELLTYPES_H\n\n#include \"kernel/yosys.h\"\n\nYOSYS_NAMESPACE_BEGIN\n\nstruct CellType\n{\n\tRTLIL::IdString type;\n\tpool<RTLIL::IdString> inputs, outputs;\n\tbool is_evaluable;\n\tbool is_combinatorial;\n\tbool is_synthesizable;\n};\n\nstruct CellTypes\n{\n\tdict<RTLIL::IdString, CellType> cell_types;\n\n\tCellTypes()\n\t{\n\t}\n\n\tCellTypes(RTLIL::Design *design)\n\t{\n\t\tsetup(design);\n\t}\n\n\tvoid setup(RTLIL::Design *design = NULL)\n\t{\n\t\tif (design)\n\t\t\tsetup_design(design);\n\n\t\tsetup_internals();\n\t\tsetup_internals_mem();\n\t\tsetup_internals_anyinit();\n\t\tsetup_stdcells();\n\t\tsetup_stdcells_mem();\n\t}\n\n\tvoid setup_type(RTLIL::IdString type, const pool<RTLIL::IdString> &inputs, const pool<RTLIL::IdString> &outputs, bool is_evaluable = false, bool is_combinatorial = false, bool is_synthesizable = false)\n\t{\n\t\tCellType ct = {type, inputs, outputs, is_evaluable, is_combinatorial, is_synthesizable};\n\t\tcell_types[ct.type] = ct;\n\t}\n\n\tvoid setup_module(RTLIL::Module *module)\n\t{\n\t\tpool<RTLIL::IdString> inputs, outputs;\n\t\tfor (RTLIL::IdString wire_name : module->ports) {\n\t\t\tRTLIL::Wire *wire = module->wire(wire_name);\n\t\t\tif (wire->port_input)\n\t\t\t\tinputs.insert(wire->name);\n\t\t\tif (wire->port_output)\n\t\t\t\toutputs.insert(wire->name);\n\t\t}\n\t\tsetup_type(module->name, inputs, outputs);\n\t}\n\n\tvoid setup_design(RTLIL::Design *design)\n\t{\n\t\tfor (auto module : design->modules())\n\t\t\tsetup_module(module);\n\t}\n\n\tvoid setup_internals()\n\t{\n\t\tsetup_internals_eval();\n\n\t\tsetup_type(ID($tribuf), {ID::A, ID::EN}, {ID::Y}, true);\n\n\t\tsetup_type(ID($assert), {ID::A, ID::EN}, pool<RTLIL::IdString>(), true);\n\t\tsetup_type(ID($assume), {ID::A, ID::EN}, pool<RTLIL::IdString>(), true);\n\t\tsetup_type(ID($live), {ID::A, ID::EN}, pool<RTLIL::IdString>(), true);\n\t\tsetup_type(ID($fair), {ID::A, ID::EN}, pool<RTLIL::IdString>(), true);\n\t\tsetup_type(ID($cover), {ID::A, ID::EN}, pool<RTLIL::IdString>(), true);\n\t\tsetup_type(ID($initstate), pool<RTLIL::IdString>(), {ID::Y}, true);\n\t\tsetup_type(ID($anyconst), pool<RTLIL::IdString>(), {ID::Y}, true);\n\t\tsetup_type(ID($anyseq), pool<RTLIL::IdString>(), {ID::Y}, true);\n\t\tsetup_type(ID($allconst), pool<RTLIL::IdString>(), {ID::Y}, true);\n\t\tsetup_type(ID($allseq), pool<RTLIL::IdString>(), {ID::Y}, true);\n\t\tsetup_type(ID($equiv), {ID::A, ID::B}, {ID::Y}, true);\n\t\tsetup_type(ID($specify2), {ID::EN, ID::SRC, ID::DST}, pool<RTLIL::IdString>(), true);\n\t\tsetup_type(ID($specify3), {ID::EN, ID::SRC, ID::DST, ID::DAT}, pool<RTLIL::IdString>(), true);\n\t\tsetup_type(ID($specrule), {ID::EN_SRC, ID::EN_DST, ID::SRC, ID::DST}, pool<RTLIL::IdString>(), true);\n\t\tsetup_type(ID($print), {ID::EN, ID::ARGS, ID::TRG}, pool<RTLIL::IdString>());\n\t\tsetup_type(ID($check), {ID::A, ID::EN, ID::ARGS, ID::TRG}, pool<RTLIL::IdString>());\n\t\tsetup_type(ID($set_tag), {ID::A, ID::SET, ID::CLR}, {ID::Y});\n\t\tsetup_type(ID($get_tag), {ID::A}, {ID::Y});\n\t\tsetup_type(ID($overwrite_tag), {ID::A, ID::SET, ID::CLR}, pool<RTLIL::IdString>());\n\t\tsetup_type(ID($original_tag), {ID::A}, {ID::Y});\n\t\tsetup_type(ID($future_ff), {ID::A}, {ID::Y});\n\t\tsetup_type(ID($scopeinfo), {}, {});\n\t}\n\n\tvoid setup_internals_eval()\n\t{\n\t\tstd::vector<RTLIL::IdString> unary_ops = {\n\t\t\tID($not), ID($pos), ID($buf), ID($neg),\n\t\t\tID($reduce_and), ID($reduce_or), ID($reduce_xor), ID($reduce_xnor), ID($reduce_bool),\n\t\t\tID($logic_not), ID($slice), ID($lut), ID($sop)\n\t\t};\n\n\t\tstd::vector<RTLIL::IdString> binary_ops = {\n\t\t\tID($and), ID($or), ID($xor), ID($xnor),\n\t\t\tID($shl), ID($shr), ID($sshl), ID($sshr), ID($shift), ID($shiftx),\n\t\t\tID($lt), ID($le), ID($eq), ID($ne), ID($eqx), ID($nex), ID($ge), ID($gt),\n\t\t\tID($add), ID($sub), ID($mul), ID($div), ID($mod), ID($divfloor), ID($modfloor), ID($pow),\n\t\t\tID($logic_and), ID($logic_or), ID($concat), ID($macc),\n\t\t\tID($bweqx)\n\t\t};\n\n\t\tfor (auto type : unary_ops)\n\t\t\tsetup_type(type, {ID::A}, {ID::Y}, true);\n\n\t\tfor (auto type : binary_ops)\n\t\t\tsetup_type(type, {ID::A, ID::B}, {ID::Y}, true);\n\n\t\tfor (auto type : std::vector<RTLIL::IdString>({ID($mux), ID($pmux), ID($bwmux)}))\n\t\t\tsetup_type(type, {ID::A, ID::B, ID::S}, {ID::Y}, true);\n\n\t\tfor (auto type : std::vector<RTLIL::IdString>({ID($bmux), ID($demux)}))\n\t\t\tsetup_type(type, {ID::A, ID::S}, {ID::Y}, true);\n\n\t\tsetup_type(ID($lcu), {ID::P, ID::G, ID::CI}, {ID::CO}, true);\n\t\tsetup_type(ID($alu), {ID::A, ID::B, ID::CI, ID::BI}, {ID::X, ID::Y, ID::CO}, true);\n\t\tsetup_type(ID($macc_v2), {ID::A, ID::B, ID::C}, {ID::Y}, true);\n\t\tsetup_type(ID($fa), {ID::A, ID::B, ID::C}, {ID::X, ID::Y}, true);\n\t}\n\n\tvoid setup_internals_ff()\n\t{\n\t\tsetup_type(ID($sr), {ID::SET, ID::CLR}, {ID::Q});\n\t\tsetup_type(ID($ff), {ID::D}, {ID::Q});\n\t\tsetup_type(ID($dff), {ID::CLK, ID::D}, {ID::Q});\n\t\tsetup_type(ID($dffe), {ID::CLK, ID::EN, ID::D}, {ID::Q});\n\t\tsetup_type(ID($dffsr), {ID::CLK, ID::SET, ID::CLR, ID::D}, {ID::Q});\n\t\tsetup_type(ID($dffsre), {ID::CLK, ID::SET, ID::CLR, ID::D, ID::EN}, {ID::Q});\n\t\tsetup_type(ID($adff), {ID::CLK, ID::ARST, ID::D}, {ID::Q});\n\t\tsetup_type(ID($adffe), {ID::CLK, ID::ARST, ID::D, ID::EN}, {ID::Q});\n\t\tsetup_type(ID($aldff), {ID::CLK, ID::ALOAD, ID::AD, ID::D}, {ID::Q});\n\t\tsetup_type(ID($aldffe), {ID::CLK, ID::ALOAD, ID::AD, ID::D, ID::EN}, {ID::Q});\n\t\tsetup_type(ID($sdff), {ID::CLK, ID::SRST, ID::D}, {ID::Q});\n\t\tsetup_type(ID($sdffe), {ID::CLK, ID::SRST, ID::D, ID::EN}, {ID::Q});\n\t\tsetup_type(ID($sdffce), {ID::CLK, ID::SRST, ID::D, ID::EN}, {ID::Q});\n\t\tsetup_type(ID($dlatch), {ID::EN, ID::D}, {ID::Q});\n\t\tsetup_type(ID($adlatch), {ID::EN, ID::D, ID::ARST}, {ID::Q});\n\t\tsetup_type(ID($dlatchsr), {ID::EN, ID::SET, ID::CLR, ID::D}, {ID::Q});\n\t}\n\n\tvoid setup_internals_anyinit()\n\t{\n\t\tsetup_type(ID($anyinit), {ID::D}, {ID::Q});\n\t}\n\n\tvoid setup_internals_mem()\n\t{\n\t\tsetup_internals_ff();\n\n\t\tsetup_type(ID($memrd), {ID::CLK, ID::EN, ID::ADDR}, {ID::DATA});\n\t\tsetup_type(ID($memrd_v2), {ID::CLK, ID::EN, ID::ARST, ID::SRST, ID::ADDR}, {ID::DATA});\n\t\tsetup_type(ID($memwr), {ID::CLK, ID::EN, ID::ADDR, ID::DATA}, pool<RTLIL::IdString>());\n\t\tsetup_type(ID($memwr_v2), {ID::CLK, ID::EN, ID::ADDR, ID::DATA}, pool<RTLIL::IdString>());\n\t\tsetup_type(ID($meminit), {ID::ADDR, ID::DATA}, pool<RTLIL::IdString>());\n\t\tsetup_type(ID($meminit_v2), {ID::ADDR, ID::DATA, ID::EN}, pool<RTLIL::IdString>());\n\t\tsetup_type(ID($mem), {ID::RD_CLK, ID::RD_EN, ID::RD_ADDR, ID::WR_CLK, ID::WR_EN, ID::WR_ADDR, ID::WR_DATA}, {ID::RD_DATA});\n\t\tsetup_type(ID($mem_v2), {ID::RD_CLK, ID::RD_EN, ID::RD_ARST, ID::RD_SRST, ID::RD_ADDR, ID::WR_CLK, ID::WR_EN, ID::WR_ADDR, ID::WR_DATA}, {ID::RD_DATA});\n\n\t\tsetup_type(ID($fsm), {ID::CLK, ID::ARST, ID::CTRL_IN}, {ID::CTRL_OUT});\n\t}\n\n\tvoid setup_stdcells()\n\t{\n\t\tsetup_stdcells_eval();\n\n\t\tsetup_type(ID($_TBUF_), {ID::A, ID::E}, {ID::Y}, true);\n\t}\n\n\tvoid setup_stdcells_eval()\n\t{\n\t\tsetup_type(ID($_BUF_), {ID::A}, {ID::Y}, true);\n\t\tsetup_type(ID($_NOT_), {ID::A}, {ID::Y}, true);\n\t\tsetup_type(ID($_AND_), {ID::A, ID::B}, {ID::Y}, true);\n\t\tsetup_type(ID($_NAND_), {ID::A, ID::B}, {ID::Y}, true);\n\t\tsetup_type(ID($_OR_), {ID::A, ID::B}, {ID::Y}, true);\n\t\tsetup_type(ID($_NOR_), {ID::A, ID::B}, {ID::Y}, true);\n\t\tsetup_type(ID($_XOR_), {ID::A, ID::B}, {ID::Y}, true);\n\t\tsetup_type(ID($_XNOR_), {ID::A, ID::B}, {ID::Y}, true);\n\t\tsetup_type(ID($_ANDNOT_), {ID::A, ID::B}, {ID::Y}, true);\n\t\tsetup_type(ID($_ORNOT_), {ID::A, ID::B}, {ID::Y}, true);\n\t\tsetup_type(ID($_MUX_), {ID::A, ID::B, ID::S}, {ID::Y}, true);\n\t\tsetup_type(ID($_NMUX_), {ID::A, ID::B, ID::S}, {ID::Y}, true);\n\t\tsetup_type(ID($_MUX4_), {ID::A, ID::B, ID::C, ID::D, ID::S, ID::T}, {ID::Y}, true);\n\t\tsetup_type(ID($_MUX8_), {ID::A, ID::B, ID::C, ID::D, ID::E, ID::F, ID::G, ID::H, ID::S, ID::T, ID::U}, {ID::Y}, true);\n\t\tsetup_type(ID($_MUX16_), {ID::A, ID::B, ID::C, ID::D, ID::E, ID::F, ID::G, ID::H, ID::I, ID::J, ID::K, ID::L, ID::M, ID::N, ID::O, ID::P, ID::S, ID::T, ID::U, ID::V}, {ID::Y}, true);\n\t\tsetup_type(ID($_AOI3_), {ID::A, ID::B, ID::C}, {ID::Y}, true);\n\t\tsetup_type(ID($_OAI3_), {ID::A, ID::B, ID::C}, {ID::Y}, true);\n\t\tsetup_type(ID($_AOI4_), {ID::A, ID::B, ID::C, ID::D}, {ID::Y}, true);\n\t\tsetup_type(ID($_OAI4_), {ID::A, ID::B, ID::C, ID::D}, {ID::Y}, true);\n\t}\n\n\tvoid setup_stdcells_mem()\n\t{\n\t\tstd::vector<char> list_np = {'N', 'P'}, list_01 = {'0', '1'};\n\n\t\tfor (auto c1 : list_np)\n\t\tfor (auto c2 : list_np)\n\t\t\tsetup_type(stringf(\"$_SR_%c%c_\", c1, c2), {ID::S, ID::R}, {ID::Q});\n\n\t\tsetup_type(ID($_FF_), {ID::D}, {ID::Q});\n\n\t\tfor (auto c1 : list_np)\n\t\t\tsetup_type(stringf(\"$_DFF_%c_\", c1), {ID::C, ID::D}, {ID::Q});\n\n\t\tfor (auto c1 : list_np)\n\t\tfor (auto c2 : list_np)\n\t\t\tsetup_type(stringf(\"$_DFFE_%c%c_\", c1, c2), {ID::C, ID::D, ID::E}, {ID::Q});\n\n\t\tfor (auto c1 : list_np)\n\t\tfor (auto c2 : list_np)\n\t\tfor (auto c3 : list_01)\n\t\t\tsetup_type(stringf(\"$_DFF_%c%c%c_\", c1, c2, c3), {ID::C, ID::R, ID::D}, {ID::Q});\n\n\t\tfor (auto c1 : list_np)\n\t\tfor (auto c2 : list_np)\n\t\tfor (auto c3 : list_01)\n\t\tfor (auto c4 : list_np)\n\t\t\tsetup_type(stringf(\"$_DFFE_%c%c%c%c_\", c1, c2, c3, c4), {ID::C, ID::R, ID::D, ID::E}, {ID::Q});\n\n\t\tfor (auto c1 : list_np)\n\t\tfor (auto c2 : list_np)\n\t\t\tsetup_type(stringf(\"$_ALDFF_%c%c_\", c1, c2), {ID::C, ID::L, ID::AD, ID::D}, {ID::Q});\n\n\t\tfor (auto c1 : list_np)\n\t\tfor (auto c2 : list_np)\n\t\tfor (auto c3 : list_np)\n\t\t\tsetup_type(stringf(\"$_ALDFFE_%c%c%c_\", c1, c2, c3), {ID::C, ID::L, ID::AD, ID::D, ID::E}, {ID::Q});\n\n\t\tfor (auto c1 : list_np)\n\t\tfor (auto c2 : list_np)\n\t\tfor (auto c3 : list_np)\n\t\t\tsetup_type(stringf(\"$_DFFSR_%c%c%c_\", c1, c2, c3), {ID::C, ID::S, ID::R, ID::D}, {ID::Q});\n\n\t\tfor (auto c1 : list_np)\n\t\tfor (auto c2 : list_np)\n\t\tfor (auto c3 : list_np)\n\t\tfor (auto c4 : list_np)\n\t\t\tsetup_type(stringf(\"$_DFFSRE_%c%c%c%c_\", c1, c2, c3, c4), {ID::C, ID::S, ID::R, ID::D, ID::E}, {ID::Q});\n\n\t\tfor (auto c1 : list_np)\n\t\tfor (auto c2 : list_np)\n\t\tfor (auto c3 : list_01)\n\t\t\tsetup_type(stringf(\"$_SDFF_%c%c%c_\", c1, c2, c3), {ID::C, ID::R, ID::D}, {ID::Q});\n\n\t\tfor (auto c1 : list_np)\n\t\tfor (auto c2 : list_np)\n\t\tfor (auto c3 : list_01)\n\t\tfor (auto c4 : list_np)\n\t\t\tsetup_type(stringf(\"$_SDFFE_%c%c%c%c_\", c1, c2, c3, c4), {ID::C, ID::R, ID::D, ID::E}, {ID::Q});\n\n\t\tfor (auto c1 : list_np)\n\t\tfor (auto c2 : list_np)\n\t\tfor (auto c3 : list_01)\n\t\tfor (auto c4 : list_np)\n\t\t\tsetup_type(stringf(\"$_SDFFCE_%c%c%c%c_\", c1, c2, c3, c4), {ID::C, ID::R, ID::D, ID::E}, {ID::Q});\n\n\t\tfor (auto c1 : list_np)\n\t\t\tsetup_type(stringf(\"$_DLATCH_%c_\", c1), {ID::E, ID::D}, {ID::Q});\n\n\t\tfor (auto c1 : list_np)\n\t\tfor (auto c2 : list_np)\n\t\tfor (auto c3 : list_01)\n\t\t\tsetup_type(stringf(\"$_DLATCH_%c%c%c_\", c1, c2, c3), {ID::E, ID::R, ID::D}, {ID::Q});\n\n\t\tfor (auto c1 : list_np)\n\t\tfor (auto c2 : list_np)\n\t\tfor (auto c3 : list_np)\n\t\t\tsetup_type(stringf(\"$_DLATCHSR_%c%c%c_\", c1, c2, c3), {ID::E, ID::S, ID::R, ID::D}, {ID::Q});\n\t}\n\n\tvoid clear()\n\t{\n\t\tcell_types.clear();\n\t}\n\n\tbool cell_known(RTLIL::IdString type) const\n\t{\n\t\treturn cell_types.count(type) != 0;\n\t}\n\n\tbool cell_output(RTLIL::IdString type, RTLIL::IdString port) const\n\t{\n\t\tauto it = cell_types.find(type);\n\t\treturn it != cell_types.end() && it->second.outputs.count(port) != 0;\n\t}\n\n\tbool cell_input(RTLIL::IdString type, RTLIL::IdString port) const\n\t{\n\t\tauto it = cell_types.find(type);\n\t\treturn it != cell_types.end() && it->second.inputs.count(port) != 0;\n\t}\n\n\tbool cell_evaluable(RTLIL::IdString type) const\n\t{\n\t\tauto it = cell_types.find(type);\n\t\treturn it != cell_types.end() && it->second.is_evaluable;\n\t}\n\n\tstatic RTLIL::Const eval_not(RTLIL::Const v)\n\t{\n\t\tfor (auto &bit : v.bits())\n\t\t\tif (bit == State::S0) bit = State::S1;\n\t\t\telse if (bit == State::S1) bit = State::S0;\n\t\treturn v;\n\t}\n\n\t// Consider using the ConstEval struct instead if you need named ports and/or multiple outputs\n\tstatic RTLIL::Const eval(RTLIL::IdString type, const RTLIL::Const &arg1, const RTLIL::Const &arg2, bool signed1, bool signed2, int result_len, bool *errp = nullptr)\n\t{\n\t\tif (type == ID($sshr) && !signed1)\n\t\t\ttype = ID($shr);\n\t\tif (type == ID($sshl) && !signed1)\n\t\t\ttype = ID($shl);\n\n\t\tif (type != ID($sshr) && type != ID($sshl) && type != ID($shr) && type != ID($shl) && type != ID($shift) && type != ID($shiftx) &&\n\t\t\t\ttype != ID($pos) && type != ID($buf) && type != ID($neg) && type != ID($not)) {\n\t\t\tif (!signed1 || !signed2)\n\t\t\t\tsigned1 = false, signed2 = false;\n\t\t}\n\n#define HANDLE_CELL_TYPE(_t) if (type == ID($##_t)) return const_ ## _t(arg1, arg2, signed1, signed2, result_len);\n\t\tHANDLE_CELL_TYPE(not)\n\t\tHANDLE_CELL_TYPE(and)\n\t\tHANDLE_CELL_TYPE(or)\n\t\tHANDLE_CELL_TYPE(xor)\n\t\tHANDLE_CELL_TYPE(xnor)\n\t\tHANDLE_CELL_TYPE(reduce_and)\n\t\tHANDLE_CELL_TYPE(reduce_or)\n\t\tHANDLE_CELL_TYPE(reduce_xor)\n\t\tHANDLE_CELL_TYPE(reduce_xnor)\n\t\tHANDLE_CELL_TYPE(reduce_bool)\n\t\tHANDLE_CELL_TYPE(logic_not)\n\t\tHANDLE_CELL_TYPE(logic_and)\n\t\tHANDLE_CELL_TYPE(logic_or)\n\t\tHANDLE_CELL_TYPE(shl)\n\t\tHANDLE_CELL_TYPE(shr)\n\t\tHANDLE_CELL_TYPE(sshl)\n\t\tHANDLE_CELL_TYPE(sshr)\n\t\tHANDLE_CELL_TYPE(shift)\n\t\tHANDLE_CELL_TYPE(shiftx)\n\t\tHANDLE_CELL_TYPE(lt)\n\t\tHANDLE_CELL_TYPE(le)\n\t\tHANDLE_CELL_TYPE(eq)\n\t\tHANDLE_CELL_TYPE(ne)\n\t\tHANDLE_CELL_TYPE(eqx)\n\t\tHANDLE_CELL_TYPE(nex)\n\t\tHANDLE_CELL_TYPE(ge)\n\t\tHANDLE_CELL_TYPE(gt)\n\t\tHANDLE_CELL_TYPE(add)\n\t\tHANDLE_CELL_TYPE(sub)\n\t\tHANDLE_CELL_TYPE(mul)\n\t\tHANDLE_CELL_TYPE(div)\n\t\tHANDLE_CELL_TYPE(mod)\n\t\tHANDLE_CELL_TYPE(divfloor)\n\t\tHANDLE_CELL_TYPE(modfloor)\n\t\tHANDLE_CELL_TYPE(pow)\n\t\tHANDLE_CELL_TYPE(pos)\n\t\tHANDLE_CELL_TYPE(neg)\n#undef HANDLE_CELL_TYPE\n\n\t\tif (type.in(ID($_BUF_), ID($buf)))\n\t\t\treturn arg1;\n\t\tif (type == ID($_NOT_))\n\t\t\treturn eval_not(arg1);\n\t\tif (type == ID($_AND_))\n\t\t\treturn const_and(arg1, arg2, false, false, 1);\n\t\tif (type == ID($_NAND_))\n\t\t\treturn eval_not(const_and(arg1, arg2, false, false, 1));\n\t\tif (type == ID($_OR_))\n\t\t\treturn const_or(arg1, arg2, false, false, 1);\n\t\tif (type == ID($_NOR_))\n\t\t\treturn eval_not(const_or(arg1, arg2, false, false, 1));\n\t\tif (type == ID($_XOR_))\n\t\t\treturn const_xor(arg1, arg2, false, false, 1);\n\t\tif (type == ID($_XNOR_))\n\t\t\treturn const_xnor(arg1, arg2, false, false, 1);\n\t\tif (type == ID($_ANDNOT_))\n\t\t\treturn const_and(arg1, eval_not(arg2), false, false, 1);\n\t\tif (type == ID($_ORNOT_))\n\t\t\treturn const_or(arg1, eval_not(arg2), false, false, 1);\n\n\t\tif (errp != nullptr) {\n\t\t\t*errp = true;\n\t\t\treturn State::Sm;\n\t\t}\n\n\t\tlog_abort();\n\t}\n\n\t// Consider using the ConstEval struct instead if you need named ports and/or multiple outputs\n\tstatic RTLIL::Const eval(RTLIL::Cell *cell, const RTLIL::Const &arg1, const RTLIL::Const &arg2, bool *errp = nullptr)\n\t{\n\t\tif (cell->type == ID($slice)) {\n\t\t\tRTLIL::Const ret;\n\t\t\tint width = cell->parameters.at(ID::Y_WIDTH).as_int();\n\t\t\tint offset = cell->parameters.at(ID::OFFSET).as_int();\n\t\t\tret.bits().insert(ret.bits().end(), arg1.begin()+offset, arg1.begin()+offset+width);\n\t\t\treturn ret;\n\t\t}\n\n\t\tif (cell->type == ID($concat)) {\n\t\t\tRTLIL::Const ret = arg1;\n\t\t\tret.bits().insert(ret.bits().end(), arg2.begin(), arg2.end());\n\t\t\treturn ret;\n\t\t}\n\n\t\tif (cell->type == ID($bmux))\n\t\t{\n\t\t\treturn const_bmux(arg1, arg2);\n\t\t}\n\n\t\tif (cell->type == ID($demux))\n\t\t{\n\t\t\treturn const_demux(arg1, arg2);\n\t\t}\n\n\t\tif (cell->type == ID($bweqx))\n\t\t{\n\t\t\treturn const_bweqx(arg1, arg2);\n\t\t}\n\n\t\tif (cell->type == ID($lut))\n\t\t{\n\t\t\tint width = cell->parameters.at(ID::WIDTH).as_int();\n\n\t\t\tstd::vector<RTLIL::State> t = cell->parameters.at(ID::LUT).to_bits();\n\t\t\twhile (GetSize(t) < (1 << width))\n\t\t\t\tt.push_back(State::S0);\n\t\t\tt.resize(1 << width);\n\n\t\t\treturn const_bmux(t, arg1);\n\t\t}\n\n\t\tif (cell->type == ID($sop))\n\t\t{\n\t\t\tint width = cell->parameters.at(ID::WIDTH).as_int();\n\t\t\tint depth = cell->parameters.at(ID::DEPTH).as_int();\n\t\t\tstd::vector<RTLIL::State> t = cell->parameters.at(ID::TABLE).to_bits();\n\n\t\t\twhile (GetSize(t) < width*depth*2)\n\t\t\t\tt.push_back(State::S0);\n\n\t\t\tRTLIL::State default_ret = State::S0;\n\n\t\t\tfor (int i = 0; i < depth; i++)\n\t\t\t{\n\t\t\t\tbool match = true;\n\t\t\t\tbool match_x = true;\n\n\t\t\t\tfor (int j = 0; j < width; j++) {\n\t\t\t\t\tRTLIL::State a = arg1.at(j);\n\t\t\t\t\tif (t.at(2*width*i + 2*j + 0) == State::S1) {\n\t\t\t\t\t\tif (a == State::S1) match_x = false;\n\t\t\t\t\t\tif (a != State::S0) match = false;\n\t\t\t\t\t}\n\t\t\t\t\tif (t.at(2*width*i + 2*j + 1) == State::S1) {\n\t\t\t\t\t\tif (a == State::S0) match_x = false;\n\t\t\t\t\t\tif (a != State::S1) match = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (match)\n\t\t\t\t\treturn State::S1;\n\n\t\t\t\tif (match_x)\n\t\t\t\t\tdefault_ret = State::Sx;\n\t\t\t}\n\n\t\t\treturn default_ret;\n\t\t}\n\n\t\tbool signed_a = cell->parameters.count(ID::A_SIGNED) > 0 && cell->parameters[ID::A_SIGNED].as_bool();\n\t\tbool signed_b = cell->parameters.count(ID::B_SIGNED) > 0 && cell->parameters[ID::B_SIGNED].as_bool();\n\t\tint result_len = cell->parameters.count(ID::Y_WIDTH) > 0 ? cell->parameters[ID::Y_WIDTH].as_int() : -1;\n\t\treturn eval(cell->type, arg1, arg2, signed_a, signed_b, result_len, errp);\n\t}\n\n\t// Consider using the ConstEval struct instead if you need named ports and/or multiple outputs\n\tstatic RTLIL::Const eval(RTLIL::Cell *cell, const RTLIL::Const &arg1, const RTLIL::Const &arg2, const RTLIL::Const &arg3, bool *errp = nullptr)\n\t{\n\t\tif (cell->type.in(ID($mux), ID($_MUX_)))\n\t\t\treturn const_mux(arg1, arg2, arg3);\n\t\tif (cell->type == ID($_NMUX_))\n\t\t\treturn eval_not(const_mux(arg1, arg2, arg3));\n\t\tif (cell->type == ID($bwmux))\n\t\t\treturn const_bwmux(arg1, arg2, arg3);\n\t\tif (cell->type == ID($pmux))\n\t\t\treturn const_pmux(arg1, arg2, arg3);\n\t\tif (cell->type == ID($_AOI3_))\n\t\t\treturn eval_not(const_or(const_and(arg1, arg2, false, false, 1), arg3, false, false, 1));\n\t\tif (cell->type == ID($_OAI3_))\n\t\t\treturn eval_not(const_and(const_or(arg1, arg2, false, false, 1), arg3, false, false, 1));\n\n\t\tlog_assert(arg3.size() == 0);\n\t\treturn eval(cell, arg1, arg2, errp);\n\t}\n\n\t// Consider using the ConstEval struct instead if you need named ports and/or multiple outputs\n\tstatic RTLIL::Const eval(RTLIL::Cell *cell, const RTLIL::Const &arg1, const RTLIL::Const &arg2, const RTLIL::Const &arg3, const RTLIL::Const &arg4, bool *errp = nullptr)\n\t{\n\t\tif (cell->type == ID($_AOI4_))\n\t\t\treturn eval_not(const_or(const_and(arg1, arg2, false, false, 1), const_and(arg3, arg4, false, false, 1), false, false, 1));\n\t\tif (cell->type == ID($_OAI4_))\n\t\t\treturn eval_not(const_and(const_or(arg1, arg2, false, false, 1), const_or(arg3, arg4, false, false, 1), false, false, 1));\n\n\t\tlog_assert(arg4.size() == 0);\n\t\treturn eval(cell, arg1, arg2, arg3, errp);\n\t}\n};\n\n// initialized by yosys_setup()\nextern CellTypes yosys_celltypes;\n\nYOSYS_NAMESPACE_END\n\n#endif\n",
|
|
@@ -173,7 +173,7 @@ export const filesystem = {
|
|
|
173
173
|
"ffmerge.h": "/*\n * yosys -- Yosys Open SYnthesis Suite\n *\n * Copyright (C) 2021 Marcelina Kościelnicka <mwk@0x04.net>\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n *\n */\n\n#ifndef FFMERGE_H\n#define FFMERGE_H\n\n#include \"kernel/ffinit.h\"\n#include \"kernel/ff.h\"\n\nYOSYS_NAMESPACE_BEGIN\n\n// A helper class for passes that want to merge FFs on the input or output\n// of a cell into the cell itself.\n//\n// The procedure is:\n//\n// 1. Construct this class (at beginning of processing for a given module).\n// 2. For every considered cell:\n//\n// a. Call find_output_ff for every considered output.\n// b. Call find_input_ff for every considered input.\n// c. Look at the FF description returned (if any) from each call, reject\n// results that cannot be merged into given cell for any reason.\n// If both inputs and outputs are being merged, take care of FF bits that\n// are returned in both input and output results (a FF bit cannot be\n// merged to both). Decide on the final set of FF bits to merge.\n// d. Call remove_output_ff for every find_output_ff result that will be used\n// for merging. This removes the actual FF bits from design and from index.\n// e. Call mark_input_ff for every find_input_ff result that will be used\n// for merging. This updates the index disallowing further usage of these\n// FF bits for output FF merging, if they were eligible before. The actual\n// FF bits are still left in the design and can be merged into other inputs.\n// If the FF bits are not otherwise used, they will be removed by later\n// opt passes.\n// f. Merge the FFs into the cell.\n//\n// Note that, if both inputs and outputs are being considered for merging in\n// a single pass, the result may be nondeterministic (depending on cell iteration\n// order) because a given FF bit could be eligible for both input and output merge,\n// perhaps in different cells. For this reason, it may be a good idea to separate\n// input and output merging.\n\nstruct FfMergeHelper\n{\n\tconst SigMapView *sigmap;\n\tRTLIL::Module *module;\n\tFfInitVals *initvals;\n\n\tdict<SigBit, std::pair<Cell*, int>> dff_driver;\n\tdict<SigBit, pool<std::pair<Cell*, int>>> dff_sink;\n\tdict<SigBit, int> sigbit_users_count;\n\n\t// Returns true if all bits in sig are completely unused.\n\tbool is_output_unused(RTLIL::SigSpec sig);\n\n\t// Finds the FF to merge into a given cell output. Takes sig, which\n\t// is the current cell output — it will be the sig_d of the found FF.\n\t// If found, returns true, and fills the two output arguments.\n\t//\n\t// For every bit of sig, this function finds a FF bit that has\n\t// the same sig_d, and fills the output FfData according to the FF\n\t// bits found. This function will only consider FF bits that are\n\t// the only user of the given sig bits — if any bit in sig is used\n\t// by anything other than a single FF, this function will return false.\n\t//\n\t// The returned FfData structure does not correspond to any actual FF\n\t// cell in the design — it is the amalgamation of extracted FF bits,\n\t// possibly coming from several FF cells.\n\t//\n\t// If some of the bits in sig have no users at all, this function\n\t// will accept them as well (and fill returned FfData with dummy values\n\t// for the given bit, effectively synthesizing an unused FF bit of the\n\t// appropriate type). However, if all bits in sig are completely\n\t// unused, this function will fail and return false (having no idea\n\t// what kind of FF to produce) — use the above helper if that case\n\t// is important to handle.\n\t//\n\t// Note that this function does not remove the FF bits returned from\n\t// the design — this is so that the caller can decide whether to accept\n\t// this FF for merging or not. If the result is accepted,\n\t// remove_output_ff should be called on the second output argument.\n\tbool find_output_ff(RTLIL::SigSpec sig, FfData &ff, pool<std::pair<Cell *, int>> &bits);\n\n\t// Like above, but returns a FF to merge into a given cell input. Takes\n\t// sig_q, which is the current cell input — it will search for FFs with\n\t// matching sig_q.\n\t//\n\t// As opposed to find_output_ff, this function doesn't care about usage\n\t// counts, and may return FF bits that also have other fanout. This\n\t// should not be a problem for input FF merging.\n\t//\n\t// As a special case, if some of the bits in sig_q are constant, this\n\t// function will accept them as well, by synthesizing in-place\n\t// a constant-input FF bit (with matching initial value and reset value).\n\t// However, this will not work if the input is all-constant — if the caller\n\t// cares about this case, it needs to check for it explicitely.\n\tbool find_input_ff(RTLIL::SigSpec sig, FfData &ff, pool<std::pair<Cell *, int>> &bits);\n\n\t// To be called on find_output_ff result that will be merged. This\n\t// marks the given FF bits as used up (and not to be considered for\n\t// further merging as inputs), and reconnects their Q ports to a dummy\n\t// wire (since the wire previously connected there will now be driven\n\t// by the merged-to cell instead).\n\tvoid remove_output_ff(const pool<std::pair<Cell *, int>> &bits);\n\n\t// To be called on find_input_ff result that will be merged. This\n\t// marks the given FF bits as used, and disallows merging them as\n\t// outputs. They can, however, still be merged as inputs again\n\t// (perhaps for another cell).\n\tvoid mark_input_ff(const pool<std::pair<Cell *, int>> &bits);\n\n\tvoid set(FfInitVals *initvals_, RTLIL::Module *module_);\n\n\tvoid clear();\n\n\tFfMergeHelper(FfInitVals *initvals, RTLIL::Module *module) {\n\t\tset(initvals, module);\n\t}\n\n\tFfMergeHelper() {}\n};\n\nYOSYS_NAMESPACE_END\n\n#endif\n",
|
|
174
174
|
"fmt.h": "/*\n * yosys -- Yosys Open SYnthesis Suite\n *\n * Copyright (C) 2020 whitequark <whitequark@whitequark.org>\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n *\n */\n\n#ifndef FMT_H\n#define FMT_H\n\n#include \"kernel/yosys.h\"\n\nYOSYS_NAMESPACE_BEGIN\n\n// Verilog format argument, such as the arguments in:\n// $display(\"foo %d bar %01x\", 4'b0, $signed(2'b11))\nstruct VerilogFmtArg {\n\tenum {\n\t\tSTRING = 0,\n\t\tINTEGER = 1,\n\t\tTIME = 2,\n\t} type;\n\n\t// All types\n\tstd::string filename;\n\tunsigned first_line;\n\n\t// STRING type\n\tstd::string str;\n\n\t// INTEGER type\n\tRTLIL::SigSpec sig;\n\tbool signed_ = false;\n\n\t// TIME type\n\tbool realtime = false;\n};\n\n// RTLIL format part, such as the substitutions in:\n// \"foo {4:> 4du} bar {2:<01hs}\"\n// Must be kept in sync with `struct fmt_part` in backends/cxxrtl/runtime/cxxrtl/cxxrtl.h!\nstruct FmtPart {\n\tenum {\n\t\tLITERAL \t= 0,\n\t\tINTEGER \t= 1,\n\t\tSTRING = 2,\n\t\tUNICHAR = 3,\n\t\tVLOG_TIME = 4,\n\t} type;\n\n\t// LITERAL type\n\tstd::string str;\n\n\t// INTEGER/STRING/UNICHAR types\n\tRTLIL::SigSpec sig;\n\n\t// INTEGER/STRING/VLOG_TIME types\n\tenum {\n\t\tRIGHT\t= 0,\n\t\tLEFT\t= 1,\n\t\tNUMERIC\t= 2,\n\t} justify = RIGHT;\n\tchar padding = '\\0';\n\tsize_t width = 0;\n\n\t// INTEGER type\n\tunsigned base = 10;\n\tbool signed_ = false;\n\tenum {\n\t\tMINUS\t\t= 0,\n\t\tPLUS_MINUS\t= 1,\n\t\tSPACE_MINUS\t= 2,\n\t} sign = MINUS;\n\tbool hex_upper = false;\n\tbool show_base = false;\n\tbool group = false;\n\n\t// VLOG_TIME type\n\tbool realtime = false;\n};\n\nstruct Fmt {\npublic:\n\tstd::vector<FmtPart> parts;\n\n\tvoid append_literal(const std::string &str);\n\n\tvoid parse_rtlil(const RTLIL::Cell *cell);\n\tvoid emit_rtlil(RTLIL::Cell *cell) const;\n\n\tvoid parse_verilog(const std::vector<VerilogFmtArg> &args, bool sformat_like, int default_base, RTLIL::IdString task_name, RTLIL::IdString module_name);\n\tstd::vector<VerilogFmtArg> emit_verilog() const;\n\n\tvoid emit_cxxrtl(std::ostream &os, std::string indent, std::function<void(const RTLIL::SigSpec &)> emit_sig, const std::string &context) const;\n\n\tstd::string render() const;\n\nprivate:\n\tvoid apply_verilog_automatic_sizing_and_add(FmtPart &part);\n};\n\nYOSYS_NAMESPACE_END\n\n#endif\n",
|
|
175
175
|
"gzip.h": "#include <string>\n#include \"kernel/yosys_common.h\"\n\n#ifndef YOSYS_GZIP_H\n#define YOSYS_GZIP_H\n\nYOSYS_NAMESPACE_BEGIN\n\n#ifdef YOSYS_ENABLE_ZLIB\n\nnamespace Zlib {\n#include <zlib.h>\n}\n\n/*\nAn output stream that uses a stringbuf to buffer data internally,\nusing zlib to write gzip-compressed data every time the stream is flushed.\n*/\nclass gzip_ostream : public std::ostream {\npublic:\n\tgzip_ostream(): std::ostream(nullptr) {\n\t\trdbuf(&outbuf);\n\t}\n\tbool open(const std::string &filename) {\n\t\treturn outbuf.open(filename);\n\t}\nprivate:\n\tclass obuf : public std::stringbuf {\n\tpublic:\n\t\tobuf();\n\t\tbool open(const std::string &filename);\n\t\tvirtual int sync() override;\n\t\tvirtual ~obuf();\n\tprivate:\n\t\tstatic const int buffer_size = 4096;\n\t\tchar buffer[buffer_size]; // Internal buffer for compressed data\n\t\tZlib::gzFile gzf = nullptr; // Handle to the gzip file\n\t};\n\n\tobuf outbuf; // The stream buffer instance\n};\n\n/*\nAn input stream that uses zlib to read gzip-compressed data from a file,\nbuffering the decompressed data internally using its own buffer.\n*/\nclass gzip_istream final : public std::istream {\npublic:\n\tgzip_istream() : std::istream(&inbuf) {}\n\tbool open(const std::string& filename) {\n\t\treturn inbuf.open(filename);\n\t}\nprivate:\n\tclass ibuf final : public std::streambuf {\n\tpublic:\n\t\tibuf() : gzf(nullptr) {}\n\t\tbool open(const std::string& filename);\n\t\tvirtual ~ibuf();\n\n\tprotected:\n\t\t// Called when the buffer is empty and more input is needed\n\t\tvirtual int_type underflow() override;\n\tprivate:\n\t\tstatic const int buffer_size = 8192;\n\t\tchar buffer[buffer_size];\n\t\tZlib::gzFile gzf;\n\t};\n\n\tibuf inbuf; // The stream buffer instance\n};\n\n#endif // YOSYS_ENABLE_ZLIB\n\nstd::istream* uncompressed(const std::string filename, std::ios_base::openmode mode = std::ios_base::in);\n\nYOSYS_NAMESPACE_END\n\n#endif // YOSYS_GZIP_H\n",
|
|
176
|
-
"hashlib.h": "// This is free and unencumbered software released into the public domain.\n//\n// Anyone is free to copy, modify, publish, use, compile, sell, or\n// distribute this software, either in source code form or as a compiled\n// binary, for any purpose, commercial or non-commercial, and by any\n// means.\n\n// -------------------------------------------------------\n// Written by Claire Xenia Wolf <claire@yosyshq.com> in 2014\n// -------------------------------------------------------\n\n#ifndef HASHLIB_H\n#define HASHLIB_H\n\n#include <stdexcept>\n#include <algorithm>\n#include <optional>\n#include <string>\n#include <variant>\n#include <vector>\n#include <type_traits>\n#include <stdint.h>\n\n#define YS_HASHING_VERSION 1\n\nnamespace hashlib {\n\n/**\n * HASHING\n *\n * Also refer to docs/source/yosys_internals/hashing.rst\n *\n * The Hasher knows how to hash 32 and 64-bit integers. That's it.\n * In the future, it could be expanded to do vectors with SIMD.\n *\n * The Hasher doesn't know how to hash common standard containers\n * and compositions. However, hashlib provides centralized wrappers.\n *\n * Hashlib doesn't know how to hash silly Yosys-specific types.\n * Hashlib doesn't depend on Yosys and can be used standalone.\n * Please don't use hashlib standalone for new projects.\n * Never directly include kernel/hashlib.h in Yosys code.\n * Instead include kernel/yosys_common.h\n *\n * The hash_ops type is now always left to its default value, derived\n * from templated functions through SFINAE. Providing custom ops is\n * still supported.\n *\n * HASH TABLES\n *\n * We implement associative data structures with separate chaining.\n * Linked lists use integers into the indirection hashtable array\n * instead of pointers.\n */\n\nconst int hashtable_size_trigger = 2;\nconst int hashtable_size_factor = 3;\n\nnamespace legacy {\n\tinline uint32_t djb2_add(uint32_t a, uint32_t b) {\n\t\treturn ((a << 5) + a) + b;\n\t}\n};\n\ntemplate<typename T>\nstruct hash_ops;\n\ninline unsigned int mkhash_xorshift(unsigned int a) {\n\tif (sizeof(a) == 4) {\n\t\ta ^= a << 13;\n\t\ta ^= a >> 17;\n\t\ta ^= a << 5;\n\t} else if (sizeof(a) == 8) {\n\t\ta ^= a << 13;\n\t\ta ^= a >> 7;\n\t\ta ^= a << 17;\n\t} else\n\t\tthrow std::runtime_error(\"mkhash_xorshift() only implemented for 32 bit and 64 bit ints\");\n\treturn a;\n}\n\nclass HasherDJB32 {\npublic:\n\tusing hash_t = uint32_t;\n\n\tHasherDJB32() {\n\t\t// traditionally 5381 is used as starting value for the djb2 hash\n\t\tstate = 5381;\n\t}\n\tstatic void set_fudge(hash_t f) {\n\t\tfudge = f;\n\t}\n\nprivate:\n\tuint32_t state;\n\tstatic uint32_t fudge;\n\t// The XOR version of DJB2\n\t[[nodiscard]]\n\tstatic uint32_t djb2_xor(uint32_t a, uint32_t b) {\n\t\tuint32_t hash = ((a << 5) + a) ^ b;\n\t\treturn hash;\n\t}\n\tpublic:\n\tvoid hash32(uint32_t i) {\n\t\tstate = djb2_xor(i, state);\n\t\tstate = mkhash_xorshift(fudge ^ state);\n\t\treturn;\n\t}\n\tvoid hash64(uint64_t i) {\n\t\tstate = djb2_xor((uint32_t)(i & 0xFFFFFFFFULL), state);\n\t\tstate = djb2_xor((uint32_t)(i >> 32ULL), state);\n\t\tstate = mkhash_xorshift(fudge ^ state);\n\t\treturn;\n\t}\n\t[[nodiscard]]\n\thash_t yield() {\n\t\treturn (hash_t)state;\n\t}\n\n\ttemplate<typename T>\n\tvoid eat(T&& t) {\n\t\t*this = hash_ops<std::remove_cv_t<std::remove_reference_t<T>>>::hash_into(std::forward<T>(t), *this);\n\t}\n\n\ttemplate<typename T>\n\tvoid eat(const T& t) {\n\t\t*this = hash_ops<T>::hash_into(t, *this);\n\t}\n\n\tvoid commutative_eat(hash_t t) {\n\t\tstate ^= t;\n\t}\n\n\tvoid force(hash_t new_state) {\n\t\tstate = new_state;\n\t}\n};\n\nusing Hasher = HasherDJB32;\n\n// Boilerplate compressor for trivially implementing\n// top-level hash method with hash_into\n#define HASH_TOP_LOOP_FST [[nodiscard]] static inline Hasher hash\n#define HASH_TOP_LOOP_SND { \\\n\tHasher h; \\\n\th = hash_into(a, h); \\\n\treturn h; \\\n}\n\ntemplate<typename T>\nstruct hash_ops {\n\tstatic inline bool cmp(const T &a, const T &b) {\n\t\treturn a == b;\n\t}\n\t[[nodiscard]] static inline Hasher hash_into(const T &a, Hasher h) {\n\t\tif constexpr (std::is_integral_v<T>) {\n\t\t\tstatic_assert(sizeof(T) <= sizeof(uint64_t));\n\t\t\tif (sizeof(T) == sizeof(uint64_t))\n\t\t\t\th.hash64(a);\n\t\t\telse\n\t\t\t\th.hash32(a);\n\t\t\treturn h;\n\t\t} else if constexpr (std::is_enum_v<T>) {\n\t\t\tusing u_type = std::underlying_type_t<T>;\n\t\t\treturn hash_ops<u_type>::hash_into((u_type) a, h);\n\t\t} else if constexpr (std::is_pointer_v<T>) {\n\t\t\treturn hash_ops<uintptr_t>::hash_into((uintptr_t) a, h);\n\t\t} else if constexpr (std::is_same_v<T, std::string>) {\n\t\t\tfor (auto c : a)\n\t\t\t\th.hash32(c);\n\t\t\treturn h;\n\t\t} else {\n\t\t\treturn a.hash_into(h);\n\t\t}\n\t}\n\tHASH_TOP_LOOP_FST (const T &a) HASH_TOP_LOOP_SND\n};\n\ntemplate<typename P, typename Q> struct hash_ops<std::pair<P, Q>> {\n\tstatic inline bool cmp(std::pair<P, Q> a, std::pair<P, Q> b) {\n\t\treturn a == b;\n\t}\n\t[[nodiscard]] static inline Hasher hash_into(std::pair<P, Q> a, Hasher h) {\n\t\th = hash_ops<P>::hash_into(a.first, h);\n\t\th = hash_ops<Q>::hash_into(a.second, h);\n\t\treturn h;\n\t}\n\tHASH_TOP_LOOP_FST (std::pair<P, Q> a) HASH_TOP_LOOP_SND\n};\n\ntemplate<typename... T> struct hash_ops<std::tuple<T...>> {\n\tstatic inline bool cmp(std::tuple<T...> a, std::tuple<T...> b) {\n\t\treturn a == b;\n\t}\n\ttemplate<size_t I = 0>\n\tstatic inline typename std::enable_if<I == sizeof...(T), Hasher>::type hash_into(std::tuple<T...>, Hasher h) {\n\t\treturn h;\n\t}\n\ttemplate<size_t I = 0>\n\tstatic inline typename std::enable_if<I != sizeof...(T), Hasher>::type hash_into(std::tuple<T...> a, Hasher h) {\n\t\ttypedef hash_ops<typename std::tuple_element<I, std::tuple<T...>>::type> element_ops_t;\n\t\th = hash_into<I+1>(a, h);\n\t\th = element_ops_t::hash_into(std::get<I>(a), h);\n\t\treturn h;\n\t}\n\tHASH_TOP_LOOP_FST (std::tuple<T...> a) HASH_TOP_LOOP_SND\n};\n\ntemplate<typename T> struct hash_ops<std::vector<T>> {\n\tstatic inline bool cmp(std::vector<T> a, std::vector<T> b) {\n\t\treturn a == b;\n\t}\n\t[[nodiscard]] static inline Hasher hash_into(std::vector<T> a, Hasher h) {\n\t\th.eat((uint32_t)a.size());\n\t\tfor (auto k : a)\n\t\t\th.eat(k);\n\t\treturn h;\n\t}\n\tHASH_TOP_LOOP_FST (std::vector<T> a) HASH_TOP_LOOP_SND\n};\n\ntemplate<typename T, size_t N> struct hash_ops<std::array<T, N>> {\n static inline bool cmp(std::array<T, N> a, std::array<T, N> b) {\n return a == b;\n }\n [[nodiscard]] static inline Hasher hash_into(std::array<T, N> a, Hasher h) {\n for (const auto& k : a)\n h = hash_ops<T>::hash_into(k, h);\n return h;\n }\n\tHASH_TOP_LOOP_FST (std::array<T, N> a) HASH_TOP_LOOP_SND\n};\n\nstruct hash_cstr_ops {\n\tstatic inline bool cmp(const char *a, const char *b) {\n\t\treturn strcmp(a, b) == 0;\n\t}\n\t[[nodiscard]] static inline Hasher hash_into(const char *a, Hasher h) {\n\t\twhile (*a)\n\t\t\th.hash32(*(a++));\n\t\treturn h;\n\t}\n\tHASH_TOP_LOOP_FST (const char *a) HASH_TOP_LOOP_SND\n};\n\ntemplate <> struct hash_ops<char*> : hash_cstr_ops {};\n\nstruct hash_ptr_ops {\n\tstatic inline bool cmp(const void *a, const void *b) {\n\t\treturn a == b;\n\t}\n\t[[nodiscard]] static inline Hasher hash_into(const void *a, Hasher h) {\n\t\treturn hash_ops<uintptr_t>::hash_into((uintptr_t)a, h);\n\t}\n\tHASH_TOP_LOOP_FST (const void *a) HASH_TOP_LOOP_SND\n};\n\nstruct hash_obj_ops {\n\tstatic inline bool cmp(const void *a, const void *b) {\n\t\treturn a == b;\n\t}\n\ttemplate<typename T>\n\t[[nodiscard]] static inline Hasher hash_into(const T *a, Hasher h) {\n\t\tif (a)\n\t\t\th = a->hash_into(h);\n\t\telse\n\t\t\th.eat(0);\n\t\treturn h;\n\t}\n\ttemplate<typename T>\n\tHASH_TOP_LOOP_FST (const T *a) HASH_TOP_LOOP_SND\n};\n/**\n * If you find yourself using this function, think hard\n * about if it's the right thing to do. Mixing finalized\n * hashes together with XORs or worse can destroy\n * desirable qualities of the hash function\n */\ntemplate<typename T>\n[[nodiscard]]\nHasher::hash_t run_hash(const T& obj) {\n\treturn hash_ops<T>::hash(obj).yield();\n}\n\n/** Refer to docs/source/yosys_internals/hashing.rst */\ntemplate<typename T>\n[[nodiscard]]\n[[deprecated]]\ninline unsigned int mkhash(const T &v) {\n\treturn (unsigned int) run_hash<T>(v);\n}\n\ntemplate<> struct hash_ops<std::monostate> {\n\tstatic inline bool cmp(std::monostate a, std::monostate b) {\n\t\treturn a == b;\n\t}\n\t[[nodiscard]] static inline Hasher hash_into(std::monostate, Hasher h) {\n\t\treturn h;\n\t}\n};\n\ntemplate<typename... T> struct hash_ops<std::variant<T...>> {\n\tstatic inline bool cmp(std::variant<T...> a, std::variant<T...> b) {\n\t\treturn a == b;\n\t}\n\t[[nodiscard]] static inline Hasher hash_into(std::variant<T...> a, Hasher h) {\n\t\tstd::visit([& h](const auto &v) { h.eat(v); }, a);\n\t\th.eat(a.index());\n\t\treturn h;\n\t}\n};\n\ntemplate<typename T> struct hash_ops<std::optional<T>> {\n\tstatic inline bool cmp(std::optional<T> a, std::optional<T> b) {\n\t\treturn a == b;\n\t}\n\t[[nodiscard]] static inline Hasher hash_into(std::optional<T> a, Hasher h) {\n\t\tif(a.has_value())\n\t\t\th.eat(*a);\n\t\telse\n\t\t\th.eat(0);\n\t\treturn h;\n\t}\n};\n\ninline unsigned int hashtable_size(unsigned int min_size)\n{\n\t// Primes as generated by https://oeis.org/A175953\n\tstatic std::vector<unsigned int> zero_and_some_primes = {\n\t\t0, 23, 29, 37, 47, 59, 79, 101, 127, 163, 211, 269, 337, 431, 541, 677,\n\t\t853, 1069, 1361, 1709, 2137, 2677, 3347, 4201, 5261, 6577, 8231, 10289,\n\t\t12889, 16127, 20161, 25219, 31531, 39419, 49277, 61603, 77017, 96281,\n\t\t120371, 150473, 188107, 235159, 293957, 367453, 459317, 574157, 717697,\n\t\t897133, 1121423, 1401791, 1752239, 2190299, 2737937, 3422429, 4278037,\n\t\t5347553, 6684443, 8355563, 10444457, 13055587, 16319519, 20399411,\n\t\t25499291, 31874149, 39842687, 49803361, 62254207, 77817767, 97272239,\n\t\t121590311, 151987889, 189984863, 237481091, 296851369, 371064217,\n\t\t463830313, 579787991, 724735009, 905918777, 1132398479, 1415498113,\n\t\t1769372713, 2211715897, 2764644887, 3455806139\n\t};\n\n\tfor (auto p : zero_and_some_primes)\n\t\tif (p >= min_size) return p;\n\n\tif (sizeof(unsigned int) == 4)\n\t\tthrow std::length_error(\"hash table exceeded maximum size.\\nDesign is likely too large for yosys to handle, if possible try not to flatten the design.\");\n\n\tfor (auto p : zero_and_some_primes)\n\t\tif (100129 * p > min_size) return 100129 * p;\n\n\tthrow std::length_error(\"hash table exceeded maximum size.\");\n}\n\ntemplate<typename K, typename T, typename OPS = hash_ops<K>> class dict;\ntemplate<typename K, int offset = 0, typename OPS = hash_ops<K>> class idict;\ntemplate<typename K, typename OPS = hash_ops<K>> class pool;\ntemplate<typename K, typename OPS = hash_ops<K>> class mfp;\n\ntemplate<typename K, typename T, typename OPS>\nclass dict {\n\tstruct entry_t\n\t{\n\t\tstd::pair<K, T> udata;\n\t\tint next;\n\n\t\tentry_t() { }\n\t\tentry_t(const std::pair<K, T> &udata, int next) : udata(udata), next(next) { }\n\t\tentry_t(std::pair<K, T> &&udata, int next) : udata(std::move(udata)), next(next) { }\n\t\tbool operator<(const entry_t &other) const { return udata.first < other.udata.first; }\n\t};\n\n\tstd::vector<int> hashtable;\n\tstd::vector<entry_t> entries;\n\tOPS ops;\n\n#ifdef NDEBUG\n\tstatic inline void do_assert(bool) { }\n#else\n\tstatic inline void do_assert(bool cond) {\n\t\tif (!cond) throw std::runtime_error(\"dict<> assert failed.\");\n\t}\n#endif\n\n\tHasher::hash_t do_hash(const K &key) const\n\t{\n\t\tHasher::hash_t hash = 0;\n\t\tif (!hashtable.empty())\n\t\t\thash = ops.hash(key).yield() % (unsigned int)(hashtable.size());\n\t\treturn hash;\n\t}\n\n\tvoid do_rehash()\n\t{\n\t\thashtable.clear();\n\t\thashtable.resize(hashtable_size(entries.capacity() * hashtable_size_factor), -1);\n\n\t\tfor (int i = 0; i < int(entries.size()); i++) {\n\t\t\tdo_assert(-1 <= entries[i].next && entries[i].next < int(entries.size()));\n\t\t\tHasher::hash_t hash = do_hash(entries[i].udata.first);\n\t\t\tentries[i].next = hashtable[hash];\n\t\t\thashtable[hash] = i;\n\t\t}\n\t}\n\n\tint do_erase(int index, Hasher::hash_t hash)\n\t{\n\t\tdo_assert(index < int(entries.size()));\n\t\tif (hashtable.empty() || index < 0)\n\t\t\treturn 0;\n\n\t\tint k = hashtable[hash];\n\t\tdo_assert(0 <= k && k < int(entries.size()));\n\n\t\tif (k == index) {\n\t\t\thashtable[hash] = entries[index].next;\n\t\t} else {\n\t\t\twhile (entries[k].next != index) {\n\t\t\t\tk = entries[k].next;\n\t\t\t\tdo_assert(0 <= k && k < int(entries.size()));\n\t\t\t}\n\t\t\tentries[k].next = entries[index].next;\n\t\t}\n\n\t\tint back_idx = entries.size()-1;\n\n\t\tif (index != back_idx)\n\t\t{\n\t\t\tHasher::hash_t back_hash = do_hash(entries[back_idx].udata.first);\n\n\t\t\tk = hashtable[back_hash];\n\t\t\tdo_assert(0 <= k && k < int(entries.size()));\n\n\t\t\tif (k == back_idx) {\n\t\t\t\thashtable[back_hash] = index;\n\t\t\t} else {\n\t\t\t\twhile (entries[k].next != back_idx) {\n\t\t\t\t\tk = entries[k].next;\n\t\t\t\t\tdo_assert(0 <= k && k < int(entries.size()));\n\t\t\t\t}\n\t\t\t\tentries[k].next = index;\n\t\t\t}\n\n\t\t\tentries[index] = std::move(entries[back_idx]);\n\t\t}\n\n\t\tentries.pop_back();\n\n\t\tif (entries.empty())\n\t\t\thashtable.clear();\n\n\t\treturn 1;\n\t}\n\n\tint do_lookup(const K &key, Hasher::hash_t &hash)\n\t{\n\t\tif (hashtable.empty())\n\t\t\treturn -1;\n\n\t\tif (entries.size() * hashtable_size_trigger > hashtable.size()) {\n\t\t\tdo_rehash();\n\t\t\thash = do_hash(key);\n\t\t}\n\n\t\treturn do_lookup_internal(key, hash);\n\t}\n\n\tint do_lookup_internal(const K &key, Hasher::hash_t hash) const\n\t{\n\t\tint index = hashtable[hash];\n\n\t\twhile (index >= 0 && !ops.cmp(entries[index].udata.first, key)) {\n\t\t\tindex = entries[index].next;\n\t\t\tdo_assert(-1 <= index && index < int(entries.size()));\n\t\t}\n\n\t\treturn index;\n\t}\n\n\tint do_lookup_no_rehash(const K &key, Hasher::hash_t hash) const\n\t{\n\t\tif (hashtable.empty())\n\t\t\treturn -1;\n\n\t\treturn do_lookup_internal(key, hash);\n\t}\n\n\tint do_insert(const K &key, Hasher::hash_t &hash)\n\t{\n\t\tif (hashtable.empty()) {\n\t\t\tentries.emplace_back(std::pair<K, T>(key, T()), -1);\n\t\t\tdo_rehash();\n\t\t\thash = do_hash(key);\n\t\t} else {\n\t\t\tentries.emplace_back(std::pair<K, T>(key, T()), hashtable[hash]);\n\t\t\thashtable[hash] = entries.size() - 1;\n\t\t}\n\t\treturn entries.size() - 1;\n\t}\n\n\tint do_insert(const std::pair<K, T> &value, Hasher::hash_t &hash)\n\t{\n\t\tif (hashtable.empty()) {\n\t\t\tentries.emplace_back(value, -1);\n\t\t\tdo_rehash();\n\t\t\thash = do_hash(value.first);\n\t\t} else {\n\t\t\tentries.emplace_back(value, hashtable[hash]);\n\t\t\thashtable[hash] = entries.size() - 1;\n\t\t}\n\t\treturn entries.size() - 1;\n\t}\n\n\tint do_insert(std::pair<K, T> &&rvalue, Hasher::hash_t &hash)\n\t{\n\t\tif (hashtable.empty()) {\n\t\t\tauto key = rvalue.first;\n\t\t\tentries.emplace_back(std::forward<std::pair<K, T>>(rvalue), -1);\n\t\t\tdo_rehash();\n\t\t\thash = do_hash(key);\n\t\t} else {\n\t\t\tentries.emplace_back(std::forward<std::pair<K, T>>(rvalue), hashtable[hash]);\n\t\t\thashtable[hash] = entries.size() - 1;\n\t\t}\n\t\treturn entries.size() - 1;\n\t}\n\npublic:\n\tclass const_iterator\n\t{\n\t\tfriend class dict;\n\tprotected:\n\t\tconst dict *ptr;\n\t\tint index;\n\t\tconst_iterator(const dict *ptr, int index) : ptr(ptr), index(index) { }\n\tpublic:\n\t\ttypedef std::forward_iterator_tag iterator_category;\n\t\ttypedef std::pair<K, T> value_type;\n\t\ttypedef ptrdiff_t difference_type;\n\t\ttypedef std::pair<K, T>* pointer;\n\t\ttypedef std::pair<K, T>& reference;\n\t\tconst_iterator() { }\n\t\tconst_iterator operator++() { index--; return *this; }\n\t\tconst_iterator operator+=(int amt) { index -= amt; return *this; }\n\t\tbool operator<(const const_iterator &other) const { return index > other.index; }\n\t\tbool operator==(const const_iterator &other) const { return index == other.index; }\n\t\tbool operator!=(const const_iterator &other) const { return index != other.index; }\n\t\tconst std::pair<K, T> &operator*() const { return ptr->entries[index].udata; }\n\t\tconst std::pair<K, T> *operator->() const { return &ptr->entries[index].udata; }\n\t};\n\n\tclass iterator\n\t{\n\t\tfriend class dict;\n\tprotected:\n\t\tdict *ptr;\n\t\tint index;\n\t\titerator(dict *ptr, int index) : ptr(ptr), index(index) { }\n\tpublic:\n\t\ttypedef std::forward_iterator_tag iterator_category;\n\t\ttypedef std::pair<K, T> value_type;\n\t\ttypedef ptrdiff_t difference_type;\n\t\ttypedef std::pair<K, T>* pointer;\n\t\ttypedef std::pair<K, T>& reference;\n\t\titerator() { }\n\t\titerator operator++() { index--; return *this; }\n\t\titerator operator+=(int amt) { index -= amt; return *this; }\n\t\tbool operator<(const iterator &other) const { return index > other.index; }\n\t\tbool operator==(const iterator &other) const { return index == other.index; }\n\t\tbool operator!=(const iterator &other) const { return index != other.index; }\n\t\tstd::pair<K, T> &operator*() { return ptr->entries[index].udata; }\n\t\tstd::pair<K, T> *operator->() { return &ptr->entries[index].udata; }\n\t\tconst std::pair<K, T> &operator*() const { return ptr->entries[index].udata; }\n\t\tconst std::pair<K, T> *operator->() const { return &ptr->entries[index].udata; }\n\t\toperator const_iterator() const { return const_iterator(ptr, index); }\n\t};\n\n\tconstexpr dict()\n\t{\n\t}\n\n\tdict(const dict &other)\n\t{\n\t\tentries = other.entries;\n\t\tdo_rehash();\n\t}\n\n\tdict(dict &&other)\n\t{\n\t\tswap(other);\n\t}\n\n\tdict &operator=(const dict &other) {\n\t\tentries = other.entries;\n\t\tdo_rehash();\n\t\treturn *this;\n\t}\n\n\tdict &operator=(dict &&other) {\n\t\tclear();\n\t\tswap(other);\n\t\treturn *this;\n\t}\n\n\tdict(const std::initializer_list<std::pair<K, T>> &list)\n\t{\n\t\tfor (auto &it : list)\n\t\t\tinsert(it);\n\t}\n\n\ttemplate<class InputIterator>\n\tdict(InputIterator first, InputIterator last)\n\t{\n\t\tinsert(first, last);\n\t}\n\n\ttemplate<class InputIterator>\n\tvoid insert(InputIterator first, InputIterator last)\n\t{\n\t\tfor (; first != last; ++first)\n\t\t\tinsert(*first);\n\t}\n\n\tstd::pair<iterator, bool> insert(const K &key)\n\t{\n\t\tHasher::hash_t hash = do_hash(key);\n\t\tint i = do_lookup(key, hash);\n\t\tif (i >= 0)\n\t\t\treturn std::pair<iterator, bool>(iterator(this, i), false);\n\t\ti = do_insert(key, hash);\n\t\treturn std::pair<iterator, bool>(iterator(this, i), true);\n\t}\n\n\tstd::pair<iterator, bool> insert(const std::pair<K, T> &value)\n\t{\n\t\tHasher::hash_t hash = do_hash(value.first);\n\t\tint i = do_lookup(value.first, hash);\n\t\tif (i >= 0)\n\t\t\treturn std::pair<iterator, bool>(iterator(this, i), false);\n\t\ti = do_insert(value, hash);\n\t\treturn std::pair<iterator, bool>(iterator(this, i), true);\n\t}\n\n\tstd::pair<iterator, bool> insert(std::pair<K, T> &&rvalue)\n\t{\n\t\tHasher::hash_t hash = do_hash(rvalue.first);\n\t\tint i = do_lookup(rvalue.first, hash);\n\t\tif (i >= 0)\n\t\t\treturn std::pair<iterator, bool>(iterator(this, i), false);\n\t\ti = do_insert(std::forward<std::pair<K, T>>(rvalue), hash);\n\t\treturn std::pair<iterator, bool>(iterator(this, i), true);\n\t}\n\n\tstd::pair<iterator, bool> emplace(K const &key, T const &value)\n\t{\n\t\tHasher::hash_t hash = do_hash(key);\n\t\tint i = do_lookup(key, hash);\n\t\tif (i >= 0)\n\t\t\treturn std::pair<iterator, bool>(iterator(this, i), false);\n\t\ti = do_insert(std::make_pair(key, value), hash);\n\t\treturn std::pair<iterator, bool>(iterator(this, i), true);\n\t}\n\n\tstd::pair<iterator, bool> emplace(K const &key, T &&rvalue)\n\t{\n\t\tHasher::hash_t hash = do_hash(key);\n\t\tint i = do_lookup(key, hash);\n\t\tif (i >= 0)\n\t\t\treturn std::pair<iterator, bool>(iterator(this, i), false);\n\t\ti = do_insert(std::make_pair(key, std::forward<T>(rvalue)), hash);\n\t\treturn std::pair<iterator, bool>(iterator(this, i), true);\n\t}\n\n\tstd::pair<iterator, bool> emplace(K &&rkey, T const &value)\n\t{\n\t\tHasher::hash_t hash = do_hash(rkey);\n\t\tint i = do_lookup(rkey, hash);\n\t\tif (i >= 0)\n\t\t\treturn std::pair<iterator, bool>(iterator(this, i), false);\n\t\ti = do_insert(std::make_pair(std::forward<K>(rkey), value), hash);\n\t\treturn std::pair<iterator, bool>(iterator(this, i), true);\n\t}\n\n\tstd::pair<iterator, bool> emplace(K &&rkey, T &&rvalue)\n\t{\n\t\tHasher::hash_t hash = do_hash(rkey);\n\t\tint i = do_lookup(rkey, hash);\n\t\tif (i >= 0)\n\t\t\treturn std::pair<iterator, bool>(iterator(this, i), false);\n\t\ti = do_insert(std::make_pair(std::forward<K>(rkey), std::forward<T>(rvalue)), hash);\n\t\treturn std::pair<iterator, bool>(iterator(this, i), true);\n\t}\n\n\tint erase(const K &key)\n\t{\n\t\tHasher::hash_t hash = do_hash(key);\n\t\tint index = do_lookup(key, hash);\n\t\treturn do_erase(index, hash);\n\t}\n\n\titerator erase(iterator it)\n\t{\n\t\tHasher::hash_t hash = do_hash(it->first);\n\t\tdo_erase(it.index, hash);\n\t\treturn ++it;\n\t}\n\n\tint count(const K &key) const\n\t{\n\t\tHasher::hash_t hash = do_hash(key);\n\t\tint i = do_lookup_no_rehash(key, hash);\n\t\treturn i < 0 ? 0 : 1;\n\t}\n\n\tint count(const K &key, const_iterator it) const\n\t{\n\t\tHasher::hash_t hash = do_hash(key);\n\t\tint i = do_lookup_no_rehash(key, hash);\n\t\treturn i < 0 || i > it.index ? 0 : 1;\n\t}\n\n\titerator find(const K &key)\n\t{\n\t\tHasher::hash_t hash = do_hash(key);\n\t\tint i = do_lookup(key, hash);\n\t\tif (i < 0)\n\t\t\treturn end();\n\t\treturn iterator(this, i);\n\t}\n\n\tconst_iterator find(const K &key) const\n\t{\n\t\tHasher::hash_t hash = do_hash(key);\n\t\tint i = do_lookup_no_rehash(key, hash);\n\t\tif (i < 0)\n\t\t\treturn end();\n\t\treturn const_iterator(this, i);\n\t}\n\n\tT& at(const K &key)\n\t{\n\t\tHasher::hash_t hash = do_hash(key);\n\t\tint i = do_lookup(key, hash);\n\t\tif (i < 0)\n\t\t\tthrow std::out_of_range(\"dict::at()\");\n\t\treturn entries[i].udata.second;\n\t}\n\n\tconst T& at(const K &key) const\n\t{\n\t\tHasher::hash_t hash = do_hash(key);\n\t\tint i = do_lookup_no_rehash(key, hash);\n\t\tif (i < 0)\n\t\t\tthrow std::out_of_range(\"dict::at()\");\n\t\treturn entries[i].udata.second;\n\t}\n\n\tconst T& at(const K &key, const T &defval) const\n\t{\n\t\tHasher::hash_t hash = do_hash(key);\n\t\tint i = do_lookup_no_rehash(key, hash);\n\t\tif (i < 0)\n\t\t\treturn defval;\n\t\treturn entries[i].udata.second;\n\t}\n\n\tT& operator[](const K &key)\n\t{\n\t\tHasher::hash_t hash = do_hash(key);\n\t\tint i = do_lookup(key, hash);\n\t\tif (i < 0)\n\t\t\ti = do_insert(std::pair<K, T>(key, T()), hash);\n\t\treturn entries[i].udata.second;\n\t}\n\n\ttemplate<typename Compare = std::less<K>>\n\tvoid sort(Compare comp = Compare())\n\t{\n\t\tstd::sort(entries.begin(), entries.end(), [comp](const entry_t &a, const entry_t &b){ return comp(b.udata.first, a.udata.first); });\n\t\tdo_rehash();\n\t}\n\n\tvoid swap(dict &other)\n\t{\n\t\thashtable.swap(other.hashtable);\n\t\tentries.swap(other.entries);\n\t}\n\n\tbool operator==(const dict &other) const {\n\t\tif (size() != other.size())\n\t\t\treturn false;\n\t\tfor (auto &it : entries) {\n\t\t\tauto oit = other.find(it.udata.first);\n\t\t\tif (oit == other.end() || !(oit->second == it.udata.second))\n\t\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\tbool operator!=(const dict &other) const {\n\t\treturn !operator==(other);\n\t}\n\n\t[[nodiscard]] Hasher hash_into(Hasher h) const {\n\t\tfor (auto &it : entries) {\n\t\t\tHasher entry_hash;\n\t\t\tentry_hash.eat(it.udata.first);\n\t\t\tentry_hash.eat(it.udata.second);\n\t\t\th.commutative_eat(entry_hash.yield());\n\t\t}\n\t\th.eat(entries.size());\n\t\treturn h;\n\t}\n\n\tvoid reserve(size_t n) { entries.reserve(n); }\n\tsize_t size() const { return entries.size(); }\n\tbool empty() const { return entries.empty(); }\n\tvoid clear() { hashtable.clear(); entries.clear(); }\n\n\titerator begin() { return iterator(this, int(entries.size())-1); }\n\titerator element(int n) { return iterator(this, int(entries.size())-1-n); }\n\titerator end() { return iterator(nullptr, -1); }\n\n\tconst_iterator begin() const { return const_iterator(this, int(entries.size())-1); }\n\tconst_iterator element(int n) const { return const_iterator(this, int(entries.size())-1-n); }\n\tconst_iterator end() const { return const_iterator(nullptr, -1); }\n};\n\ntemplate<typename K, typename OPS>\nclass pool\n{\n\ttemplate<typename, int, typename> friend class idict;\n\nprotected:\n\tstruct entry_t\n\t{\n\t\tK udata;\n\t\tint next;\n\n\t\tentry_t() { }\n\t\tentry_t(const K &udata, int next) : udata(udata), next(next) { }\n\t\tentry_t(K &&udata, int next) : udata(std::move(udata)), next(next) { }\n\t};\n\n\tstd::vector<int> hashtable;\n\tstd::vector<entry_t> entries;\n\tOPS ops;\n\n#ifdef NDEBUG\n\tstatic inline void do_assert(bool) { }\n#else\n\tstatic inline void do_assert(bool cond) {\n\t\tif (!cond) throw std::runtime_error(\"pool<> assert failed.\");\n\t}\n#endif\n\n\tHasher::hash_t do_hash(const K &key) const\n\t{\n\t\tHasher::hash_t hash = 0;\n\t\tif (!hashtable.empty())\n\t\t\thash = ops.hash(key).yield() % (unsigned int)(hashtable.size());\n\t\treturn hash;\n\t}\n\n\tvoid do_rehash()\n\t{\n\t\thashtable.clear();\n\t\thashtable.resize(hashtable_size(entries.capacity() * hashtable_size_factor), -1);\n\n\t\tfor (int i = 0; i < int(entries.size()); i++) {\n\t\t\tdo_assert(-1 <= entries[i].next && entries[i].next < int(entries.size()));\n\t\t\tHasher::hash_t hash = do_hash(entries[i].udata);\n\t\t\tentries[i].next = hashtable[hash];\n\t\t\thashtable[hash] = i;\n\t\t}\n\t}\n\n\tint do_erase(int index, Hasher::hash_t hash)\n\t{\n\t\tdo_assert(index < int(entries.size()));\n\t\tif (hashtable.empty() || index < 0)\n\t\t\treturn 0;\n\n\t\tint k = hashtable[hash];\n\t\tif (k == index) {\n\t\t\thashtable[hash] = entries[index].next;\n\t\t} else {\n\t\t\twhile (entries[k].next != index) {\n\t\t\t\tk = entries[k].next;\n\t\t\t\tdo_assert(0 <= k && k < int(entries.size()));\n\t\t\t}\n\t\t\tentries[k].next = entries[index].next;\n\t\t}\n\n\t\tint back_idx = entries.size()-1;\n\n\t\tif (index != back_idx)\n\t\t{\n\t\t\tHasher::hash_t back_hash = do_hash(entries[back_idx].udata);\n\n\t\t\tk = hashtable[back_hash];\n\t\t\tif (k == back_idx) {\n\t\t\t\thashtable[back_hash] = index;\n\t\t\t} else {\n\t\t\t\twhile (entries[k].next != back_idx) {\n\t\t\t\t\tk = entries[k].next;\n\t\t\t\t\tdo_assert(0 <= k && k < int(entries.size()));\n\t\t\t\t}\n\t\t\t\tentries[k].next = index;\n\t\t\t}\n\n\t\t\tentries[index] = std::move(entries[back_idx]);\n\t\t}\n\n\t\tentries.pop_back();\n\n\t\tif (entries.empty())\n\t\t\thashtable.clear();\n\n\t\treturn 1;\n\t}\n\n\tint do_lookup(const K &key, Hasher::hash_t &hash)\n\t{\n\t\tif (hashtable.empty())\n\t\t\treturn -1;\n\n\t\tif (entries.size() * hashtable_size_trigger > hashtable.size()) {\n\t\t\tdo_rehash();\n\t\t\thash = do_hash(key);\n\t\t}\n\n\t\treturn do_lookup_internal(key, hash);\n\t}\n\n\tint do_lookup_internal(const K &key, Hasher::hash_t hash) const\n\t{\n\t\tint index = hashtable[hash];\n\n\t\twhile (index >= 0 && !ops.cmp(entries[index].udata, key)) {\n\t\t\tindex = entries[index].next;\n\t\t\tdo_assert(-1 <= index && index < int(entries.size()));\n\t\t}\n\n\t\treturn index;\n\t}\n\n\tint do_lookup_no_rehash(const K &key, Hasher::hash_t hash) const\n\t{\n\t\tif (hashtable.empty())\n\t\t\treturn -1;\n\n\t\treturn do_lookup_internal(key, hash);\n\t}\n\n\tint do_insert(const K &value, Hasher::hash_t &hash)\n\t{\n\t\tif (hashtable.empty()) {\n\t\t\tentries.emplace_back(value, -1);\n\t\t\tdo_rehash();\n\t\t\thash = do_hash(value);\n\t\t} else {\n\t\t\tentries.emplace_back(value, hashtable[hash]);\n\t\t\thashtable[hash] = entries.size() - 1;\n\t\t}\n\t\treturn entries.size() - 1;\n\t}\n\n\tint do_insert(K &&rvalue, Hasher::hash_t &hash)\n\t{\n\t\tif (hashtable.empty()) {\n\t\t\tentries.emplace_back(std::forward<K>(rvalue), -1);\n\t\t\tdo_rehash();\n\t\t\thash = do_hash(rvalue);\n\t\t} else {\n\t\t\tentries.emplace_back(std::forward<K>(rvalue), hashtable[hash]);\n\t\t\thashtable[hash] = entries.size() - 1;\n\t\t}\n\t\treturn entries.size() - 1;\n\t}\n\npublic:\n\tclass const_iterator\n\t{\n\t\tfriend class pool;\n\tprotected:\n\t\tconst pool *ptr;\n\t\tint index;\n\t\tconst_iterator(const pool *ptr, int index) : ptr(ptr), index(index) { }\n\tpublic:\n\t\ttypedef std::forward_iterator_tag iterator_category;\n\t\ttypedef K value_type;\n\t\ttypedef ptrdiff_t difference_type;\n\t\ttypedef K* pointer;\n\t\ttypedef K& reference;\n\t\tconst_iterator() { }\n\t\tconst_iterator operator++() { index--; return *this; }\n\t\tbool operator==(const const_iterator &other) const { return index == other.index; }\n\t\tbool operator!=(const const_iterator &other) const { return index != other.index; }\n\t\tconst K &operator*() const { return ptr->entries[index].udata; }\n\t\tconst K *operator->() const { return &ptr->entries[index].udata; }\n\t};\n\n\tclass iterator\n\t{\n\t\tfriend class pool;\n\tprotected:\n\t\tpool *ptr;\n\t\tint index;\n\t\titerator(pool *ptr, int index) : ptr(ptr), index(index) { }\n\tpublic:\n\t\ttypedef std::forward_iterator_tag iterator_category;\n\t\ttypedef K value_type;\n\t\ttypedef ptrdiff_t difference_type;\n\t\ttypedef K* pointer;\n\t\ttypedef K& reference;\n\t\titerator() { }\n\t\titerator operator++() { index--; return *this; }\n\t\tbool operator==(const iterator &other) const { return index == other.index; }\n\t\tbool operator!=(const iterator &other) const { return index != other.index; }\n\t\tK &operator*() { return ptr->entries[index].udata; }\n\t\tK *operator->() { return &ptr->entries[index].udata; }\n\t\tconst K &operator*() const { return ptr->entries[index].udata; }\n\t\tconst K *operator->() const { return &ptr->entries[index].udata; }\n\t\toperator const_iterator() const { return const_iterator(ptr, index); }\n\t};\n\n\tconstexpr pool()\n\t{\n\t}\n\n\tpool(const pool &other)\n\t{\n\t\tentries = other.entries;\n\t\tdo_rehash();\n\t}\n\n\tpool(pool &&other)\n\t{\n\t\tswap(other);\n\t}\n\n\tpool &operator=(const pool &other) {\n\t\tentries = other.entries;\n\t\tdo_rehash();\n\t\treturn *this;\n\t}\n\n\tpool &operator=(pool &&other) {\n\t\tclear();\n\t\tswap(other);\n\t\treturn *this;\n\t}\n\n\tpool(const std::initializer_list<K> &list)\n\t{\n\t\tfor (auto &it : list)\n\t\t\tinsert(it);\n\t}\n\n\ttemplate<class InputIterator>\n\tpool(InputIterator first, InputIterator last)\n\t{\n\t\tinsert(first, last);\n\t}\n\n\ttemplate<class InputIterator>\n\tvoid insert(InputIterator first, InputIterator last)\n\t{\n\t\tfor (; first != last; ++first)\n\t\t\tinsert(*first);\n\t}\n\n\tstd::pair<iterator, bool> insert(const K &value)\n\t{\n\t\tHasher::hash_t hash = do_hash(value);\n\t\tint i = do_lookup(value, hash);\n\t\tif (i >= 0)\n\t\t\treturn std::pair<iterator, bool>(iterator(this, i), false);\n\t\ti = do_insert(value, hash);\n\t\treturn std::pair<iterator, bool>(iterator(this, i), true);\n\t}\n\n\tstd::pair<iterator, bool> insert(K &&rvalue)\n\t{\n\t\tHasher::hash_t hash = do_hash(rvalue);\n\t\tint i = do_lookup(rvalue, hash);\n\t\tif (i >= 0)\n\t\t\treturn std::pair<iterator, bool>(iterator(this, i), false);\n\t\ti = do_insert(std::forward<K>(rvalue), hash);\n\t\treturn std::pair<iterator, bool>(iterator(this, i), true);\n\t}\n\n\ttemplate<typename... Args>\n\tstd::pair<iterator, bool> emplace(Args&&... args)\n\t{\n\t\treturn insert(K(std::forward<Args>(args)...));\n\t}\n\n\tint erase(const K &key)\n\t{\n\t\tHasher::hash_t hash = do_hash(key);\n\t\tint index = do_lookup(key, hash);\n\t\treturn do_erase(index, hash);\n\t}\n\n\titerator erase(iterator it)\n\t{\n\t\tHasher::hash_t hash = do_hash(*it);\n\t\tdo_erase(it.index, hash);\n\t\treturn ++it;\n\t}\n\n\tint count(const K &key) const\n\t{\n\t\tHasher::hash_t hash = do_hash(key);\n\t\tint i = do_lookup_no_rehash(key, hash);\n\t\treturn i < 0 ? 0 : 1;\n\t}\n\n\tint count(const K &key, const_iterator it) const\n\t{\n\t\tHasher::hash_t hash = do_hash(key);\n\t\tint i = do_lookup_no_rehash(key, hash);\n\t\treturn i < 0 || i > it.index ? 0 : 1;\n\t}\n\n\titerator find(const K &key)\n\t{\n\t\tHasher::hash_t hash = do_hash(key);\n\t\tint i = do_lookup(key, hash);\n\t\tif (i < 0)\n\t\t\treturn end();\n\t\treturn iterator(this, i);\n\t}\n\n\tconst_iterator find(const K &key) const\n\t{\n\t\tHasher::hash_t hash = do_hash(key);\n\t\tint i = do_lookup_no_rehash(key, hash);\n\t\tif (i < 0)\n\t\t\treturn end();\n\t\treturn const_iterator(this, i);\n\t}\n\n\tbool operator[](const K &key)\n\t{\n\t\tHasher::hash_t hash = do_hash(key);\n\t\tint i = do_lookup(key, hash);\n\t\treturn i >= 0;\n\t}\n\n\ttemplate<typename Compare = std::less<K>>\n\tvoid sort(Compare comp = Compare())\n\t{\n\t\tstd::sort(entries.begin(), entries.end(), [comp](const entry_t &a, const entry_t &b){ return comp(b.udata, a.udata); });\n\t\tdo_rehash();\n\t}\n\n\tK pop()\n\t{\n\t\titerator it = begin();\n\t\tK ret = *it;\n\t\terase(it);\n\t\treturn ret;\n\t}\n\n\tvoid swap(pool &other)\n\t{\n\t\thashtable.swap(other.hashtable);\n\t\tentries.swap(other.entries);\n\t}\n\n\tbool operator==(const pool &other) const {\n\t\tif (size() != other.size())\n\t\t\treturn false;\n\t\tfor (auto &it : entries)\n\t\t\tif (!other.count(it.udata))\n\t\t\t\treturn false;\n\t\treturn true;\n\t}\n\n\tbool operator!=(const pool &other) const {\n\t\treturn !operator==(other);\n\t}\n\n\t[[nodiscard]] Hasher hash_into(Hasher h) const {\n\t\tfor (auto &it : entries) {\n\t\t\th.commutative_eat(ops.hash(it.udata).yield());\n\t\t}\n\t\th.eat(entries.size());\n\t\treturn h;\n\t}\n\n\tvoid reserve(size_t n) { entries.reserve(n); }\n\tsize_t size() const { return entries.size(); }\n\tbool empty() const { return entries.empty(); }\n\tvoid clear() { hashtable.clear(); entries.clear(); }\n\n\titerator begin() { return iterator(this, int(entries.size())-1); }\n\titerator element(int n) { return iterator(this, int(entries.size())-1-n); }\n\titerator end() { return iterator(nullptr, -1); }\n\n\tconst_iterator begin() const { return const_iterator(this, int(entries.size())-1); }\n\tconst_iterator element(int n) const { return const_iterator(this, int(entries.size())-1-n); }\n\tconst_iterator end() const { return const_iterator(nullptr, -1); }\n};\n\ntemplate<typename K, int offset, typename OPS>\nclass idict\n{\n\tpool<K, OPS> database;\n\npublic:\n\tclass const_iterator\n\t{\n\t\tfriend class idict;\n\tprotected:\n\t\tconst idict &container;\n\t\tint index;\n\t\tconst_iterator(const idict &container, int index) : container(container), index(index) { }\n\tpublic:\n\t\ttypedef std::forward_iterator_tag iterator_category;\n\t\ttypedef K value_type;\n\t\ttypedef ptrdiff_t difference_type;\n\t\ttypedef K* pointer;\n\t\ttypedef K& reference;\n\t\tconst_iterator() { }\n\t\tconst_iterator operator++() { index++; return *this; }\n\t\tbool operator==(const const_iterator &other) const { return index == other.index; }\n\t\tbool operator!=(const const_iterator &other) const { return index != other.index; }\n\t\tconst K &operator*() const { return container[index]; }\n\t\tconst K *operator->() const { return &container[index]; }\n\t};\n\n\tconstexpr idict()\n\t{\n\t}\n\n\tint operator()(const K &key)\n\t{\n\t\tHasher::hash_t hash = database.do_hash(key);\n\t\tint i = database.do_lookup(key, hash);\n\t\tif (i < 0)\n\t\t\ti = database.do_insert(key, hash);\n\t\treturn i + offset;\n\t}\n\n\tint at(const K &key) const\n\t{\n\t\tHasher::hash_t hash = database.do_hash(key);\n\t\tint i = database.do_lookup_no_rehash(key, hash);\n\t\tif (i < 0)\n\t\t\tthrow std::out_of_range(\"idict::at()\");\n\t\treturn i + offset;\n\t}\n\n\tint at(const K &key, int defval) const\n\t{\n\t\tHasher::hash_t hash = database.do_hash(key);\n\t\tint i = database.do_lookup_no_rehash(key, hash);\n\t\tif (i < 0)\n\t\t\treturn defval;\n\t\treturn i + offset;\n\t}\n\n\tint count(const K &key) const\n\t{\n\t\tHasher::hash_t hash = database.do_hash(key);\n\t\tint i = database.do_lookup_no_rehash(key, hash);\n\t\treturn i < 0 ? 0 : 1;\n\t}\n\n\tvoid expect(const K &key, int i)\n\t{\n\t\tint j = (*this)(key);\n\t\tif (i != j)\n\t\t\tthrow std::out_of_range(\"idict::expect()\");\n\t}\n\n\tconst K &operator[](int index) const\n\t{\n\t\treturn database.entries.at(index - offset).udata;\n\t}\n\n\tvoid swap(idict &other)\n\t{\n\t\tdatabase.swap(other.database);\n\t}\n\n\tvoid reserve(size_t n) { database.reserve(n); }\n\tsize_t size() const { return database.size(); }\n\tbool empty() const { return database.empty(); }\n\tvoid clear() { database.clear(); }\n\n\tconst_iterator begin() const { return const_iterator(*this, offset); }\n\tconst_iterator element(int n) const { return const_iterator(*this, n); }\n\tconst_iterator end() const { return const_iterator(*this, offset + size()); }\n};\n\n/**\n * Union-find data structure with a promotion method\n * mfp stands for \"merge, find, promote\"\n * i-prefixed methods operate on indices in parents\n*/\ntemplate<typename K, typename OPS>\nclass mfp\n{\n\tmutable idict<K, 0, OPS> database;\n\tmutable std::vector<int> parents;\n\npublic:\n\ttypedef typename idict<K, 0>::const_iterator const_iterator;\n\n\tconstexpr mfp()\n\t{\n\t}\n\n\t// Finds a given element's index. If it isn't in the data structure,\n\t// it is added as its own set\n\tint operator()(const K &key) const\n\t{\n\t\tint i = database(key);\n\t\t// If the lookup caused the database to grow,\n\t\t// also add a corresponding entry in parents initialized to -1 (no parent)\n\t\tparents.resize(database.size(), -1);\n\t\treturn i;\n\t}\n\n\t// Finds an element at given index\n\tconst K &operator[](int index) const\n\t{\n\t\treturn database[index];\n\t}\n\n\tint ifind(int i) const\n\t{\n\t\tint p = i, k = i;\n\n\t\twhile (parents[p] != -1)\n\t\t\tp = parents[p];\n\n\t\t// p is now the representative of i\n\t\t// Now we traverse from i up to the representative again\n\t\t// and make p the parent of all the nodes along the way.\n\t\t// This is a side effect and doesn't affect the return value.\n\t\t// It speeds up future find operations\n\t\twhile (k != p) {\n\t\t\tint next_k = parents[k];\n\t\t\tparents[k] = p;\n\t\t\tk = next_k;\n\t\t}\n\n\t\treturn p;\n\t}\n\n\t// Merge sets if the given indices belong to different sets.\n\t// Makes ifind(j) the root of the merged set.\n\tvoid imerge(int i, int j)\n\t{\n\t\ti = ifind(i);\n\t\tj = ifind(j);\n\n\t\tif (i != j)\n\t\t\tparents[i] = j;\n\t}\n\n\tvoid ipromote(int i)\n\t{\n\t\tint k = i;\n\n\t\twhile (k != -1) {\n\t\t\tint next_k = parents[k];\n\t\t\tparents[k] = i;\n\t\t\tk = next_k;\n\t\t}\n\n\t\tparents[i] = -1;\n\t}\n\n\tint lookup(const K &a) const\n\t{\n\t\treturn ifind((*this)(a));\n\t}\n\n\tconst K &find(const K &a) const\n\t{\n\t\tint i = database.at(a, -1);\n\t\tif (i < 0)\n\t\t\treturn a;\n\t\treturn (*this)[ifind(i)];\n\t}\n\n\tvoid merge(const K &a, const K &b)\n\t{\n\t\timerge((*this)(a), (*this)(b));\n\t}\n\n\tvoid promote(const K &a)\n\t{\n\t\tint i = database.at(a, -1);\n\t\tif (i >= 0)\n\t\t\tipromote(i);\n\t}\n\n\tvoid swap(mfp &other)\n\t{\n\t\tdatabase.swap(other.database);\n\t\tparents.swap(other.parents);\n\t}\n\n\tvoid reserve(size_t n) { database.reserve(n); }\n\tsize_t size() const { return database.size(); }\n\tbool empty() const { return database.empty(); }\n\tvoid clear() { database.clear(); parents.clear(); }\n\n\tconst_iterator begin() const { return database.begin(); }\n\tconst_iterator element(int n) const { return database.element(n); }\n\tconst_iterator end() const { return database.end(); }\n};\n\n} /* namespace hashlib */\n\n#endif\n",
|
|
176
|
+
"hashlib.h": "// This is free and unencumbered software released into the public domain.\n//\n// Anyone is free to copy, modify, publish, use, compile, sell, or\n// distribute this software, either in source code form or as a compiled\n// binary, for any purpose, commercial or non-commercial, and by any\n// means.\n\n// -------------------------------------------------------\n// Written by Claire Xenia Wolf <claire@yosyshq.com> in 2014\n// -------------------------------------------------------\n\n#ifndef HASHLIB_H\n#define HASHLIB_H\n\n#include <array>\n#include <stdexcept>\n#include <algorithm>\n#include <optional>\n#include <string>\n#include <variant>\n#include <vector>\n#include <type_traits>\n#include <stdint.h>\n\n#define YS_HASHING_VERSION 1\n\nnamespace hashlib {\n\n/**\n * HASHING\n *\n * Also refer to docs/source/yosys_internals/hashing.rst\n *\n * The Hasher knows how to hash 32 and 64-bit integers. That's it.\n * In the future, it could be expanded to do vectors with SIMD.\n *\n * The Hasher doesn't know how to hash common standard containers\n * and compositions. However, hashlib provides centralized wrappers.\n *\n * Hashlib doesn't know how to hash silly Yosys-specific types.\n * Hashlib doesn't depend on Yosys and can be used standalone.\n * Please don't use hashlib standalone for new projects.\n * Never directly include kernel/hashlib.h in Yosys code.\n * Instead include kernel/yosys_common.h\n *\n * The hash_ops type is now always left to its default value, derived\n * from templated functions through SFINAE. Providing custom ops is\n * still supported.\n *\n * HASH TABLES\n *\n * We implement associative data structures with separate chaining.\n * Linked lists use integers into the indirection hashtable array\n * instead of pointers.\n */\n\nconst int hashtable_size_trigger = 2;\nconst int hashtable_size_factor = 3;\n\nnamespace legacy {\n\tinline uint32_t djb2_add(uint32_t a, uint32_t b) {\n\t\treturn ((a << 5) + a) + b;\n\t}\n};\n\ntemplate<typename T>\nstruct hash_ops;\n\ninline unsigned int mkhash_xorshift(unsigned int a) {\n\tif (sizeof(a) == 4) {\n\t\ta ^= a << 13;\n\t\ta ^= a >> 17;\n\t\ta ^= a << 5;\n\t} else if (sizeof(a) == 8) {\n\t\ta ^= a << 13;\n\t\ta ^= a >> 7;\n\t\ta ^= a << 17;\n\t} else\n\t\tthrow std::runtime_error(\"mkhash_xorshift() only implemented for 32 bit and 64 bit ints\");\n\treturn a;\n}\n\nclass HasherDJB32 {\npublic:\n\tusing hash_t = uint32_t;\n\n\tHasherDJB32() {\n\t\t// traditionally 5381 is used as starting value for the djb2 hash\n\t\tstate = 5381;\n\t}\n\tstatic void set_fudge(hash_t f) {\n\t\tfudge = f;\n\t}\n\nprivate:\n\tuint32_t state;\n\tstatic uint32_t fudge;\n\t// The XOR version of DJB2\n\t[[nodiscard]]\n\tstatic uint32_t djb2_xor(uint32_t a, uint32_t b) {\n\t\tuint32_t hash = ((a << 5) + a) ^ b;\n\t\treturn hash;\n\t}\npublic:\n\tvoid hash32(uint32_t i) {\n\t\tstate = djb2_xor(i, state);\n\t\tstate = mkhash_xorshift(fudge ^ state);\n\t\treturn;\n\t}\n\tvoid hash64(uint64_t i) {\n\t\tstate = djb2_xor((uint32_t)(i & 0xFFFFFFFFULL), state);\n\t\tstate = djb2_xor((uint32_t)(i >> 32ULL), state);\n\t\tstate = mkhash_xorshift(fudge ^ state);\n\t\treturn;\n\t}\n\t[[nodiscard]]\n\thash_t yield() {\n\t\treturn (hash_t)state;\n\t}\n\n\ttemplate<typename T>\n\tvoid eat(T&& t) {\n\t\t*this = hash_ops<std::remove_cv_t<std::remove_reference_t<T>>>::hash_into(std::forward<T>(t), *this);\n\t}\n\n\ttemplate<typename T>\n\tvoid eat(const T& t) {\n\t\t*this = hash_ops<T>::hash_into(t, *this);\n\t}\n\n\t[[deprecated]]\n\tvoid commutative_eat(hash_t t) {\n\t\tstate ^= t;\n\t}\n\n\tvoid force(hash_t new_state) {\n\t\tstate = new_state;\n\t}\n};\n\nusing Hasher = HasherDJB32;\n\n// Boilerplate compressor for trivially implementing\n// top-level hash method with hash_into\n#define HASH_TOP_LOOP_FST [[nodiscard]] static inline Hasher hash\n#define HASH_TOP_LOOP_SND { \\\n\tHasher h; \\\n\th = hash_into(a, h); \\\n\treturn h; \\\n}\n\ntemplate<typename T>\nstruct hash_ops {\n\tstatic inline bool cmp(const T &a, const T &b) {\n\t\treturn a == b;\n\t}\n\t[[nodiscard]] static inline Hasher hash_into(const T &a, Hasher h) {\n\t\tif constexpr (std::is_integral_v<T>) {\n\t\t\tstatic_assert(sizeof(T) <= sizeof(uint64_t));\n\t\t\tif (sizeof(T) == sizeof(uint64_t))\n\t\t\t\th.hash64(a);\n\t\t\telse\n\t\t\t\th.hash32(a);\n\t\t\treturn h;\n\t\t} else if constexpr (std::is_enum_v<T>) {\n\t\t\tusing u_type = std::underlying_type_t<T>;\n\t\t\treturn hash_ops<u_type>::hash_into((u_type) a, h);\n\t\t} else if constexpr (std::is_pointer_v<T>) {\n\t\t\treturn hash_ops<uintptr_t>::hash_into((uintptr_t) a, h);\n\t\t} else if constexpr (std::is_same_v<T, std::string>) {\n\t\t\tfor (auto c : a)\n\t\t\t\th.hash32(c);\n\t\t\treturn h;\n\t\t} else {\n\t\t\treturn a.hash_into(h);\n\t\t}\n\t}\n\tHASH_TOP_LOOP_FST (const T &a) HASH_TOP_LOOP_SND\n};\n\ntemplate<typename P, typename Q> struct hash_ops<std::pair<P, Q>> {\n\tstatic inline bool cmp(const std::pair<P, Q> &a, const std::pair<P, Q> &b) {\n\t\treturn a == b;\n\t}\n\t[[nodiscard]] static inline Hasher hash_into(const std::pair<P, Q> &a, Hasher h) {\n\t\th = hash_ops<P>::hash_into(a.first, h);\n\t\th = hash_ops<Q>::hash_into(a.second, h);\n\t\treturn h;\n\t}\n\tHASH_TOP_LOOP_FST (const std::pair<P, Q> &a) HASH_TOP_LOOP_SND\n};\n\ntemplate<typename... T> struct hash_ops<std::tuple<T...>> {\n\tstatic inline bool cmp(const std::tuple<T...> &a, const std::tuple<T...> &b) {\n\t\treturn a == b;\n\t}\n\ttemplate<size_t I = 0>\n\tstatic inline typename std::enable_if<I == sizeof...(T), Hasher>::type hash_into(const std::tuple<T...> &, Hasher h) {\n\t\treturn h;\n\t}\n\ttemplate<size_t I = 0>\n\tstatic inline typename std::enable_if<I != sizeof...(T), Hasher>::type hash_into(const std::tuple<T...> &a, Hasher h) {\n\t\ttypedef hash_ops<typename std::tuple_element<I, std::tuple<T...>>::type> element_ops_t;\n\t\th = hash_into<I+1>(a, h);\n\t\th = element_ops_t::hash_into(std::get<I>(a), h);\n\t\treturn h;\n\t}\n\tHASH_TOP_LOOP_FST (const std::tuple<T...> &a) HASH_TOP_LOOP_SND\n};\n\ntemplate<typename T> struct hash_ops<std::vector<T>> {\n\tstatic inline bool cmp(const std::vector<T> &a, const std::vector<T> &b) {\n\t\treturn a == b;\n\t}\n\t[[nodiscard]] static inline Hasher hash_into(const std::vector<T> &a, Hasher h) {\n\t\th.eat((uint32_t)a.size());\n\t\tfor (auto k : a)\n\t\t\th.eat(k);\n\t\treturn h;\n\t}\n\tHASH_TOP_LOOP_FST (const std::vector<T> &a) HASH_TOP_LOOP_SND\n};\n\ntemplate<typename T, size_t N> struct hash_ops<std::array<T, N>> {\n static inline bool cmp(const std::array<T, N> &a, const std::array<T, N> &b) {\n return a == b;\n }\n [[nodiscard]] static inline Hasher hash_into(const std::array<T, N> &a, Hasher h) {\n for (const auto& k : a)\n h = hash_ops<T>::hash_into(k, h);\n return h;\n }\n\tHASH_TOP_LOOP_FST (const std::array<T, N> &a) HASH_TOP_LOOP_SND\n};\n\nstruct hash_cstr_ops {\n\tstatic inline bool cmp(const char *a, const char *b) {\n\t\treturn strcmp(a, b) == 0;\n\t}\n\t[[nodiscard]] static inline Hasher hash_into(const char *a, Hasher h) {\n\t\twhile (*a)\n\t\t\th.hash32(*(a++));\n\t\treturn h;\n\t}\n\tHASH_TOP_LOOP_FST (const char *a) HASH_TOP_LOOP_SND\n};\n\ntemplate <> struct hash_ops<char*> : hash_cstr_ops {};\n\nstruct hash_ptr_ops {\n\tstatic inline bool cmp(const void *a, const void *b) {\n\t\treturn a == b;\n\t}\n\t[[nodiscard]] static inline Hasher hash_into(const void *a, Hasher h) {\n\t\treturn hash_ops<uintptr_t>::hash_into((uintptr_t)a, h);\n\t}\n\tHASH_TOP_LOOP_FST (const void *a) HASH_TOP_LOOP_SND\n};\n\nstruct hash_obj_ops {\n\tstatic inline bool cmp(const void *a, const void *b) {\n\t\treturn a == b;\n\t}\n\ttemplate<typename T>\n\t[[nodiscard]] static inline Hasher hash_into(const T *a, Hasher h) {\n\t\tif (a)\n\t\t\th = a->hash_into(h);\n\t\telse\n\t\t\th.eat(0);\n\t\treturn h;\n\t}\n\ttemplate<typename T>\n\tHASH_TOP_LOOP_FST (const T *a) HASH_TOP_LOOP_SND\n};\n/**\n * If you find yourself using this function, think hard\n * about if it's the right thing to do. Mixing finalized\n * hashes together with XORs or worse can destroy\n * desirable qualities of the hash function\n */\ntemplate<typename T>\n[[nodiscard]]\nHasher::hash_t run_hash(const T& obj) {\n\treturn hash_ops<T>::hash(obj).yield();\n}\n\n/** Refer to docs/source/yosys_internals/hashing.rst */\ntemplate<typename T>\n[[nodiscard]]\n[[deprecated]]\ninline unsigned int mkhash(const T &v) {\n\treturn (unsigned int) run_hash<T>(v);\n}\n\ntemplate<> struct hash_ops<std::monostate> {\n\tstatic inline bool cmp(std::monostate a, std::monostate b) {\n\t\treturn a == b;\n\t}\n\t[[nodiscard]] static inline Hasher hash_into(std::monostate, Hasher h) {\n\t\treturn h;\n\t}\n};\n\ntemplate<typename... T> struct hash_ops<std::variant<T...>> {\n\tstatic inline bool cmp(const std::variant<T...> &a, const std::variant<T...> &b) {\n\t\treturn a == b;\n\t}\n\t[[nodiscard]] static inline Hasher hash_into(const std::variant<T...> &a, Hasher h) {\n\t\tstd::visit([& h](const auto &v) { h.eat(v); }, a);\n\t\th.eat(a.index());\n\t\treturn h;\n\t}\n};\n\ntemplate<typename T> struct hash_ops<std::optional<T>> {\n\tstatic inline bool cmp(const std::optional<T> &a, const std::optional<T> &b) {\n\t\treturn a == b;\n\t}\n\t[[nodiscard]] static inline Hasher hash_into(const std::optional<T> &a, Hasher h) {\n\t\tif(a.has_value())\n\t\t\th.eat(*a);\n\t\telse\n\t\t\th.eat(0);\n\t\treturn h;\n\t}\n};\n\ninline unsigned int hashtable_size(unsigned int min_size)\n{\n\t// Primes as generated by https://oeis.org/A175953\n\tstatic std::vector<unsigned int> zero_and_some_primes = {\n\t\t0, 23, 29, 37, 47, 59, 79, 101, 127, 163, 211, 269, 337, 431, 541, 677,\n\t\t853, 1069, 1361, 1709, 2137, 2677, 3347, 4201, 5261, 6577, 8231, 10289,\n\t\t12889, 16127, 20161, 25219, 31531, 39419, 49277, 61603, 77017, 96281,\n\t\t120371, 150473, 188107, 235159, 293957, 367453, 459317, 574157, 717697,\n\t\t897133, 1121423, 1401791, 1752239, 2190299, 2737937, 3422429, 4278037,\n\t\t5347553, 6684443, 8355563, 10444457, 13055587, 16319519, 20399411,\n\t\t25499291, 31874149, 39842687, 49803361, 62254207, 77817767, 97272239,\n\t\t121590311, 151987889, 189984863, 237481091, 296851369, 371064217,\n\t\t463830313, 579787991, 724735009, 905918777, 1132398479, 1415498113,\n\t\t1769372713, 2211715897, 2764644887, 3455806139\n\t};\n\n\tfor (auto p : zero_and_some_primes)\n\t\tif (p >= min_size) return p;\n\n\tif (sizeof(unsigned int) == 4)\n\t\tthrow std::length_error(\"hash table exceeded maximum size.\\nDesign is likely too large for yosys to handle, if possible try not to flatten the design.\");\n\n\tfor (auto p : zero_and_some_primes)\n\t\tif (100129 * p > min_size) return 100129 * p;\n\n\tthrow std::length_error(\"hash table exceeded maximum size.\");\n}\n\ntemplate<typename K, typename T, typename OPS = hash_ops<K>> class dict;\ntemplate<typename K, int offset = 0, typename OPS = hash_ops<K>> class idict;\ntemplate<typename K, typename OPS = hash_ops<K>> class pool;\ntemplate<typename K, typename OPS = hash_ops<K>> class mfp;\n\n// Computes the hash value of an unordered set of elements.\n// See https://www.preprints.org/manuscript/201710.0192/v1/download.\n// This is the Sum(4) algorithm from that paper, which has good collision resistance,\n// much better than Sum(1) or Xor(1) (and somewhat better than Xor(4)).\nclass commutative_hash {\npublic:\n\tcommutative_hash() {\n\t\tbuckets.fill(0);\n\t}\n\tvoid eat(Hasher h) {\n\t\tHasher::hash_t v = h.yield();\n\t\tsize_t index = v & (buckets.size() - 1);\n\t\tbuckets[index] += v;\n\t}\n\t[[nodiscard]] Hasher hash_into(Hasher h) const {\n\t\tfor (auto b : buckets)\n\t\t\th.eat(b);\n\t\treturn h;\n\t}\nprivate:\n\tstd::array<Hasher::hash_t, 4> buckets;\n};\n\ntemplate<typename K, typename T, typename OPS>\nclass dict {\n\tstruct entry_t\n\t{\n\t\tstd::pair<K, T> udata;\n\t\tint next;\n\n\t\tentry_t() { }\n\t\tentry_t(const std::pair<K, T> &udata, int next) : udata(udata), next(next) { }\n\t\tentry_t(std::pair<K, T> &&udata, int next) : udata(std::move(udata)), next(next) { }\n\t\tbool operator<(const entry_t &other) const { return udata.first < other.udata.first; }\n\t};\n\n\tstd::vector<int> hashtable;\n\tstd::vector<entry_t> entries;\n\tOPS ops;\n\n#ifdef NDEBUG\n\tstatic inline void do_assert(bool) { }\n#else\n\tstatic inline void do_assert(bool cond) {\n\t\tif (!cond) throw std::runtime_error(\"dict<> assert failed.\");\n\t}\n#endif\n\n\tHasher::hash_t do_hash(const K &key) const\n\t{\n\t\tHasher::hash_t hash = 0;\n\t\tif (!hashtable.empty())\n\t\t\thash = ops.hash(key).yield() % (unsigned int)(hashtable.size());\n\t\treturn hash;\n\t}\n\n\tvoid do_rehash()\n\t{\n\t\thashtable.clear();\n\t\thashtable.resize(hashtable_size(entries.capacity() * hashtable_size_factor), -1);\n\n\t\tfor (int i = 0; i < int(entries.size()); i++) {\n\t\t\tdo_assert(-1 <= entries[i].next && entries[i].next < int(entries.size()));\n\t\t\tHasher::hash_t hash = do_hash(entries[i].udata.first);\n\t\t\tentries[i].next = hashtable[hash];\n\t\t\thashtable[hash] = i;\n\t\t}\n\t}\n\n\tint do_erase(int index, Hasher::hash_t hash)\n\t{\n\t\tdo_assert(index < int(entries.size()));\n\t\tif (hashtable.empty() || index < 0)\n\t\t\treturn 0;\n\n\t\tint k = hashtable[hash];\n\t\tdo_assert(0 <= k && k < int(entries.size()));\n\n\t\tif (k == index) {\n\t\t\thashtable[hash] = entries[index].next;\n\t\t} else {\n\t\t\twhile (entries[k].next != index) {\n\t\t\t\tk = entries[k].next;\n\t\t\t\tdo_assert(0 <= k && k < int(entries.size()));\n\t\t\t}\n\t\t\tentries[k].next = entries[index].next;\n\t\t}\n\n\t\tint back_idx = entries.size()-1;\n\n\t\tif (index != back_idx)\n\t\t{\n\t\t\tHasher::hash_t back_hash = do_hash(entries[back_idx].udata.first);\n\n\t\t\tk = hashtable[back_hash];\n\t\t\tdo_assert(0 <= k && k < int(entries.size()));\n\n\t\t\tif (k == back_idx) {\n\t\t\t\thashtable[back_hash] = index;\n\t\t\t} else {\n\t\t\t\twhile (entries[k].next != back_idx) {\n\t\t\t\t\tk = entries[k].next;\n\t\t\t\t\tdo_assert(0 <= k && k < int(entries.size()));\n\t\t\t\t}\n\t\t\t\tentries[k].next = index;\n\t\t\t}\n\n\t\t\tentries[index] = std::move(entries[back_idx]);\n\t\t}\n\n\t\tentries.pop_back();\n\n\t\tif (entries.empty())\n\t\t\thashtable.clear();\n\n\t\treturn 1;\n\t}\n\n\tint do_lookup(const K &key, Hasher::hash_t &hash)\n\t{\n\t\tif (hashtable.empty())\n\t\t\treturn -1;\n\n\t\tif (entries.size() * hashtable_size_trigger > hashtable.size()) {\n\t\t\tdo_rehash();\n\t\t\thash = do_hash(key);\n\t\t}\n\n\t\treturn do_lookup_internal(key, hash);\n\t}\n\n\tint do_lookup_internal(const K &key, Hasher::hash_t hash) const\n\t{\n\t\tint index = hashtable[hash];\n\n\t\twhile (index >= 0 && !ops.cmp(entries[index].udata.first, key)) {\n\t\t\tindex = entries[index].next;\n\t\t\tdo_assert(-1 <= index && index < int(entries.size()));\n\t\t}\n\n\t\treturn index;\n\t}\n\n\tint do_lookup_no_rehash(const K &key, Hasher::hash_t hash) const\n\t{\n\t\tif (hashtable.empty())\n\t\t\treturn -1;\n\n\t\treturn do_lookup_internal(key, hash);\n\t}\n\n\tint do_insert(const K &key, Hasher::hash_t &hash)\n\t{\n\t\tif (hashtable.empty()) {\n\t\t\tentries.emplace_back(std::pair<K, T>(key, T()), -1);\n\t\t\tdo_rehash();\n\t\t\thash = do_hash(key);\n\t\t} else {\n\t\t\tentries.emplace_back(std::pair<K, T>(key, T()), hashtable[hash]);\n\t\t\thashtable[hash] = entries.size() - 1;\n\t\t}\n\t\treturn entries.size() - 1;\n\t}\n\n\tint do_insert(const std::pair<K, T> &value, Hasher::hash_t &hash)\n\t{\n\t\tif (hashtable.empty()) {\n\t\t\tentries.emplace_back(value, -1);\n\t\t\tdo_rehash();\n\t\t\thash = do_hash(value.first);\n\t\t} else {\n\t\t\tentries.emplace_back(value, hashtable[hash]);\n\t\t\thashtable[hash] = entries.size() - 1;\n\t\t}\n\t\treturn entries.size() - 1;\n\t}\n\n\tint do_insert(std::pair<K, T> &&rvalue, Hasher::hash_t &hash)\n\t{\n\t\tif (hashtable.empty()) {\n\t\t\tauto key = rvalue.first;\n\t\t\tentries.emplace_back(std::forward<std::pair<K, T>>(rvalue), -1);\n\t\t\tdo_rehash();\n\t\t\thash = do_hash(key);\n\t\t} else {\n\t\t\tentries.emplace_back(std::forward<std::pair<K, T>>(rvalue), hashtable[hash]);\n\t\t\thashtable[hash] = entries.size() - 1;\n\t\t}\n\t\treturn entries.size() - 1;\n\t}\n\npublic:\n\tclass const_iterator\n\t{\n\t\tfriend class dict;\n\tprotected:\n\t\tconst dict *ptr;\n\t\tint index;\n\t\tconst_iterator(const dict *ptr, int index) : ptr(ptr), index(index) { }\n\tpublic:\n\t\ttypedef std::forward_iterator_tag iterator_category;\n\t\ttypedef std::pair<K, T> value_type;\n\t\ttypedef ptrdiff_t difference_type;\n\t\ttypedef std::pair<K, T>* pointer;\n\t\ttypedef std::pair<K, T>& reference;\n\t\tconst_iterator() { }\n\t\tconst_iterator operator++() { index--; return *this; }\n\t\tconst_iterator operator+=(int amt) { index -= amt; return *this; }\n\t\tbool operator<(const const_iterator &other) const { return index > other.index; }\n\t\tbool operator==(const const_iterator &other) const { return index == other.index; }\n\t\tbool operator!=(const const_iterator &other) const { return index != other.index; }\n\t\tconst std::pair<K, T> &operator*() const { return ptr->entries[index].udata; }\n\t\tconst std::pair<K, T> *operator->() const { return &ptr->entries[index].udata; }\n\t};\n\n\tclass iterator\n\t{\n\t\tfriend class dict;\n\tprotected:\n\t\tdict *ptr;\n\t\tint index;\n\t\titerator(dict *ptr, int index) : ptr(ptr), index(index) { }\n\tpublic:\n\t\ttypedef std::forward_iterator_tag iterator_category;\n\t\ttypedef std::pair<K, T> value_type;\n\t\ttypedef ptrdiff_t difference_type;\n\t\ttypedef std::pair<K, T>* pointer;\n\t\ttypedef std::pair<K, T>& reference;\n\t\titerator() { }\n\t\titerator operator++() { index--; return *this; }\n\t\titerator operator+=(int amt) { index -= amt; return *this; }\n\t\tbool operator<(const iterator &other) const { return index > other.index; }\n\t\tbool operator==(const iterator &other) const { return index == other.index; }\n\t\tbool operator!=(const iterator &other) const { return index != other.index; }\n\t\tstd::pair<K, T> &operator*() { return ptr->entries[index].udata; }\n\t\tstd::pair<K, T> *operator->() { return &ptr->entries[index].udata; }\n\t\tconst std::pair<K, T> &operator*() const { return ptr->entries[index].udata; }\n\t\tconst std::pair<K, T> *operator->() const { return &ptr->entries[index].udata; }\n\t\toperator const_iterator() const { return const_iterator(ptr, index); }\n\t};\n\n\tconstexpr dict()\n\t{\n\t}\n\n\tdict(const dict &other)\n\t{\n\t\tentries = other.entries;\n\t\tdo_rehash();\n\t}\n\n\tdict(dict &&other)\n\t{\n\t\tswap(other);\n\t}\n\n\tdict &operator=(const dict &other) {\n\t\tentries = other.entries;\n\t\tdo_rehash();\n\t\treturn *this;\n\t}\n\n\tdict &operator=(dict &&other) {\n\t\tclear();\n\t\tswap(other);\n\t\treturn *this;\n\t}\n\n\tdict(const std::initializer_list<std::pair<K, T>> &list)\n\t{\n\t\tfor (auto &it : list)\n\t\t\tinsert(it);\n\t}\n\n\ttemplate<class InputIterator>\n\tdict(InputIterator first, InputIterator last)\n\t{\n\t\tinsert(first, last);\n\t}\n\n\ttemplate<class InputIterator>\n\tvoid insert(InputIterator first, InputIterator last)\n\t{\n\t\tfor (; first != last; ++first)\n\t\t\tinsert(*first);\n\t}\n\n\tstd::pair<iterator, bool> insert(const K &key)\n\t{\n\t\tHasher::hash_t hash = do_hash(key);\n\t\tint i = do_lookup(key, hash);\n\t\tif (i >= 0)\n\t\t\treturn std::pair<iterator, bool>(iterator(this, i), false);\n\t\ti = do_insert(key, hash);\n\t\treturn std::pair<iterator, bool>(iterator(this, i), true);\n\t}\n\n\tstd::pair<iterator, bool> insert(const std::pair<K, T> &value)\n\t{\n\t\tHasher::hash_t hash = do_hash(value.first);\n\t\tint i = do_lookup(value.first, hash);\n\t\tif (i >= 0)\n\t\t\treturn std::pair<iterator, bool>(iterator(this, i), false);\n\t\ti = do_insert(value, hash);\n\t\treturn std::pair<iterator, bool>(iterator(this, i), true);\n\t}\n\n\tstd::pair<iterator, bool> insert(std::pair<K, T> &&rvalue)\n\t{\n\t\tHasher::hash_t hash = do_hash(rvalue.first);\n\t\tint i = do_lookup(rvalue.first, hash);\n\t\tif (i >= 0)\n\t\t\treturn std::pair<iterator, bool>(iterator(this, i), false);\n\t\ti = do_insert(std::forward<std::pair<K, T>>(rvalue), hash);\n\t\treturn std::pair<iterator, bool>(iterator(this, i), true);\n\t}\n\n\tstd::pair<iterator, bool> emplace(K const &key, T const &value)\n\t{\n\t\tHasher::hash_t hash = do_hash(key);\n\t\tint i = do_lookup(key, hash);\n\t\tif (i >= 0)\n\t\t\treturn std::pair<iterator, bool>(iterator(this, i), false);\n\t\ti = do_insert(std::make_pair(key, value), hash);\n\t\treturn std::pair<iterator, bool>(iterator(this, i), true);\n\t}\n\n\tstd::pair<iterator, bool> emplace(K const &key, T &&rvalue)\n\t{\n\t\tHasher::hash_t hash = do_hash(key);\n\t\tint i = do_lookup(key, hash);\n\t\tif (i >= 0)\n\t\t\treturn std::pair<iterator, bool>(iterator(this, i), false);\n\t\ti = do_insert(std::make_pair(key, std::forward<T>(rvalue)), hash);\n\t\treturn std::pair<iterator, bool>(iterator(this, i), true);\n\t}\n\n\tstd::pair<iterator, bool> emplace(K &&rkey, T const &value)\n\t{\n\t\tHasher::hash_t hash = do_hash(rkey);\n\t\tint i = do_lookup(rkey, hash);\n\t\tif (i >= 0)\n\t\t\treturn std::pair<iterator, bool>(iterator(this, i), false);\n\t\ti = do_insert(std::make_pair(std::forward<K>(rkey), value), hash);\n\t\treturn std::pair<iterator, bool>(iterator(this, i), true);\n\t}\n\n\tstd::pair<iterator, bool> emplace(K &&rkey, T &&rvalue)\n\t{\n\t\tHasher::hash_t hash = do_hash(rkey);\n\t\tint i = do_lookup(rkey, hash);\n\t\tif (i >= 0)\n\t\t\treturn std::pair<iterator, bool>(iterator(this, i), false);\n\t\ti = do_insert(std::make_pair(std::forward<K>(rkey), std::forward<T>(rvalue)), hash);\n\t\treturn std::pair<iterator, bool>(iterator(this, i), true);\n\t}\n\n\tint erase(const K &key)\n\t{\n\t\tHasher::hash_t hash = do_hash(key);\n\t\tint index = do_lookup(key, hash);\n\t\treturn do_erase(index, hash);\n\t}\n\n\titerator erase(iterator it)\n\t{\n\t\tHasher::hash_t hash = do_hash(it->first);\n\t\tdo_erase(it.index, hash);\n\t\treturn ++it;\n\t}\n\n\tint count(const K &key) const\n\t{\n\t\tHasher::hash_t hash = do_hash(key);\n\t\tint i = do_lookup_no_rehash(key, hash);\n\t\treturn i < 0 ? 0 : 1;\n\t}\n\n\tint count(const K &key, const_iterator it) const\n\t{\n\t\tHasher::hash_t hash = do_hash(key);\n\t\tint i = do_lookup_no_rehash(key, hash);\n\t\treturn i < 0 || i > it.index ? 0 : 1;\n\t}\n\n\titerator find(const K &key)\n\t{\n\t\tHasher::hash_t hash = do_hash(key);\n\t\tint i = do_lookup(key, hash);\n\t\tif (i < 0)\n\t\t\treturn end();\n\t\treturn iterator(this, i);\n\t}\n\n\tconst_iterator find(const K &key) const\n\t{\n\t\tHasher::hash_t hash = do_hash(key);\n\t\tint i = do_lookup_no_rehash(key, hash);\n\t\tif (i < 0)\n\t\t\treturn end();\n\t\treturn const_iterator(this, i);\n\t}\n\n\tT& at(const K &key)\n\t{\n\t\tHasher::hash_t hash = do_hash(key);\n\t\tint i = do_lookup(key, hash);\n\t\tif (i < 0)\n\t\t\tthrow std::out_of_range(\"dict::at()\");\n\t\treturn entries[i].udata.second;\n\t}\n\n\tconst T& at(const K &key) const\n\t{\n\t\tHasher::hash_t hash = do_hash(key);\n\t\tint i = do_lookup_no_rehash(key, hash);\n\t\tif (i < 0)\n\t\t\tthrow std::out_of_range(\"dict::at()\");\n\t\treturn entries[i].udata.second;\n\t}\n\n\tconst T& at(const K &key, const T &defval) const\n\t{\n\t\tHasher::hash_t hash = do_hash(key);\n\t\tint i = do_lookup_no_rehash(key, hash);\n\t\tif (i < 0)\n\t\t\treturn defval;\n\t\treturn entries[i].udata.second;\n\t}\n\n\tT& operator[](const K &key)\n\t{\n\t\tHasher::hash_t hash = do_hash(key);\n\t\tint i = do_lookup(key, hash);\n\t\tif (i < 0)\n\t\t\ti = do_insert(std::pair<K, T>(key, T()), hash);\n\t\treturn entries[i].udata.second;\n\t}\n\n\ttemplate<typename Compare = std::less<K>>\n\tvoid sort(Compare comp = Compare())\n\t{\n\t\tstd::sort(entries.begin(), entries.end(), [comp](const entry_t &a, const entry_t &b){ return comp(b.udata.first, a.udata.first); });\n\t\tdo_rehash();\n\t}\n\n\tvoid swap(dict &other)\n\t{\n\t\thashtable.swap(other.hashtable);\n\t\tentries.swap(other.entries);\n\t}\n\n\tbool operator==(const dict &other) const {\n\t\tif (size() != other.size())\n\t\t\treturn false;\n\t\tfor (auto &it : entries) {\n\t\t\tauto oit = other.find(it.udata.first);\n\t\t\tif (oit == other.end() || !(oit->second == it.udata.second))\n\t\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\tbool operator!=(const dict &other) const {\n\t\treturn !operator==(other);\n\t}\n\n\t[[nodiscard]] Hasher hash_into(Hasher h) const {\n\t\tcommutative_hash comm;\n\t\tfor (auto &it : entries) {\n\t\t\tHasher entry_hash;\n\t\t\tentry_hash.eat(it.udata.first);\n\t\t\tentry_hash.eat(it.udata.second);\n\t\t\tcomm.eat(entry_hash);\n\t\t}\n\t\treturn comm.hash_into(h);\n\t}\n\n\tvoid reserve(size_t n) { entries.reserve(n); }\n\tsize_t size() const { return entries.size(); }\n\tbool empty() const { return entries.empty(); }\n\tvoid clear() { hashtable.clear(); entries.clear(); }\n\n\titerator begin() { return iterator(this, int(entries.size())-1); }\n\titerator element(int n) { return iterator(this, int(entries.size())-1-n); }\n\titerator end() { return iterator(nullptr, -1); }\n\n\tconst_iterator begin() const { return const_iterator(this, int(entries.size())-1); }\n\tconst_iterator element(int n) const { return const_iterator(this, int(entries.size())-1-n); }\n\tconst_iterator end() const { return const_iterator(nullptr, -1); }\n};\n\ntemplate<typename K, typename OPS>\nclass pool\n{\n\ttemplate<typename, int, typename> friend class idict;\n\nprotected:\n\tstruct entry_t\n\t{\n\t\tK udata;\n\t\tint next;\n\n\t\tentry_t() { }\n\t\tentry_t(const K &udata, int next) : udata(udata), next(next) { }\n\t\tentry_t(K &&udata, int next) : udata(std::move(udata)), next(next) { }\n\t};\n\n\tstd::vector<int> hashtable;\n\tstd::vector<entry_t> entries;\n\tOPS ops;\n\n#ifdef NDEBUG\n\tstatic inline void do_assert(bool) { }\n#else\n\tstatic inline void do_assert(bool cond) {\n\t\tif (!cond) throw std::runtime_error(\"pool<> assert failed.\");\n\t}\n#endif\n\n\tHasher::hash_t do_hash(const K &key) const\n\t{\n\t\tHasher::hash_t hash = 0;\n\t\tif (!hashtable.empty())\n\t\t\thash = ops.hash(key).yield() % (unsigned int)(hashtable.size());\n\t\treturn hash;\n\t}\n\n\tvoid do_rehash()\n\t{\n\t\thashtable.clear();\n\t\thashtable.resize(hashtable_size(entries.capacity() * hashtable_size_factor), -1);\n\n\t\tfor (int i = 0; i < int(entries.size()); i++) {\n\t\t\tdo_assert(-1 <= entries[i].next && entries[i].next < int(entries.size()));\n\t\t\tHasher::hash_t hash = do_hash(entries[i].udata);\n\t\t\tentries[i].next = hashtable[hash];\n\t\t\thashtable[hash] = i;\n\t\t}\n\t}\n\n\tint do_erase(int index, Hasher::hash_t hash)\n\t{\n\t\tdo_assert(index < int(entries.size()));\n\t\tif (hashtable.empty() || index < 0)\n\t\t\treturn 0;\n\n\t\tint k = hashtable[hash];\n\t\tif (k == index) {\n\t\t\thashtable[hash] = entries[index].next;\n\t\t} else {\n\t\t\twhile (entries[k].next != index) {\n\t\t\t\tk = entries[k].next;\n\t\t\t\tdo_assert(0 <= k && k < int(entries.size()));\n\t\t\t}\n\t\t\tentries[k].next = entries[index].next;\n\t\t}\n\n\t\tint back_idx = entries.size()-1;\n\n\t\tif (index != back_idx)\n\t\t{\n\t\t\tHasher::hash_t back_hash = do_hash(entries[back_idx].udata);\n\n\t\t\tk = hashtable[back_hash];\n\t\t\tif (k == back_idx) {\n\t\t\t\thashtable[back_hash] = index;\n\t\t\t} else {\n\t\t\t\twhile (entries[k].next != back_idx) {\n\t\t\t\t\tk = entries[k].next;\n\t\t\t\t\tdo_assert(0 <= k && k < int(entries.size()));\n\t\t\t\t}\n\t\t\t\tentries[k].next = index;\n\t\t\t}\n\n\t\t\tentries[index] = std::move(entries[back_idx]);\n\t\t}\n\n\t\tentries.pop_back();\n\n\t\tif (entries.empty())\n\t\t\thashtable.clear();\n\n\t\treturn 1;\n\t}\n\n\tint do_lookup(const K &key, Hasher::hash_t &hash)\n\t{\n\t\tif (hashtable.empty())\n\t\t\treturn -1;\n\n\t\tif (entries.size() * hashtable_size_trigger > hashtable.size()) {\n\t\t\tdo_rehash();\n\t\t\thash = do_hash(key);\n\t\t}\n\n\t\treturn do_lookup_internal(key, hash);\n\t}\n\n\tint do_lookup_internal(const K &key, Hasher::hash_t hash) const\n\t{\n\t\tint index = hashtable[hash];\n\n\t\twhile (index >= 0 && !ops.cmp(entries[index].udata, key)) {\n\t\t\tindex = entries[index].next;\n\t\t\tdo_assert(-1 <= index && index < int(entries.size()));\n\t\t}\n\n\t\treturn index;\n\t}\n\n\tint do_lookup_no_rehash(const K &key, Hasher::hash_t hash) const\n\t{\n\t\tif (hashtable.empty())\n\t\t\treturn -1;\n\n\t\treturn do_lookup_internal(key, hash);\n\t}\n\n\tint do_insert(const K &value, Hasher::hash_t &hash)\n\t{\n\t\tif (hashtable.empty()) {\n\t\t\tentries.emplace_back(value, -1);\n\t\t\tdo_rehash();\n\t\t\thash = do_hash(value);\n\t\t} else {\n\t\t\tentries.emplace_back(value, hashtable[hash]);\n\t\t\thashtable[hash] = entries.size() - 1;\n\t\t}\n\t\treturn entries.size() - 1;\n\t}\n\n\tint do_insert(K &&rvalue, Hasher::hash_t &hash)\n\t{\n\t\tif (hashtable.empty()) {\n\t\t\tentries.emplace_back(std::forward<K>(rvalue), -1);\n\t\t\tdo_rehash();\n\t\t\thash = do_hash(rvalue);\n\t\t} else {\n\t\t\tentries.emplace_back(std::forward<K>(rvalue), hashtable[hash]);\n\t\t\thashtable[hash] = entries.size() - 1;\n\t\t}\n\t\treturn entries.size() - 1;\n\t}\n\npublic:\n\tclass const_iterator\n\t{\n\t\tfriend class pool;\n\tprotected:\n\t\tconst pool *ptr;\n\t\tint index;\n\t\tconst_iterator(const pool *ptr, int index) : ptr(ptr), index(index) { }\n\tpublic:\n\t\ttypedef std::forward_iterator_tag iterator_category;\n\t\ttypedef K value_type;\n\t\ttypedef ptrdiff_t difference_type;\n\t\ttypedef K* pointer;\n\t\ttypedef K& reference;\n\t\tconst_iterator() { }\n\t\tconst_iterator operator++() { index--; return *this; }\n\t\tbool operator==(const const_iterator &other) const { return index == other.index; }\n\t\tbool operator!=(const const_iterator &other) const { return index != other.index; }\n\t\tconst K &operator*() const { return ptr->entries[index].udata; }\n\t\tconst K *operator->() const { return &ptr->entries[index].udata; }\n\t};\n\n\tclass iterator\n\t{\n\t\tfriend class pool;\n\tprotected:\n\t\tpool *ptr;\n\t\tint index;\n\t\titerator(pool *ptr, int index) : ptr(ptr), index(index) { }\n\tpublic:\n\t\ttypedef std::forward_iterator_tag iterator_category;\n\t\ttypedef K value_type;\n\t\ttypedef ptrdiff_t difference_type;\n\t\ttypedef K* pointer;\n\t\ttypedef K& reference;\n\t\titerator() { }\n\t\titerator operator++() { index--; return *this; }\n\t\tbool operator==(const iterator &other) const { return index == other.index; }\n\t\tbool operator!=(const iterator &other) const { return index != other.index; }\n\t\tK &operator*() { return ptr->entries[index].udata; }\n\t\tK *operator->() { return &ptr->entries[index].udata; }\n\t\tconst K &operator*() const { return ptr->entries[index].udata; }\n\t\tconst K *operator->() const { return &ptr->entries[index].udata; }\n\t\toperator const_iterator() const { return const_iterator(ptr, index); }\n\t};\n\n\tconstexpr pool()\n\t{\n\t}\n\n\tpool(const pool &other)\n\t{\n\t\tentries = other.entries;\n\t\tdo_rehash();\n\t}\n\n\tpool(pool &&other)\n\t{\n\t\tswap(other);\n\t}\n\n\tpool &operator=(const pool &other) {\n\t\tentries = other.entries;\n\t\tdo_rehash();\n\t\treturn *this;\n\t}\n\n\tpool &operator=(pool &&other) {\n\t\tclear();\n\t\tswap(other);\n\t\treturn *this;\n\t}\n\n\tpool(const std::initializer_list<K> &list)\n\t{\n\t\tfor (auto &it : list)\n\t\t\tinsert(it);\n\t}\n\n\ttemplate<class InputIterator>\n\tpool(InputIterator first, InputIterator last)\n\t{\n\t\tinsert(first, last);\n\t}\n\n\ttemplate<class InputIterator>\n\tvoid insert(InputIterator first, InputIterator last)\n\t{\n\t\tfor (; first != last; ++first)\n\t\t\tinsert(*first);\n\t}\n\n\tstd::pair<iterator, bool> insert(const K &value)\n\t{\n\t\tHasher::hash_t hash = do_hash(value);\n\t\tint i = do_lookup(value, hash);\n\t\tif (i >= 0)\n\t\t\treturn std::pair<iterator, bool>(iterator(this, i), false);\n\t\ti = do_insert(value, hash);\n\t\treturn std::pair<iterator, bool>(iterator(this, i), true);\n\t}\n\n\tstd::pair<iterator, bool> insert(K &&rvalue)\n\t{\n\t\tHasher::hash_t hash = do_hash(rvalue);\n\t\tint i = do_lookup(rvalue, hash);\n\t\tif (i >= 0)\n\t\t\treturn std::pair<iterator, bool>(iterator(this, i), false);\n\t\ti = do_insert(std::forward<K>(rvalue), hash);\n\t\treturn std::pair<iterator, bool>(iterator(this, i), true);\n\t}\n\n\ttemplate<typename... Args>\n\tstd::pair<iterator, bool> emplace(Args&&... args)\n\t{\n\t\treturn insert(K(std::forward<Args>(args)...));\n\t}\n\n\tint erase(const K &key)\n\t{\n\t\tHasher::hash_t hash = do_hash(key);\n\t\tint index = do_lookup(key, hash);\n\t\treturn do_erase(index, hash);\n\t}\n\n\titerator erase(iterator it)\n\t{\n\t\tHasher::hash_t hash = do_hash(*it);\n\t\tdo_erase(it.index, hash);\n\t\treturn ++it;\n\t}\n\n\tint count(const K &key) const\n\t{\n\t\tHasher::hash_t hash = do_hash(key);\n\t\tint i = do_lookup_no_rehash(key, hash);\n\t\treturn i < 0 ? 0 : 1;\n\t}\n\n\tint count(const K &key, const_iterator it) const\n\t{\n\t\tHasher::hash_t hash = do_hash(key);\n\t\tint i = do_lookup_no_rehash(key, hash);\n\t\treturn i < 0 || i > it.index ? 0 : 1;\n\t}\n\n\titerator find(const K &key)\n\t{\n\t\tHasher::hash_t hash = do_hash(key);\n\t\tint i = do_lookup(key, hash);\n\t\tif (i < 0)\n\t\t\treturn end();\n\t\treturn iterator(this, i);\n\t}\n\n\tconst_iterator find(const K &key) const\n\t{\n\t\tHasher::hash_t hash = do_hash(key);\n\t\tint i = do_lookup_no_rehash(key, hash);\n\t\tif (i < 0)\n\t\t\treturn end();\n\t\treturn const_iterator(this, i);\n\t}\n\n\tbool operator[](const K &key)\n\t{\n\t\tHasher::hash_t hash = do_hash(key);\n\t\tint i = do_lookup(key, hash);\n\t\treturn i >= 0;\n\t}\n\n\ttemplate<typename Compare = std::less<K>>\n\tvoid sort(Compare comp = Compare())\n\t{\n\t\tstd::sort(entries.begin(), entries.end(), [comp](const entry_t &a, const entry_t &b){ return comp(b.udata, a.udata); });\n\t\tdo_rehash();\n\t}\n\n\tK pop()\n\t{\n\t\titerator it = begin();\n\t\tK ret = *it;\n\t\terase(it);\n\t\treturn ret;\n\t}\n\n\tvoid swap(pool &other)\n\t{\n\t\thashtable.swap(other.hashtable);\n\t\tentries.swap(other.entries);\n\t}\n\n\tbool operator==(const pool &other) const {\n\t\tif (size() != other.size())\n\t\t\treturn false;\n\t\tfor (auto &it : entries)\n\t\t\tif (!other.count(it.udata))\n\t\t\t\treturn false;\n\t\treturn true;\n\t}\n\n\tbool operator!=(const pool &other) const {\n\t\treturn !operator==(other);\n\t}\n\n\t[[nodiscard]] Hasher hash_into(Hasher h) const {\n\t\tcommutative_hash comm;\n\t\tfor (auto &it : entries) {\n\t\t\tcomm.eat(ops.hash(it.udata));\n\t\t}\n\t\treturn comm.hash_into(h);\n\t}\n\n\tvoid reserve(size_t n) { entries.reserve(n); }\n\tsize_t size() const { return entries.size(); }\n\tbool empty() const { return entries.empty(); }\n\tvoid clear() { hashtable.clear(); entries.clear(); }\n\n\titerator begin() { return iterator(this, int(entries.size())-1); }\n\titerator element(int n) { return iterator(this, int(entries.size())-1-n); }\n\titerator end() { return iterator(nullptr, -1); }\n\n\tconst_iterator begin() const { return const_iterator(this, int(entries.size())-1); }\n\tconst_iterator element(int n) const { return const_iterator(this, int(entries.size())-1-n); }\n\tconst_iterator end() const { return const_iterator(nullptr, -1); }\n};\n\ntemplate<typename K, int offset, typename OPS>\nclass idict\n{\n\tpool<K, OPS> database;\n\npublic:\n\tclass const_iterator\n\t{\n\t\tfriend class idict;\n\tprotected:\n\t\tconst idict &container;\n\t\tint index;\n\t\tconst_iterator(const idict &container, int index) : container(container), index(index) { }\n\tpublic:\n\t\ttypedef std::forward_iterator_tag iterator_category;\n\t\ttypedef K value_type;\n\t\ttypedef ptrdiff_t difference_type;\n\t\ttypedef K* pointer;\n\t\ttypedef K& reference;\n\t\tconst_iterator() { }\n\t\tconst_iterator operator++() { index++; return *this; }\n\t\tbool operator==(const const_iterator &other) const { return index == other.index; }\n\t\tbool operator!=(const const_iterator &other) const { return index != other.index; }\n\t\tconst K &operator*() const { return container[index]; }\n\t\tconst K *operator->() const { return &container[index]; }\n\t};\n\n\tconstexpr idict()\n\t{\n\t}\n\n\tint operator()(const K &key)\n\t{\n\t\tHasher::hash_t hash = database.do_hash(key);\n\t\tint i = database.do_lookup(key, hash);\n\t\tif (i < 0)\n\t\t\ti = database.do_insert(key, hash);\n\t\treturn i + offset;\n\t}\n\n\tint at(const K &key) const\n\t{\n\t\tHasher::hash_t hash = database.do_hash(key);\n\t\tint i = database.do_lookup_no_rehash(key, hash);\n\t\tif (i < 0)\n\t\t\tthrow std::out_of_range(\"idict::at()\");\n\t\treturn i + offset;\n\t}\n\n\tint at(const K &key, int defval) const\n\t{\n\t\tHasher::hash_t hash = database.do_hash(key);\n\t\tint i = database.do_lookup_no_rehash(key, hash);\n\t\tif (i < 0)\n\t\t\treturn defval;\n\t\treturn i + offset;\n\t}\n\n\tint count(const K &key) const\n\t{\n\t\tHasher::hash_t hash = database.do_hash(key);\n\t\tint i = database.do_lookup_no_rehash(key, hash);\n\t\treturn i < 0 ? 0 : 1;\n\t}\n\n\tvoid expect(const K &key, int i)\n\t{\n\t\tint j = (*this)(key);\n\t\tif (i != j)\n\t\t\tthrow std::out_of_range(\"idict::expect()\");\n\t}\n\n\tconst K &operator[](int index) const\n\t{\n\t\treturn database.entries.at(index - offset).udata;\n\t}\n\n\tvoid swap(idict &other)\n\t{\n\t\tdatabase.swap(other.database);\n\t}\n\n\tvoid reserve(size_t n) { database.reserve(n); }\n\tsize_t size() const { return database.size(); }\n\tbool empty() const { return database.empty(); }\n\tvoid clear() { database.clear(); }\n\n\tconst_iterator begin() const { return const_iterator(*this, offset); }\n\tconst_iterator element(int n) const { return const_iterator(*this, n); }\n\tconst_iterator end() const { return const_iterator(*this, offset + size()); }\n};\n\n/**\n * Union-find data structure with a promotion method\n * mfp stands for \"merge, find, promote\"\n * i-prefixed methods operate on indices in parents\n*/\ntemplate<typename K, typename OPS>\nclass mfp\n{\n\tmutable idict<K, 0, OPS> database;\n\tmutable std::vector<int> parents;\n\npublic:\n\ttypedef typename idict<K, 0>::const_iterator const_iterator;\n\n\tconstexpr mfp()\n\t{\n\t}\n\n\t// Finds a given element's index. If it isn't in the data structure,\n\t// it is added as its own set\n\tint operator()(const K &key) const\n\t{\n\t\tint i = database(key);\n\t\t// If the lookup caused the database to grow,\n\t\t// also add a corresponding entry in parents initialized to -1 (no parent)\n\t\tparents.resize(database.size(), -1);\n\t\treturn i;\n\t}\n\n\t// Finds an element at given index\n\tconst K &operator[](int index) const\n\t{\n\t\treturn database[index];\n\t}\n\n\tint ifind(int i) const\n\t{\n\t\tint p = i, k = i;\n\n\t\twhile (parents[p] != -1)\n\t\t\tp = parents[p];\n\n\t\t// p is now the representative of i\n\t\t// Now we traverse from i up to the representative again\n\t\t// and make p the parent of all the nodes along the way.\n\t\t// This is a side effect and doesn't affect the return value.\n\t\t// It speeds up future find operations\n\t\twhile (k != p) {\n\t\t\tint next_k = parents[k];\n\t\t\tparents[k] = p;\n\t\t\tk = next_k;\n\t\t}\n\n\t\treturn p;\n\t}\n\n\t// Merge sets if the given indices belong to different sets.\n\t// Makes ifind(j) the root of the merged set.\n\tvoid imerge(int i, int j)\n\t{\n\t\ti = ifind(i);\n\t\tj = ifind(j);\n\n\t\tif (i != j)\n\t\t\tparents[i] = j;\n\t}\n\n\tvoid ipromote(int i)\n\t{\n\t\tint k = i;\n\n\t\twhile (k != -1) {\n\t\t\tint next_k = parents[k];\n\t\t\tparents[k] = i;\n\t\t\tk = next_k;\n\t\t}\n\n\t\tparents[i] = -1;\n\t}\n\n\tint lookup(const K &a) const\n\t{\n\t\treturn ifind((*this)(a));\n\t}\n\n\tconst K &find(const K &a) const\n\t{\n\t\tint i = database.at(a, -1);\n\t\tif (i < 0)\n\t\t\treturn a;\n\t\treturn (*this)[ifind(i)];\n\t}\n\n\tvoid merge(const K &a, const K &b)\n\t{\n\t\timerge((*this)(a), (*this)(b));\n\t}\n\n\tvoid promote(const K &a)\n\t{\n\t\tint i = database.at(a, -1);\n\t\tif (i >= 0)\n\t\t\tipromote(i);\n\t}\n\n\tvoid swap(mfp &other)\n\t{\n\t\tdatabase.swap(other.database);\n\t\tparents.swap(other.parents);\n\t}\n\n\tvoid reserve(size_t n) { database.reserve(n); }\n\tsize_t size() const { return database.size(); }\n\tbool empty() const { return database.empty(); }\n\tvoid clear() { database.clear(); parents.clear(); }\n\n\tconst_iterator begin() const { return database.begin(); }\n\tconst_iterator element(int n) const { return database.element(n); }\n\tconst_iterator end() const { return database.end(); }\n};\n\n} /* namespace hashlib */\n\n#endif\n",
|
|
177
177
|
"io.h": "#include <string>\n#include <stdarg.h>\n#include <type_traits>\n#include \"kernel/yosys_common.h\"\n\n#ifndef YOSYS_IO_H\n#define YOSYS_IO_H\n\nYOSYS_NAMESPACE_BEGIN\n\ninline std::string vstringf(const char *fmt, va_list ap)\n{\n\t// For the common case of strings shorter than 128, save a heap\n\t// allocation by using a stack allocated buffer.\n\tconst int kBufSize = 128;\n\tchar buf[kBufSize];\n\tbuf[0] = '\\0';\n\tva_list apc;\n\tva_copy(apc, ap);\n\tint n = vsnprintf(buf, kBufSize, fmt, apc);\n\tva_end(apc);\n\tif (n < kBufSize)\n\t\treturn std::string(buf);\n\n\tstd::string string;\n\tchar *str = NULL;\n#if defined(_WIN32) || defined(__CYGWIN__)\n\tint sz = 2 * kBufSize, rc;\n\twhile (1) {\n\t\tva_copy(apc, ap);\n\t\tstr = (char *)realloc(str, sz);\n\t\trc = vsnprintf(str, sz, fmt, apc);\n\t\tva_end(apc);\n\t\tif (rc >= 0 && rc < sz)\n\t\t\tbreak;\n\t\tsz *= 2;\n\t}\n\tif (str != NULL) {\n\t\tstring = str;\n\t\tfree(str);\n\t}\n\treturn string;\n#else\n\tif (vasprintf(&str, fmt, ap) < 0)\n\t\tstr = NULL;\n\tif (str != NULL) {\n\t\tstring = str;\n\t\tfree(str);\n\t}\n\treturn string;\n#endif\n}\n\nenum ConversionSpecifier : uint8_t\n{\n\tCONVSPEC_NONE,\n\t// Specifier not understood/supported\n\tCONVSPEC_ERROR,\n\t// Consumes a \"long long\"\n\tCONVSPEC_SIGNED_INT,\n\t// Consumes a \"unsigned long long\"\n\tCONVSPEC_UNSIGNED_INT,\n\t// Consumes a \"double\"\n\tCONVSPEC_DOUBLE,\n\t// Consumes a \"const char*\" or other string type\n\tCONVSPEC_CHAR_PTR,\n\t// Consumes a \"void*\"\n\tCONVSPEC_VOID_PTR,\n};\n\nconstexpr ConversionSpecifier parse_conversion_specifier(char ch, char prev_ch)\n{\n\tswitch (ch) {\n\tcase 'd':\n\tcase 'i':\n\t\treturn CONVSPEC_SIGNED_INT;\n\tcase 'o':\n\tcase 'u':\n\tcase 'x':\n\tcase 'X':\n\tcase 'm':\n\t\treturn CONVSPEC_UNSIGNED_INT;\n\tcase 'c':\n\t\tif (prev_ch == 'l' || prev_ch == 'q' || prev_ch == 'L') {\n\t\t\t// wchar not supported\n\t\t\treturn CONVSPEC_ERROR;\n\t\t}\n\t\treturn CONVSPEC_UNSIGNED_INT;\n\tcase 'e':\n\tcase 'E':\n\tcase 'f':\n\tcase 'F':\n\tcase 'g':\n\tcase 'G':\n\tcase 'a':\n\tcase 'A':\n\t\treturn CONVSPEC_DOUBLE;\n\tcase 's':\n\t\tif (prev_ch == 'l' || prev_ch == 'q' || prev_ch == 'L') {\n\t\t\t// wchar not supported\n\t\t\treturn CONVSPEC_ERROR;\n\t\t}\n\t\treturn CONVSPEC_CHAR_PTR;\n\tcase 'p':\n\t\treturn CONVSPEC_VOID_PTR;\n\tcase '$': // positional parameters\n\tcase 'n':\n\tcase 'S':\n\t\treturn CONVSPEC_ERROR;\n\tdefault:\n\t\treturn CONVSPEC_NONE;\n\t}\n}\n\nenum class DynamicIntCount : uint8_t {\n\tNONE = 0,\n\tONE = 1,\n\tTWO = 2,\n};\n\n// Describes a printf-style format conversion specifier found in a format string.\nstruct FoundFormatSpec\n{\n\t// The start offset of the conversion spec in the format string.\n\tint start;\n\t// The end offset of the conversion spec in the format string.\n\tint end;\n\tConversionSpecifier spec;\n\t// Number of int args consumed by '*' dynamic width/precision args.\n\tDynamicIntCount num_dynamic_ints;\n};\n\n// Ensure there is no format spec.\nconstexpr void ensure_no_format_spec(std::string_view fmt, int index, bool *has_escapes)\n{\n\tint fmt_size = static_cast<int>(fmt.size());\n\t// A trailing '%' is not a format spec.\n\twhile (index + 1 < fmt_size) {\n\t\tif (fmt[index] != '%') {\n\t\t\t++index;\n\t\t\tcontinue;\n\t\t}\n\t\tif (fmt[index + 1] != '%') {\n\t\t\tYOSYS_ABORT(\"More format conversion specifiers than arguments\");\n\t\t}\n\t\t*has_escapes = true;\n\t\tindex += 2;\n\t}\n}\n\n// Returns the next format conversion specifier (starting with '%').\n// Returns CONVSPEC_NONE if there isn't a format conversion specifier.\nconstexpr FoundFormatSpec find_next_format_spec(std::string_view fmt, int fmt_start, bool *has_escapes)\n{\n\tint index = fmt_start;\n\tint fmt_size = static_cast<int>(fmt.size());\n\twhile (index < fmt_size) {\n\t\tif (fmt[index] != '%') {\n\t\t\t++index;\n\t\t\tcontinue;\n\t\t}\n\t\tint p = index + 1;\n\t\tuint8_t num_dynamic_ints = 0;\n\t\twhile (true) {\n\t\t\tif (p == fmt_size) {\n\t\t\t\treturn {0, 0, CONVSPEC_NONE, DynamicIntCount::NONE};\n\t\t\t}\n\t\t\tif (fmt[p] == '%') {\n\t\t\t\t*has_escapes = true;\n\t\t\t\tindex = p + 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (fmt[p] == '*') {\n\t\t\t\tif (num_dynamic_ints >= 2) {\n\t\t\t\t\treturn {0, 0, CONVSPEC_ERROR, DynamicIntCount::NONE};\n\t\t\t\t}\n\t\t\t\t++num_dynamic_ints;\n\t\t\t}\n\t\t\tConversionSpecifier spec = parse_conversion_specifier(fmt[p], fmt[p - 1]);\n\t\t\tif (spec != CONVSPEC_NONE) {\n\t\t\t\treturn {index, p + 1, spec, static_cast<DynamicIntCount>(num_dynamic_ints)};\n\t\t\t}\n\t\t\t++p;\n\t\t}\n\t}\n\treturn {0, 0, CONVSPEC_NONE, DynamicIntCount::NONE};\n}\n\ntemplate <typename... Args>\nconstexpr typename std::enable_if<sizeof...(Args) == 0>::type\ncheck_format(std::string_view fmt, int fmt_start, bool *has_escapes, FoundFormatSpec*, DynamicIntCount)\n{\n\tensure_no_format_spec(fmt, fmt_start, has_escapes);\n}\n\n// Check that the format string `fmt.substr(fmt_start)` is valid for the given type arguments.\n// Fills `specs` with the FoundFormatSpecs found in the format string.\n// `int_args_consumed` is the number of int arguments already consumed to satisfy the\n// dynamic width/precision args for the next format conversion specifier.\ntemplate <typename Arg, typename... Args>\nconstexpr void check_format(std::string_view fmt, int fmt_start, bool *has_escapes, FoundFormatSpec* specs,\n DynamicIntCount int_args_consumed)\n{\n\tFoundFormatSpec found = find_next_format_spec(fmt, fmt_start, has_escapes);\n\tif (found.num_dynamic_ints > int_args_consumed) {\n\t\t// We need to consume at least one more int for the dynamic\n\t\t// width/precision of this format conversion specifier.\n\t\tif constexpr (!std::is_convertible_v<Arg, int>) {\n\t\t\tYOSYS_ABORT(\"Expected dynamic int argument\");\n\t\t}\n\t\tcheck_format<Args...>(fmt, fmt_start, has_escapes, specs,\n\t\t\tstatic_cast<DynamicIntCount>(static_cast<uint8_t>(int_args_consumed) + 1));\n\t\treturn;\n\t}\n\tswitch (found.spec) {\n\tcase CONVSPEC_NONE:\n\t\tYOSYS_ABORT(\"Expected format conversion specifier for argument\");\n\t\tbreak;\n\tcase CONVSPEC_ERROR:\n\t\tYOSYS_ABORT(\"Found unsupported format conversion specifier\");\n\t\tbreak;\n\tcase CONVSPEC_SIGNED_INT:\n\t\tif constexpr (!std::is_convertible_v<Arg, long long>) {\n\t\t\tYOSYS_ABORT(\"Expected type convertible to signed integer\");\n\t\t}\n\t\t*specs = found;\n\t\tbreak;\n\tcase CONVSPEC_UNSIGNED_INT:\n\t\tif constexpr (!std::is_convertible_v<Arg, unsigned long long>) {\n\t\t\tYOSYS_ABORT(\"Expected type convertible to unsigned integer\");\n\t\t}\n\t\t*specs = found;\n\t\tbreak;\n\tcase CONVSPEC_DOUBLE:\n\t\tif constexpr (!std::is_convertible_v<Arg, double>) {\n\t\t\tYOSYS_ABORT(\"Expected type convertible to double\");\n\t\t}\n\t\t*specs = found;\n\t\tbreak;\n\tcase CONVSPEC_CHAR_PTR:\n\t\tif constexpr (!std::is_convertible_v<Arg, const char *> &&\n\t\t !std::is_convertible_v<Arg, const std::string &> &&\n\t\t\t!std::is_convertible_v<Arg, const std::string_view &>) {\n\t\t\tYOSYS_ABORT(\"Expected type convertible to char *\");\n\t\t}\n\t\t*specs = found;\n\t\tbreak;\n\tcase CONVSPEC_VOID_PTR:\n\t\tif constexpr (!std::is_convertible_v<Arg, const void *>) {\n\t\t\tYOSYS_ABORT(\"Expected pointer type\");\n\t\t}\n\t\t*specs = found;\n\t\tbreak;\n\t}\n\tcheck_format<Args...>(fmt, found.end, has_escapes, specs + 1, DynamicIntCount::NONE);\n}\n\n// Emit the string representation of `arg` that has been converted to a `long long'.\nvoid format_emit_long_long(std::string &result, std::string_view spec, int *dynamic_ints,\n\tDynamicIntCount num_dynamic_ints, long long arg);\n\n// Emit the string representation of `arg` that has been converted to a `unsigned long long'.\nvoid format_emit_unsigned_long_long(std::string &result, std::string_view spec, int *dynamic_ints,\n\tDynamicIntCount num_dynamic_ints, unsigned long long arg);\n\n// Emit the string representation of `arg` that has been converted to a `double'.\nvoid format_emit_double(std::string &result, std::string_view spec, int *dynamic_ints,\n\tDynamicIntCount num_dynamic_ints, double arg);\n\n// Emit the string representation of `arg` that has been converted to a `const char*'.\nvoid format_emit_char_ptr(std::string &result, std::string_view spec, int *dynamic_ints,\n\tDynamicIntCount num_dynamic_ints, const char *arg);\n\n// Emit the string representation of `arg` that has been converted to a `std::string'.\nvoid format_emit_string(std::string &result, std::string_view spec, int *dynamic_ints,\n\tDynamicIntCount num_dynamic_ints, const std::string &arg);\n\n// Emit the string representation of `arg` that has been converted to a `std::string_view'.\nvoid format_emit_string_view(std::string &result, std::string_view spec, int *dynamic_ints,\n\tDynamicIntCount num_dynamic_ints, std::string_view arg);\n\n// Emit the string representation of `arg` that has been converted to a `double'.\nvoid format_emit_void_ptr(std::string &result, std::string_view spec, int *dynamic_ints,\n\tDynamicIntCount num_dynamic_ints, const void *arg);\n\n// Emit the string representation of `arg` according to the given `FoundFormatSpec`,\n// appending it to `result`.\ntemplate <typename Arg>\ninline void format_emit_one(std::string &result, std::string_view fmt, const FoundFormatSpec &ffspec,\n\tint *dynamic_ints, const Arg& arg)\n{\n\tstd::string_view spec = fmt.substr(ffspec.start, ffspec.end - ffspec.start);\n\tDynamicIntCount num_dynamic_ints = ffspec.num_dynamic_ints;\n\tswitch (ffspec.spec) {\n\tcase CONVSPEC_SIGNED_INT:\n\t\tif constexpr (std::is_convertible_v<Arg, long long>) {\n\t\t\tlong long s = arg;\n\t\t\tformat_emit_long_long(result, spec, dynamic_ints, num_dynamic_ints, s);\n\t\t\treturn;\n\t\t}\n\t\tbreak;\n\tcase CONVSPEC_UNSIGNED_INT:\n\t\tif constexpr (std::is_convertible_v<Arg, unsigned long long>) {\n\t\t\tunsigned long long s = arg;\n\t\t\tformat_emit_unsigned_long_long(result, spec, dynamic_ints, num_dynamic_ints, s);\n\t\t\treturn;\n\t\t}\n\t\tbreak;\n\tcase CONVSPEC_DOUBLE:\n\t\tif constexpr (std::is_convertible_v<Arg, double>) {\n\t\t\tdouble s = arg;\n\t\t\tformat_emit_double(result, spec, dynamic_ints, num_dynamic_ints, s);\n\t\t\treturn;\n\t\t}\n\t\tbreak;\n\tcase CONVSPEC_CHAR_PTR:\n\t\tif constexpr (std::is_convertible_v<Arg, const char *>) {\n\t\t\tconst char *s = arg;\n\t\t\tformat_emit_char_ptr(result, spec, dynamic_ints, num_dynamic_ints, s);\n\t\t\treturn;\n\t\t}\n\t\tif constexpr (std::is_convertible_v<Arg, const std::string &>) {\n\t\t\tconst std::string &s = arg;\n\t\t\tformat_emit_string(result, spec, dynamic_ints, num_dynamic_ints, s);\n\t\t\treturn;\n\t\t}\n\t\tif constexpr (std::is_convertible_v<Arg, const std::string_view &>) {\n\t\t\tconst std::string_view &s = arg;\n\t\t\tformat_emit_string_view(result, spec, dynamic_ints, num_dynamic_ints, s);\n\t\t\treturn;\n\t\t}\n\t\tbreak;\n\tcase CONVSPEC_VOID_PTR:\n\t\tif constexpr (std::is_convertible_v<Arg, const void *>) {\n\t\t\tconst void *s = arg;\n\t\t\tformat_emit_void_ptr(result, spec, dynamic_ints, num_dynamic_ints, s);\n\t\t\treturn;\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\tbreak;\n\t}\n\tYOSYS_ABORT(\"Internal error\");\n}\n\n// Append the format string `fmt` to `result`, assuming there are no format conversion\n// specifiers other than \"%%\" and therefore no arguments. Unescape \"%%\".\nvoid format_emit_unescaped(std::string &result, std::string_view fmt);\nstd::string unescape_format_string(std::string_view fmt);\n\ninline void format_emit(std::string &result, std::string_view fmt, int fmt_start,\n\tbool has_escapes, const FoundFormatSpec*, int*, DynamicIntCount)\n{\n\tfmt = fmt.substr(fmt_start);\n\tif (has_escapes) {\n\t\tformat_emit_unescaped(result, fmt);\n\t} else {\n\t\tresult += fmt;\n\t}\n}\n// Format `args` according to `fmt` (starting at `fmt_start`) and `specs` and append to `result`.\n// `num_dynamic_ints` in `dynamic_ints[]` have already been collected to provide as\n// dynamic width/precision args for the next format conversion specifier.\ntemplate <typename Arg, typename... Args>\ninline void format_emit(std::string &result, std::string_view fmt, int fmt_start, bool has_escapes,\n\tconst FoundFormatSpec* specs, int *dynamic_ints, DynamicIntCount num_dynamic_ints,\n\tconst Arg &arg, const Args &... args)\n{\n\tif (specs->num_dynamic_ints > num_dynamic_ints) {\n\t\t// Collect another int for the dynamic width precision/args\n\t\t// for the next format conversion specifier.\n\t\tif constexpr (std::is_convertible_v<Arg, int>) {\n\t\t\tdynamic_ints[static_cast<uint8_t>(num_dynamic_ints)] = arg;\n\t\t} else {\n\t\t\tYOSYS_ABORT(\"Internal error\");\n\t\t}\n\t\tformat_emit(result, fmt, fmt_start, has_escapes, specs, dynamic_ints,\n\t\t static_cast<DynamicIntCount>(static_cast<uint8_t>(num_dynamic_ints) + 1), args...);\n\t\treturn;\n\t}\n\tstd::string_view str = fmt.substr(fmt_start, specs->start - fmt_start);\n\tif (has_escapes) {\n\t\tformat_emit_unescaped(result, str);\n\t} else {\n\t\tresult += str;\n\t}\n\tformat_emit_one(result, fmt, *specs, dynamic_ints, arg);\n\tformat_emit(result, fmt, specs->end, has_escapes, specs + 1, dynamic_ints, DynamicIntCount::NONE, args...);\n}\n\ntemplate <typename... Args>\ninline std::string format_emit_toplevel(std::string_view fmt, bool has_escapes, const FoundFormatSpec* specs, const Args &... args)\n{\n\tstd::string result;\n\tint dynamic_ints[2] = { 0, 0 };\n\tformat_emit(result, fmt, 0, has_escapes, specs, dynamic_ints, DynamicIntCount::NONE, args...);\n\treturn result;\n}\ntemplate <>\ninline std::string format_emit_toplevel(std::string_view fmt, bool has_escapes, const FoundFormatSpec*)\n{\n\tif (!has_escapes) {\n\t\treturn std::string(fmt);\n\t}\n\treturn unescape_format_string(fmt);\n}\n\n// This class parses format strings to build a list of `FoundFormatSpecs` in `specs`.\n// When the compiler supports `consteval` (C++20), this parsing happens at compile time and\n// type errors will be reported at compile time. Otherwise the parsing happens at\n// runtime and type errors will trigger an `abort()` at runtime.\ntemplate <typename... Args>\nclass FmtString\n{\npublic:\n\t// Implicit conversion from const char * means that users can pass\n\t// C string constants which are automatically parsed.\n\tYOSYS_CONSTEVAL FmtString(const char *p) : fmt(p)\n\t{\n\t\tcheck_format<Args...>(fmt, 0, &has_escapes, specs, DynamicIntCount::NONE);\n\t}\n\tstd::string format(const Args &... args)\n\t{\n\t\treturn format_emit_toplevel(fmt, has_escapes, specs, args...);\n\t}\nprivate:\n\tstd::string_view fmt;\n\tbool has_escapes = false;\n\tFoundFormatSpec specs[sizeof...(Args)] = {};\n};\n\ntemplate <typename T> struct WrapType { using type = T; };\ntemplate <typename T> using TypeIdentity = typename WrapType<T>::type;\n\ntemplate <typename... Args>\ninline std::string stringf(FmtString<TypeIdentity<Args>...> fmt, Args... args)\n{\n\treturn fmt.format(args...);\n}\n\nint readsome(std::istream &f, char *s, int n);\nstd::string next_token(std::string &text, const char *sep = \" \\t\\r\\n\", bool long_strings = false);\nstd::vector<std::string> split_tokens(const std::string &text, const char *sep = \" \\t\\r\\n\");\nbool patmatch(const char *pattern, const char *string);\n#if !defined(YOSYS_DISABLE_SPAWN)\nint run_command(const std::string &command, std::function<void(const std::string&)> process_line = std::function<void(const std::string&)>());\n#endif\nstd::string get_base_tmpdir();\nstd::string make_temp_file(std::string template_str = get_base_tmpdir() + \"/yosys_XXXXXX\");\nstd::string make_temp_dir(std::string template_str = get_base_tmpdir() + \"/yosys_XXXXXX\");\nbool check_file_exists(const std::string& filename, bool is_exec = false);\nbool check_directory_exists(const std::string& dirname, bool is_exec = false);\nbool is_absolute_path(std::string filename);\nvoid remove_directory(std::string dirname);\nbool create_directory(const std::string& dirname);\nstd::string escape_filename_spaces(const std::string& filename);\n\nYOSYS_NAMESPACE_END\n\n#endif // YOSYS_IO_H\n",
|
|
178
178
|
"json.h": "/*\n * yosys -- Yosys Open SYnthesis Suite\n *\n * Copyright (C) 2022 Jannis Harder <jix@yosyshq.com> <me@jix.one>\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n *\n */\n\n#ifndef JSON_H\n#define JSON_H\n\n#include \"kernel/yosys.h\"\n#include \"libs/json11/json11.hpp\"\n#include <functional>\n\nYOSYS_NAMESPACE_BEGIN\n\nusing json11::Json;\n\nclass PrettyJson\n{\n enum Scope {\n VALUE,\n OBJECT_FIRST,\n OBJECT,\n ARRAY_FIRST,\n ARRAY,\n };\n\n struct Target {\n virtual void emit(const char *data) = 0;\n virtual void flush() {};\n virtual ~Target() {};\n };\n\n std::string newline_indent = \"\\n\";\n std::vector<std::unique_ptr<Target>> targets;\n std::vector<Scope> state = {VALUE};\n int compact_depth = INT_MAX;\npublic:\n\n void emit_to_log();\n void append_to_string(std::string &target);\n bool write_to_file(const std::string &path);\n\n bool active() { return !targets.empty(); }\n\n void compact() { compact_depth = GetSize(state); }\n\n void line(bool space_if_inline = true);\n void raw(const char *raw_json);\n void flush();\n void begin_object();\n void begin_array();\n void end_object();\n void end_array();\n void name(const char *name);\n void begin_value();\n void end_value();\n void value_json(const Json &value);\n void value(unsigned int value) { value_json(Json((int)value)); }\n template<typename T>\n void value(T &&value) { value_json(Json(std::forward<T>(value))); };\n\n void entry_json(const char *name, const Json &value);\n void entry(const char *name, unsigned int value) { entry_json(name, Json((int)value)); }\n template<typename T>\n void entry(const char *name, T &&value) { entry_json(name, Json(std::forward<T>(value))); };\n\n template<typename T>\n void object(const T &&values)\n {\n begin_object();\n for (auto &item : values)\n entry(item.first, item.second);\n end_object();\n }\n\n template<typename T>\n void array(const T &&values)\n {\n begin_array();\n for (auto &item : values)\n value(item);\n end_array();\n }\n};\n\n\n\nYOSYS_NAMESPACE_END\n\n#endif\n",
|
|
179
179
|
"log.h": "/*\n * yosys -- Yosys Open SYnthesis Suite\n *\n * Copyright (C) 2012 Claire Xenia Wolf <claire@yosyshq.com>\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n *\n */\n\n#ifndef LOG_H\n#define LOG_H\n\n#include \"kernel/yosys_common.h\"\n\n#include <time.h>\n\n#include <regex>\n#define YS_REGEX_COMPILE(param) std::regex(param, \\\n\t\t\t\tstd::regex_constants::nosubs | \\\n\t\t\t\tstd::regex_constants::optimize | \\\n\t\t\t\tstd::regex_constants::egrep)\n#define YS_REGEX_COMPILE_WITH_SUBS(param) std::regex(param, \\\n\t\t\t\tstd::regex_constants::optimize | \\\n\t\t\t\tstd::regex_constants::egrep)\n\n#if defined(_WIN32)\n# include <intrin.h>\n#else\n# include <sys/time.h>\n# include <sys/resource.h>\n# if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))\n# include <signal.h>\n# endif\n#endif\n\n#if defined(_MSC_VER)\n// At least this is not in MSVC++ 2013.\n# define __PRETTY_FUNCTION__ __FUNCTION__\n#endif\n\n// from libs/sha1/sha1.h\nclass SHA1;\n\nYOSYS_NAMESPACE_BEGIN\n\n#define S__LINE__sub2(x) #x\n#define S__LINE__sub1(x) S__LINE__sub2(x)\n#define S__LINE__ S__LINE__sub1(__LINE__)\n\n// YS_DEBUGTRAP is a macro that is functionally equivalent to a breakpoint\n// if the platform provides such functionality, and does nothing otherwise.\n// If no debugger is attached, it starts a just-in-time debugger if available,\n// and crashes the process otherwise.\n#if defined(_WIN32)\n# define YS_DEBUGTRAP __debugbreak()\n#else\n# ifndef __has_builtin\n// __has_builtin is a GCC/Clang extension; on a different compiler (or old enough GCC/Clang)\n// that does not have it, using __has_builtin(...) is a syntax error.\n# define __has_builtin(x) 0\n# endif\n# if __has_builtin(__builtin_debugtrap)\n# define YS_DEBUGTRAP __builtin_debugtrap()\n# elif defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))\n# define YS_DEBUGTRAP raise(SIGTRAP)\n# else\n# define YS_DEBUGTRAP do {} while(0)\n# endif\n#endif\n\n// YS_DEBUGTRAP_IF_DEBUGGING is a macro that is functionally equivalent to a breakpoint\n// if a debugger is attached, and does nothing otherwise.\n#if defined(_WIN32)\n# define YS_DEBUGTRAP_IF_DEBUGGING do { if (IsDebuggerPresent()) DebugBreak(); } while(0)\n# elif defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))\n// There is no reliable (or portable) *nix equivalent of IsDebuggerPresent(). However,\n// debuggers will stop when SIGTRAP is raised, even if the action is set to ignore.\n# define YS_DEBUGTRAP_IF_DEBUGGING do { \\\n\t\tauto old = signal(SIGTRAP, SIG_IGN); raise(SIGTRAP); signal(SIGTRAP, old); \\\n\t} while(0)\n#else\n# define YS_DEBUGTRAP_IF_DEBUGGING do {} while(0)\n#endif\n\nstruct log_cmd_error_exception { };\n\nextern std::vector<FILE*> log_files;\nextern std::vector<std::ostream*> log_streams;\nextern std::vector<std::string> log_scratchpads;\nextern std::map<std::string, std::set<std::string>> log_hdump;\nextern std::vector<std::regex> log_warn_regexes, log_nowarn_regexes, log_werror_regexes;\nextern std::set<std::string> log_warnings, log_experimentals, log_experimentals_ignored;\nextern int log_warnings_count;\nextern int log_warnings_count_noexpect;\nextern bool log_expect_no_warnings;\nextern bool log_hdump_all;\nextern FILE *log_errfile;\nextern SHA1 *log_hasher;\n\nextern bool log_time;\nextern bool log_error_stderr;\nextern bool log_cmd_error_throw;\nextern bool log_quiet_warnings;\nextern int log_verbose_level;\nextern string log_last_error;\nextern void (*log_error_atexit)();\n\nextern int log_make_debug;\nextern int log_force_debug;\nextern int log_debug_suppressed;\n\nvoid logv(const char *format, va_list ap);\nvoid logv_header(RTLIL::Design *design, const char *format, va_list ap);\nvoid logv_warning(const char *format, va_list ap);\nvoid logv_warning_noprefix(const char *format, va_list ap);\n[[noreturn]] void logv_error(const char *format, va_list ap);\n[[noreturn]] void logv_file_error(const string &filename, int lineno, const char *format, va_list ap);\n\nvoid log(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2));\nvoid log_header(RTLIL::Design *design, const char *format, ...) YS_ATTRIBUTE(format(printf, 2, 3));\nvoid log_warning(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2));\nvoid log_experimental(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2));\n\nvoid set_verific_logging(void (*cb)(int msg_type, const char *message_id, const char* file_path, unsigned int left_line, unsigned int left_col, unsigned int right_line, unsigned int right_col, const char *msg));\nextern void (*log_verific_callback)(int msg_type, const char *message_id, const char* file_path, unsigned int left_line, unsigned int left_col, unsigned int right_line, unsigned int right_col, const char *msg);\n\n// Log with filename to report a problem in a source file.\nvoid log_file_warning(const std::string &filename, int lineno, const char *format, ...) YS_ATTRIBUTE(format(printf, 3, 4));\nvoid log_file_info(const std::string &filename, int lineno, const char *format, ...) YS_ATTRIBUTE(format(printf, 3, 4));\n\nvoid log_warning_noprefix(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2));\n[[noreturn]] void log_error(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2));\n[[noreturn]] void log_file_error(const string &filename, int lineno, const char *format, ...) YS_ATTRIBUTE(format(printf, 3, 4));\n[[noreturn]] void log_cmd_error(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2));\n\n#ifndef NDEBUG\nstatic inline bool ys_debug(int n = 0) { if (log_force_debug) return true; log_debug_suppressed += n; return false; }\n#else\nstatic inline bool ys_debug(int = 0) { return false; }\n#endif\n# define log_debug(...) do { if (ys_debug(1)) log(__VA_ARGS__); } while (0)\n\nstatic inline void log_suppressed() {\n\tif (log_debug_suppressed && !log_make_debug) {\n\t\tlog(\"<suppressed ~%d debug messages>\\n\", log_debug_suppressed);\n\t\tlog_debug_suppressed = 0;\n\t}\n}\n\nstruct LogMakeDebugHdl {\n\tbool status = false;\n\tLogMakeDebugHdl(bool start_on = false) {\n\t\tif (start_on)\n\t\t\ton();\n\t}\n\t~LogMakeDebugHdl() {\n\t\toff();\n\t}\n\tvoid on() {\n\t\tif (status) return;\n\t\tstatus=true;\n\t\tlog_make_debug++;\n\t}\n\tvoid off_silent() {\n\t\tif (!status) return;\n\t\tstatus=false;\n\t\tlog_make_debug--;\n\t}\n\tvoid off() {\n\t\toff_silent();\n\t}\n};\n\nvoid log_spacer();\nvoid log_push();\nvoid log_pop();\n\nvoid log_backtrace(const char *prefix, int levels);\nvoid log_reset_stack();\nvoid log_flush();\n\nstruct LogExpectedItem\n{\n\tLogExpectedItem(const std::regex &pat, int expected) :\n\t\t\tpattern(pat), expected_count(expected), current_count(0) {}\n\tLogExpectedItem() : expected_count(0), current_count(0) {}\n\n\tstd::regex pattern;\n\tint expected_count;\n\tint current_count;\n};\n\nextern dict<std::string, LogExpectedItem> log_expect_log, log_expect_warning, log_expect_error;\nextern dict<std::string, LogExpectedItem> log_expect_prefix_log, log_expect_prefix_warning, log_expect_prefix_error;\nvoid log_check_expected();\n\nconst char *log_signal(const RTLIL::SigSpec &sig, bool autoint = true);\nconst char *log_const(const RTLIL::Const &value, bool autoint = true);\nconst char *log_id(const RTLIL::IdString &id);\nconst char *log_str(const char *str);\nconst char *log_str(std::string const &str);\n\ntemplate<typename T> static inline const char *log_id(T *obj, const char *nullstr = nullptr) {\n\tif (nullstr && obj == nullptr)\n\t\treturn nullstr;\n\treturn log_id(obj->name);\n}\n\nvoid log_module(RTLIL::Module *module, std::string indent = \"\");\nvoid log_cell(RTLIL::Cell *cell, std::string indent = \"\");\nvoid log_wire(RTLIL::Wire *wire, std::string indent = \"\");\n\n#ifndef NDEBUG\nstatic inline void log_assert_worker(bool cond, const char *expr, const char *file, int line) {\n\tif (!cond) log_error(\"Assert `%s' failed in %s:%d.\\n\", expr, file, line);\n}\n# define log_assert(_assert_expr_) YOSYS_NAMESPACE_PREFIX log_assert_worker(_assert_expr_, #_assert_expr_, __FILE__, __LINE__)\n#else\n# define log_assert(_assert_expr_) do { if (0) { (void)(_assert_expr_); } } while(0)\n#endif\n\n#define log_abort() YOSYS_NAMESPACE_PREFIX log_error(\"Abort in %s:%d.\\n\", __FILE__, __LINE__)\n#define log_ping() YOSYS_NAMESPACE_PREFIX log(\"-- %s:%d %s --\\n\", __FILE__, __LINE__, __PRETTY_FUNCTION__)\n\n\n// ---------------------------------------------------\n// This is the magic behind the code coverage counters\n// ---------------------------------------------------\n\n#if defined(YOSYS_ENABLE_COVER) && (defined(__linux__) || defined(__FreeBSD__))\n\n#define cover(_id) do { \\\n static CoverData __d __attribute__((section(\"yosys_cover_list\"), aligned(1), used)) = { __FILE__, __FUNCTION__, _id, __LINE__, 0 }; \\\n __d.counter++; \\\n} while (0)\n\nstruct CoverData {\n\tconst char *file, *func, *id;\n\tint line, counter;\n} YS_ATTRIBUTE(packed);\n\n// this two symbols are created by the linker for the \"yosys_cover_list\" ELF section\nextern \"C\" struct CoverData __start_yosys_cover_list[];\nextern \"C\" struct CoverData __stop_yosys_cover_list[];\n\nextern dict<std::string, std::pair<std::string, int>> extra_coverage_data;\n\nvoid cover_extra(std::string parent, std::string id, bool increment = true);\ndict<std::string, std::pair<std::string, int>> get_coverage_data();\n\n#define cover_list(_id, ...) do { cover(_id); \\\n\tstd::string r = cover_list_worker(_id, __VA_ARGS__); \\\n\tlog_assert(r.empty()); \\\n} while (0)\n\nstatic inline std::string cover_list_worker(std::string, std::string last) {\n\treturn last;\n}\n\ntemplate<typename... T>\nstd::string cover_list_worker(std::string prefix, std::string first, T... rest) {\n\tstd::string selected = cover_list_worker(prefix, rest...);\n\tcover_extra(prefix, prefix + \".\" + first, first == selected);\n\treturn first == selected ? \"\" : selected;\n}\n\n#else\n# define cover(...) do { } while (0)\n# define cover_list(...) do { } while (0)\n#endif\n\n\n// ------------------------------------------------------------\n// everything below this line are utilities for troubleshooting\n// ------------------------------------------------------------\n\n// simple timer for performance measurements\n// toggle the '#if 1' to get a baseline for the performance penalty added by the measurement\nstruct PerformanceTimer\n{\n#if 1\n\tint64_t total_ns;\n\n\tPerformanceTimer() {\n\t\ttotal_ns = 0;\n\t}\n\n\tstatic int64_t query() {\n# ifdef _WIN32\n\t\treturn 0;\n# elif defined(RUSAGE_SELF)\n\t\tstruct rusage rusage;\n\t\tint64_t t = 0;\n\t\tfor (int who : {RUSAGE_SELF, RUSAGE_CHILDREN}) {\n\t\t\tif (getrusage(who, &rusage) == -1) {\n\t\t\t\tlog_cmd_error(\"getrusage failed!\\n\");\n\t\t\t\tlog_abort();\n\t\t\t}\n\t\t\tt += 1000000000ULL * (int64_t) rusage.ru_utime.tv_sec + (int64_t) rusage.ru_utime.tv_usec * 1000ULL;\n\t\t\tt += 1000000000ULL * (int64_t) rusage.ru_stime.tv_sec + (int64_t) rusage.ru_stime.tv_usec * 1000ULL;\n\t\t}\n\t\treturn t;\n# else\n# error \"Don't know how to measure per-process CPU time. Need alternative method (times()/clocks()/gettimeofday()?).\"\n# endif\n\t}\n\n\tvoid reset() {\n\t\ttotal_ns = 0;\n\t}\n\n\tvoid begin() {\n\t\ttotal_ns -= query();\n\t}\n\n\tvoid end() {\n\t\ttotal_ns += query();\n\t}\n\n\tfloat sec() const {\n\t\treturn total_ns * 1e-9f;\n\t}\n#else\n\tstatic int64_t query() { return 0; }\n\tvoid reset() { }\n\tvoid begin() { }\n\tvoid end() { }\n\tfloat sec() const { return 0; }\n#endif\n};\n\n// simple API for quickly dumping values when debugging\n\nstatic inline void log_dump_val_worker(short v) { log(\"%d\", v); }\nstatic inline void log_dump_val_worker(unsigned short v) { log(\"%u\", v); }\nstatic inline void log_dump_val_worker(int v) { log(\"%d\", v); }\nstatic inline void log_dump_val_worker(unsigned int v) { log(\"%u\", v); }\nstatic inline void log_dump_val_worker(long int v) { log(\"%ld\", v); }\nstatic inline void log_dump_val_worker(unsigned long int v) { log(\"%lu\", v); }\n#ifndef _WIN32\nstatic inline void log_dump_val_worker(long long int v) { log(\"%lld\", v); }\nstatic inline void log_dump_val_worker(unsigned long long int v) { log(\"%lld\", v); }\n#endif\nstatic inline void log_dump_val_worker(char c) { log(c >= 32 && c < 127 ? \"'%c'\" : \"'\\\\x%02x'\", c); }\nstatic inline void log_dump_val_worker(unsigned char c) { log(c >= 32 && c < 127 ? \"'%c'\" : \"'\\\\x%02x'\", c); }\nstatic inline void log_dump_val_worker(bool v) { log(\"%s\", v ? \"true\" : \"false\"); }\nstatic inline void log_dump_val_worker(double v) { log(\"%f\", v); }\nstatic inline void log_dump_val_worker(char *v) { log(\"%s\", v); }\nstatic inline void log_dump_val_worker(const char *v) { log(\"%s\", v); }\nstatic inline void log_dump_val_worker(std::string v) { log(\"%s\", v.c_str()); }\nstatic inline void log_dump_val_worker(PerformanceTimer p) { log(\"%f seconds\", p.sec()); }\nstatic inline void log_dump_args_worker(const char *p) { log_assert(*p == 0); }\nvoid log_dump_val_worker(RTLIL::IdString v);\nvoid log_dump_val_worker(RTLIL::SigSpec v);\nvoid log_dump_val_worker(RTLIL::State v);\n\ntemplate<typename K, typename T> static inline void log_dump_val_worker(dict<K, T> &v);\ntemplate<typename K> static inline void log_dump_val_worker(pool<K> &v);\ntemplate<typename K> static inline void log_dump_val_worker(std::vector<K> &v);\ntemplate<typename T> static inline void log_dump_val_worker(T *ptr);\n\ntemplate<typename K, typename T>\nstatic inline void log_dump_val_worker(dict<K, T> &v) {\n\tlog(\"{\");\n\tbool first = true;\n\tfor (auto &it : v) {\n\t\tlog(first ? \" \" : \", \");\n\t\tlog_dump_val_worker(it.first);\n\t\tlog(\": \");\n\t\tlog_dump_val_worker(it.second);\n\t\tfirst = false;\n\t}\n\tlog(\" }\");\n}\n\ntemplate<typename K>\nstatic inline void log_dump_val_worker(pool<K> &v) {\n\tlog(\"{\");\n\tbool first = true;\n\tfor (auto &it : v) {\n\t\tlog(first ? \" \" : \", \");\n\t\tlog_dump_val_worker(it);\n\t\tfirst = false;\n\t}\n\tlog(\" }\");\n}\n\ntemplate<typename K>\nstatic inline void log_dump_val_worker(std::vector<K> &v) {\n\tlog(\"{\");\n\tbool first = true;\n\tfor (auto &it : v) {\n\t\tlog(first ? \" \" : \", \");\n\t\tlog_dump_val_worker(it);\n\t\tfirst = false;\n\t}\n\tlog(\" }\");\n}\n\ntemplate<typename T>\nstatic inline void log_dump_val_worker(T *ptr) { log(\"%p\", ptr); }\n\ntemplate<typename T, typename ... Args>\nvoid log_dump_args_worker(const char *p, T first, Args ... args)\n{\n\tint next_p_state = 0;\n\tconst char *next_p = p;\n\twhile (*next_p && (next_p_state != 0 || *next_p != ',')) {\n\t\tif (*next_p == '\"')\n\t\t\tdo {\n\t\t\t\tnext_p++;\n\t\t\t\twhile (*next_p == '\\\\' && *(next_p + 1))\n\t\t\t\t\tnext_p += 2;\n\t\t\t} while (*next_p && *next_p != '\"');\n\t\tif (*next_p == '\\'') {\n\t\t\tnext_p++;\n\t\t\tif (*next_p == '\\\\')\n\t\t\t\tnext_p++;\n\t\t\tif (*next_p)\n\t\t\t\tnext_p++;\n\t\t}\n\t\tif (*next_p == '(' || *next_p == '[' || *next_p == '{')\n\t\t\tnext_p_state++;\n\t\tif ((*next_p == ')' || *next_p == ']' || *next_p == '}') && next_p_state > 0)\n\t\t\tnext_p_state--;\n\t\tnext_p++;\n\t}\n\tlog(\"\\n\\t%.*s => \", int(next_p - p), p);\n\tif (*next_p == ',')\n\t\tnext_p++;\n\twhile (*next_p == ' ' || *next_p == '\\t' || *next_p == '\\r' || *next_p == '\\n')\n\t\tnext_p++;\n\tlog_dump_val_worker(first);\n\tlog_dump_args_worker(next_p, args ...);\n}\n\n#define log_dump(...) do { \\\n\tlog(\"DEBUG DUMP IN %s AT %s:%d:\", __PRETTY_FUNCTION__, __FILE__, __LINE__); \\\n\tlog_dump_args_worker(#__VA_ARGS__, __VA_ARGS__); \\\n\tlog(\"\\n\"); \\\n} while (0)\n\nYOSYS_NAMESPACE_END\n\n#include \"kernel/yosys.h\"\n\n#endif\n",
|
|
@@ -190,7 +190,7 @@ export const filesystem = {
|
|
|
190
190
|
"timinginfo.h": "/*\n * yosys -- Yosys Open SYnthesis Suite\n *\n * Copyright (C) 2012 Claire Xenia Wolf <claire@yosyshq.com>\n * (C) 2020 Eddie Hung <eddie@fpgeh.com>\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n *\n */\n\n#ifndef TIMINGINFO_H\n#define TIMINGINFO_H\n\n#include \"kernel/yosys.h\"\n\nYOSYS_NAMESPACE_BEGIN\n\nstruct TimingInfo\n{\n\tstruct NameBit\n\t{\n\t\tRTLIL::IdString name;\n\t\tint offset;\n\t\tNameBit() : offset(0) {}\n\t\tNameBit(const RTLIL::IdString name, int offset) : name(name), offset(offset) {}\n\t\texplicit NameBit(const RTLIL::SigBit &b) : name(b.wire->name), offset(b.offset) {}\n\t\tbool operator==(const NameBit& nb) const { return nb.name == name && nb.offset == offset; }\n\t\tbool operator!=(const NameBit& nb) const { return !operator==(nb); }\n\t\tstd::optional<SigBit> get_connection(RTLIL::Cell *cell) {\n\t\t\tif (!cell->hasPort(name))\n\t\t\t\treturn {};\n\t\t\tauto &port = cell->getPort(name);\n\t\t\tif (offset >= port.size())\n\t\t\t\treturn {};\n\t\t\treturn port[offset];\n\t\t}\n\t\t[[nodiscard]] Hasher hash_into(Hasher h) const {\n\t\t\th.eat(name);\n\t\t\th.eat(offset);\n\t\t\treturn h;\n\t\t}\n\t};\n\tstruct BitBit\n\t{\n\t\tNameBit first, second;\n\t\tBitBit(const NameBit &first, const NameBit &second) : first(first), second(second) {}\n\t\tBitBit(const SigBit &first, const SigBit &second) : first(first), second(second) {}\n\t\tbool operator==(const BitBit& bb) const { return bb.first == first && bb.second == second; }\n\t\t[[nodiscard]] Hasher hash_into(Hasher h) const {\n\t\t\th.eat(first);\n\t\t\th.eat(second);\n\t\t\treturn h;\n\t\t}\n\t};\n\n\tstruct ModuleTiming\n\t{\n\t\tdict<BitBit, int> comb;\n\t\tdict<NameBit, std::pair<int,NameBit>> arrival, required;\n\t\tbool has_inputs;\n\t};\n\n\tdict<RTLIL::IdString, ModuleTiming> data;\n\n\tTimingInfo()\n\t{\n\t}\n\n\tTimingInfo(RTLIL::Design *design)\n\t{\n\t\tsetup(design);\n\t}\n\n\tvoid setup(RTLIL::Design *design)\n\t{\n\t\tfor (auto module : design->modules()) {\n\t\t\tif (!module->get_blackbox_attribute())\n\t\t\t\tcontinue;\n\t\t\tsetup_module(module);\n\t\t}\n\t}\n\n\tconst ModuleTiming& setup_module(RTLIL::Module *module)\n\t{\n\t\tauto r = data.insert(module->name);\n\t\tlog_assert(r.second);\n\t\tauto &t = r.first->second;\n\n\t\tfor (auto cell : module->cells()) {\n\t\t\tif (cell->type == ID($specify2)) {\n\t\t\t\tauto en = cell->getPort(ID::EN);\n\t\t\t\tif (en.is_fully_const() && !en.as_bool())\n\t\t\t\t\tcontinue;\n\t\t\t\tauto src = cell->getPort(ID::SRC);\n\t\t\t\tauto dst = cell->getPort(ID::DST);\n\t\t\t\tfor (const auto &c : src.chunks())\n\t\t\t\t\tif (!c.wire || !c.wire->port_input)\n\t\t\t\t\t\tlog_error(\"Module '%s' contains specify cell '%s' where SRC '%s' is not a module input.\\n\", log_id(module), log_id(cell), log_signal(src));\n\t\t\t\tfor (const auto &c : dst.chunks())\n\t\t\t\t\tif (!c.wire || !c.wire->port_output)\n\t\t\t\t\t\tlog_error(\"Module '%s' contains specify cell '%s' where DST '%s' is not a module output.\\n\", log_id(module), log_id(cell), log_signal(dst));\n\t\t\t\tint rise_max = cell->getParam(ID::T_RISE_MAX).as_int();\n\t\t\t\tint fall_max = cell->getParam(ID::T_FALL_MAX).as_int();\n\t\t\t\tint max = std::max(rise_max,fall_max);\n\t\t\t\tif (max < 0)\n\t\t\t\t\tlog_error(\"Module '%s' contains specify cell '%s' with T_{RISE,FALL}_MAX < 0.\\n\", log_id(module), log_id(cell));\n\t\t\t\tif (cell->getParam(ID::FULL).as_bool()) {\n\t\t\t\t\tfor (const auto &s : src)\n\t\t\t\t\t\tfor (const auto &d : dst) {\n\t\t\t\t\t\t\tauto r = t.comb.insert(BitBit(s,d));\n\t\t\t\t\t\t\tif (!r.second)\n\t\t\t\t\t\t\t\tlog_error(\"Module '%s' contains multiple specify cells for SRC '%s' and DST '%s'.\\n\", log_id(module), log_signal(s), log_signal(d));\n\t\t\t\t\t\t\tr.first->second = max;\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tlog_assert(GetSize(src) == GetSize(dst));\n\t\t\t\t\tfor (auto i = 0; i < GetSize(src); i++) {\n\t\t\t\t\t\tconst auto &s = src[i];\n\t\t\t\t\t\tconst auto &d = dst[i];\n\t\t\t\t\t\tauto r = t.comb.insert(BitBit(s,d));\n\t\t\t\t\t\tif (!r.second)\n\t\t\t\t\t\t\tlog_error(\"Module '%s' contains multiple specify cells for SRC '%s' and DST '%s'.\\n\", log_id(module), log_signal(s), log_signal(d));\n\t\t\t\t\t\tr.first->second = max;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (cell->type == ID($specify3)) {\n\t\t\t\tauto src = cell->getPort(ID::SRC).as_bit();\n\t\t\t\tauto dst = cell->getPort(ID::DST);\n\t\t\t\tif (!src.wire || !src.wire->port_input)\n\t\t\t\t\tlog_error(\"Module '%s' contains specify cell '%s' where SRC '%s' is not a module input.\\n\", log_id(module), log_id(cell), log_signal(src));\n\t\t\t\tfor (const auto &c : dst.chunks())\n\t\t\t\t\tif (!c.wire->port_output)\n\t\t\t\t\t\tlog_error(\"Module '%s' contains specify cell '%s' where DST '%s' is not a module output.\\n\", log_id(module), log_id(cell), log_signal(dst));\n\t\t\t\tint rise_max = cell->getParam(ID::T_RISE_MAX).as_int();\n\t\t\t\tint fall_max = cell->getParam(ID::T_FALL_MAX).as_int();\n\t\t\t\tint max = std::max(rise_max,fall_max);\n\t\t\t\tif (max < 0) {\n\t\t\t\t\tlog_warning(\"Module '%s' contains specify cell '%s' with T_{RISE,FALL}_MAX < 0 which is currently unsupported. Clamping to 0.\\n\", log_id(module), log_id(cell));\n\t\t\t\t\tmax = 0;\n\t\t\t\t}\n\t\t\t\tfor (const auto &d : dst) {\n\t\t\t\t\tauto r = t.arrival.insert(NameBit(d));\n\t\t\t\t\tauto &v = r.first->second;\n\t\t\t\t\tif (r.second || v.first < max) {\n\t\t\t\t\t\tv.first = max;\n\t\t\t\t\t\tv.second = NameBit(src);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (cell->type == ID($specrule)) {\n\t\t\t\tIdString type = cell->getParam(ID::TYPE).decode_string();\n\t\t\t\tif (type != ID($setup) && type != ID($setuphold))\n\t\t\t\t\tcontinue;\n\t\t\t\tauto src = cell->getPort(ID::SRC);\n\t\t\t\tauto dst = cell->getPort(ID::DST).as_bit();\n\t\t\t\tfor (const auto &c : src.chunks())\n\t\t\t\t\tif (!c.wire || !c.wire->port_input)\n\t\t\t\t\t\tlog_error(\"Module '%s' contains specify cell '%s' where SRC '%s' is not a module input.\\n\", log_id(module), log_id(cell), log_signal(src));\n\t\t\t\tif (!dst.wire || !dst.wire->port_input)\n\t\t\t\t\tlog_error(\"Module '%s' contains specify cell '%s' where DST '%s' is not a module input.\\n\", log_id(module), log_id(cell), log_signal(dst));\n\t\t\t\tint max = cell->getParam(ID::T_LIMIT_MAX).as_int();\n\t\t\t\tif (max < 0) {\n\t\t\t\t\tlog_warning(\"Module '%s' contains specify cell '%s' with T_LIMIT_MAX < 0 which is currently unsupported. Clamping to 0.\\n\", log_id(module), log_id(cell));\n\t\t\t\t\tmax = 0;\n\t\t\t\t}\n\t\t\t\tfor (const auto &s : src) {\n\t\t\t\t\tauto r = t.required.insert(NameBit(s));\n\t\t\t\t\tauto &v = r.first->second;\n\t\t\t\t\tif (r.second || v.first < max) {\n\t\t\t\t\t\tv.first = max;\n\t\t\t\t\t\tv.second = NameBit(dst);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (auto port_name : module->ports) {\n\t\t\tauto wire = module->wire(port_name);\n\t\t\tif (wire->port_input) {\n\t\t\t\tt.has_inputs = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn t;\n\t}\n\n\tdecltype(data)::const_iterator find(RTLIL::IdString module_name) const { return data.find(module_name); }\n\tdecltype(data)::const_iterator end() const { return data.end(); }\n\tint count(RTLIL::IdString module_name) const { return data.count(module_name); }\n\tconst ModuleTiming& at(RTLIL::IdString module_name) const { return data.at(module_name); }\n};\n\nYOSYS_NAMESPACE_END\n\n#endif\n",
|
|
191
191
|
"utils.h": "/*\n * yosys -- Yosys Open SYnthesis Suite\n *\n * Copyright (C) 2012 Claire Xenia Wolf <claire@yosyshq.com>\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n *\n */\n\n// This file contains various c++ utility routines and helper classes that\n// do not depend on any other components of yosys (except stuff like log_*).\n\n#include \"kernel/yosys.h\"\n\n#ifndef UTILS_H\n#define UTILS_H\n\nYOSYS_NAMESPACE_BEGIN\n\n// ------------------------------------------------\n// A map-like container, but you can save and restore the state\n// ------------------------------------------------\n\ntemplate<typename Key, typename T>\nstruct stackmap\n{\nprivate:\n\tstd::vector<dict<Key, T*>> backup_state;\n\tdict<Key, T> current_state;\n\tstatic T empty_tuple;\n\npublic:\n\tstackmap() { }\n\tstackmap(const dict<Key, T> &other) : current_state(other) { }\n\n\ttemplate<typename Other>\n\tvoid operator=(const Other &other)\n\t{\n\t\tfor (auto &it : current_state)\n\t\t\tif (!backup_state.empty() && backup_state.back().count(it.first) == 0)\n\t\t\t\tbackup_state.back()[it.first] = new T(it.second);\n\t\tcurrent_state.clear();\n\n\t\tfor (auto &it : other)\n\t\t\tset(it.first, it.second);\n\t}\n\n\tbool has(const Key &k)\n\t{\n\t\treturn current_state.count(k) != 0;\n\t}\n\n\tvoid set(const Key &k, const T &v)\n\t{\n\t\tif (!backup_state.empty() && backup_state.back().count(k) == 0)\n\t\t\tbackup_state.back()[k] = current_state.count(k) ? new T(current_state.at(k)) : nullptr;\n\t\tcurrent_state[k] = v;\n\t}\n\n\tvoid unset(const Key &k)\n\t{\n\t\tif (!backup_state.empty() && backup_state.back().count(k) == 0)\n\t\t\tbackup_state.back()[k] = current_state.count(k) ? new T(current_state.at(k)) : nullptr;\n\t\tcurrent_state.erase(k);\n\t}\n\n\tconst T &get(const Key &k)\n\t{\n\t\tif (current_state.count(k) == 0)\n\t\t\treturn empty_tuple;\n\t\treturn current_state.at(k);\n\t}\n\n\tvoid reset(const Key &k)\n\t{\n\t\tfor (int i = GetSize(backup_state)-1; i >= 0; i--)\n\t\t\tif (backup_state[i].count(k) != 0) {\n\t\t\t\tif (backup_state[i].at(k) == nullptr)\n\t\t\t\t\tcurrent_state.erase(k);\n\t\t\t\telse\n\t\t\t\t\tcurrent_state[k] = *backup_state[i].at(k);\n\t\t\t\treturn;\n\t\t\t}\n\t\tcurrent_state.erase(k);\n\t}\n\n\tconst dict<Key, T> &stdmap()\n\t{\n\t\treturn current_state;\n\t}\n\n\tvoid save()\n\t{\n\t\tbackup_state.resize(backup_state.size()+1);\n\t}\n\n\tvoid restore()\n\t{\n\t\tlog_assert(!backup_state.empty());\n\t\tfor (auto &it : backup_state.back())\n\t\t\tif (it.second != nullptr) {\n\t\t\t\tcurrent_state[it.first] = *it.second;\n\t\t\t\tdelete it.second;\n\t\t\t} else\n\t\t\t\tcurrent_state.erase(it.first);\n\t\tbackup_state.pop_back();\n\t}\n\n\t~stackmap()\n\t{\n\t\twhile (!backup_state.empty())\n\t\t\trestore();\n\t}\n};\n\n\n// ------------------------------------------------\n// A simple class for topological sorting\n// ------------------------------------------------\n\ntemplate <typename T, typename C = std::less<T>> class TopoSort\n{\n public:\n\t// We use this ordering of the edges in the adjacency matrix for\n\t// exact compatibility with an older implementation.\n\tstruct IndirectCmp {\n IndirectCmp(const std::vector<T> &nodes) : node_cmp_(), nodes_(nodes) {}\n\t\tbool operator()(int a, int b) const\n\t\t{\n log_assert(static_cast<size_t>(a) < nodes_.size());\n\t\t\tlog_assert(static_cast<size_t>(b) < nodes_.size());\n\t\t\treturn node_cmp_(nodes_[a], nodes_[b]);\n\t\t}\n\t\tconst C node_cmp_;\n\t\tconst std::vector<T> &nodes_;\n\t};\n\n\tbool analyze_loops;\n\tstd::map<T, int, C> node_to_index;\n\tstd::vector<std::set<int, IndirectCmp>> edges;\n\tstd::vector<T> sorted;\n\tstd::set<std::vector<T>> loops;\n\n\tTopoSort() : indirect_cmp(nodes)\n\t{\n\t\tanalyze_loops = true;\n\t\tfound_loops = false;\n\t}\n\n\tint node(T n)\n\t{\n auto rv = node_to_index.emplace(n, static_cast<int>(nodes.size()));\n if (rv.second) {\n \t nodes.push_back(n);\n\t\t edges.push_back(std::set<int, IndirectCmp>(indirect_cmp));\n\t\t}\n\t\treturn rv.first->second;\n\t}\n\n\tvoid edge(int l_index, int r_index) { edges[r_index].insert(l_index); }\n\n\tvoid edge(T left, T right) { edge(node(left), node(right)); }\n\n\tbool has_node(const T &node) { return node_to_index.find(node) != node_to_index.end(); }\n\n\tbool sort()\n\t{\n\t\tlog_assert(GetSize(node_to_index) == GetSize(edges));\n\t\tlog_assert(GetSize(nodes) == GetSize(edges));\n\n\t\tloops.clear();\n\t\tsorted.clear();\n\t\tfound_loops = false;\n\n\t\tstd::vector<bool> marked_cells(edges.size(), false);\n\t\tstd::vector<bool> active_cells(edges.size(), false);\n\t\tstd::vector<int> active_stack;\n\t\tsorted.reserve(edges.size());\n\n\t\tfor (const auto &it : node_to_index)\n\t\t\tsort_worker(it.second, marked_cells, active_cells, active_stack);\n\n\t\tlog_assert(GetSize(sorted) == GetSize(nodes));\n\n\t\treturn !found_loops;\n\t}\n\n\t// Build the more expensive representation of edges for\n\t// a few passes that use it directly.\n\tstd::map<T, std::set<T, C>, C> get_database()\n\t{\n\t\tstd::map<T, std::set<T, C>, C> database;\n\t\tfor (size_t i = 0; i < nodes.size(); ++i) {\n\t\t\tstd::set<T, C> converted_edge_set;\n\t\t\tfor (int other_node : edges[i]) {\n\t\t\t\tconverted_edge_set.insert(nodes[other_node]);\n\t\t\t}\n\t\t\tdatabase.emplace(nodes[i], converted_edge_set);\n\t\t}\n\t\treturn database;\n\t}\n\n private:\n\tbool found_loops;\n\tstd::vector<T> nodes;\n\tconst IndirectCmp indirect_cmp;\n\n\tvoid sort_worker(const int root_index, std::vector<bool> &marked_cells, std::vector<bool> &active_cells, std::vector<int> &active_stack)\n\t{\n\t\tif (active_cells[root_index]) {\n\t\t\tfound_loops = true;\n\t\t\tif (analyze_loops) {\n\t\t\t\tstd::vector<T> loop;\n\t\t\t\tfor (int i = GetSize(active_stack) - 1; i >= 0; i--) {\n\t\t\t\t\tconst int index = active_stack[i];\n\t\t\t\t\tloop.push_back(nodes[index]);\n\t\t\t\t\tif (index == root_index)\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tloops.insert(loop);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tif (marked_cells[root_index])\n\t\t\treturn;\n\n\t\tif (!edges[root_index].empty()) {\n\t\t\tif (analyze_loops)\n\t\t\t\tactive_stack.push_back(root_index);\n\t\t\tactive_cells[root_index] = true;\n\n\t\t\tfor (int left_n : edges[root_index])\n\t\t\t\tsort_worker(left_n, marked_cells, active_cells, active_stack);\n\n\t\t\tif (analyze_loops)\n\t\t\t\tactive_stack.pop_back();\n\t\t\tactive_cells[root_index] = false;\n\t\t}\n\n\t\tmarked_cells[root_index] = true;\n\t\tsorted.push_back(nodes[root_index]);\n\t}\n};\n\n// this class is used for implementing operator-> on iterators that return values rather than references\n// it's necessary because in C++ operator-> is called recursively until a raw pointer is obtained\ntemplate<class T>\nstruct arrow_proxy {\n\tT v;\n\texplicit arrow_proxy(T const & v) : v(v) {}\n\tT* operator->() { return &v; }\n};\n\ninline int ceil_log2(int x)\n{\n#if defined(__GNUC__)\n return x > 1 ? (8*sizeof(int)) - __builtin_clz(x-1) : 0;\n#else\n\tif (x <= 0)\n\t\treturn 0;\n\tfor (int i = 0; i < 32; i++)\n\t\tif (((x-1) >> i) == 0)\n\t\t\treturn i;\n\tlog_abort();\n#endif\n}\n\nYOSYS_NAMESPACE_END\n\n#endif\n",
|
|
192
192
|
"yosys.h": "/* -*- c++ -*-\n * yosys -- Yosys Open SYnthesis Suite\n *\n * Copyright (C) 2012 Claire Xenia Wolf <claire@yosyshq.com>\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n *\n */\n\n\n// *** NOTE TO THE READER ***\n//\n// Maybe you have just opened this file in the hope to learn more about the\n// Yosys API. Let me congratulate you on this great decision! ;)\n//\n// If you want to know how the design is represented by Yosys in the memory,\n// you should read \"kernel/rtlil.h\".\n//\n// If you want to know how to register a command with Yosys, you could read\n// \"kernel/register.h\", but it would be easier to just look at a simple\n// example instead. A simple one would be \"passes/cmds/log.cc\".\n//\n// This header is very boring. It just defines some general things that\n// belong nowhere else and includes the interesting headers.\n\n\n#ifndef YOSYS_H\n#define YOSYS_H\n\n#include \"kernel/yosys_common.h\"\n\n#include \"kernel/log.h\"\n#include \"kernel/rtlil.h\"\n#include \"kernel/register.h\"\n\n#ifdef YOSYS_ENABLE_TCL\nstruct Tcl_Interp;\n#endif\n\nYOSYS_NAMESPACE_BEGIN\n\nvoid yosys_setup();\n\n#ifdef WITH_PYTHON\nbool yosys_already_setup();\n#endif\n\nvoid yosys_shutdown();\n\n#ifdef YOSYS_ENABLE_TCL\nTcl_Interp *yosys_get_tcl_interp();\n#endif\n\nextern RTLIL::Design *yosys_design;\n\nRTLIL::Design *yosys_get_design();\nstd::string proc_self_dirname();\nstd::string proc_share_dirname();\nstd::string proc_program_prefix();\nconst char *create_prompt(RTLIL::Design *design, int recursion_counter);\nstd::vector<std::string> glob_filename(const std::string &filename_pattern);\nvoid rewrite_filename(std::string &filename);\n\nvoid run_pass(std::string command, RTLIL::Design *design = nullptr);\nbool run_frontend(std::string filename, std::string command, RTLIL::Design *design = nullptr, std::string *from_to_label = nullptr);\nvoid run_backend(std::string filename, std::string command, RTLIL::Design *design = nullptr);\nvoid shell(RTLIL::Design *design);\n\n// journal of all input and output files read (for \"yosys -E\")\nextern std::set<std::string> yosys_input_files, yosys_output_files;\n\n// from kernel/version_*.o (cc source generated from Makefile)\nextern const char *yosys_version_str;\nconst char* yosys_maybe_version();\n\n// from passes/cmds/design.cc\nextern std::map<std::string, RTLIL::Design*> saved_designs;\nextern std::vector<RTLIL::Design*> pushed_designs;\n\n// from passes/cmds/pluginc.cc\nextern std::map<std::string, void*> loaded_plugins;\n#ifdef WITH_PYTHON\nextern std::map<std::string, void*> loaded_python_plugins;\n#endif\nextern std::map<std::string, std::string> loaded_plugin_aliases;\nvoid load_plugin(std::string filename, std::vector<std::string> aliases);\n\nextern std::string yosys_share_dirname;\nextern std::string yosys_abc_executable;\n\nYOSYS_NAMESPACE_END\n\n#endif\n",
|
|
193
|
-
"yosys_common.h": "/* -*- c++ -*-\n * yosys -- Yosys Open SYnthesis Suite\n *\n * Copyright (C) 2012 Claire Xenia Wolf <claire@yosyshq.com>\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n *\n */\n\n#ifndef YOSYS_COMMON_H\n#define YOSYS_COMMON_H\n\n#include <map>\n#include <set>\n#include <tuple>\n#include <vector>\n#include <string>\n#include <algorithm>\n#include <functional>\n#include <unordered_map>\n#include <unordered_set>\n#include <initializer_list>\n#include <variant>\n#include <optional>\n#include <stdexcept>\n#include <memory>\n#include <cmath>\n#include <cstddef>\n\n#include <sstream>\n#include <fstream>\n#include <istream>\n#include <ostream>\n#include <iostream>\n\n#include <stdarg.h>\n#include <stdlib.h>\n#include <string.h>\n#include <stdint.h>\n#include <stdio.h>\n#include <limits.h>\n#include <sys/stat.h>\n#include <errno.h>\n\n#ifdef WITH_PYTHON\n#include <Python.h>\n#endif\n\n#ifndef _YOSYS_\n# error It looks like you are trying to build Yosys without the config defines set. \\\n When building Yosys with a custom make system, make sure you set all the \\\n defines the Yosys Makefile would set for your build configuration.\n#endif\n\n#define FRIEND_TEST(test_case_name, test_name) \\\n friend class test_case_name##_##test_name##_Test\n\n#ifdef _WIN32\n# undef NOMINMAX\n# define NOMINMAX 1\n# undef YY_NO_UNISTD_H\n# define YY_NO_UNISTD_H 1\n\n# include <windows.h>\n# include <io.h>\n# include <direct.h>\n\n# define strtok_r strtok_s\n# define strdup _strdup\n# define snprintf _snprintf\n# define getcwd _getcwd\n# define mkdir _mkdir\n# define popen _popen\n# define pclose _pclose\n\n# ifndef __MINGW32__\n# define PATH_MAX MAX_PATH\n# define isatty _isatty\n# define fileno _fileno\n# endif\n\n// The following defines conflict with our identifiers:\n# undef CONST\n// `wingdi.h` defines a TRANSPARENT macro that conflicts with X(TRANSPARENT) entry in kernel/constids.inc\n# undef TRANSPARENT\n#endif\n\n#ifndef PATH_MAX\n# define PATH_MAX 4096\n#endif\n\n\n#define YOSYS_NAMESPACE Yosys\n#define PRIVATE_NAMESPACE_BEGIN namespace {\n#define PRIVATE_NAMESPACE_END }\n#define YOSYS_NAMESPACE_BEGIN namespace Yosys {\n#define YOSYS_NAMESPACE_END }\n#define YOSYS_NAMESPACE_PREFIX Yosys::\n#define USING_YOSYS_NAMESPACE using namespace Yosys;\n\n#if defined(__GNUC__) || defined(__clang__)\n# define YS_ATTRIBUTE(...) __attribute__((__VA_ARGS__))\n#elif defined(_MSC_VER)\n# define YS_ATTRIBUTE(...)\n#else\n# define YS_ATTRIBUTE(...)\n#endif\n\n#if defined(__GNUC__) || defined(__clang__)\n# define YS_MAYBE_UNUSED __attribute__((__unused__))\n#else\n# define YS_MAYBE_UNUSED\n#endif\n\n#if __cplusplus >= 201703L\n# define YS_FALLTHROUGH [[fallthrough]];\n#else\n# error \"C++17 or later compatible compiler is required\"\n#endif\n\n#if defined(__has_cpp_attribute) && __has_cpp_attribute(gnu::cold)\n# define YS_COLD [[gnu::cold]]\n#else\n# define YS_COLD\n#endif\n\n#ifdef __cpp_consteval\n#define YOSYS_CONSTEVAL consteval\n#else\n// If we can't use consteval we can at least make it constexpr.\n#define YOSYS_CONSTEVAL constexpr\n#endif\n\n#define YOSYS_ABORT(s) abort()\n\n#include \"kernel/io.h\"\n\nYOSYS_NAMESPACE_BEGIN\n\n// Note: All headers included in hashlib.h must be included\n// outside of YOSYS_NAMESPACE before this or bad things will happen.\n#ifdef HASHLIB_H\n# error \"You've probably included hashlib.h under two namespace paths. Bad idea.\"\n#else\n# include \"kernel/hashlib.h\"\n# undef HASHLIB_H\n#endif\n\n\nusing std::vector;\nusing std::string;\nusing std::tuple;\nusing std::pair;\n\nusing std::make_tuple;\nusing std::make_pair;\nusing std::get;\nusing std::min;\nusing std::max;\n\nusing hashlib::Hasher;\nusing hashlib::run_hash;\nusing hashlib::hash_ops;\nusing hashlib::mkhash_xorshift;\nusing hashlib::dict;\nusing hashlib::idict;\nusing hashlib::pool;\nusing hashlib::mfp;\n\n// A primitive shared string implementation that does not\n// move its .c_str() when the object is copied or moved.\nstruct shared_str {\n\tstd::shared_ptr<string> content;\n\tshared_str() { }\n\tshared_str(string s) { content = std::shared_ptr<string>(new string(s)); }\n\tshared_str(const char *s) { content = std::shared_ptr<string>(new string(s)); }\n\tconst char *c_str() const { return content->c_str(); }\n\tconst string &str() const { return *content; }\n\tbool operator==(const shared_str &other) const { return *content == *other.content; }\n\t[[nodiscard]] Hasher hash_into(Hasher h) const {\n\t\th.eat(*content);\n\t\treturn h;\n\t}\n};\n\nnamespace RTLIL {\n\tstruct IdString;\n\tstruct Const;\n\tstruct SigBit;\n\tstruct SigSpec;\n\tstruct Wire;\n\tstruct Cell;\n\tstruct Memory;\n\tstruct Process;\n\tstruct Module;\n\tstruct Design;\n\tstruct Monitor;\n struct Selection;\n\tstruct SigChunk;\n\tenum State : unsigned char;\n\n\ttypedef std::pair<SigSpec, SigSpec> SigSig;\n\n namespace ID {}\n}\n\nnamespace AST {\n\tstruct AstNode;\n}\n\nusing RTLIL::IdString;\nusing RTLIL::Const;\nusing RTLIL::SigBit;\nusing RTLIL::SigSpec;\nusing RTLIL::Wire;\nusing RTLIL::Cell;\nusing RTLIL::Module;\nusing RTLIL::Design;\n\nusing RTLIL::State;\nusing RTLIL::SigChunk;\nusing RTLIL::SigSig;\n\nnamespace hashlib {\n\ttemplate<> struct hash_ops<RTLIL::Wire*> : hash_obj_ops {};\n\ttemplate<> struct hash_ops<RTLIL::Cell*> : hash_obj_ops {};\n\ttemplate<> struct hash_ops<RTLIL::Memory*> : hash_obj_ops {};\n\ttemplate<> struct hash_ops<RTLIL::Process*> : hash_obj_ops {};\n\ttemplate<> struct hash_ops<RTLIL::Module*> : hash_obj_ops {};\n\ttemplate<> struct hash_ops<RTLIL::Design*> : hash_obj_ops {};\n\ttemplate<> struct hash_ops<RTLIL::Monitor*> : hash_obj_ops {};\n\ttemplate<> struct hash_ops<AST::AstNode*> : hash_obj_ops {};\n\n\ttemplate<> struct hash_ops<const RTLIL::Wire*> : hash_obj_ops {};\n\ttemplate<> struct hash_ops<const RTLIL::Cell*> : hash_obj_ops {};\n\ttemplate<> struct hash_ops<const RTLIL::Memory*> : hash_obj_ops {};\n\ttemplate<> struct hash_ops<const RTLIL::Process*> : hash_obj_ops {};\n\ttemplate<> struct hash_ops<const RTLIL::Module*> : hash_obj_ops {};\n\ttemplate<> struct hash_ops<const RTLIL::Design*> : hash_obj_ops {};\n\ttemplate<> struct hash_ops<const RTLIL::Monitor*> : hash_obj_ops {};\n\ttemplate<> struct hash_ops<const AST::AstNode*> : hash_obj_ops {};\n}\n\nvoid memhasher_on();\nvoid memhasher_off();\nvoid memhasher_do();\n\nextern bool memhasher_active;\ninline void memhasher() { if (memhasher_active) memhasher_do(); }\n\nvoid yosys_banner();\nint ceil_log2(int x) YS_ATTRIBUTE(const);\n\ntemplate<typename T> int GetSize(const T &obj) { return obj.size(); }\ninline int GetSize(RTLIL::Wire *wire);\n\nextern int autoidx;\nextern int yosys_xtrace;\nextern bool yosys_write_versions;\n\nRTLIL::IdString new_id(std::string file, int line, std::string func);\nRTLIL::IdString new_id_suffix(std::string file, int line, std::string func, std::string suffix);\n\n#define NEW_ID \\\n\tYOSYS_NAMESPACE_PREFIX new_id(__FILE__, __LINE__, __FUNCTION__)\n#define NEW_ID_SUFFIX(suffix) \\\n\tYOSYS_NAMESPACE_PREFIX new_id_suffix(__FILE__, __LINE__, __FUNCTION__, suffix)\n\n// Create a statically allocated IdString object, using for example ID::A or ID($add).\n//\n// Recipe for Converting old code that is using conversion of strings like ID::A and\n// \"$add\" for creating IdStrings: Run below SED command on the .cc file and then use for\n// example \"meld foo.cc foo.cc.orig\" to manually compile errors, if necessary.\n//\n// sed -i.orig -r 's/\"\\\\\\\\([a-zA-Z0-9_]+)\"/ID(\\1)/g; s/\"(\\$[a-zA-Z0-9_]+)\"/ID(\\1)/g;' <filename>\n//\n#define ID(_id) ([]() { const char *p = \"\\\\\" #_id, *q = p[1] == '$' ? p+1 : p; \\\n static const YOSYS_NAMESPACE_PREFIX RTLIL::IdString id(q); return id; })()\nnamespace ID = RTLIL::ID;\n\n\nYOSYS_NAMESPACE_END\n\n#endif\n",
|
|
193
|
+
"yosys_common.h": "/* -*- c++ -*-\n * yosys -- Yosys Open SYnthesis Suite\n *\n * Copyright (C) 2012 Claire Xenia Wolf <claire@yosyshq.com>\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n *\n */\n\n#ifndef YOSYS_COMMON_H\n#define YOSYS_COMMON_H\n\n#include <array>\n#include <map>\n#include <set>\n#include <tuple>\n#include <vector>\n#include <string>\n#include <algorithm>\n#include <functional>\n#include <unordered_map>\n#include <unordered_set>\n#include <initializer_list>\n#include <variant>\n#include <optional>\n#include <stdexcept>\n#include <memory>\n#include <cmath>\n#include <cstddef>\n\n#include <sstream>\n#include <fstream>\n#include <istream>\n#include <ostream>\n#include <iostream>\n\n#include <stdarg.h>\n#include <stdlib.h>\n#include <string.h>\n#include <stdint.h>\n#include <stdio.h>\n#include <limits.h>\n#include <sys/stat.h>\n#include <errno.h>\n\n#ifdef WITH_PYTHON\n#include <Python.h>\n#endif\n\n#ifndef _YOSYS_\n# error It looks like you are trying to build Yosys without the config defines set. \\\n When building Yosys with a custom make system, make sure you set all the \\\n defines the Yosys Makefile would set for your build configuration.\n#endif\n\n#define FRIEND_TEST(test_case_name, test_name) \\\n friend class test_case_name##_##test_name##_Test\n\n#ifdef _WIN32\n# undef NOMINMAX\n# define NOMINMAX 1\n# undef YY_NO_UNISTD_H\n# define YY_NO_UNISTD_H 1\n\n# include <windows.h>\n# include <io.h>\n# include <direct.h>\n\n# define strtok_r strtok_s\n# define strdup _strdup\n# define snprintf _snprintf\n# define getcwd _getcwd\n# define mkdir _mkdir\n# define popen _popen\n# define pclose _pclose\n\n# ifndef __MINGW32__\n# define PATH_MAX MAX_PATH\n# define isatty _isatty\n# define fileno _fileno\n# endif\n\n// The following defines conflict with our identifiers:\n# undef CONST\n// `wingdi.h` defines a TRANSPARENT macro that conflicts with X(TRANSPARENT) entry in kernel/constids.inc\n# undef TRANSPARENT\n#endif\n\n#ifndef PATH_MAX\n# define PATH_MAX 4096\n#endif\n\n\n#define YOSYS_NAMESPACE Yosys\n#define PRIVATE_NAMESPACE_BEGIN namespace {\n#define PRIVATE_NAMESPACE_END }\n#define YOSYS_NAMESPACE_BEGIN namespace Yosys {\n#define YOSYS_NAMESPACE_END }\n#define YOSYS_NAMESPACE_PREFIX Yosys::\n#define USING_YOSYS_NAMESPACE using namespace Yosys;\n\n#if defined(__GNUC__) || defined(__clang__)\n# define YS_ATTRIBUTE(...) __attribute__((__VA_ARGS__))\n#elif defined(_MSC_VER)\n# define YS_ATTRIBUTE(...)\n#else\n# define YS_ATTRIBUTE(...)\n#endif\n\n#if defined(__GNUC__) || defined(__clang__)\n# define YS_MAYBE_UNUSED __attribute__((__unused__))\n#else\n# define YS_MAYBE_UNUSED\n#endif\n\n#if __cplusplus >= 201703L\n# define YS_FALLTHROUGH [[fallthrough]];\n#else\n# error \"C++17 or later compatible compiler is required\"\n#endif\n\n#if defined(__has_cpp_attribute) && __has_cpp_attribute(gnu::cold)\n# define YS_COLD [[gnu::cold]]\n#else\n# define YS_COLD\n#endif\n\n#ifdef __cpp_consteval\n#define YOSYS_CONSTEVAL consteval\n#else\n// If we can't use consteval we can at least make it constexpr.\n#define YOSYS_CONSTEVAL constexpr\n#endif\n\n#define YOSYS_ABORT(s) abort()\n\n#include \"kernel/io.h\"\n\nYOSYS_NAMESPACE_BEGIN\n\n// Note: All headers included in hashlib.h must be included\n// outside of YOSYS_NAMESPACE before this or bad things will happen.\n#ifdef HASHLIB_H\n# error \"You've probably included hashlib.h under two namespace paths. Bad idea.\"\n#else\n# include \"kernel/hashlib.h\"\n# undef HASHLIB_H\n#endif\n\n\nusing std::vector;\nusing std::string;\nusing std::tuple;\nusing std::pair;\n\nusing std::make_tuple;\nusing std::make_pair;\nusing std::get;\nusing std::min;\nusing std::max;\n\nusing hashlib::Hasher;\nusing hashlib::run_hash;\nusing hashlib::hash_ops;\nusing hashlib::mkhash_xorshift;\nusing hashlib::dict;\nusing hashlib::idict;\nusing hashlib::pool;\nusing hashlib::mfp;\n\n// A primitive shared string implementation that does not\n// move its .c_str() when the object is copied or moved.\nstruct shared_str {\n\tstd::shared_ptr<string> content;\n\tshared_str() { }\n\tshared_str(string s) { content = std::shared_ptr<string>(new string(s)); }\n\tshared_str(const char *s) { content = std::shared_ptr<string>(new string(s)); }\n\tconst char *c_str() const { return content->c_str(); }\n\tconst string &str() const { return *content; }\n\tbool operator==(const shared_str &other) const { return *content == *other.content; }\n\t[[nodiscard]] Hasher hash_into(Hasher h) const {\n\t\th.eat(*content);\n\t\treturn h;\n\t}\n};\n\nnamespace RTLIL {\n\tstruct IdString;\n\tstruct Const;\n\tstruct SigBit;\n\tstruct SigSpec;\n\tstruct Wire;\n\tstruct Cell;\n\tstruct Memory;\n\tstruct Process;\n\tstruct Module;\n\tstruct Design;\n\tstruct Monitor;\n struct Selection;\n\tstruct SigChunk;\n\tenum State : unsigned char;\n\n\ttypedef std::pair<SigSpec, SigSpec> SigSig;\n\n namespace ID {}\n}\n\nnamespace AST {\n\tstruct AstNode;\n}\n\nusing RTLIL::IdString;\nusing RTLIL::Const;\nusing RTLIL::SigBit;\nusing RTLIL::SigSpec;\nusing RTLIL::Wire;\nusing RTLIL::Cell;\nusing RTLIL::Module;\nusing RTLIL::Design;\n\nusing RTLIL::State;\nusing RTLIL::SigChunk;\nusing RTLIL::SigSig;\n\nnamespace hashlib {\n\ttemplate<> struct hash_ops<RTLIL::Wire*> : hash_obj_ops {};\n\ttemplate<> struct hash_ops<RTLIL::Cell*> : hash_obj_ops {};\n\ttemplate<> struct hash_ops<RTLIL::Memory*> : hash_obj_ops {};\n\ttemplate<> struct hash_ops<RTLIL::Process*> : hash_obj_ops {};\n\ttemplate<> struct hash_ops<RTLIL::Module*> : hash_obj_ops {};\n\ttemplate<> struct hash_ops<RTLIL::Design*> : hash_obj_ops {};\n\ttemplate<> struct hash_ops<RTLIL::Monitor*> : hash_obj_ops {};\n\ttemplate<> struct hash_ops<AST::AstNode*> : hash_obj_ops {};\n\n\ttemplate<> struct hash_ops<const RTLIL::Wire*> : hash_obj_ops {};\n\ttemplate<> struct hash_ops<const RTLIL::Cell*> : hash_obj_ops {};\n\ttemplate<> struct hash_ops<const RTLIL::Memory*> : hash_obj_ops {};\n\ttemplate<> struct hash_ops<const RTLIL::Process*> : hash_obj_ops {};\n\ttemplate<> struct hash_ops<const RTLIL::Module*> : hash_obj_ops {};\n\ttemplate<> struct hash_ops<const RTLIL::Design*> : hash_obj_ops {};\n\ttemplate<> struct hash_ops<const RTLIL::Monitor*> : hash_obj_ops {};\n\ttemplate<> struct hash_ops<const AST::AstNode*> : hash_obj_ops {};\n}\n\nvoid memhasher_on();\nvoid memhasher_off();\nvoid memhasher_do();\n\nextern bool memhasher_active;\ninline void memhasher() { if (memhasher_active) memhasher_do(); }\n\nvoid yosys_banner();\nint ceil_log2(int x) YS_ATTRIBUTE(const);\n\ntemplate<typename T> int GetSize(const T &obj) { return obj.size(); }\ninline int GetSize(RTLIL::Wire *wire);\n\nextern int autoidx;\nextern int yosys_xtrace;\nextern bool yosys_write_versions;\n\nRTLIL::IdString new_id(std::string file, int line, std::string func);\nRTLIL::IdString new_id_suffix(std::string file, int line, std::string func, std::string suffix);\n\n#define NEW_ID \\\n\tYOSYS_NAMESPACE_PREFIX new_id(__FILE__, __LINE__, __FUNCTION__)\n#define NEW_ID_SUFFIX(suffix) \\\n\tYOSYS_NAMESPACE_PREFIX new_id_suffix(__FILE__, __LINE__, __FUNCTION__, suffix)\n\n// Create a statically allocated IdString object, using for example ID::A or ID($add).\n//\n// Recipe for Converting old code that is using conversion of strings like ID::A and\n// \"$add\" for creating IdStrings: Run below SED command on the .cc file and then use for\n// example \"meld foo.cc foo.cc.orig\" to manually compile errors, if necessary.\n//\n// sed -i.orig -r 's/\"\\\\\\\\([a-zA-Z0-9_]+)\"/ID(\\1)/g; s/\"(\\$[a-zA-Z0-9_]+)\"/ID(\\1)/g;' <filename>\n//\n#define ID(_id) ([]() { const char *p = \"\\\\\" #_id, *q = p[1] == '$' ? p+1 : p; \\\n static const YOSYS_NAMESPACE_PREFIX RTLIL::IdString id(q); return id; })()\nnamespace ID = RTLIL::ID;\n\n\nYOSYS_NAMESPACE_END\n\n#endif\n",
|
|
194
194
|
"yw.h": "/*\n * yosys -- Yosys Open SYnthesis Suite\n *\n * Copyright (C) 2022 Jannis Harder <jix@yosyshq.com> <me@jix.one>\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n *\n */\n\n#ifndef YW_H\n#define YW_H\n\n#include \"kernel/yosys.h\"\n#include \"kernel/mem.h\"\n\nYOSYS_NAMESPACE_BEGIN\n\nstruct IdPath : public std::vector<RTLIL::IdString>\n{\n\ttemplate<typename... T>\n\tIdPath(T&&... args) : std::vector<RTLIL::IdString>(std::forward<T>(args)...) { }\n\tIdPath prefix() const { return {begin(), end() - !empty()}; }\n\tstd::string str() const;\n\n\tbool has_address() const { int tmp; return get_address(tmp); };\n\tbool get_address(int &addr) const;\n\n\t[[nodiscard]] Hasher hash_into(Hasher h) const {\n\t\th.eat(static_cast<const std::vector<RTLIL::IdString>&&>(*this));\n\t\treturn h;\n\t}\n};\n\nstruct WitnessHierarchyItem {\n\tRTLIL::Module *module;\n\tRTLIL::Wire *wire = nullptr;\n\tRTLIL::Cell *cell = nullptr;\n\tMem *mem = nullptr;\n\n\tWitnessHierarchyItem(RTLIL::Module *module, RTLIL::Wire *wire) : module(module), wire(wire) {}\n\tWitnessHierarchyItem(RTLIL::Module *module, RTLIL::Cell *cell) : module(module), cell(cell) {}\n\tWitnessHierarchyItem(RTLIL::Module *module, Mem *mem) : module(module), mem(mem) {}\n};\n\ntemplate<typename D, typename T>\nvoid witness_hierarchy(RTLIL::Module *module, D data, T callback);\n\ntemplate<class T> static std::vector<std::string> witness_path(T *obj) {\n\tstd::vector<std::string> path;\n\tif (obj->name.isPublic()) {\n\t\tauto hdlname = obj->get_string_attribute(ID::hdlname);\n\t\tfor (auto token : split_tokens(hdlname))\n\t\t\tpath.push_back(\"\\\\\" + token);\n\t}\n\tif (path.empty())\n\t\tpath.push_back(obj->name.str());\n\treturn path;\n}\n\nstruct ReadWitness\n{\n\tstruct Clock {\n\t\tIdPath path;\n\t\tint offset;\n\t\tbool is_posedge = false;\n\t\tbool is_negedge = false;\n\t};\n\n\tstruct Signal {\n\t\tIdPath path;\n\t\tint offset;\n\t\tint width;\n\t\tbool init_only;\n\n\t\tint bits_offset;\n\t};\n\n\tstruct Step {\n\t\tstd::string bits;\n\t};\n\n\tstd::string filename;\n\tstd::vector<Clock> clocks;\n\tstd::vector<Signal> signals;\n\tstd::vector<Step> steps;\n\n\tReadWitness(const std::string &filename);\n\n\tRTLIL::Const get_bits(int t, int bits_offset, int width) const;\n};\n\ntemplate<typename D, typename T>\nvoid witness_hierarchy_recursion(IdPath &path, int hdlname_mode, RTLIL::Module *module, D data, T &callback)\n{\n\tauto const &const_path = path;\n\tsize_t path_size = path.size();\n\tfor (auto wire : module->wires())\n\t{\n\t\tauto hdlname = hdlname_mode < 0 ? std::vector<std::string>() : wire->get_hdlname_attribute();\n\t\tfor (auto item : hdlname)\n\t\t\tpath.push_back(\"\\\\\" + item);\n\t\tif (hdlname.size() == 1 && path.back() == wire->name)\n\t\t\thdlname.clear();\n\t\tif (!hdlname.empty())\n\t\t\tcallback(const_path, WitnessHierarchyItem(module, wire), data);\n\t\tpath.resize(path_size);\n\t\tif (hdlname.empty() || hdlname_mode <= 0) {\n\t\t\tpath.push_back(wire->name);\n\t\t\tcallback(const_path, WitnessHierarchyItem(module, wire), data);\n\t\t\tpath.pop_back();\n\t\t}\n\t}\n\n\tfor (auto cell : module->cells())\n\t{\n\t\tModule *child = module->design->module(cell->type);\n\t\tif (child == nullptr)\n\t\t\tcontinue;\n\n\t\tauto hdlname = hdlname_mode < 0 ? std::vector<std::string>() : cell->get_hdlname_attribute();\n\t\tfor (auto item : hdlname)\n\t\t\tpath.push_back(\"\\\\\" + item);\n\t\tif (hdlname.size() == 1 && path.back() == cell->name)\n\t\t\thdlname.clear();\n\t\tif (!hdlname.empty()) {\n\t\t\tD child_data = callback(const_path, WitnessHierarchyItem(module, cell), data);\n\t\t\twitness_hierarchy_recursion<D, T>(path, 1, child, child_data, callback);\n\t\t}\n\t\tpath.resize(path_size);\n\t\tif (hdlname.empty() || hdlname_mode <= 0) {\n\t\t\tpath.push_back(cell->name);\n\t\t\tD child_data = callback(const_path, WitnessHierarchyItem(module, cell), data);\n\t\t\twitness_hierarchy_recursion<D, T>(path, hdlname.empty() ? hdlname_mode : -1, child, child_data, callback);\n\t\t\tpath.pop_back();\n\t\t}\n\t}\n\n\tfor (auto mem : Mem::get_all_memories(module)) {\n\t\tstd::vector<std::string> hdlname;\n\n\t\tif (hdlname_mode >= 0 && mem.cell != nullptr)\n\t\t\thdlname = mem.cell->get_hdlname_attribute();\n\t\tfor (auto item : hdlname)\n\t\t\tpath.push_back(\"\\\\\" + item);\n\t\tif (hdlname.size() == 1 && path.back() == mem.cell->name)\n\t\t\thdlname.clear();\n\t\tif (!hdlname.empty()) {\n\t\t\tcallback(const_path, WitnessHierarchyItem(module, &mem), data);\n\t\t}\n\t\tpath.resize(path_size);\n\n\t\tif (hdlname.empty() || hdlname_mode <= 0) {\n\t\t\tpath.push_back(mem.memid);\n\t\t\tcallback(const_path, WitnessHierarchyItem(module, &mem), data);\n\t\t\tpath.pop_back();\n\n\t\t\tif (mem.cell != nullptr && mem.cell->name != mem.memid) {\n\t\t\t\tpath.push_back(mem.cell->name);\n\t\t\t\tcallback(const_path, WitnessHierarchyItem(module, &mem), data);\n\t\t\t\tpath.pop_back();\n\t\t\t}\n\t\t}\n\t}\n}\n\ntemplate<typename D, typename T>\nvoid witness_hierarchy(RTLIL::Module *module, D data, T callback)\n{\n\tIdPath path;\n\twitness_hierarchy_recursion<D, T>(path, 0, module, data, callback);\n}\n\nYOSYS_NAMESPACE_END\n\n#endif\n",
|
|
195
195
|
},
|
|
196
196
|
"libs": {
|
|
@@ -271,7 +271,7 @@ export const filesystem = {
|
|
|
271
271
|
"brams_map_8kc.v": "module $__DP8KC_ (...);\n\nparameter INIT = 0;\nparameter OPTION_RESETMODE = \"SYNC\";\n\nparameter PORT_A_WIDTH = 18;\nparameter PORT_A_OPTION_WRITEMODE = \"NORMAL\";\n\ninput PORT_A_CLK;\ninput PORT_A_CLK_EN;\ninput PORT_A_WR_EN;\ninput PORT_A_RD_SRST;\ninput PORT_A_RD_ARST;\ninput [12:0] PORT_A_ADDR;\ninput [PORT_A_WIDTH-1:0] PORT_A_WR_DATA;\noutput [PORT_A_WIDTH-1:0] PORT_A_RD_DATA;\n\nparameter PORT_B_WIDTH = 18;\nparameter PORT_B_OPTION_WRITEMODE = \"NORMAL\";\n\ninput PORT_B_CLK;\ninput PORT_B_CLK_EN;\ninput PORT_B_WR_EN;\ninput PORT_B_RD_SRST;\ninput PORT_B_RD_ARST;\ninput [12:0] PORT_B_ADDR;\ninput [PORT_B_WIDTH-1:0] PORT_B_WR_DATA;\noutput [PORT_B_WIDTH-1:0] PORT_B_RD_DATA;\n\nfunction [319:0] init_slice;\n\tinput integer idx;\n\tinteger i, j;\n\tinit_slice = 0;\n\tfor (i = 0; i < 16; i = i + 1) begin\n\t\tinit_slice[i*20+:18] = INIT[(idx * 16 + i) * 18+:18];\n\tend\nendfunction\n\nwire [8:0] DOA;\nwire [8:0] DOB;\nwire [8:0] DIA;\nwire [8:0] DIB;\n\ncase(PORT_A_WIDTH)\n\t1: assign DIA = {7'bx, PORT_A_WR_DATA[0], 1'bx};\n\t2: assign DIA = {3'bx, PORT_A_WR_DATA[1], 2'bx, PORT_A_WR_DATA[0], 2'bx};\n\tdefault: assign DIA = PORT_A_WR_DATA;\nendcase\n\ncase(PORT_B_WIDTH)\n\t1: assign DIB = {7'bx, PORT_B_WR_DATA[0], 1'bx};\n\t2: assign DIB = {3'bx, PORT_B_WR_DATA[1], 2'bx, PORT_B_WR_DATA[0], 2'bx};\n\tdefault: assign DIB = PORT_B_WR_DATA;\nendcase\n\nassign PORT_A_RD_DATA = DOA;\nassign PORT_B_RD_DATA = DOB;\n\nDP8KC #(\n\t.INITVAL_00(init_slice('h00)),\n\t.INITVAL_01(init_slice('h01)),\n\t.INITVAL_02(init_slice('h02)),\n\t.INITVAL_03(init_slice('h03)),\n\t.INITVAL_04(init_slice('h04)),\n\t.INITVAL_05(init_slice('h05)),\n\t.INITVAL_06(init_slice('h06)),\n\t.INITVAL_07(init_slice('h07)),\n\t.INITVAL_08(init_slice('h08)),\n\t.INITVAL_09(init_slice('h09)),\n\t.INITVAL_0A(init_slice('h0a)),\n\t.INITVAL_0B(init_slice('h0b)),\n\t.INITVAL_0C(init_slice('h0c)),\n\t.INITVAL_0D(init_slice('h0d)),\n\t.INITVAL_0E(init_slice('h0e)),\n\t.INITVAL_0F(init_slice('h0f)),\n\t.INITVAL_10(init_slice('h10)),\n\t.INITVAL_11(init_slice('h11)),\n\t.INITVAL_12(init_slice('h12)),\n\t.INITVAL_13(init_slice('h13)),\n\t.INITVAL_14(init_slice('h14)),\n\t.INITVAL_15(init_slice('h15)),\n\t.INITVAL_16(init_slice('h16)),\n\t.INITVAL_17(init_slice('h17)),\n\t.INITVAL_18(init_slice('h18)),\n\t.INITVAL_19(init_slice('h19)),\n\t.INITVAL_1A(init_slice('h1a)),\n\t.INITVAL_1B(init_slice('h1b)),\n\t.INITVAL_1C(init_slice('h1c)),\n\t.INITVAL_1D(init_slice('h1d)),\n\t.INITVAL_1E(init_slice('h1e)),\n\t.INITVAL_1F(init_slice('h1f)),\n\t.DATA_WIDTH_A(PORT_A_WIDTH),\n\t.DATA_WIDTH_B(PORT_B_WIDTH),\n\t.REGMODE_A(\"NOREG\"),\n\t.REGMODE_B(\"NOREG\"),\n\t.RESETMODE(OPTION_RESETMODE),\n\t.ASYNC_RESET_RELEASE(OPTION_RESETMODE),\n\t.CSDECODE_A(\"0b000\"),\n\t.CSDECODE_B(\"0b000\"),\n\t.WRITEMODE_A(PORT_A_OPTION_WRITEMODE),\n\t.WRITEMODE_B(PORT_B_OPTION_WRITEMODE),\n\t.GSR(\"AUTO\")\n) _TECHMAP_REPLACE_ (\n\t.CLKA(PORT_A_CLK),\n\t.WEA(PORT_A_WR_EN),\n\t.CEA(PORT_A_CLK_EN),\n\t.OCEA(1'b1),\n\t.RSTA(OPTION_RESETMODE == \"SYNC\" ? PORT_A_RD_SRST : PORT_A_RD_ARST),\n\t.CSA0(1'b0),\n\t.CSA1(1'b0),\n\t.CSA2(1'b0),\n\t.ADA0(PORT_A_WIDTH == 9 ? 1'b1 : PORT_A_ADDR[0]),\n\t.ADA1(PORT_A_ADDR[1]),\n\t.ADA2(PORT_A_ADDR[2]),\n\t.ADA3(PORT_A_ADDR[3]),\n\t.ADA4(PORT_A_ADDR[4]),\n\t.ADA5(PORT_A_ADDR[5]),\n\t.ADA6(PORT_A_ADDR[6]),\n\t.ADA7(PORT_A_ADDR[7]),\n\t.ADA8(PORT_A_ADDR[8]),\n\t.ADA9(PORT_A_ADDR[9]),\n\t.ADA10(PORT_A_ADDR[10]),\n\t.ADA11(PORT_A_ADDR[11]),\n\t.ADA12(PORT_A_ADDR[12]),\n\t.DIA0(DIA[0]),\n\t.DIA1(DIA[1]),\n\t.DIA2(DIA[2]),\n\t.DIA3(DIA[3]),\n\t.DIA4(DIA[4]),\n\t.DIA5(DIA[5]),\n\t.DIA6(DIA[6]),\n\t.DIA7(DIA[7]),\n\t.DIA8(DIA[8]),\n\t.DOA0(DOA[0]),\n\t.DOA1(DOA[1]),\n\t.DOA2(DOA[2]),\n\t.DOA3(DOA[3]),\n\t.DOA4(DOA[4]),\n\t.DOA5(DOA[5]),\n\t.DOA6(DOA[6]),\n\t.DOA7(DOA[7]),\n\t.DOA8(DOA[8]),\n\n\t.CLKB(PORT_B_CLK),\n\t.WEB(PORT_B_WR_EN),\n\t.CEB(PORT_B_CLK_EN),\n\t.OCEB(1'b1),\n\t.RSTB(OPTION_RESETMODE == \"SYNC\" ? PORT_B_RD_SRST : PORT_B_RD_ARST),\n\t.CSB0(1'b0),\n\t.CSB1(1'b0),\n\t.CSB2(1'b0),\n\t.ADB0(PORT_B_WIDTH == 9 ? 1'b1 : PORT_B_ADDR[0]),\n\t.ADB1(PORT_B_ADDR[1]),\n\t.ADB2(PORT_B_ADDR[2]),\n\t.ADB3(PORT_B_ADDR[3]),\n\t.ADB4(PORT_B_ADDR[4]),\n\t.ADB5(PORT_B_ADDR[5]),\n\t.ADB6(PORT_B_ADDR[6]),\n\t.ADB7(PORT_B_ADDR[7]),\n\t.ADB8(PORT_B_ADDR[8]),\n\t.ADB9(PORT_B_ADDR[9]),\n\t.ADB10(PORT_B_ADDR[10]),\n\t.ADB11(PORT_B_ADDR[11]),\n\t.ADB12(PORT_B_ADDR[12]),\n\t.DIB0(DIB[0]),\n\t.DIB1(DIB[1]),\n\t.DIB2(DIB[2]),\n\t.DIB3(DIB[3]),\n\t.DIB4(DIB[4]),\n\t.DIB5(DIB[5]),\n\t.DIB6(DIB[6]),\n\t.DIB7(DIB[7]),\n\t.DIB8(DIB[8]),\n\t.DOB0(DOB[0]),\n\t.DOB1(DOB[1]),\n\t.DOB2(DOB[2]),\n\t.DOB3(DOB[3]),\n\t.DOB4(DOB[4]),\n\t.DOB5(DOB[5]),\n\t.DOB6(DOB[6]),\n\t.DOB7(DOB[7]),\n\t.DOB8(DOB[8]),\n);\n\nendmodule\n\n\nmodule $__PDPW8KC_ (...);\n\nparameter INIT = 0;\nparameter OPTION_RESETMODE = \"SYNC\";\n\nparameter PORT_R_WIDTH = 18;\n\ninput PORT_R_CLK;\ninput PORT_R_CLK_EN;\ninput PORT_R_RD_SRST;\ninput PORT_R_RD_ARST;\ninput [12:0] PORT_R_ADDR;\noutput [PORT_R_WIDTH-1:0] PORT_R_RD_DATA;\n\nparameter PORT_W_WIDTH = 18;\nparameter PORT_W_WR_EN_WIDTH = 2;\n\ninput PORT_W_CLK;\ninput PORT_W_CLK_EN;\ninput [12:0] PORT_W_ADDR;\ninput [PORT_W_WR_EN_WIDTH-1:0] PORT_W_WR_EN;\ninput [PORT_W_WIDTH-1:0] PORT_W_WR_DATA;\n\nfunction [319:0] init_slice;\n\tinput integer idx;\n\tinteger i, j;\n\tinit_slice = 0;\n\tfor (i = 0; i < 16; i = i + 1) begin\n\t\tinit_slice[i*20+:18] = INIT[(idx * 16 + i) * 18+:18];\n\tend\nendfunction\n\nwire [17:0] DI = PORT_W_WR_DATA;\nwire [17:0] DO;\n\nassign PORT_R_RD_DATA = PORT_R_WIDTH == 18 ? DO : DO[17:9];\n\nDP8KC #(\n\t.INITVAL_00(init_slice('h00)),\n\t.INITVAL_01(init_slice('h01)),\n\t.INITVAL_02(init_slice('h02)),\n\t.INITVAL_03(init_slice('h03)),\n\t.INITVAL_04(init_slice('h04)),\n\t.INITVAL_05(init_slice('h05)),\n\t.INITVAL_06(init_slice('h06)),\n\t.INITVAL_07(init_slice('h07)),\n\t.INITVAL_08(init_slice('h08)),\n\t.INITVAL_09(init_slice('h09)),\n\t.INITVAL_0A(init_slice('h0a)),\n\t.INITVAL_0B(init_slice('h0b)),\n\t.INITVAL_0C(init_slice('h0c)),\n\t.INITVAL_0D(init_slice('h0d)),\n\t.INITVAL_0E(init_slice('h0e)),\n\t.INITVAL_0F(init_slice('h0f)),\n\t.INITVAL_10(init_slice('h10)),\n\t.INITVAL_11(init_slice('h11)),\n\t.INITVAL_12(init_slice('h12)),\n\t.INITVAL_13(init_slice('h13)),\n\t.INITVAL_14(init_slice('h14)),\n\t.INITVAL_15(init_slice('h15)),\n\t.INITVAL_16(init_slice('h16)),\n\t.INITVAL_17(init_slice('h17)),\n\t.INITVAL_18(init_slice('h18)),\n\t.INITVAL_19(init_slice('h19)),\n\t.INITVAL_1A(init_slice('h1a)),\n\t.INITVAL_1B(init_slice('h1b)),\n\t.INITVAL_1C(init_slice('h1c)),\n\t.INITVAL_1D(init_slice('h1d)),\n\t.INITVAL_1E(init_slice('h1e)),\n\t.INITVAL_1F(init_slice('h1f)),\n\t.DATA_WIDTH_A(PORT_W_WIDTH),\n\t.DATA_WIDTH_B(PORT_R_WIDTH),\n\t.REGMODE_A(\"NOREG\"),\n\t.REGMODE_B(\"NOREG\"),\n\t.RESETMODE(OPTION_RESETMODE),\n\t.ASYNC_RESET_RELEASE(OPTION_RESETMODE),\n\t.CSDECODE_A(\"0b000\"),\n\t.CSDECODE_B(\"0b000\"),\n\t.GSR(\"AUTO\")\n) _TECHMAP_REPLACE_ (\n\t.CLKA(PORT_W_CLK),\n\t.WEA(PORT_W_WIDTH >= 9 ? 1'b1 : PORT_W_WR_EN[0]),\n\t.CEA(PORT_W_CLK_EN),\n\t.OCEA(1'b0),\n\t.RSTA(1'b0),\n\t.CSA0(1'b0),\n\t.CSA1(1'b0),\n\t.CSA2(1'b0),\n\t.ADA0(PORT_W_WIDTH >= 9 ? PORT_W_WR_EN[0] : PORT_W_ADDR[0]),\n\t.ADA1(PORT_W_WIDTH >= 18 ? PORT_W_WR_EN[1] : PORT_W_ADDR[1]),\n\t.ADA2(PORT_W_ADDR[2]),\n\t.ADA3(PORT_W_ADDR[3]),\n\t.ADA4(PORT_W_ADDR[4]),\n\t.ADA5(PORT_W_ADDR[5]),\n\t.ADA6(PORT_W_ADDR[6]),\n\t.ADA7(PORT_W_ADDR[7]),\n\t.ADA8(PORT_W_ADDR[8]),\n\t.ADA9(PORT_W_ADDR[9]),\n\t.ADA10(PORT_W_ADDR[10]),\n\t.ADA11(PORT_W_ADDR[11]),\n\t.ADA12(PORT_W_ADDR[12]),\n\t.DIA0(DI[0]),\n\t.DIA1(DI[1]),\n\t.DIA2(DI[2]),\n\t.DIA3(DI[3]),\n\t.DIA4(DI[4]),\n\t.DIA5(DI[5]),\n\t.DIA6(DI[6]),\n\t.DIA7(DI[7]),\n\t.DIA8(DI[8]),\n\t.DIB0(DI[9]),\n\t.DIB1(DI[10]),\n\t.DIB2(DI[11]),\n\t.DIB3(DI[12]),\n\t.DIB4(DI[13]),\n\t.DIB5(DI[14]),\n\t.DIB6(DI[15]),\n\t.DIB7(DI[16]),\n\t.DIB8(DI[17]),\n\n\t.CLKB(PORT_R_CLK),\n\t.WEB(1'b0),\n\t.CEB(PORT_R_CLK_EN),\n\t.OCEB(1'b1),\n\t.RSTB(OPTION_RESETMODE == \"SYNC\" ? PORT_R_RD_SRST : PORT_R_RD_ARST),\n\t.CSB0(1'b0),\n\t.CSB1(1'b0),\n\t.CSB2(1'b0),\n\t.ADB0(PORT_R_ADDR[0]),\n\t.ADB1(PORT_R_ADDR[1]),\n\t.ADB2(PORT_R_ADDR[2]),\n\t.ADB3(PORT_R_ADDR[3]),\n\t.ADB4(PORT_R_ADDR[4]),\n\t.ADB5(PORT_R_ADDR[5]),\n\t.ADB6(PORT_R_ADDR[6]),\n\t.ADB7(PORT_R_ADDR[7]),\n\t.ADB8(PORT_R_ADDR[8]),\n\t.ADB9(PORT_R_ADDR[9]),\n\t.ADB10(PORT_R_ADDR[10]),\n\t.ADB11(PORT_R_ADDR[11]),\n\t.ADB12(PORT_R_ADDR[12]),\n\t.DOA0(DO[0]),\n\t.DOA1(DO[1]),\n\t.DOA2(DO[2]),\n\t.DOA3(DO[3]),\n\t.DOA4(DO[4]),\n\t.DOA5(DO[5]),\n\t.DOA6(DO[6]),\n\t.DOA7(DO[7]),\n\t.DOA8(DO[8]),\n\t.DOB0(DO[9]),\n\t.DOB1(DO[10]),\n\t.DOB2(DO[11]),\n\t.DOB3(DO[12]),\n\t.DOB4(DO[13]),\n\t.DOB5(DO[14]),\n\t.DOB6(DO[15]),\n\t.DOB7(DO[16]),\n\t.DOB8(DO[17]),\n);\n\nendmodule\n",
|
|
272
272
|
"ccu2c_sim.vh": "// ---------------------------------------\n(* abc9_box, lib_whitebox *)\nmodule CCU2C(\n\t(* abc9_carry *)\n\tinput CIN,\n\tinput A0, B0, C0, D0, A1, B1, C1, D1,\n\toutput S0, S1,\n\t(* abc9_carry *)\n\toutput COUT\n);\n\tparameter [15:0] INIT0 = 16'h0000;\n\tparameter [15:0] INIT1 = 16'h0000;\n\tparameter INJECT1_0 = \"YES\";\n\tparameter INJECT1_1 = \"YES\";\n\n\t// First half\n\twire LUT4_0, LUT2_0;\n\tLUT4 #(.INIT(INIT0)) lut4_0(.A(A0), .B(B0), .C(C0), .D(D0), .Z(LUT4_0));\n\tLUT2 #(.INIT(INIT0[3:0])) lut2_0(.A(A0), .B(B0), .Z(LUT2_0));\n\twire gated_cin_0 = (INJECT1_0 == \"YES\") ? 1'b0 : CIN;\n\tassign S0 = LUT4_0 ^ gated_cin_0;\n\n\twire gated_lut2_0 = (INJECT1_0 == \"YES\") ? 1'b0 : LUT2_0;\n\twire cout_0 = (~LUT4_0 & gated_lut2_0) | (LUT4_0 & CIN);\n\n\t// Second half\n\twire LUT4_1, LUT2_1;\n\tLUT4 #(.INIT(INIT1)) lut4_1(.A(A1), .B(B1), .C(C1), .D(D1), .Z(LUT4_1));\n\tLUT2 #(.INIT(INIT1[3:0])) lut2_1(.A(A1), .B(B1), .Z(LUT2_1));\n\twire gated_cin_1 = (INJECT1_1 == \"YES\") ? 1'b0 : cout_0;\n\tassign S1 = LUT4_1 ^ gated_cin_1;\n\n\twire gated_lut2_1 = (INJECT1_1 == \"YES\") ? 1'b0 : LUT2_1;\n\tassign COUT = (~LUT4_1 & gated_lut2_1) | (LUT4_1 & cout_0);\n\n\tspecify\n\t\t(A0 => S0) = 379;\n\t\t(B0 => S0) = 379;\n\t\t(C0 => S0) = 275;\n\t\t(D0 => S0) = 141;\n\t\t(CIN => S0) = 257;\n\t\t(A0 => S1) = 630;\n\t\t(B0 => S1) = 630;\n\t\t(C0 => S1) = 526;\n\t\t(D0 => S1) = 392;\n\t\t(A1 => S1) = 379;\n\t\t(B1 => S1) = 379;\n\t\t(C1 => S1) = 275;\n\t\t(D1 => S1) = 141;\n\t\t(CIN => S1) = 273;\n\t\t(A0 => COUT) = 516;\n\t\t(B0 => COUT) = 516;\n\t\t(C0 => COUT) = 412;\n\t\t(D0 => COUT) = 278;\n\t\t(A1 => COUT) = 516;\n\t\t(B1 => COUT) = 516;\n\t\t(C1 => COUT) = 412;\n\t\t(D1 => COUT) = 278;\n\t\t(CIN => COUT) = 43;\n\tendspecify\nendmodule\n",
|
|
273
273
|
"ccu2d_sim.vh": "// ---------------------------------------\n(* lib_whitebox *)\nmodule CCU2D (\n\tinput CIN,\n\tinput A0, B0, C0, D0, A1, B1, C1, D1,\n\toutput S0, S1,\n\toutput COUT\n);\n\tparameter [15:0] INIT0 = 16'h0000;\n\tparameter [15:0] INIT1 = 16'h0000;\n\tparameter INJECT1_0 = \"YES\";\n\tparameter INJECT1_1 = \"YES\";\n\n\t// First half\n\twire LUT4_0, LUT2_0;\n\tLUT4 #(.INIT(INIT0)) lut4_0(.A(A0), .B(B0), .C(C0), .D(D0), .Z(LUT4_0));\n\tLUT2 #(.INIT(~INIT0[15:12])) lut2_0(.A(A0), .B(B0), .Z(LUT2_0));\n\twire gated_cin_0 = (INJECT1_0 == \"YES\") ? 1'b0 : CIN;\n\tassign S0 = LUT4_0 ^ gated_cin_0;\n\n\twire gated_lut2_0 = (INJECT1_0 == \"YES\") ? 1'b0 : LUT2_0;\n\twire cout_0 = (~LUT4_0 & gated_lut2_0) | (LUT4_0 & CIN);\n\n\t// Second half\n\twire LUT4_1, LUT2_1;\n\tLUT4 #(.INIT(INIT1)) lut4_1(.A(A1), .B(B1), .C(C1), .D(D1), .Z(LUT4_1));\n\tLUT2 #(.INIT(~INIT1[15:12])) lut2_1(.A(A1), .B(B1), .Z(LUT2_1));\n\twire gated_cin_1 = (INJECT1_1 == \"YES\") ? 1'b0 : cout_0;\n\tassign S1 = LUT4_1 ^ gated_cin_1;\n\n\twire gated_lut2_1 = (INJECT1_1 == \"YES\") ? 1'b0 : LUT2_1;\n\tassign COUT = (~LUT4_1 & gated_lut2_1) | (LUT4_1 & cout_0);\nendmodule\n",
|
|
274
|
-
"cells_bb_ecp5.v": "// Created by cells_xtra.py from Lattice models\n\n(* blackbox *) (* keep *)\nmodule GSR (...);\n input GSR;\nendmodule\n\n(* blackbox *)\nmodule PUR (...);\n parameter RST_PULSE = 1;\n input PUR;\nendmodule\n\n(* blackbox *) (* keep *)\nmodule SGSR (...);\n input GSR;\n input CLK;\nendmodule\n\n(* blackbox *)\nmodule DP16KD (...);\n parameter DATA_WIDTH_A = 18;\n parameter DATA_WIDTH_B = 18;\n parameter REGMODE_A = \"NOREG\";\n parameter REGMODE_B = \"NOREG\";\n parameter RESETMODE = \"SYNC\";\n parameter ASYNC_RESET_RELEASE = \"SYNC\";\n parameter WRITEMODE_A = \"NORMAL\";\n parameter WRITEMODE_B = \"NORMAL\";\n parameter CSDECODE_A = \"0b000\";\n parameter CSDECODE_B = \"0b000\";\n parameter GSR = \"ENABLED\";\n parameter INITVAL_00 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_01 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_02 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_03 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_04 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_05 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_06 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_07 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_08 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_09 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0A = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0B = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0C = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0D = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0E = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0F = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_10 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_11 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_12 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_13 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_14 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_15 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_16 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_17 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_18 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_19 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1A = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1B = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1C = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1D = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1E = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1F = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_20 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_21 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_22 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_23 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_24 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_25 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_26 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_27 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_28 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_29 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_2A = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_2B = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_2C = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_2D = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_2E = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_2F = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_30 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_31 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_32 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_33 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_34 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_35 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_36 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_37 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_38 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_39 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_3A = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_3B = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_3C = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_3D = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_3E = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_3F = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INIT_DATA = \"STATIC\";\n input DIA17;\n input DIA16;\n input DIA15;\n input DIA14;\n input DIA13;\n input DIA12;\n input DIA11;\n input DIA10;\n input DIA9;\n input DIA8;\n input DIA7;\n input DIA6;\n input DIA5;\n input DIA4;\n input DIA3;\n input DIA2;\n input DIA1;\n input DIA0;\n input ADA13;\n input ADA12;\n input ADA11;\n input ADA10;\n input ADA9;\n input ADA8;\n input ADA7;\n input ADA6;\n input ADA5;\n input ADA4;\n input ADA3;\n input ADA2;\n input ADA1;\n input ADA0;\n input CEA;\n input OCEA;\n input CLKA;\n input WEA;\n input CSA2;\n input CSA1;\n input CSA0;\n input RSTA;\n input DIB17;\n input DIB16;\n input DIB15;\n input DIB14;\n input DIB13;\n input DIB12;\n input DIB11;\n input DIB10;\n input DIB9;\n input DIB8;\n input DIB7;\n input DIB6;\n input DIB5;\n input DIB4;\n input DIB3;\n input DIB2;\n input DIB1;\n input DIB0;\n input ADB13;\n input ADB12;\n input ADB11;\n input ADB10;\n input ADB9;\n input ADB8;\n input ADB7;\n input ADB6;\n input ADB5;\n input ADB4;\n input ADB3;\n input ADB2;\n input ADB1;\n input ADB0;\n input CEB;\n input OCEB;\n input CLKB;\n input WEB;\n input CSB2;\n input CSB1;\n input CSB0;\n input RSTB;\n output DOA17;\n output DOA16;\n output DOA15;\n output DOA14;\n output DOA13;\n output DOA12;\n output DOA11;\n output DOA10;\n output DOA9;\n output DOA8;\n output DOA7;\n output DOA6;\n output DOA5;\n output DOA4;\n output DOA3;\n output DOA2;\n output DOA1;\n output DOA0;\n output DOB17;\n output DOB16;\n output DOB15;\n output DOB14;\n output DOB13;\n output DOB12;\n output DOB11;\n output DOB10;\n output DOB9;\n output DOB8;\n output DOB7;\n output DOB6;\n output DOB5;\n output DOB4;\n output DOB3;\n output DOB2;\n output DOB1;\n output DOB0;\nendmodule\n\n(* blackbox *)\nmodule PDPW16KD (...);\n parameter DATA_WIDTH_W = 36;\n parameter DATA_WIDTH_R = 36;\n parameter GSR = \"ENABLED\";\n parameter REGMODE = \"NOREG\";\n parameter RESETMODE = \"SYNC\";\n parameter ASYNC_RESET_RELEASE = \"SYNC\";\n parameter CSDECODE_W = \"0b000\";\n parameter CSDECODE_R = \"0b000\";\n parameter INITVAL_00 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_01 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_02 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_03 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_04 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_05 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_06 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_07 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_08 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_09 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0A = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0B = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0C = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0D = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0E = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0F = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_10 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_11 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_12 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_13 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_14 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_15 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_16 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_17 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_18 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_19 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1A = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1B = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1C = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1D = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1E = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1F = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_20 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_21 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_22 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_23 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_24 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_25 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_26 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_27 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_28 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_29 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_2A = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_2B = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_2C = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_2D = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_2E = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_2F = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_30 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_31 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_32 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_33 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_34 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_35 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_36 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_37 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_38 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_39 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_3A = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_3B = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_3C = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_3D = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_3E = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_3F = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INIT_DATA = \"STATIC\";\n input DI35;\n input DI34;\n input DI33;\n input DI32;\n input DI31;\n input DI30;\n input DI29;\n input DI28;\n input DI27;\n input DI26;\n input DI25;\n input DI24;\n input DI23;\n input DI22;\n input DI21;\n input DI20;\n input DI19;\n input DI18;\n input DI17;\n input DI16;\n input DI15;\n input DI14;\n input DI13;\n input DI12;\n input DI11;\n input DI10;\n input DI9;\n input DI8;\n input DI7;\n input DI6;\n input DI5;\n input DI4;\n input DI3;\n input DI2;\n input DI1;\n input DI0;\n input ADW8;\n input ADW7;\n input ADW6;\n input ADW5;\n input ADW4;\n input ADW3;\n input ADW2;\n input ADW1;\n input ADW0;\n input BE3;\n input BE2;\n input BE1;\n input BE0;\n input CEW;\n input CLKW;\n input CSW2;\n input CSW1;\n input CSW0;\n input ADR13;\n input ADR12;\n input ADR11;\n input ADR10;\n input ADR9;\n input ADR8;\n input ADR7;\n input ADR6;\n input ADR5;\n input ADR4;\n input ADR3;\n input ADR2;\n input ADR1;\n input ADR0;\n input CER;\n input OCER;\n input CLKR;\n input CSR2;\n input CSR1;\n input CSR0;\n input RST;\n output DO35;\n output DO34;\n output DO33;\n output DO32;\n output DO31;\n output DO30;\n output DO29;\n output DO28;\n output DO27;\n output DO26;\n output DO25;\n output DO24;\n output DO23;\n output DO22;\n output DO21;\n output DO20;\n output DO19;\n output DO18;\n output DO17;\n output DO16;\n output DO15;\n output DO14;\n output DO13;\n output DO12;\n output DO11;\n output DO10;\n output DO9;\n output DO8;\n output DO7;\n output DO6;\n output DO5;\n output DO4;\n output DO3;\n output DO2;\n output DO1;\n output DO0;\nendmodule\n\n(* blackbox *)\nmodule MULT18X18D (...);\n parameter REG_INPUTA_CLK = \"NONE\";\n parameter REG_INPUTA_CE = \"CE0\";\n parameter REG_INPUTA_RST = \"RST0\";\n parameter REG_INPUTB_CLK = \"NONE\";\n parameter REG_INPUTB_CE = \"CE0\";\n parameter REG_INPUTB_RST = \"RST0\";\n parameter REG_INPUTC_CLK = \"NONE\";\n parameter REG_INPUTC_CE = \"CE0\";\n parameter REG_INPUTC_RST = \"RST0\";\n parameter REG_PIPELINE_CLK = \"NONE\";\n parameter REG_PIPELINE_CE = \"CE0\";\n parameter REG_PIPELINE_RST = \"RST0\";\n parameter REG_OUTPUT_CLK = \"NONE\";\n parameter REG_OUTPUT_CE = \"CE0\";\n parameter REG_OUTPUT_RST = \"RST0\";\n parameter CLK0_DIV = \"ENABLED\";\n parameter CLK1_DIV = \"ENABLED\";\n parameter CLK2_DIV = \"ENABLED\";\n parameter CLK3_DIV = \"ENABLED\";\n parameter HIGHSPEED_CLK = \"NONE\";\n parameter GSR = \"ENABLED\";\n parameter CAS_MATCH_REG = \"FALSE\";\n parameter SOURCEB_MODE = \"B_SHIFT\";\n parameter MULT_BYPASS = \"DISABLED\";\n parameter RESETMODE = \"SYNC\";\n input A17;\n input A16;\n input A15;\n input A14;\n input A13;\n input A12;\n input A11;\n input A10;\n input A9;\n input A8;\n input A7;\n input A6;\n input A5;\n input A4;\n input A3;\n input A2;\n input A1;\n input A0;\n input B17;\n input B16;\n input B15;\n input B14;\n input B13;\n input B12;\n input B11;\n input B10;\n input B9;\n input B8;\n input B7;\n input B6;\n input B5;\n input B4;\n input B3;\n input B2;\n input B1;\n input B0;\n input C17;\n input C16;\n input C15;\n input C14;\n input C13;\n input C12;\n input C11;\n input C10;\n input C9;\n input C8;\n input C7;\n input C6;\n input C5;\n input C4;\n input C3;\n input C2;\n input C1;\n input C0;\n input SIGNEDA;\n input SIGNEDB;\n input SOURCEA;\n input SOURCEB;\n input CLK3;\n input CLK2;\n input CLK1;\n input CLK0;\n input CE3;\n input CE2;\n input CE1;\n input CE0;\n input RST3;\n input RST2;\n input RST1;\n input RST0;\n input SRIA17;\n input SRIA16;\n input SRIA15;\n input SRIA14;\n input SRIA13;\n input SRIA12;\n input SRIA11;\n input SRIA10;\n input SRIA9;\n input SRIA8;\n input SRIA7;\n input SRIA6;\n input SRIA5;\n input SRIA4;\n input SRIA3;\n input SRIA2;\n input SRIA1;\n input SRIA0;\n input SRIB17;\n input SRIB16;\n input SRIB15;\n input SRIB14;\n input SRIB13;\n input SRIB12;\n input SRIB11;\n input SRIB10;\n input SRIB9;\n input SRIB8;\n input SRIB7;\n input SRIB6;\n input SRIB5;\n input SRIB4;\n input SRIB3;\n input SRIB2;\n input SRIB1;\n input SRIB0;\n output SROA17;\n output SROA16;\n output SROA15;\n output SROA14;\n output SROA13;\n output SROA12;\n output SROA11;\n output SROA10;\n output SROA9;\n output SROA8;\n output SROA7;\n output SROA6;\n output SROA5;\n output SROA4;\n output SROA3;\n output SROA2;\n output SROA1;\n output SROA0;\n output SROB17;\n output SROB16;\n output SROB15;\n output SROB14;\n output SROB13;\n output SROB12;\n output SROB11;\n output SROB10;\n output SROB9;\n output SROB8;\n output SROB7;\n output SROB6;\n output SROB5;\n output SROB4;\n output SROB3;\n output SROB2;\n output SROB1;\n output SROB0;\n output ROA17;\n output ROA16;\n output ROA15;\n output ROA14;\n output ROA13;\n output ROA12;\n output ROA11;\n output ROA10;\n output ROA9;\n output ROA8;\n output ROA7;\n output ROA6;\n output ROA5;\n output ROA4;\n output ROA3;\n output ROA2;\n output ROA1;\n output ROA0;\n output ROB17;\n output ROB16;\n output ROB15;\n output ROB14;\n output ROB13;\n output ROB12;\n output ROB11;\n output ROB10;\n output ROB9;\n output ROB8;\n output ROB7;\n output ROB6;\n output ROB5;\n output ROB4;\n output ROB3;\n output ROB2;\n output ROB1;\n output ROB0;\n output ROC17;\n output ROC16;\n output ROC15;\n output ROC14;\n output ROC13;\n output ROC12;\n output ROC11;\n output ROC10;\n output ROC9;\n output ROC8;\n output ROC7;\n output ROC6;\n output ROC5;\n output ROC4;\n output ROC3;\n output ROC2;\n output ROC1;\n output ROC0;\n output P35;\n output P34;\n output P33;\n output P32;\n output P31;\n output P30;\n output P29;\n output P28;\n output P27;\n output P26;\n output P25;\n output P24;\n output P23;\n output P22;\n output P21;\n output P20;\n output P19;\n output P18;\n output P17;\n output P16;\n output P15;\n output P14;\n output P13;\n output P12;\n output P11;\n output P10;\n output P9;\n output P8;\n output P7;\n output P6;\n output P5;\n output P4;\n output P3;\n output P2;\n output P1;\n output P0;\n output SIGNEDP;\nendmodule\n\n(* blackbox *)\nmodule ALU54B (...);\n parameter REG_INPUTC0_CLK = \"NONE\";\n parameter REG_INPUTC0_CE = \"CE0\";\n parameter REG_INPUTC0_RST = \"RST0\";\n parameter REG_INPUTC1_CLK = \"NONE\";\n parameter REG_INPUTC1_CE = \"CE0\";\n parameter REG_INPUTC1_RST = \"RST0\";\n parameter REG_OPCODEOP0_0_CLK = \"NONE\";\n parameter REG_OPCODEOP0_0_CE = \"CE0\";\n parameter REG_OPCODEOP0_0_RST = \"RST0\";\n parameter REG_OPCODEOP1_0_CLK = \"NONE\";\n parameter REG_OPCODEOP0_1_CLK = \"NONE\";\n parameter REG_OPCODEOP0_1_CE = \"CE0\";\n parameter REG_OPCODEOP0_1_RST = \"RST0\";\n parameter REG_OPCODEOP1_1_CLK = \"NONE\";\n parameter REG_OPCODEIN_0_CLK = \"NONE\";\n parameter REG_OPCODEIN_0_CE = \"CE0\";\n parameter REG_OPCODEIN_0_RST = \"RST0\";\n parameter REG_OPCODEIN_1_CLK = \"NONE\";\n parameter REG_OPCODEIN_1_CE = \"CE0\";\n parameter REG_OPCODEIN_1_RST = \"RST0\";\n parameter REG_OUTPUT0_CLK = \"NONE\";\n parameter REG_OUTPUT0_CE = \"CE0\";\n parameter REG_OUTPUT0_RST = \"RST0\";\n parameter REG_OUTPUT1_CLK = \"NONE\";\n parameter REG_OUTPUT1_CE = \"CE0\";\n parameter REG_OUTPUT1_RST = \"RST0\";\n parameter REG_FLAG_CLK = \"NONE\";\n parameter REG_FLAG_CE = \"CE0\";\n parameter REG_FLAG_RST = \"RST0\";\n parameter MCPAT_SOURCE = \"STATIC\";\n parameter MASKPAT_SOURCE = \"STATIC\";\n parameter MASK01 = \"0x00000000000000\";\n parameter REG_INPUTCFB_CLK = \"NONE\";\n parameter REG_INPUTCFB_CE = \"CE0\";\n parameter REG_INPUTCFB_RST = \"RST0\";\n parameter CLK0_DIV = \"ENABLED\";\n parameter CLK1_DIV = \"ENABLED\";\n parameter CLK2_DIV = \"ENABLED\";\n parameter CLK3_DIV = \"ENABLED\";\n parameter MCPAT = \"0x00000000000000\";\n parameter MASKPAT = \"0x00000000000000\";\n parameter RNDPAT = \"0x00000000000000\";\n parameter GSR = \"ENABLED\";\n parameter RESETMODE = \"SYNC\";\n parameter MULT9_MODE = \"DISABLED\";\n parameter FORCE_ZERO_BARREL_SHIFT = \"DISABLED\";\n parameter LEGACY = \"DISABLED\";\n input CE3;\n input CE2;\n input CE1;\n input CE0;\n input CLK3;\n input CLK2;\n input CLK1;\n input CLK0;\n input RST3;\n input RST2;\n input RST1;\n input RST0;\n input SIGNEDIA;\n input SIGNEDIB;\n input SIGNEDCIN;\n input A35;\n input A34;\n input A33;\n input A32;\n input A31;\n input A30;\n input A29;\n input A28;\n input A27;\n input A26;\n input A25;\n input A24;\n input A23;\n input A22;\n input A21;\n input A20;\n input A19;\n input A18;\n input A17;\n input A16;\n input A15;\n input A14;\n input A13;\n input A12;\n input A11;\n input A10;\n input A9;\n input A8;\n input A7;\n input A6;\n input A5;\n input A4;\n input A3;\n input A2;\n input A1;\n input A0;\n input B35;\n input B34;\n input B33;\n input B32;\n input B31;\n input B30;\n input B29;\n input B28;\n input B27;\n input B26;\n input B25;\n input B24;\n input B23;\n input B22;\n input B21;\n input B20;\n input B19;\n input B18;\n input B17;\n input B16;\n input B15;\n input B14;\n input B13;\n input B12;\n input B11;\n input B10;\n input B9;\n input B8;\n input B7;\n input B6;\n input B5;\n input B4;\n input B3;\n input B2;\n input B1;\n input B0;\n input C53;\n input C52;\n input C51;\n input C50;\n input C49;\n input C48;\n input C47;\n input C46;\n input C45;\n input C44;\n input C43;\n input C42;\n input C41;\n input C40;\n input C39;\n input C38;\n input C37;\n input C36;\n input C35;\n input C34;\n input C33;\n input C32;\n input C31;\n input C30;\n input C29;\n input C28;\n input C27;\n input C26;\n input C25;\n input C24;\n input C23;\n input C22;\n input C21;\n input C20;\n input C19;\n input C18;\n input C17;\n input C16;\n input C15;\n input C14;\n input C13;\n input C12;\n input C11;\n input C10;\n input C9;\n input C8;\n input C7;\n input C6;\n input C5;\n input C4;\n input C3;\n input C2;\n input C1;\n input C0;\n input CFB53;\n input CFB52;\n input CFB51;\n input CFB50;\n input CFB49;\n input CFB48;\n input CFB47;\n input CFB46;\n input CFB45;\n input CFB44;\n input CFB43;\n input CFB42;\n input CFB41;\n input CFB40;\n input CFB39;\n input CFB38;\n input CFB37;\n input CFB36;\n input CFB35;\n input CFB34;\n input CFB33;\n input CFB32;\n input CFB31;\n input CFB30;\n input CFB29;\n input CFB28;\n input CFB27;\n input CFB26;\n input CFB25;\n input CFB24;\n input CFB23;\n input CFB22;\n input CFB21;\n input CFB20;\n input CFB19;\n input CFB18;\n input CFB17;\n input CFB16;\n input CFB15;\n input CFB14;\n input CFB13;\n input CFB12;\n input CFB11;\n input CFB10;\n input CFB9;\n input CFB8;\n input CFB7;\n input CFB6;\n input CFB5;\n input CFB4;\n input CFB3;\n input CFB2;\n input CFB1;\n input CFB0;\n input MA35;\n input MA34;\n input MA33;\n input MA32;\n input MA31;\n input MA30;\n input MA29;\n input MA28;\n input MA27;\n input MA26;\n input MA25;\n input MA24;\n input MA23;\n input MA22;\n input MA21;\n input MA20;\n input MA19;\n input MA18;\n input MA17;\n input MA16;\n input MA15;\n input MA14;\n input MA13;\n input MA12;\n input MA11;\n input MA10;\n input MA9;\n input MA8;\n input MA7;\n input MA6;\n input MA5;\n input MA4;\n input MA3;\n input MA2;\n input MA1;\n input MA0;\n input MB35;\n input MB34;\n input MB33;\n input MB32;\n input MB31;\n input MB30;\n input MB29;\n input MB28;\n input MB27;\n input MB26;\n input MB25;\n input MB24;\n input MB23;\n input MB22;\n input MB21;\n input MB20;\n input MB19;\n input MB18;\n input MB17;\n input MB16;\n input MB15;\n input MB14;\n input MB13;\n input MB12;\n input MB11;\n input MB10;\n input MB9;\n input MB8;\n input MB7;\n input MB6;\n input MB5;\n input MB4;\n input MB3;\n input MB2;\n input MB1;\n input MB0;\n input CIN53;\n input CIN52;\n input CIN51;\n input CIN50;\n input CIN49;\n input CIN48;\n input CIN47;\n input CIN46;\n input CIN45;\n input CIN44;\n input CIN43;\n input CIN42;\n input CIN41;\n input CIN40;\n input CIN39;\n input CIN38;\n input CIN37;\n input CIN36;\n input CIN35;\n input CIN34;\n input CIN33;\n input CIN32;\n input CIN31;\n input CIN30;\n input CIN29;\n input CIN28;\n input CIN27;\n input CIN26;\n input CIN25;\n input CIN24;\n input CIN23;\n input CIN22;\n input CIN21;\n input CIN20;\n input CIN19;\n input CIN18;\n input CIN17;\n input CIN16;\n input CIN15;\n input CIN14;\n input CIN13;\n input CIN12;\n input CIN11;\n input CIN10;\n input CIN9;\n input CIN8;\n input CIN7;\n input CIN6;\n input CIN5;\n input CIN4;\n input CIN3;\n input CIN2;\n input CIN1;\n input CIN0;\n input OP10;\n input OP9;\n input OP8;\n input OP7;\n input OP6;\n input OP5;\n input OP4;\n input OP3;\n input OP2;\n input OP1;\n input OP0;\n output R53;\n output R52;\n output R51;\n output R50;\n output R49;\n output R48;\n output R47;\n output R46;\n output R45;\n output R44;\n output R43;\n output R42;\n output R41;\n output R40;\n output R39;\n output R38;\n output R37;\n output R36;\n output R35;\n output R34;\n output R33;\n output R32;\n output R31;\n output R30;\n output R29;\n output R28;\n output R27;\n output R26;\n output R25;\n output R24;\n output R23;\n output R22;\n output R21;\n output R20;\n output R19;\n output R18;\n output R17;\n output R16;\n output R15;\n output R14;\n output R13;\n output R12;\n output R11;\n output R10;\n output R9;\n output R8;\n output R7;\n output R6;\n output R5;\n output R4;\n output R3;\n output R2;\n output R1;\n output R0;\n output CO53;\n output CO52;\n output CO51;\n output CO50;\n output CO49;\n output CO48;\n output CO47;\n output CO46;\n output CO45;\n output CO44;\n output CO43;\n output CO42;\n output CO41;\n output CO40;\n output CO39;\n output CO38;\n output CO37;\n output CO36;\n output CO35;\n output CO34;\n output CO33;\n output CO32;\n output CO31;\n output CO30;\n output CO29;\n output CO28;\n output CO27;\n output CO26;\n output CO25;\n output CO24;\n output CO23;\n output CO22;\n output CO21;\n output CO20;\n output CO19;\n output CO18;\n output CO17;\n output CO16;\n output CO15;\n output CO14;\n output CO13;\n output CO12;\n output CO11;\n output CO10;\n output CO9;\n output CO8;\n output CO7;\n output CO6;\n output CO5;\n output CO4;\n output CO3;\n output CO2;\n output CO1;\n output CO0;\n output EQZ;\n output EQZM;\n output EQOM;\n output EQPAT;\n output EQPATB;\n output OVER;\n output UNDER;\n output OVERUNDER;\n output SIGNEDR;\nendmodule\n\n(* blackbox *)\nmodule CLKDIVF (...);\n parameter GSR = \"DISABLED\";\n parameter DIV = \"2.0\";\n input CLKI;\n input RST;\n input ALIGNWD;\n output CDIVX;\nendmodule\n\n(* blackbox *)\nmodule PCSCLKDIV (...);\n parameter GSR = \"DISABLED\";\n input CLKI;\n input RST;\n input SEL2;\n input SEL1;\n input SEL0;\n output CDIV1;\n output CDIVX;\nendmodule\n\n(* blackbox *)\nmodule DCSC (...);\n parameter DCSMODE = \"POS\";\n input CLK1;\n input CLK0;\n input SEL1;\n input SEL0;\n input MODESEL;\n output DCSOUT;\nendmodule\n\n(* blackbox *)\nmodule DCCA (...);\n input CLKI;\n input CE;\n output CLKO;\nendmodule\n\n(* blackbox *)\nmodule ECLKSYNCB (...);\n input ECLKI;\n input STOP;\n output ECLKO;\nendmodule\n\n(* blackbox *)\nmodule ECLKBRIDGECS (...);\n input CLK0;\n input CLK1;\n input SEL;\n output ECSOUT;\nendmodule\n\n(* blackbox *)\nmodule DELAYF (...);\n parameter DEL_MODE = \"USER_DEFINED\";\n parameter DEL_VALUE = 0;\n input A;\n input LOADN;\n input MOVE;\n input DIRECTION;\n output Z;\n output CFLAG;\nendmodule\n\n(* blackbox *)\nmodule DELAYG (...);\n parameter DEL_MODE = \"USER_DEFINED\";\n parameter DEL_VALUE = 0;\n input A;\n output Z;\nendmodule\n\n(* blackbox *) (* keep *)\nmodule USRMCLK (...);\n input USRMCLKI;\n input USRMCLKTS;\nendmodule\n\n(* blackbox *)\nmodule DQSBUFM (...);\n parameter DQS_LI_DEL_VAL = 4;\n parameter DQS_LI_DEL_ADJ = \"FACTORYONLY\";\n parameter DQS_LO_DEL_VAL = 0;\n parameter DQS_LO_DEL_ADJ = \"FACTORYONLY\";\n parameter GSR = \"ENABLED\";\n input DQSI;\n input READ1;\n input READ0;\n input READCLKSEL2;\n input READCLKSEL1;\n input READCLKSEL0;\n input DDRDEL;\n input ECLK;\n input SCLK;\n input RST;\n input DYNDELAY7;\n input DYNDELAY6;\n input DYNDELAY5;\n input DYNDELAY4;\n input DYNDELAY3;\n input DYNDELAY2;\n input DYNDELAY1;\n input DYNDELAY0;\n input PAUSE;\n input RDLOADN;\n input RDMOVE;\n input RDDIRECTION;\n input WRLOADN;\n input WRMOVE;\n input WRDIRECTION;\n output DQSR90;\n output DQSW;\n output DQSW270;\n output RDPNTR2;\n output RDPNTR1;\n output RDPNTR0;\n output WRPNTR2;\n output WRPNTR1;\n output WRPNTR0;\n output DATAVALID;\n output BURSTDET;\n output RDCFLAG;\n output WRCFLAG;\nendmodule\n\n(* blackbox *)\nmodule DDRDLLA (...);\n parameter FORCE_MAX_DELAY = \"NO\";\n parameter GSR = \"ENABLED\";\n input CLK;\n input RST;\n input UDDCNTLN;\n input FREEZE;\n output DDRDEL;\n output LOCK;\n output DCNTL7;\n output DCNTL6;\n output DCNTL5;\n output DCNTL4;\n output DCNTL3;\n output DCNTL2;\n output DCNTL1;\n output DCNTL0;\nendmodule\n\n(* blackbox *)\nmodule DLLDELD (...);\n input A;\n input DDRDEL;\n input LOADN;\n input MOVE;\n input DIRECTION;\n output Z;\n output CFLAG;\nendmodule\n\n(* blackbox *)\nmodule IDDRX1F (...);\n parameter GSR = \"ENABLED\";\n input D;\n input SCLK;\n input RST;\n output Q0;\n output Q1;\nendmodule\n\n(* blackbox *)\nmodule IDDRX2F (...);\n parameter GSR = \"ENABLED\";\n input D;\n input SCLK;\n input ECLK;\n input RST;\n input ALIGNWD;\n output Q3;\n output Q2;\n output Q1;\n output Q0;\nendmodule\n\n(* blackbox *)\nmodule IDDR71B (...);\n parameter GSR = \"ENABLED\";\n input D;\n input SCLK;\n input ECLK;\n input RST;\n input ALIGNWD;\n output Q6;\n output Q5;\n output Q4;\n output Q3;\n output Q2;\n output Q1;\n output Q0;\nendmodule\n\n(* blackbox *)\nmodule IDDRX2DQA (...);\n parameter GSR = \"ENABLED\";\n input SCLK;\n input ECLK;\n input DQSR90;\n input D;\n input RST;\n input RDPNTR2;\n input RDPNTR1;\n input RDPNTR0;\n input WRPNTR2;\n input WRPNTR1;\n input WRPNTR0;\n output Q3;\n output Q2;\n output Q1;\n output Q0;\n output QWL;\nendmodule\n\n(* blackbox *)\nmodule ODDRX1F (...);\n parameter GSR = \"ENABLED\";\n input SCLK;\n input RST;\n input D0;\n input D1;\n output Q;\nendmodule\n\n(* blackbox *)\nmodule ODDRX2F (...);\n parameter GSR = \"ENABLED\";\n input SCLK;\n input ECLK;\n input RST;\n input D3;\n input D2;\n input D1;\n input D0;\n output Q;\nendmodule\n\n(* blackbox *)\nmodule ODDR71B (...);\n parameter GSR = \"ENABLED\";\n input SCLK;\n input ECLK;\n input RST;\n input D6;\n input D5;\n input D4;\n input D3;\n input D2;\n input D1;\n input D0;\n output Q;\nendmodule\n\n(* blackbox *)\nmodule OSHX2A (...);\n parameter GSR = \"ENABLED\";\n input D1;\n input D0;\n input SCLK;\n input ECLK;\n input RST;\n output Q;\nendmodule\n\n(* blackbox *)\nmodule TSHX2DQA (...);\n parameter GSR = \"ENABLED\";\n parameter REGSET = \"SET\";\n input T1;\n input T0;\n input SCLK;\n input ECLK;\n input DQSW270;\n input RST;\n output Q;\nendmodule\n\n(* blackbox *)\nmodule TSHX2DQSA (...);\n parameter GSR = \"ENABLED\";\n parameter REGSET = \"SET\";\n input T1;\n input T0;\n input SCLK;\n input ECLK;\n input DQSW;\n input RST;\n output Q;\nendmodule\n\n(* blackbox *)\nmodule ODDRX2DQA (...);\n parameter GSR = \"ENABLED\";\n input D3;\n input D2;\n input D1;\n input D0;\n input DQSW270;\n input SCLK;\n input ECLK;\n input RST;\n output Q;\nendmodule\n\n(* blackbox *)\nmodule ODDRX2DQSB (...);\n parameter GSR = \"ENABLED\";\n input D3;\n input D2;\n input D1;\n input D0;\n input SCLK;\n input ECLK;\n input DQSW;\n input RST;\n output Q;\nendmodule\n\n(* blackbox *)\nmodule EHXPLLL (...);\n parameter CLKI_DIV = 1;\n parameter CLKFB_DIV = 1;\n parameter CLKOP_DIV = 8;\n parameter CLKOS_DIV = 8;\n parameter CLKOS2_DIV = 8;\n parameter CLKOS3_DIV = 8;\n parameter CLKOP_ENABLE = \"ENABLED\";\n parameter CLKOS_ENABLE = \"DISABLED\";\n parameter CLKOS2_ENABLE = \"DISABLED\";\n parameter CLKOS3_ENABLE = \"DISABLED\";\n parameter CLKOP_CPHASE = 0;\n parameter CLKOS_CPHASE = 0;\n parameter CLKOS2_CPHASE = 0;\n parameter CLKOS3_CPHASE = 0;\n parameter CLKOP_FPHASE = 0;\n parameter CLKOS_FPHASE = 0;\n parameter CLKOS2_FPHASE = 0;\n parameter CLKOS3_FPHASE = 0;\n parameter FEEDBK_PATH = \"CLKOP\";\n parameter CLKOP_TRIM_POL = \"RISING\";\n parameter CLKOP_TRIM_DELAY = 0;\n parameter CLKOS_TRIM_POL = \"RISING\";\n parameter CLKOS_TRIM_DELAY = 0;\n parameter OUTDIVIDER_MUXA = \"DIVA\";\n parameter OUTDIVIDER_MUXB = \"DIVB\";\n parameter OUTDIVIDER_MUXC = \"DIVC\";\n parameter OUTDIVIDER_MUXD = \"DIVD\";\n parameter PLL_LOCK_MODE = 0;\n parameter PLL_LOCK_DELAY = 200;\n parameter STDBY_ENABLE = \"DISABLED\";\n parameter REFIN_RESET = \"DISABLED\";\n parameter SYNC_ENABLE = \"DISABLED\";\n parameter INT_LOCK_STICKY = \"ENABLED\";\n parameter DPHASE_SOURCE = \"DISABLED\";\n parameter PLLRST_ENA = \"DISABLED\";\n parameter INTFB_WAKE = \"DISABLED\";\n input CLKI;\n input CLKFB;\n input PHASESEL1;\n input PHASESEL0;\n input PHASEDIR;\n input PHASESTEP;\n input PHASELOADREG;\n input STDBY;\n input PLLWAKESYNC;\n input RST;\n input ENCLKOP;\n input ENCLKOS;\n input ENCLKOS2;\n input ENCLKOS3;\n output CLKOP;\n output CLKOS;\n output CLKOS2;\n output CLKOS3;\n output LOCK;\n output INTLOCK;\n output REFCLK;\n output CLKINTFB;\nendmodule\n\n(* blackbox *)\nmodule DTR (...);\n parameter DTR_TEMP = 25;\n input STARTPULSE;\n output DTROUT7;\n output DTROUT6;\n output DTROUT5;\n output DTROUT4;\n output DTROUT3;\n output DTROUT2;\n output DTROUT1;\n output DTROUT0;\nendmodule\n\n(* blackbox *)\nmodule OSCG (...);\n parameter DIV = 128;\n output OSC;\nendmodule\n\n(* blackbox *)\nmodule EXTREFB (...);\n parameter REFCK_PWDNB = \"DONTCARE\";\n parameter REFCK_RTERM = \"DONTCARE\";\n parameter REFCK_DCBIAS_EN = \"DONTCARE\";\n (* iopad_external_pin *)\n input REFCLKP;\n (* iopad_external_pin *)\n input REFCLKN;\n output REFCLKO;\nendmodule\n\n(* blackbox *) (* keep *)\nmodule JTAGG (...);\n parameter ER1 = \"ENABLED\";\n parameter ER2 = \"ENABLED\";\n (* iopad_external_pin *)\n input TCK;\n (* iopad_external_pin *)\n input TMS;\n (* iopad_external_pin *)\n input TDI;\n input JTDO2;\n input JTDO1;\n (* iopad_external_pin *)\n output TDO;\n output JTDI;\n output JTCK;\n output JRTI2;\n output JRTI1;\n output JSHIFT;\n output JUPDATE;\n output JRSTN;\n output JCE2;\n output JCE1;\nendmodule\n\n(* blackbox *) (* keep *)\nmodule DCUA (...);\n parameter D_MACROPDB = \"DONTCARE\";\n parameter D_IB_PWDNB = \"DONTCARE\";\n parameter D_XGE_MODE = \"DONTCARE\";\n parameter D_LOW_MARK = \"DONTCARE\";\n parameter D_HIGH_MARK = \"DONTCARE\";\n parameter D_BUS8BIT_SEL = \"DONTCARE\";\n parameter D_CDR_LOL_SET = \"DONTCARE\";\n parameter D_BITCLK_LOCAL_EN = \"DONTCARE\";\n parameter D_BITCLK_ND_EN = \"DONTCARE\";\n parameter D_BITCLK_FROM_ND_EN = \"DONTCARE\";\n parameter D_SYNC_LOCAL_EN = \"DONTCARE\";\n parameter D_SYNC_ND_EN = \"DONTCARE\";\n parameter CH0_UC_MODE = \"DONTCARE\";\n parameter CH1_UC_MODE = \"DONTCARE\";\n parameter CH0_PCIE_MODE = \"DONTCARE\";\n parameter CH1_PCIE_MODE = \"DONTCARE\";\n parameter CH0_RIO_MODE = \"DONTCARE\";\n parameter CH1_RIO_MODE = \"DONTCARE\";\n parameter CH0_WA_MODE = \"DONTCARE\";\n parameter CH1_WA_MODE = \"DONTCARE\";\n parameter CH0_INVERT_RX = \"DONTCARE\";\n parameter CH1_INVERT_RX = \"DONTCARE\";\n parameter CH0_INVERT_TX = \"DONTCARE\";\n parameter CH1_INVERT_TX = \"DONTCARE\";\n parameter CH0_PRBS_SELECTION = \"DONTCARE\";\n parameter CH1_PRBS_SELECTION = \"DONTCARE\";\n parameter CH0_GE_AN_ENABLE = \"DONTCARE\";\n parameter CH1_GE_AN_ENABLE = \"DONTCARE\";\n parameter CH0_PRBS_LOCK = \"DONTCARE\";\n parameter CH1_PRBS_LOCK = \"DONTCARE\";\n parameter CH0_PRBS_ENABLE = \"DONTCARE\";\n parameter CH1_PRBS_ENABLE = \"DONTCARE\";\n parameter CH0_ENABLE_CG_ALIGN = \"DONTCARE\";\n parameter CH1_ENABLE_CG_ALIGN = \"DONTCARE\";\n parameter CH0_TX_GEAR_MODE = \"DONTCARE\";\n parameter CH1_TX_GEAR_MODE = \"DONTCARE\";\n parameter CH0_RX_GEAR_MODE = \"DONTCARE\";\n parameter CH1_RX_GEAR_MODE = \"DONTCARE\";\n parameter CH0_PCS_DET_TIME_SEL = \"DONTCARE\";\n parameter CH1_PCS_DET_TIME_SEL = \"DONTCARE\";\n parameter CH0_PCIE_EI_EN = \"DONTCARE\";\n parameter CH1_PCIE_EI_EN = \"DONTCARE\";\n parameter CH0_TX_GEAR_BYPASS = \"DONTCARE\";\n parameter CH1_TX_GEAR_BYPASS = \"DONTCARE\";\n parameter CH0_ENC_BYPASS = \"DONTCARE\";\n parameter CH1_ENC_BYPASS = \"DONTCARE\";\n parameter CH0_SB_BYPASS = \"DONTCARE\";\n parameter CH1_SB_BYPASS = \"DONTCARE\";\n parameter CH0_RX_SB_BYPASS = \"DONTCARE\";\n parameter CH1_RX_SB_BYPASS = \"DONTCARE\";\n parameter CH0_WA_BYPASS = \"DONTCARE\";\n parameter CH1_WA_BYPASS = \"DONTCARE\";\n parameter CH0_DEC_BYPASS = \"DONTCARE\";\n parameter CH1_DEC_BYPASS = \"DONTCARE\";\n parameter CH0_CTC_BYPASS = \"DONTCARE\";\n parameter CH1_CTC_BYPASS = \"DONTCARE\";\n parameter CH0_RX_GEAR_BYPASS = \"DONTCARE\";\n parameter CH1_RX_GEAR_BYPASS = \"DONTCARE\";\n parameter CH0_LSM_DISABLE = \"DONTCARE\";\n parameter CH1_LSM_DISABLE = \"DONTCARE\";\n parameter CH0_MATCH_2_ENABLE = \"DONTCARE\";\n parameter CH1_MATCH_2_ENABLE = \"DONTCARE\";\n parameter CH0_MATCH_4_ENABLE = \"DONTCARE\";\n parameter CH1_MATCH_4_ENABLE = \"DONTCARE\";\n parameter CH0_MIN_IPG_CNT = \"DONTCARE\";\n parameter CH1_MIN_IPG_CNT = \"DONTCARE\";\n parameter CH0_CC_MATCH_1 = \"DONTCARE\";\n parameter CH1_CC_MATCH_1 = \"DONTCARE\";\n parameter CH0_CC_MATCH_2 = \"DONTCARE\";\n parameter CH1_CC_MATCH_2 = \"DONTCARE\";\n parameter CH0_CC_MATCH_3 = \"DONTCARE\";\n parameter CH1_CC_MATCH_3 = \"DONTCARE\";\n parameter CH0_CC_MATCH_4 = \"DONTCARE\";\n parameter CH1_CC_MATCH_4 = \"DONTCARE\";\n parameter CH0_UDF_COMMA_MASK = \"DONTCARE\";\n parameter CH1_UDF_COMMA_MASK = \"DONTCARE\";\n parameter CH0_UDF_COMMA_A = \"DONTCARE\";\n parameter CH1_UDF_COMMA_A = \"DONTCARE\";\n parameter CH0_UDF_COMMA_B = \"DONTCARE\";\n parameter CH1_UDF_COMMA_B = \"DONTCARE\";\n parameter CH0_RX_DCO_CK_DIV = \"DONTCARE\";\n parameter CH1_RX_DCO_CK_DIV = \"DONTCARE\";\n parameter CH0_RCV_DCC_EN = \"DONTCARE\";\n parameter CH1_RCV_DCC_EN = \"DONTCARE\";\n parameter CH0_REQ_LVL_SET = \"DONTCARE\";\n parameter CH1_REQ_LVL_SET = \"DONTCARE\";\n parameter CH0_REQ_EN = \"DONTCARE\";\n parameter CH1_REQ_EN = \"DONTCARE\";\n parameter CH0_RTERM_RX = \"DONTCARE\";\n parameter CH1_RTERM_RX = \"DONTCARE\";\n parameter CH0_PDEN_SEL = \"DONTCARE\";\n parameter CH1_PDEN_SEL = \"DONTCARE\";\n parameter CH0_LDR_RX2CORE_SEL = \"DONTCARE\";\n parameter CH1_LDR_RX2CORE_SEL = \"DONTCARE\";\n parameter CH0_LDR_CORE2TX_SEL = \"DONTCARE\";\n parameter CH1_LDR_CORE2TX_SEL = \"DONTCARE\";\n parameter CH0_TPWDNB = \"DONTCARE\";\n parameter CH1_TPWDNB = \"DONTCARE\";\n parameter CH0_RATE_MODE_TX = \"DONTCARE\";\n parameter CH1_RATE_MODE_TX = \"DONTCARE\";\n parameter CH0_RTERM_TX = \"DONTCARE\";\n parameter CH1_RTERM_TX = \"DONTCARE\";\n parameter CH0_TX_CM_SEL = \"DONTCARE\";\n parameter CH1_TX_CM_SEL = \"DONTCARE\";\n parameter CH0_TDRV_PRE_EN = \"DONTCARE\";\n parameter CH1_TDRV_PRE_EN = \"DONTCARE\";\n parameter CH0_TDRV_SLICE0_SEL = \"DONTCARE\";\n parameter CH1_TDRV_SLICE0_SEL = \"DONTCARE\";\n parameter CH0_TDRV_SLICE1_SEL = \"DONTCARE\";\n parameter CH1_TDRV_SLICE1_SEL = \"DONTCARE\";\n parameter CH0_TDRV_SLICE2_SEL = \"DONTCARE\";\n parameter CH1_TDRV_SLICE2_SEL = \"DONTCARE\";\n parameter CH0_TDRV_SLICE3_SEL = \"DONTCARE\";\n parameter CH1_TDRV_SLICE3_SEL = \"DONTCARE\";\n parameter CH0_TDRV_SLICE4_SEL = \"DONTCARE\";\n parameter CH1_TDRV_SLICE4_SEL = \"DONTCARE\";\n parameter CH0_TDRV_SLICE5_SEL = \"DONTCARE\";\n parameter CH1_TDRV_SLICE5_SEL = \"DONTCARE\";\n parameter CH0_TDRV_SLICE0_CUR = \"DONTCARE\";\n parameter CH1_TDRV_SLICE0_CUR = \"DONTCARE\";\n parameter CH0_TDRV_SLICE1_CUR = \"DONTCARE\";\n parameter CH1_TDRV_SLICE1_CUR = \"DONTCARE\";\n parameter CH0_TDRV_SLICE2_CUR = \"DONTCARE\";\n parameter CH1_TDRV_SLICE2_CUR = \"DONTCARE\";\n parameter CH0_TDRV_SLICE3_CUR = \"DONTCARE\";\n parameter CH1_TDRV_SLICE3_CUR = \"DONTCARE\";\n parameter CH0_TDRV_SLICE4_CUR = \"DONTCARE\";\n parameter CH1_TDRV_SLICE4_CUR = \"DONTCARE\";\n parameter CH0_TDRV_SLICE5_CUR = \"DONTCARE\";\n parameter CH1_TDRV_SLICE5_CUR = \"DONTCARE\";\n parameter CH0_TDRV_DAT_SEL = \"DONTCARE\";\n parameter CH1_TDRV_DAT_SEL = \"DONTCARE\";\n parameter CH0_TX_DIV11_SEL = \"DONTCARE\";\n parameter CH1_TX_DIV11_SEL = \"DONTCARE\";\n parameter CH0_RPWDNB = \"DONTCARE\";\n parameter CH1_RPWDNB = \"DONTCARE\";\n parameter CH0_RATE_MODE_RX = \"DONTCARE\";\n parameter CH1_RATE_MODE_RX = \"DONTCARE\";\n parameter CH0_RLOS_SEL = \"DONTCARE\";\n parameter CH1_RLOS_SEL = \"DONTCARE\";\n parameter CH0_RX_LOS_LVL = \"DONTCARE\";\n parameter CH1_RX_LOS_LVL = \"DONTCARE\";\n parameter CH0_RX_LOS_CEQ = \"DONTCARE\";\n parameter CH1_RX_LOS_CEQ = \"DONTCARE\";\n parameter CH0_RX_LOS_HYST_EN = \"DONTCARE\";\n parameter CH1_RX_LOS_HYST_EN = \"DONTCARE\";\n parameter CH0_RX_LOS_EN = \"DONTCARE\";\n parameter CH1_RX_LOS_EN = \"DONTCARE\";\n parameter CH0_RX_DIV11_SEL = \"DONTCARE\";\n parameter CH1_RX_DIV11_SEL = \"DONTCARE\";\n parameter CH0_SEL_SD_RX_CLK = \"DONTCARE\";\n parameter CH1_SEL_SD_RX_CLK = \"DONTCARE\";\n parameter CH0_FF_RX_H_CLK_EN = \"DONTCARE\";\n parameter CH1_FF_RX_H_CLK_EN = \"DONTCARE\";\n parameter CH0_FF_RX_F_CLK_DIS = \"DONTCARE\";\n parameter CH1_FF_RX_F_CLK_DIS = \"DONTCARE\";\n parameter CH0_FF_TX_H_CLK_EN = \"DONTCARE\";\n parameter CH1_FF_TX_H_CLK_EN = \"DONTCARE\";\n parameter CH0_FF_TX_F_CLK_DIS = \"DONTCARE\";\n parameter CH1_FF_TX_F_CLK_DIS = \"DONTCARE\";\n parameter CH0_RX_RATE_SEL = \"DONTCARE\";\n parameter CH1_RX_RATE_SEL = \"DONTCARE\";\n parameter CH0_TDRV_POST_EN = \"DONTCARE\";\n parameter CH1_TDRV_POST_EN = \"DONTCARE\";\n parameter CH0_TX_POST_SIGN = \"DONTCARE\";\n parameter CH1_TX_POST_SIGN = \"DONTCARE\";\n parameter CH0_TX_PRE_SIGN = \"DONTCARE\";\n parameter CH1_TX_PRE_SIGN = \"DONTCARE\";\n parameter CH0_RXTERM_CM = \"DONTCARE\";\n parameter CH1_RXTERM_CM = \"DONTCARE\";\n parameter CH0_RXIN_CM = \"DONTCARE\";\n parameter CH1_RXIN_CM = \"DONTCARE\";\n parameter CH0_LEQ_OFFSET_SEL = \"DONTCARE\";\n parameter CH1_LEQ_OFFSET_SEL = \"DONTCARE\";\n parameter CH0_LEQ_OFFSET_TRIM = \"DONTCARE\";\n parameter CH1_LEQ_OFFSET_TRIM = \"DONTCARE\";\n parameter D_TX_MAX_RATE = \"DONTCARE\";\n parameter CH0_CDR_MAX_RATE = \"DONTCARE\";\n parameter CH1_CDR_MAX_RATE = \"DONTCARE\";\n parameter CH0_TXAMPLITUDE = \"DONTCARE\";\n parameter CH1_TXAMPLITUDE = \"DONTCARE\";\n parameter CH0_TXDEPRE = \"DONTCARE\";\n parameter CH1_TXDEPRE = \"DONTCARE\";\n parameter CH0_TXDEPOST = \"DONTCARE\";\n parameter CH1_TXDEPOST = \"DONTCARE\";\n parameter CH0_PROTOCOL = \"DONTCARE\";\n parameter CH1_PROTOCOL = \"DONTCARE\";\n parameter D_ISETLOS = \"DONTCARE\";\n parameter D_SETIRPOLY_AUX = \"DONTCARE\";\n parameter D_SETICONST_AUX = \"DONTCARE\";\n parameter D_SETIRPOLY_CH = \"DONTCARE\";\n parameter D_SETICONST_CH = \"DONTCARE\";\n parameter D_REQ_ISET = \"DONTCARE\";\n parameter D_PD_ISET = \"DONTCARE\";\n parameter D_DCO_CALIB_TIME_SEL = \"DONTCARE\";\n parameter CH0_DCOCTLGI = \"DONTCARE\";\n parameter CH1_DCOCTLGI = \"DONTCARE\";\n parameter CH0_DCOATDDLY = \"DONTCARE\";\n parameter CH1_DCOATDDLY = \"DONTCARE\";\n parameter CH0_DCOATDCFG = \"DONTCARE\";\n parameter CH1_DCOATDCFG = \"DONTCARE\";\n parameter CH0_DCOBYPSATD = \"DONTCARE\";\n parameter CH1_DCOBYPSATD = \"DONTCARE\";\n parameter CH0_DCOSCALEI = \"DONTCARE\";\n parameter CH1_DCOSCALEI = \"DONTCARE\";\n parameter CH0_DCOITUNE4LSB = \"DONTCARE\";\n parameter CH1_DCOITUNE4LSB = \"DONTCARE\";\n parameter CH0_DCOIOSTUNE = \"DONTCARE\";\n parameter CH1_DCOIOSTUNE = \"DONTCARE\";\n parameter CH0_DCODISBDAVOID = \"DONTCARE\";\n parameter CH1_DCODISBDAVOID = \"DONTCARE\";\n parameter CH0_DCOCALDIV = \"DONTCARE\";\n parameter CH1_DCOCALDIV = \"DONTCARE\";\n parameter CH0_DCONUOFLSB = \"DONTCARE\";\n parameter CH1_DCONUOFLSB = \"DONTCARE\";\n parameter CH0_DCOIUPDNX2 = \"DONTCARE\";\n parameter CH1_DCOIUPDNX2 = \"DONTCARE\";\n parameter CH0_DCOSTEP = \"DONTCARE\";\n parameter CH1_DCOSTEP = \"DONTCARE\";\n parameter CH0_DCOSTARTVAL = \"DONTCARE\";\n parameter CH1_DCOSTARTVAL = \"DONTCARE\";\n parameter CH0_DCOFLTDAC = \"DONTCARE\";\n parameter CH1_DCOFLTDAC = \"DONTCARE\";\n parameter CH0_DCOITUNE = \"DONTCARE\";\n parameter CH1_DCOITUNE = \"DONTCARE\";\n parameter CH0_DCOFTNRG = \"DONTCARE\";\n parameter CH1_DCOFTNRG = \"DONTCARE\";\n parameter CH0_CDR_CNT4SEL = \"DONTCARE\";\n parameter CH1_CDR_CNT4SEL = \"DONTCARE\";\n parameter CH0_CDR_CNT8SEL = \"DONTCARE\";\n parameter CH1_CDR_CNT8SEL = \"DONTCARE\";\n parameter CH0_BAND_THRESHOLD = \"DONTCARE\";\n parameter CH1_BAND_THRESHOLD = \"DONTCARE\";\n parameter CH0_AUTO_FACQ_EN = \"DONTCARE\";\n parameter CH1_AUTO_FACQ_EN = \"DONTCARE\";\n parameter CH0_AUTO_CALIB_EN = \"DONTCARE\";\n parameter CH1_AUTO_CALIB_EN = \"DONTCARE\";\n parameter CH0_CALIB_CK_MODE = \"DONTCARE\";\n parameter CH1_CALIB_CK_MODE = \"DONTCARE\";\n parameter CH0_REG_BAND_OFFSET = \"DONTCARE\";\n parameter CH1_REG_BAND_OFFSET = \"DONTCARE\";\n parameter CH0_REG_BAND_SEL = \"DONTCARE\";\n parameter CH1_REG_BAND_SEL = \"DONTCARE\";\n parameter CH0_REG_IDAC_SEL = \"DONTCARE\";\n parameter CH1_REG_IDAC_SEL = \"DONTCARE\";\n parameter CH0_REG_IDAC_EN = \"DONTCARE\";\n parameter CH1_REG_IDAC_EN = \"DONTCARE\";\n parameter D_TXPLL_PWDNB = \"DONTCARE\";\n parameter D_SETPLLRC = \"DONTCARE\";\n parameter D_REFCK_MODE = \"DONTCARE\";\n parameter D_TX_VCO_CK_DIV = \"DONTCARE\";\n parameter D_PLL_LOL_SET = \"DONTCARE\";\n parameter D_RG_EN = \"DONTCARE\";\n parameter D_RG_SET = \"DONTCARE\";\n parameter D_CMUSETISCL4VCO = \"DONTCARE\";\n parameter D_CMUSETI4VCO = \"DONTCARE\";\n parameter D_CMUSETINITVCT = \"DONTCARE\";\n parameter D_CMUSETZGM = \"DONTCARE\";\n parameter D_CMUSETP2AGM = \"DONTCARE\";\n parameter D_CMUSETP1GM = \"DONTCARE\";\n parameter D_CMUSETI4CPZ = \"DONTCARE\";\n parameter D_CMUSETI4CPP = \"DONTCARE\";\n parameter D_CMUSETICP4Z = \"DONTCARE\";\n parameter D_CMUSETICP4P = \"DONTCARE\";\n parameter D_CMUSETBIASI = \"DONTCARE\";\n (* iopad_external_pin *)\n (* iopad_external_pin *)\n input CH0_HDINP;\n (* iopad_external_pin *)\n input CH1_HDINP;\n (* iopad_external_pin *)\n input CH0_HDINN;\n (* iopad_external_pin *)\n input CH1_HDINN;\n input D_TXBIT_CLKP_FROM_ND;\n input D_TXBIT_CLKN_FROM_ND;\n input D_SYNC_ND;\n input D_TXPLL_LOL_FROM_ND;\n input CH0_RX_REFCLK;\n input CH1_RX_REFCLK;\n input CH0_FF_RXI_CLK;\n input CH1_FF_RXI_CLK;\n input CH0_FF_TXI_CLK;\n input CH1_FF_TXI_CLK;\n input CH0_FF_EBRD_CLK;\n input CH1_FF_EBRD_CLK;\n input CH0_FF_TX_D_0;\n input CH1_FF_TX_D_0;\n input CH0_FF_TX_D_1;\n input CH1_FF_TX_D_1;\n input CH0_FF_TX_D_2;\n input CH1_FF_TX_D_2;\n input CH0_FF_TX_D_3;\n input CH1_FF_TX_D_3;\n input CH0_FF_TX_D_4;\n input CH1_FF_TX_D_4;\n input CH0_FF_TX_D_5;\n input CH1_FF_TX_D_5;\n input CH0_FF_TX_D_6;\n input CH1_FF_TX_D_6;\n input CH0_FF_TX_D_7;\n input CH1_FF_TX_D_7;\n input CH0_FF_TX_D_8;\n input CH1_FF_TX_D_8;\n input CH0_FF_TX_D_9;\n input CH1_FF_TX_D_9;\n input CH0_FF_TX_D_10;\n input CH1_FF_TX_D_10;\n input CH0_FF_TX_D_11;\n input CH1_FF_TX_D_11;\n input CH0_FF_TX_D_12;\n input CH1_FF_TX_D_12;\n input CH0_FF_TX_D_13;\n input CH1_FF_TX_D_13;\n input CH0_FF_TX_D_14;\n input CH1_FF_TX_D_14;\n input CH0_FF_TX_D_15;\n input CH1_FF_TX_D_15;\n input CH0_FF_TX_D_16;\n input CH1_FF_TX_D_16;\n input CH0_FF_TX_D_17;\n input CH1_FF_TX_D_17;\n input CH0_FF_TX_D_18;\n input CH1_FF_TX_D_18;\n input CH0_FF_TX_D_19;\n input CH1_FF_TX_D_19;\n input CH0_FF_TX_D_20;\n input CH1_FF_TX_D_20;\n input CH0_FF_TX_D_21;\n input CH1_FF_TX_D_21;\n input CH0_FF_TX_D_22;\n input CH1_FF_TX_D_22;\n input CH0_FF_TX_D_23;\n input CH1_FF_TX_D_23;\n input CH0_FFC_EI_EN;\n input CH1_FFC_EI_EN;\n input CH0_FFC_PCIE_DET_EN;\n input CH1_FFC_PCIE_DET_EN;\n input CH0_FFC_PCIE_CT;\n input CH1_FFC_PCIE_CT;\n input CH0_FFC_SB_INV_RX;\n input CH1_FFC_SB_INV_RX;\n input CH0_FFC_ENABLE_CGALIGN;\n input CH1_FFC_ENABLE_CGALIGN;\n input CH0_FFC_SIGNAL_DETECT;\n input CH1_FFC_SIGNAL_DETECT;\n input CH0_FFC_FB_LOOPBACK;\n input CH1_FFC_FB_LOOPBACK;\n input CH0_FFC_SB_PFIFO_LP;\n input CH1_FFC_SB_PFIFO_LP;\n input CH0_FFC_PFIFO_CLR;\n input CH1_FFC_PFIFO_CLR;\n input CH0_FFC_RATE_MODE_RX;\n input CH1_FFC_RATE_MODE_RX;\n input CH0_FFC_RATE_MODE_TX;\n input CH1_FFC_RATE_MODE_TX;\n input CH0_FFC_DIV11_MODE_RX;\n input CH1_FFC_DIV11_MODE_RX;\n input CH0_FFC_RX_GEAR_MODE;\n input CH1_FFC_RX_GEAR_MODE;\n input CH0_FFC_TX_GEAR_MODE;\n input CH1_FFC_TX_GEAR_MODE;\n input CH0_FFC_DIV11_MODE_TX;\n input CH1_FFC_DIV11_MODE_TX;\n input CH0_FFC_LDR_CORE2TX_EN;\n input CH1_FFC_LDR_CORE2TX_EN;\n input CH0_FFC_LANE_TX_RST;\n input CH1_FFC_LANE_TX_RST;\n input CH0_FFC_LANE_RX_RST;\n input CH1_FFC_LANE_RX_RST;\n input CH0_FFC_RRST;\n input CH1_FFC_RRST;\n input CH0_FFC_TXPWDNB;\n input CH1_FFC_TXPWDNB;\n input CH0_FFC_RXPWDNB;\n input CH1_FFC_RXPWDNB;\n input CH0_LDR_CORE2TX;\n input CH1_LDR_CORE2TX;\n input D_SCIWDATA0;\n input D_SCIWDATA1;\n input D_SCIWDATA2;\n input D_SCIWDATA3;\n input D_SCIWDATA4;\n input D_SCIWDATA5;\n input D_SCIWDATA6;\n input D_SCIWDATA7;\n input D_SCIADDR0;\n input D_SCIADDR1;\n input D_SCIADDR2;\n input D_SCIADDR3;\n input D_SCIADDR4;\n input D_SCIADDR5;\n input D_SCIENAUX;\n input D_SCISELAUX;\n input CH0_SCIEN;\n input CH1_SCIEN;\n input CH0_SCISEL;\n input CH1_SCISEL;\n input D_SCIRD;\n input D_SCIWSTN;\n input D_CYAWSTN;\n input D_FFC_SYNC_TOGGLE;\n input D_FFC_DUAL_RST;\n input D_FFC_MACRO_RST;\n input D_FFC_MACROPDB;\n input D_FFC_TRST;\n input CH0_FFC_CDR_EN_BITSLIP;\n input CH1_FFC_CDR_EN_BITSLIP;\n input D_SCAN_ENABLE;\n input D_SCAN_IN_0;\n input D_SCAN_IN_1;\n input D_SCAN_IN_2;\n input D_SCAN_IN_3;\n input D_SCAN_IN_4;\n input D_SCAN_IN_5;\n input D_SCAN_IN_6;\n input D_SCAN_IN_7;\n input D_SCAN_MODE;\n input D_SCAN_RESET;\n input D_CIN0;\n input D_CIN1;\n input D_CIN2;\n input D_CIN3;\n input D_CIN4;\n input D_CIN5;\n input D_CIN6;\n input D_CIN7;\n input D_CIN8;\n input D_CIN9;\n input D_CIN10;\n input D_CIN11;\n output CH0_HDOUTP;\n output CH1_HDOUTP;\n output CH0_HDOUTN;\n output CH1_HDOUTN;\n output D_TXBIT_CLKP_TO_ND;\n output D_TXBIT_CLKN_TO_ND;\n output D_SYNC_PULSE2ND;\n output D_TXPLL_LOL_TO_ND;\n output CH0_FF_RX_F_CLK;\n output CH1_FF_RX_F_CLK;\n output CH0_FF_RX_H_CLK;\n output CH1_FF_RX_H_CLK;\n output CH0_FF_TX_F_CLK;\n output CH1_FF_TX_F_CLK;\n output CH0_FF_TX_H_CLK;\n output CH1_FF_TX_H_CLK;\n output CH0_FF_RX_PCLK;\n output CH1_FF_RX_PCLK;\n output CH0_FF_TX_PCLK;\n output CH1_FF_TX_PCLK;\n output CH0_FF_RX_D_0;\n output CH1_FF_RX_D_0;\n output CH0_FF_RX_D_1;\n output CH1_FF_RX_D_1;\n output CH0_FF_RX_D_2;\n output CH1_FF_RX_D_2;\n output CH0_FF_RX_D_3;\n output CH1_FF_RX_D_3;\n output CH0_FF_RX_D_4;\n output CH1_FF_RX_D_4;\n output CH0_FF_RX_D_5;\n output CH1_FF_RX_D_5;\n output CH0_FF_RX_D_6;\n output CH1_FF_RX_D_6;\n output CH0_FF_RX_D_7;\n output CH1_FF_RX_D_7;\n output CH0_FF_RX_D_8;\n output CH1_FF_RX_D_8;\n output CH0_FF_RX_D_9;\n output CH1_FF_RX_D_9;\n output CH0_FF_RX_D_10;\n output CH1_FF_RX_D_10;\n output CH0_FF_RX_D_11;\n output CH1_FF_RX_D_11;\n output CH0_FF_RX_D_12;\n output CH1_FF_RX_D_12;\n output CH0_FF_RX_D_13;\n output CH1_FF_RX_D_13;\n output CH0_FF_RX_D_14;\n output CH1_FF_RX_D_14;\n output CH0_FF_RX_D_15;\n output CH1_FF_RX_D_15;\n output CH0_FF_RX_D_16;\n output CH1_FF_RX_D_16;\n output CH0_FF_RX_D_17;\n output CH1_FF_RX_D_17;\n output CH0_FF_RX_D_18;\n output CH1_FF_RX_D_18;\n output CH0_FF_RX_D_19;\n output CH1_FF_RX_D_19;\n output CH0_FF_RX_D_20;\n output CH1_FF_RX_D_20;\n output CH0_FF_RX_D_21;\n output CH1_FF_RX_D_21;\n output CH0_FF_RX_D_22;\n output CH1_FF_RX_D_22;\n output CH0_FF_RX_D_23;\n output CH1_FF_RX_D_23;\n output CH0_FFS_PCIE_DONE;\n output CH1_FFS_PCIE_DONE;\n output CH0_FFS_PCIE_CON;\n output CH1_FFS_PCIE_CON;\n output CH0_FFS_RLOS;\n output CH1_FFS_RLOS;\n output CH0_FFS_LS_SYNC_STATUS;\n output CH1_FFS_LS_SYNC_STATUS;\n output CH0_FFS_CC_UNDERRUN;\n output CH1_FFS_CC_UNDERRUN;\n output CH0_FFS_CC_OVERRUN;\n output CH1_FFS_CC_OVERRUN;\n output CH0_FFS_RXFBFIFO_ERROR;\n output CH1_FFS_RXFBFIFO_ERROR;\n output CH0_FFS_TXFBFIFO_ERROR;\n output CH1_FFS_TXFBFIFO_ERROR;\n output CH0_FFS_RLOL;\n output CH1_FFS_RLOL;\n output CH0_FFS_SKP_ADDED;\n output CH1_FFS_SKP_ADDED;\n output CH0_FFS_SKP_DELETED;\n output CH1_FFS_SKP_DELETED;\n output CH0_LDR_RX2CORE;\n output CH1_LDR_RX2CORE;\n output D_SCIRDATA0;\n output D_SCIRDATA1;\n output D_SCIRDATA2;\n output D_SCIRDATA3;\n output D_SCIRDATA4;\n output D_SCIRDATA5;\n output D_SCIRDATA6;\n output D_SCIRDATA7;\n output D_SCIINT;\n output D_SCAN_OUT_0;\n output D_SCAN_OUT_1;\n output D_SCAN_OUT_2;\n output D_SCAN_OUT_3;\n output D_SCAN_OUT_4;\n output D_SCAN_OUT_5;\n output D_SCAN_OUT_6;\n output D_SCAN_OUT_7;\n output D_COUT0;\n output D_COUT1;\n output D_COUT2;\n output D_COUT3;\n output D_COUT4;\n output D_COUT5;\n output D_COUT6;\n output D_COUT7;\n output D_COUT8;\n output D_COUT9;\n output D_COUT10;\n output D_COUT11;\n output D_COUT12;\n output D_COUT13;\n output D_COUT14;\n output D_COUT15;\n output D_COUT16;\n output D_COUT17;\n output D_COUT18;\n output D_COUT19;\n input D_REFCLKI;\n output D_FFS_PLOL;\nendmodule\n\n",
|
|
274
|
+
"cells_bb_ecp5.v": "// Created by cells_xtra.py from Lattice models\n\n(* blackbox *) (* keep *)\nmodule GSR (...);\n input GSR;\nendmodule\n\n(* blackbox *)\nmodule PUR (...);\n parameter RST_PULSE = 1;\n input PUR;\nendmodule\n\n(* blackbox *) (* keep *)\nmodule SGSR (...);\n input GSR;\n input CLK;\nendmodule\n\n(* blackbox *)\nmodule DP16KD (...);\n parameter CLKAMUX = \"CLKA\";\n parameter CLKBMUX = \"CLKB\";\n parameter DATA_WIDTH_A = 18;\n parameter DATA_WIDTH_B = 18;\n parameter REGMODE_A = \"NOREG\";\n parameter REGMODE_B = \"NOREG\";\n parameter RESETMODE = \"SYNC\";\n parameter ASYNC_RESET_RELEASE = \"SYNC\";\n parameter WRITEMODE_A = \"NORMAL\";\n parameter WRITEMODE_B = \"NORMAL\";\n parameter CSDECODE_A = \"0b000\";\n parameter CSDECODE_B = \"0b000\";\n parameter GSR = \"ENABLED\";\n parameter INITVAL_00 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_01 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_02 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_03 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_04 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_05 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_06 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_07 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_08 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_09 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0A = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0B = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0C = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0D = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0E = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0F = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_10 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_11 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_12 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_13 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_14 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_15 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_16 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_17 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_18 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_19 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1A = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1B = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1C = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1D = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1E = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1F = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_20 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_21 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_22 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_23 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_24 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_25 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_26 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_27 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_28 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_29 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_2A = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_2B = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_2C = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_2D = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_2E = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_2F = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_30 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_31 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_32 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_33 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_34 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_35 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_36 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_37 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_38 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_39 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_3A = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_3B = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_3C = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_3D = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_3E = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_3F = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INIT_DATA = \"STATIC\";\n input DIA17;\n input DIA16;\n input DIA15;\n input DIA14;\n input DIA13;\n input DIA12;\n input DIA11;\n input DIA10;\n input DIA9;\n input DIA8;\n input DIA7;\n input DIA6;\n input DIA5;\n input DIA4;\n input DIA3;\n input DIA2;\n input DIA1;\n input DIA0;\n input ADA13;\n input ADA12;\n input ADA11;\n input ADA10;\n input ADA9;\n input ADA8;\n input ADA7;\n input ADA6;\n input ADA5;\n input ADA4;\n input ADA3;\n input ADA2;\n input ADA1;\n input ADA0;\n input CEA;\n input OCEA;\n input CLKA;\n input WEA;\n input CSA2;\n input CSA1;\n input CSA0;\n input RSTA;\n input DIB17;\n input DIB16;\n input DIB15;\n input DIB14;\n input DIB13;\n input DIB12;\n input DIB11;\n input DIB10;\n input DIB9;\n input DIB8;\n input DIB7;\n input DIB6;\n input DIB5;\n input DIB4;\n input DIB3;\n input DIB2;\n input DIB1;\n input DIB0;\n input ADB13;\n input ADB12;\n input ADB11;\n input ADB10;\n input ADB9;\n input ADB8;\n input ADB7;\n input ADB6;\n input ADB5;\n input ADB4;\n input ADB3;\n input ADB2;\n input ADB1;\n input ADB0;\n input CEB;\n input OCEB;\n input CLKB;\n input WEB;\n input CSB2;\n input CSB1;\n input CSB0;\n input RSTB;\n output DOA17;\n output DOA16;\n output DOA15;\n output DOA14;\n output DOA13;\n output DOA12;\n output DOA11;\n output DOA10;\n output DOA9;\n output DOA8;\n output DOA7;\n output DOA6;\n output DOA5;\n output DOA4;\n output DOA3;\n output DOA2;\n output DOA1;\n output DOA0;\n output DOB17;\n output DOB16;\n output DOB15;\n output DOB14;\n output DOB13;\n output DOB12;\n output DOB11;\n output DOB10;\n output DOB9;\n output DOB8;\n output DOB7;\n output DOB6;\n output DOB5;\n output DOB4;\n output DOB3;\n output DOB2;\n output DOB1;\n output DOB0;\nendmodule\n\n(* blackbox *)\nmodule PDPW16KD (...);\n parameter CLKRMUX = \"CLKR\";\n parameter CLKWMUX = \"CLKW\";\n parameter DATA_WIDTH_W = 36;\n parameter DATA_WIDTH_R = 36;\n parameter GSR = \"ENABLED\";\n parameter REGMODE = \"NOREG\";\n parameter RESETMODE = \"SYNC\";\n parameter ASYNC_RESET_RELEASE = \"SYNC\";\n parameter CSDECODE_W = \"0b000\";\n parameter CSDECODE_R = \"0b000\";\n parameter INITVAL_00 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_01 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_02 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_03 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_04 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_05 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_06 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_07 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_08 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_09 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0A = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0B = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0C = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0D = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0E = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0F = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_10 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_11 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_12 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_13 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_14 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_15 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_16 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_17 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_18 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_19 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1A = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1B = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1C = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1D = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1E = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1F = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_20 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_21 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_22 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_23 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_24 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_25 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_26 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_27 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_28 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_29 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_2A = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_2B = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_2C = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_2D = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_2E = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_2F = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_30 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_31 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_32 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_33 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_34 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_35 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_36 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_37 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_38 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_39 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_3A = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_3B = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_3C = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_3D = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_3E = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_3F = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INIT_DATA = \"STATIC\";\n input DI35;\n input DI34;\n input DI33;\n input DI32;\n input DI31;\n input DI30;\n input DI29;\n input DI28;\n input DI27;\n input DI26;\n input DI25;\n input DI24;\n input DI23;\n input DI22;\n input DI21;\n input DI20;\n input DI19;\n input DI18;\n input DI17;\n input DI16;\n input DI15;\n input DI14;\n input DI13;\n input DI12;\n input DI11;\n input DI10;\n input DI9;\n input DI8;\n input DI7;\n input DI6;\n input DI5;\n input DI4;\n input DI3;\n input DI2;\n input DI1;\n input DI0;\n input ADW8;\n input ADW7;\n input ADW6;\n input ADW5;\n input ADW4;\n input ADW3;\n input ADW2;\n input ADW1;\n input ADW0;\n input BE3;\n input BE2;\n input BE1;\n input BE0;\n input CEW;\n input CLKW;\n input CSW2;\n input CSW1;\n input CSW0;\n input ADR13;\n input ADR12;\n input ADR11;\n input ADR10;\n input ADR9;\n input ADR8;\n input ADR7;\n input ADR6;\n input ADR5;\n input ADR4;\n input ADR3;\n input ADR2;\n input ADR1;\n input ADR0;\n input CER;\n input OCER;\n input CLKR;\n input CSR2;\n input CSR1;\n input CSR0;\n input RST;\n output DO35;\n output DO34;\n output DO33;\n output DO32;\n output DO31;\n output DO30;\n output DO29;\n output DO28;\n output DO27;\n output DO26;\n output DO25;\n output DO24;\n output DO23;\n output DO22;\n output DO21;\n output DO20;\n output DO19;\n output DO18;\n output DO17;\n output DO16;\n output DO15;\n output DO14;\n output DO13;\n output DO12;\n output DO11;\n output DO10;\n output DO9;\n output DO8;\n output DO7;\n output DO6;\n output DO5;\n output DO4;\n output DO3;\n output DO2;\n output DO1;\n output DO0;\nendmodule\n\n(* blackbox *)\nmodule MULT18X18D (...);\n parameter REG_INPUTA_CLK = \"NONE\";\n parameter REG_INPUTA_CE = \"CE0\";\n parameter REG_INPUTA_RST = \"RST0\";\n parameter REG_INPUTB_CLK = \"NONE\";\n parameter REG_INPUTB_CE = \"CE0\";\n parameter REG_INPUTB_RST = \"RST0\";\n parameter REG_INPUTC_CLK = \"NONE\";\n parameter REG_INPUTC_CE = \"CE0\";\n parameter REG_INPUTC_RST = \"RST0\";\n parameter REG_PIPELINE_CLK = \"NONE\";\n parameter REG_PIPELINE_CE = \"CE0\";\n parameter REG_PIPELINE_RST = \"RST0\";\n parameter REG_OUTPUT_CLK = \"NONE\";\n parameter REG_OUTPUT_CE = \"CE0\";\n parameter REG_OUTPUT_RST = \"RST0\";\n parameter CLK0_DIV = \"ENABLED\";\n parameter CLK1_DIV = \"ENABLED\";\n parameter CLK2_DIV = \"ENABLED\";\n parameter CLK3_DIV = \"ENABLED\";\n parameter HIGHSPEED_CLK = \"NONE\";\n parameter GSR = \"ENABLED\";\n parameter CAS_MATCH_REG = \"FALSE\";\n parameter SOURCEB_MODE = \"B_SHIFT\";\n parameter MULT_BYPASS = \"DISABLED\";\n parameter RESETMODE = \"SYNC\";\n input A17;\n input A16;\n input A15;\n input A14;\n input A13;\n input A12;\n input A11;\n input A10;\n input A9;\n input A8;\n input A7;\n input A6;\n input A5;\n input A4;\n input A3;\n input A2;\n input A1;\n input A0;\n input B17;\n input B16;\n input B15;\n input B14;\n input B13;\n input B12;\n input B11;\n input B10;\n input B9;\n input B8;\n input B7;\n input B6;\n input B5;\n input B4;\n input B3;\n input B2;\n input B1;\n input B0;\n input C17;\n input C16;\n input C15;\n input C14;\n input C13;\n input C12;\n input C11;\n input C10;\n input C9;\n input C8;\n input C7;\n input C6;\n input C5;\n input C4;\n input C3;\n input C2;\n input C1;\n input C0;\n input SIGNEDA;\n input SIGNEDB;\n input SOURCEA;\n input SOURCEB;\n input CLK3;\n input CLK2;\n input CLK1;\n input CLK0;\n input CE3;\n input CE2;\n input CE1;\n input CE0;\n input RST3;\n input RST2;\n input RST1;\n input RST0;\n input SRIA17;\n input SRIA16;\n input SRIA15;\n input SRIA14;\n input SRIA13;\n input SRIA12;\n input SRIA11;\n input SRIA10;\n input SRIA9;\n input SRIA8;\n input SRIA7;\n input SRIA6;\n input SRIA5;\n input SRIA4;\n input SRIA3;\n input SRIA2;\n input SRIA1;\n input SRIA0;\n input SRIB17;\n input SRIB16;\n input SRIB15;\n input SRIB14;\n input SRIB13;\n input SRIB12;\n input SRIB11;\n input SRIB10;\n input SRIB9;\n input SRIB8;\n input SRIB7;\n input SRIB6;\n input SRIB5;\n input SRIB4;\n input SRIB3;\n input SRIB2;\n input SRIB1;\n input SRIB0;\n output SROA17;\n output SROA16;\n output SROA15;\n output SROA14;\n output SROA13;\n output SROA12;\n output SROA11;\n output SROA10;\n output SROA9;\n output SROA8;\n output SROA7;\n output SROA6;\n output SROA5;\n output SROA4;\n output SROA3;\n output SROA2;\n output SROA1;\n output SROA0;\n output SROB17;\n output SROB16;\n output SROB15;\n output SROB14;\n output SROB13;\n output SROB12;\n output SROB11;\n output SROB10;\n output SROB9;\n output SROB8;\n output SROB7;\n output SROB6;\n output SROB5;\n output SROB4;\n output SROB3;\n output SROB2;\n output SROB1;\n output SROB0;\n output ROA17;\n output ROA16;\n output ROA15;\n output ROA14;\n output ROA13;\n output ROA12;\n output ROA11;\n output ROA10;\n output ROA9;\n output ROA8;\n output ROA7;\n output ROA6;\n output ROA5;\n output ROA4;\n output ROA3;\n output ROA2;\n output ROA1;\n output ROA0;\n output ROB17;\n output ROB16;\n output ROB15;\n output ROB14;\n output ROB13;\n output ROB12;\n output ROB11;\n output ROB10;\n output ROB9;\n output ROB8;\n output ROB7;\n output ROB6;\n output ROB5;\n output ROB4;\n output ROB3;\n output ROB2;\n output ROB1;\n output ROB0;\n output ROC17;\n output ROC16;\n output ROC15;\n output ROC14;\n output ROC13;\n output ROC12;\n output ROC11;\n output ROC10;\n output ROC9;\n output ROC8;\n output ROC7;\n output ROC6;\n output ROC5;\n output ROC4;\n output ROC3;\n output ROC2;\n output ROC1;\n output ROC0;\n output P35;\n output P34;\n output P33;\n output P32;\n output P31;\n output P30;\n output P29;\n output P28;\n output P27;\n output P26;\n output P25;\n output P24;\n output P23;\n output P22;\n output P21;\n output P20;\n output P19;\n output P18;\n output P17;\n output P16;\n output P15;\n output P14;\n output P13;\n output P12;\n output P11;\n output P10;\n output P9;\n output P8;\n output P7;\n output P6;\n output P5;\n output P4;\n output P3;\n output P2;\n output P1;\n output P0;\n output SIGNEDP;\nendmodule\n\n(* blackbox *)\nmodule ALU54B (...);\n parameter REG_INPUTC0_CLK = \"NONE\";\n parameter REG_INPUTC0_CE = \"CE0\";\n parameter REG_INPUTC0_RST = \"RST0\";\n parameter REG_INPUTC1_CLK = \"NONE\";\n parameter REG_INPUTC1_CE = \"CE0\";\n parameter REG_INPUTC1_RST = \"RST0\";\n parameter REG_OPCODEOP0_0_CLK = \"NONE\";\n parameter REG_OPCODEOP0_0_CE = \"CE0\";\n parameter REG_OPCODEOP0_0_RST = \"RST0\";\n parameter REG_OPCODEOP1_0_CLK = \"NONE\";\n parameter REG_OPCODEOP0_1_CLK = \"NONE\";\n parameter REG_OPCODEOP0_1_CE = \"CE0\";\n parameter REG_OPCODEOP0_1_RST = \"RST0\";\n parameter REG_OPCODEOP1_1_CLK = \"NONE\";\n parameter REG_OPCODEIN_0_CLK = \"NONE\";\n parameter REG_OPCODEIN_0_CE = \"CE0\";\n parameter REG_OPCODEIN_0_RST = \"RST0\";\n parameter REG_OPCODEIN_1_CLK = \"NONE\";\n parameter REG_OPCODEIN_1_CE = \"CE0\";\n parameter REG_OPCODEIN_1_RST = \"RST0\";\n parameter REG_OUTPUT0_CLK = \"NONE\";\n parameter REG_OUTPUT0_CE = \"CE0\";\n parameter REG_OUTPUT0_RST = \"RST0\";\n parameter REG_OUTPUT1_CLK = \"NONE\";\n parameter REG_OUTPUT1_CE = \"CE0\";\n parameter REG_OUTPUT1_RST = \"RST0\";\n parameter REG_FLAG_CLK = \"NONE\";\n parameter REG_FLAG_CE = \"CE0\";\n parameter REG_FLAG_RST = \"RST0\";\n parameter MCPAT_SOURCE = \"STATIC\";\n parameter MASKPAT_SOURCE = \"STATIC\";\n parameter MASK01 = \"0x00000000000000\";\n parameter REG_INPUTCFB_CLK = \"NONE\";\n parameter REG_INPUTCFB_CE = \"CE0\";\n parameter REG_INPUTCFB_RST = \"RST0\";\n parameter CLK0_DIV = \"ENABLED\";\n parameter CLK1_DIV = \"ENABLED\";\n parameter CLK2_DIV = \"ENABLED\";\n parameter CLK3_DIV = \"ENABLED\";\n parameter MCPAT = \"0x00000000000000\";\n parameter MASKPAT = \"0x00000000000000\";\n parameter RNDPAT = \"0x00000000000000\";\n parameter GSR = \"ENABLED\";\n parameter RESETMODE = \"SYNC\";\n parameter MULT9_MODE = \"DISABLED\";\n parameter FORCE_ZERO_BARREL_SHIFT = \"DISABLED\";\n parameter LEGACY = \"DISABLED\";\n input CE3;\n input CE2;\n input CE1;\n input CE0;\n input CLK3;\n input CLK2;\n input CLK1;\n input CLK0;\n input RST3;\n input RST2;\n input RST1;\n input RST0;\n input SIGNEDIA;\n input SIGNEDIB;\n input SIGNEDCIN;\n input A35;\n input A34;\n input A33;\n input A32;\n input A31;\n input A30;\n input A29;\n input A28;\n input A27;\n input A26;\n input A25;\n input A24;\n input A23;\n input A22;\n input A21;\n input A20;\n input A19;\n input A18;\n input A17;\n input A16;\n input A15;\n input A14;\n input A13;\n input A12;\n input A11;\n input A10;\n input A9;\n input A8;\n input A7;\n input A6;\n input A5;\n input A4;\n input A3;\n input A2;\n input A1;\n input A0;\n input B35;\n input B34;\n input B33;\n input B32;\n input B31;\n input B30;\n input B29;\n input B28;\n input B27;\n input B26;\n input B25;\n input B24;\n input B23;\n input B22;\n input B21;\n input B20;\n input B19;\n input B18;\n input B17;\n input B16;\n input B15;\n input B14;\n input B13;\n input B12;\n input B11;\n input B10;\n input B9;\n input B8;\n input B7;\n input B6;\n input B5;\n input B4;\n input B3;\n input B2;\n input B1;\n input B0;\n input C53;\n input C52;\n input C51;\n input C50;\n input C49;\n input C48;\n input C47;\n input C46;\n input C45;\n input C44;\n input C43;\n input C42;\n input C41;\n input C40;\n input C39;\n input C38;\n input C37;\n input C36;\n input C35;\n input C34;\n input C33;\n input C32;\n input C31;\n input C30;\n input C29;\n input C28;\n input C27;\n input C26;\n input C25;\n input C24;\n input C23;\n input C22;\n input C21;\n input C20;\n input C19;\n input C18;\n input C17;\n input C16;\n input C15;\n input C14;\n input C13;\n input C12;\n input C11;\n input C10;\n input C9;\n input C8;\n input C7;\n input C6;\n input C5;\n input C4;\n input C3;\n input C2;\n input C1;\n input C0;\n input CFB53;\n input CFB52;\n input CFB51;\n input CFB50;\n input CFB49;\n input CFB48;\n input CFB47;\n input CFB46;\n input CFB45;\n input CFB44;\n input CFB43;\n input CFB42;\n input CFB41;\n input CFB40;\n input CFB39;\n input CFB38;\n input CFB37;\n input CFB36;\n input CFB35;\n input CFB34;\n input CFB33;\n input CFB32;\n input CFB31;\n input CFB30;\n input CFB29;\n input CFB28;\n input CFB27;\n input CFB26;\n input CFB25;\n input CFB24;\n input CFB23;\n input CFB22;\n input CFB21;\n input CFB20;\n input CFB19;\n input CFB18;\n input CFB17;\n input CFB16;\n input CFB15;\n input CFB14;\n input CFB13;\n input CFB12;\n input CFB11;\n input CFB10;\n input CFB9;\n input CFB8;\n input CFB7;\n input CFB6;\n input CFB5;\n input CFB4;\n input CFB3;\n input CFB2;\n input CFB1;\n input CFB0;\n input MA35;\n input MA34;\n input MA33;\n input MA32;\n input MA31;\n input MA30;\n input MA29;\n input MA28;\n input MA27;\n input MA26;\n input MA25;\n input MA24;\n input MA23;\n input MA22;\n input MA21;\n input MA20;\n input MA19;\n input MA18;\n input MA17;\n input MA16;\n input MA15;\n input MA14;\n input MA13;\n input MA12;\n input MA11;\n input MA10;\n input MA9;\n input MA8;\n input MA7;\n input MA6;\n input MA5;\n input MA4;\n input MA3;\n input MA2;\n input MA1;\n input MA0;\n input MB35;\n input MB34;\n input MB33;\n input MB32;\n input MB31;\n input MB30;\n input MB29;\n input MB28;\n input MB27;\n input MB26;\n input MB25;\n input MB24;\n input MB23;\n input MB22;\n input MB21;\n input MB20;\n input MB19;\n input MB18;\n input MB17;\n input MB16;\n input MB15;\n input MB14;\n input MB13;\n input MB12;\n input MB11;\n input MB10;\n input MB9;\n input MB8;\n input MB7;\n input MB6;\n input MB5;\n input MB4;\n input MB3;\n input MB2;\n input MB1;\n input MB0;\n input CIN53;\n input CIN52;\n input CIN51;\n input CIN50;\n input CIN49;\n input CIN48;\n input CIN47;\n input CIN46;\n input CIN45;\n input CIN44;\n input CIN43;\n input CIN42;\n input CIN41;\n input CIN40;\n input CIN39;\n input CIN38;\n input CIN37;\n input CIN36;\n input CIN35;\n input CIN34;\n input CIN33;\n input CIN32;\n input CIN31;\n input CIN30;\n input CIN29;\n input CIN28;\n input CIN27;\n input CIN26;\n input CIN25;\n input CIN24;\n input CIN23;\n input CIN22;\n input CIN21;\n input CIN20;\n input CIN19;\n input CIN18;\n input CIN17;\n input CIN16;\n input CIN15;\n input CIN14;\n input CIN13;\n input CIN12;\n input CIN11;\n input CIN10;\n input CIN9;\n input CIN8;\n input CIN7;\n input CIN6;\n input CIN5;\n input CIN4;\n input CIN3;\n input CIN2;\n input CIN1;\n input CIN0;\n input OP10;\n input OP9;\n input OP8;\n input OP7;\n input OP6;\n input OP5;\n input OP4;\n input OP3;\n input OP2;\n input OP1;\n input OP0;\n output R53;\n output R52;\n output R51;\n output R50;\n output R49;\n output R48;\n output R47;\n output R46;\n output R45;\n output R44;\n output R43;\n output R42;\n output R41;\n output R40;\n output R39;\n output R38;\n output R37;\n output R36;\n output R35;\n output R34;\n output R33;\n output R32;\n output R31;\n output R30;\n output R29;\n output R28;\n output R27;\n output R26;\n output R25;\n output R24;\n output R23;\n output R22;\n output R21;\n output R20;\n output R19;\n output R18;\n output R17;\n output R16;\n output R15;\n output R14;\n output R13;\n output R12;\n output R11;\n output R10;\n output R9;\n output R8;\n output R7;\n output R6;\n output R5;\n output R4;\n output R3;\n output R2;\n output R1;\n output R0;\n output CO53;\n output CO52;\n output CO51;\n output CO50;\n output CO49;\n output CO48;\n output CO47;\n output CO46;\n output CO45;\n output CO44;\n output CO43;\n output CO42;\n output CO41;\n output CO40;\n output CO39;\n output CO38;\n output CO37;\n output CO36;\n output CO35;\n output CO34;\n output CO33;\n output CO32;\n output CO31;\n output CO30;\n output CO29;\n output CO28;\n output CO27;\n output CO26;\n output CO25;\n output CO24;\n output CO23;\n output CO22;\n output CO21;\n output CO20;\n output CO19;\n output CO18;\n output CO17;\n output CO16;\n output CO15;\n output CO14;\n output CO13;\n output CO12;\n output CO11;\n output CO10;\n output CO9;\n output CO8;\n output CO7;\n output CO6;\n output CO5;\n output CO4;\n output CO3;\n output CO2;\n output CO1;\n output CO0;\n output EQZ;\n output EQZM;\n output EQOM;\n output EQPAT;\n output EQPATB;\n output OVER;\n output UNDER;\n output OVERUNDER;\n output SIGNEDR;\nendmodule\n\n(* blackbox *)\nmodule CLKDIVF (...);\n parameter GSR = \"DISABLED\";\n parameter DIV = \"2.0\";\n input CLKI;\n input RST;\n input ALIGNWD;\n output CDIVX;\nendmodule\n\n(* blackbox *)\nmodule PCSCLKDIV (...);\n parameter GSR = \"DISABLED\";\n input CLKI;\n input RST;\n input SEL2;\n input SEL1;\n input SEL0;\n output CDIV1;\n output CDIVX;\nendmodule\n\n(* blackbox *)\nmodule DCSC (...);\n parameter DCSMODE = \"POS\";\n input CLK1;\n input CLK0;\n input SEL1;\n input SEL0;\n input MODESEL;\n output DCSOUT;\nendmodule\n\n(* blackbox *)\nmodule DCCA (...);\n input CLKI;\n input CE;\n output CLKO;\nendmodule\n\n(* blackbox *)\nmodule ECLKSYNCB (...);\n input ECLKI;\n input STOP;\n output ECLKO;\nendmodule\n\n(* blackbox *)\nmodule ECLKBRIDGECS (...);\n input CLK0;\n input CLK1;\n input SEL;\n output ECSOUT;\nendmodule\n\n(* blackbox *)\nmodule DELAYF (...);\n parameter DEL_MODE = \"USER_DEFINED\";\n parameter DEL_VALUE = 0;\n input A;\n input LOADN;\n input MOVE;\n input DIRECTION;\n output Z;\n output CFLAG;\nendmodule\n\n(* blackbox *)\nmodule DELAYG (...);\n parameter DEL_MODE = \"USER_DEFINED\";\n parameter DEL_VALUE = 0;\n input A;\n output Z;\nendmodule\n\n(* blackbox *) (* keep *)\nmodule USRMCLK (...);\n input USRMCLKI;\n input USRMCLKTS;\nendmodule\n\n(* blackbox *)\nmodule DQSBUFM (...);\n parameter DQS_LI_DEL_VAL = 4;\n parameter DQS_LI_DEL_ADJ = \"FACTORYONLY\";\n parameter DQS_LO_DEL_VAL = 0;\n parameter DQS_LO_DEL_ADJ = \"FACTORYONLY\";\n parameter GSR = \"ENABLED\";\n input DQSI;\n input READ1;\n input READ0;\n input READCLKSEL2;\n input READCLKSEL1;\n input READCLKSEL0;\n input DDRDEL;\n input ECLK;\n input SCLK;\n input RST;\n input DYNDELAY7;\n input DYNDELAY6;\n input DYNDELAY5;\n input DYNDELAY4;\n input DYNDELAY3;\n input DYNDELAY2;\n input DYNDELAY1;\n input DYNDELAY0;\n input PAUSE;\n input RDLOADN;\n input RDMOVE;\n input RDDIRECTION;\n input WRLOADN;\n input WRMOVE;\n input WRDIRECTION;\n output DQSR90;\n output DQSW;\n output DQSW270;\n output RDPNTR2;\n output RDPNTR1;\n output RDPNTR0;\n output WRPNTR2;\n output WRPNTR1;\n output WRPNTR0;\n output DATAVALID;\n output BURSTDET;\n output RDCFLAG;\n output WRCFLAG;\nendmodule\n\n(* blackbox *)\nmodule DDRDLLA (...);\n parameter FORCE_MAX_DELAY = \"NO\";\n parameter GSR = \"ENABLED\";\n input CLK;\n input RST;\n input UDDCNTLN;\n input FREEZE;\n output DDRDEL;\n output LOCK;\n output DCNTL7;\n output DCNTL6;\n output DCNTL5;\n output DCNTL4;\n output DCNTL3;\n output DCNTL2;\n output DCNTL1;\n output DCNTL0;\nendmodule\n\n(* blackbox *)\nmodule DLLDELD (...);\n input A;\n input DDRDEL;\n input LOADN;\n input MOVE;\n input DIRECTION;\n output Z;\n output CFLAG;\nendmodule\n\n(* blackbox *)\nmodule IDDRX1F (...);\n parameter GSR = \"ENABLED\";\n input D;\n input SCLK;\n input RST;\n output Q0;\n output Q1;\nendmodule\n\n(* blackbox *)\nmodule IDDRX2F (...);\n parameter GSR = \"ENABLED\";\n input D;\n input SCLK;\n input ECLK;\n input RST;\n input ALIGNWD;\n output Q3;\n output Q2;\n output Q1;\n output Q0;\nendmodule\n\n(* blackbox *)\nmodule IDDR71B (...);\n parameter GSR = \"ENABLED\";\n input D;\n input SCLK;\n input ECLK;\n input RST;\n input ALIGNWD;\n output Q6;\n output Q5;\n output Q4;\n output Q3;\n output Q2;\n output Q1;\n output Q0;\nendmodule\n\n(* blackbox *)\nmodule IDDRX2DQA (...);\n parameter GSR = \"ENABLED\";\n input SCLK;\n input ECLK;\n input DQSR90;\n input D;\n input RST;\n input RDPNTR2;\n input RDPNTR1;\n input RDPNTR0;\n input WRPNTR2;\n input WRPNTR1;\n input WRPNTR0;\n output Q3;\n output Q2;\n output Q1;\n output Q0;\n output QWL;\nendmodule\n\n(* blackbox *)\nmodule ODDRX1F (...);\n parameter GSR = \"ENABLED\";\n input SCLK;\n input RST;\n input D0;\n input D1;\n output Q;\nendmodule\n\n(* blackbox *)\nmodule ODDRX2F (...);\n parameter GSR = \"ENABLED\";\n input SCLK;\n input ECLK;\n input RST;\n input D3;\n input D2;\n input D1;\n input D0;\n output Q;\nendmodule\n\n(* blackbox *)\nmodule ODDR71B (...);\n parameter GSR = \"ENABLED\";\n input SCLK;\n input ECLK;\n input RST;\n input D6;\n input D5;\n input D4;\n input D3;\n input D2;\n input D1;\n input D0;\n output Q;\nendmodule\n\n(* blackbox *)\nmodule OSHX2A (...);\n parameter GSR = \"ENABLED\";\n input D1;\n input D0;\n input SCLK;\n input ECLK;\n input RST;\n output Q;\nendmodule\n\n(* blackbox *)\nmodule TSHX2DQA (...);\n parameter GSR = \"ENABLED\";\n parameter REGSET = \"SET\";\n input T1;\n input T0;\n input SCLK;\n input ECLK;\n input DQSW270;\n input RST;\n output Q;\nendmodule\n\n(* blackbox *)\nmodule TSHX2DQSA (...);\n parameter GSR = \"ENABLED\";\n parameter REGSET = \"SET\";\n input T1;\n input T0;\n input SCLK;\n input ECLK;\n input DQSW;\n input RST;\n output Q;\nendmodule\n\n(* blackbox *)\nmodule ODDRX2DQA (...);\n parameter GSR = \"ENABLED\";\n input D3;\n input D2;\n input D1;\n input D0;\n input DQSW270;\n input SCLK;\n input ECLK;\n input RST;\n output Q;\nendmodule\n\n(* blackbox *)\nmodule ODDRX2DQSB (...);\n parameter GSR = \"ENABLED\";\n input D3;\n input D2;\n input D1;\n input D0;\n input SCLK;\n input ECLK;\n input DQSW;\n input RST;\n output Q;\nendmodule\n\n(* blackbox *)\nmodule EHXPLLL (...);\n parameter CLKI_DIV = 1;\n parameter CLKFB_DIV = 1;\n parameter CLKOP_DIV = 8;\n parameter CLKOS_DIV = 8;\n parameter CLKOS2_DIV = 8;\n parameter CLKOS3_DIV = 8;\n parameter CLKOP_ENABLE = \"ENABLED\";\n parameter CLKOS_ENABLE = \"DISABLED\";\n parameter CLKOS2_ENABLE = \"DISABLED\";\n parameter CLKOS3_ENABLE = \"DISABLED\";\n parameter CLKOP_CPHASE = 0;\n parameter CLKOS_CPHASE = 0;\n parameter CLKOS2_CPHASE = 0;\n parameter CLKOS3_CPHASE = 0;\n parameter CLKOP_FPHASE = 0;\n parameter CLKOS_FPHASE = 0;\n parameter CLKOS2_FPHASE = 0;\n parameter CLKOS3_FPHASE = 0;\n parameter FEEDBK_PATH = \"CLKOP\";\n parameter CLKOP_TRIM_POL = \"RISING\";\n parameter CLKOP_TRIM_DELAY = 0;\n parameter CLKOS_TRIM_POL = \"RISING\";\n parameter CLKOS_TRIM_DELAY = 0;\n parameter OUTDIVIDER_MUXA = \"DIVA\";\n parameter OUTDIVIDER_MUXB = \"DIVB\";\n parameter OUTDIVIDER_MUXC = \"DIVC\";\n parameter OUTDIVIDER_MUXD = \"DIVD\";\n parameter PLL_LOCK_MODE = 0;\n parameter PLL_LOCK_DELAY = 200;\n parameter STDBY_ENABLE = \"DISABLED\";\n parameter REFIN_RESET = \"DISABLED\";\n parameter SYNC_ENABLE = \"DISABLED\";\n parameter INT_LOCK_STICKY = \"ENABLED\";\n parameter DPHASE_SOURCE = \"DISABLED\";\n parameter PLLRST_ENA = \"DISABLED\";\n parameter INTFB_WAKE = \"DISABLED\";\n input CLKI;\n input CLKFB;\n input PHASESEL1;\n input PHASESEL0;\n input PHASEDIR;\n input PHASESTEP;\n input PHASELOADREG;\n input STDBY;\n input PLLWAKESYNC;\n input RST;\n input ENCLKOP;\n input ENCLKOS;\n input ENCLKOS2;\n input ENCLKOS3;\n output CLKOP;\n output CLKOS;\n output CLKOS2;\n output CLKOS3;\n output LOCK;\n output INTLOCK;\n output REFCLK;\n output CLKINTFB;\nendmodule\n\n(* blackbox *)\nmodule DTR (...);\n parameter DTR_TEMP = 25;\n input STARTPULSE;\n output DTROUT7;\n output DTROUT6;\n output DTROUT5;\n output DTROUT4;\n output DTROUT3;\n output DTROUT2;\n output DTROUT1;\n output DTROUT0;\nendmodule\n\n(* blackbox *)\nmodule OSCG (...);\n parameter DIV = 128;\n output OSC;\nendmodule\n\n(* blackbox *)\nmodule EXTREFB (...);\n parameter REFCK_PWDNB = \"DONTCARE\";\n parameter REFCK_RTERM = \"DONTCARE\";\n parameter REFCK_DCBIAS_EN = \"DONTCARE\";\n (* iopad_external_pin *)\n input REFCLKP;\n (* iopad_external_pin *)\n input REFCLKN;\n output REFCLKO;\nendmodule\n\n(* blackbox *) (* keep *)\nmodule JTAGG (...);\n parameter ER1 = \"ENABLED\";\n parameter ER2 = \"ENABLED\";\n (* iopad_external_pin *)\n input TCK;\n (* iopad_external_pin *)\n input TMS;\n (* iopad_external_pin *)\n input TDI;\n input JTDO2;\n input JTDO1;\n (* iopad_external_pin *)\n output TDO;\n output JTDI;\n output JTCK;\n output JRTI2;\n output JRTI1;\n output JSHIFT;\n output JUPDATE;\n output JRSTN;\n output JCE2;\n output JCE1;\nendmodule\n\n(* blackbox *) (* keep *)\nmodule DCUA (...);\n parameter D_MACROPDB = \"DONTCARE\";\n parameter D_IB_PWDNB = \"DONTCARE\";\n parameter D_XGE_MODE = \"DONTCARE\";\n parameter D_LOW_MARK = \"DONTCARE\";\n parameter D_HIGH_MARK = \"DONTCARE\";\n parameter D_BUS8BIT_SEL = \"DONTCARE\";\n parameter D_CDR_LOL_SET = \"DONTCARE\";\n parameter D_BITCLK_LOCAL_EN = \"DONTCARE\";\n parameter D_BITCLK_ND_EN = \"DONTCARE\";\n parameter D_BITCLK_FROM_ND_EN = \"DONTCARE\";\n parameter D_SYNC_LOCAL_EN = \"DONTCARE\";\n parameter D_SYNC_ND_EN = \"DONTCARE\";\n parameter CH0_UC_MODE = \"DONTCARE\";\n parameter CH1_UC_MODE = \"DONTCARE\";\n parameter CH0_PCIE_MODE = \"DONTCARE\";\n parameter CH1_PCIE_MODE = \"DONTCARE\";\n parameter CH0_RIO_MODE = \"DONTCARE\";\n parameter CH1_RIO_MODE = \"DONTCARE\";\n parameter CH0_WA_MODE = \"DONTCARE\";\n parameter CH1_WA_MODE = \"DONTCARE\";\n parameter CH0_INVERT_RX = \"DONTCARE\";\n parameter CH1_INVERT_RX = \"DONTCARE\";\n parameter CH0_INVERT_TX = \"DONTCARE\";\n parameter CH1_INVERT_TX = \"DONTCARE\";\n parameter CH0_PRBS_SELECTION = \"DONTCARE\";\n parameter CH1_PRBS_SELECTION = \"DONTCARE\";\n parameter CH0_GE_AN_ENABLE = \"DONTCARE\";\n parameter CH1_GE_AN_ENABLE = \"DONTCARE\";\n parameter CH0_PRBS_LOCK = \"DONTCARE\";\n parameter CH1_PRBS_LOCK = \"DONTCARE\";\n parameter CH0_PRBS_ENABLE = \"DONTCARE\";\n parameter CH1_PRBS_ENABLE = \"DONTCARE\";\n parameter CH0_ENABLE_CG_ALIGN = \"DONTCARE\";\n parameter CH1_ENABLE_CG_ALIGN = \"DONTCARE\";\n parameter CH0_TX_GEAR_MODE = \"DONTCARE\";\n parameter CH1_TX_GEAR_MODE = \"DONTCARE\";\n parameter CH0_RX_GEAR_MODE = \"DONTCARE\";\n parameter CH1_RX_GEAR_MODE = \"DONTCARE\";\n parameter CH0_PCS_DET_TIME_SEL = \"DONTCARE\";\n parameter CH1_PCS_DET_TIME_SEL = \"DONTCARE\";\n parameter CH0_PCIE_EI_EN = \"DONTCARE\";\n parameter CH1_PCIE_EI_EN = \"DONTCARE\";\n parameter CH0_TX_GEAR_BYPASS = \"DONTCARE\";\n parameter CH1_TX_GEAR_BYPASS = \"DONTCARE\";\n parameter CH0_ENC_BYPASS = \"DONTCARE\";\n parameter CH1_ENC_BYPASS = \"DONTCARE\";\n parameter CH0_SB_BYPASS = \"DONTCARE\";\n parameter CH1_SB_BYPASS = \"DONTCARE\";\n parameter CH0_RX_SB_BYPASS = \"DONTCARE\";\n parameter CH1_RX_SB_BYPASS = \"DONTCARE\";\n parameter CH0_WA_BYPASS = \"DONTCARE\";\n parameter CH1_WA_BYPASS = \"DONTCARE\";\n parameter CH0_DEC_BYPASS = \"DONTCARE\";\n parameter CH1_DEC_BYPASS = \"DONTCARE\";\n parameter CH0_CTC_BYPASS = \"DONTCARE\";\n parameter CH1_CTC_BYPASS = \"DONTCARE\";\n parameter CH0_RX_GEAR_BYPASS = \"DONTCARE\";\n parameter CH1_RX_GEAR_BYPASS = \"DONTCARE\";\n parameter CH0_LSM_DISABLE = \"DONTCARE\";\n parameter CH1_LSM_DISABLE = \"DONTCARE\";\n parameter CH0_MATCH_2_ENABLE = \"DONTCARE\";\n parameter CH1_MATCH_2_ENABLE = \"DONTCARE\";\n parameter CH0_MATCH_4_ENABLE = \"DONTCARE\";\n parameter CH1_MATCH_4_ENABLE = \"DONTCARE\";\n parameter CH0_MIN_IPG_CNT = \"DONTCARE\";\n parameter CH1_MIN_IPG_CNT = \"DONTCARE\";\n parameter CH0_CC_MATCH_1 = \"DONTCARE\";\n parameter CH1_CC_MATCH_1 = \"DONTCARE\";\n parameter CH0_CC_MATCH_2 = \"DONTCARE\";\n parameter CH1_CC_MATCH_2 = \"DONTCARE\";\n parameter CH0_CC_MATCH_3 = \"DONTCARE\";\n parameter CH1_CC_MATCH_3 = \"DONTCARE\";\n parameter CH0_CC_MATCH_4 = \"DONTCARE\";\n parameter CH1_CC_MATCH_4 = \"DONTCARE\";\n parameter CH0_UDF_COMMA_MASK = \"DONTCARE\";\n parameter CH1_UDF_COMMA_MASK = \"DONTCARE\";\n parameter CH0_UDF_COMMA_A = \"DONTCARE\";\n parameter CH1_UDF_COMMA_A = \"DONTCARE\";\n parameter CH0_UDF_COMMA_B = \"DONTCARE\";\n parameter CH1_UDF_COMMA_B = \"DONTCARE\";\n parameter CH0_RX_DCO_CK_DIV = \"DONTCARE\";\n parameter CH1_RX_DCO_CK_DIV = \"DONTCARE\";\n parameter CH0_RCV_DCC_EN = \"DONTCARE\";\n parameter CH1_RCV_DCC_EN = \"DONTCARE\";\n parameter CH0_REQ_LVL_SET = \"DONTCARE\";\n parameter CH1_REQ_LVL_SET = \"DONTCARE\";\n parameter CH0_REQ_EN = \"DONTCARE\";\n parameter CH1_REQ_EN = \"DONTCARE\";\n parameter CH0_RTERM_RX = \"DONTCARE\";\n parameter CH1_RTERM_RX = \"DONTCARE\";\n parameter CH0_PDEN_SEL = \"DONTCARE\";\n parameter CH1_PDEN_SEL = \"DONTCARE\";\n parameter CH0_LDR_RX2CORE_SEL = \"DONTCARE\";\n parameter CH1_LDR_RX2CORE_SEL = \"DONTCARE\";\n parameter CH0_LDR_CORE2TX_SEL = \"DONTCARE\";\n parameter CH1_LDR_CORE2TX_SEL = \"DONTCARE\";\n parameter CH0_TPWDNB = \"DONTCARE\";\n parameter CH1_TPWDNB = \"DONTCARE\";\n parameter CH0_RATE_MODE_TX = \"DONTCARE\";\n parameter CH1_RATE_MODE_TX = \"DONTCARE\";\n parameter CH0_RTERM_TX = \"DONTCARE\";\n parameter CH1_RTERM_TX = \"DONTCARE\";\n parameter CH0_TX_CM_SEL = \"DONTCARE\";\n parameter CH1_TX_CM_SEL = \"DONTCARE\";\n parameter CH0_TDRV_PRE_EN = \"DONTCARE\";\n parameter CH1_TDRV_PRE_EN = \"DONTCARE\";\n parameter CH0_TDRV_SLICE0_SEL = \"DONTCARE\";\n parameter CH1_TDRV_SLICE0_SEL = \"DONTCARE\";\n parameter CH0_TDRV_SLICE1_SEL = \"DONTCARE\";\n parameter CH1_TDRV_SLICE1_SEL = \"DONTCARE\";\n parameter CH0_TDRV_SLICE2_SEL = \"DONTCARE\";\n parameter CH1_TDRV_SLICE2_SEL = \"DONTCARE\";\n parameter CH0_TDRV_SLICE3_SEL = \"DONTCARE\";\n parameter CH1_TDRV_SLICE3_SEL = \"DONTCARE\";\n parameter CH0_TDRV_SLICE4_SEL = \"DONTCARE\";\n parameter CH1_TDRV_SLICE4_SEL = \"DONTCARE\";\n parameter CH0_TDRV_SLICE5_SEL = \"DONTCARE\";\n parameter CH1_TDRV_SLICE5_SEL = \"DONTCARE\";\n parameter CH0_TDRV_SLICE0_CUR = \"DONTCARE\";\n parameter CH1_TDRV_SLICE0_CUR = \"DONTCARE\";\n parameter CH0_TDRV_SLICE1_CUR = \"DONTCARE\";\n parameter CH1_TDRV_SLICE1_CUR = \"DONTCARE\";\n parameter CH0_TDRV_SLICE2_CUR = \"DONTCARE\";\n parameter CH1_TDRV_SLICE2_CUR = \"DONTCARE\";\n parameter CH0_TDRV_SLICE3_CUR = \"DONTCARE\";\n parameter CH1_TDRV_SLICE3_CUR = \"DONTCARE\";\n parameter CH0_TDRV_SLICE4_CUR = \"DONTCARE\";\n parameter CH1_TDRV_SLICE4_CUR = \"DONTCARE\";\n parameter CH0_TDRV_SLICE5_CUR = \"DONTCARE\";\n parameter CH1_TDRV_SLICE5_CUR = \"DONTCARE\";\n parameter CH0_TDRV_DAT_SEL = \"DONTCARE\";\n parameter CH1_TDRV_DAT_SEL = \"DONTCARE\";\n parameter CH0_TX_DIV11_SEL = \"DONTCARE\";\n parameter CH1_TX_DIV11_SEL = \"DONTCARE\";\n parameter CH0_RPWDNB = \"DONTCARE\";\n parameter CH1_RPWDNB = \"DONTCARE\";\n parameter CH0_RATE_MODE_RX = \"DONTCARE\";\n parameter CH1_RATE_MODE_RX = \"DONTCARE\";\n parameter CH0_RLOS_SEL = \"DONTCARE\";\n parameter CH1_RLOS_SEL = \"DONTCARE\";\n parameter CH0_RX_LOS_LVL = \"DONTCARE\";\n parameter CH1_RX_LOS_LVL = \"DONTCARE\";\n parameter CH0_RX_LOS_CEQ = \"DONTCARE\";\n parameter CH1_RX_LOS_CEQ = \"DONTCARE\";\n parameter CH0_RX_LOS_HYST_EN = \"DONTCARE\";\n parameter CH1_RX_LOS_HYST_EN = \"DONTCARE\";\n parameter CH0_RX_LOS_EN = \"DONTCARE\";\n parameter CH1_RX_LOS_EN = \"DONTCARE\";\n parameter CH0_RX_DIV11_SEL = \"DONTCARE\";\n parameter CH1_RX_DIV11_SEL = \"DONTCARE\";\n parameter CH0_SEL_SD_RX_CLK = \"DONTCARE\";\n parameter CH1_SEL_SD_RX_CLK = \"DONTCARE\";\n parameter CH0_FF_RX_H_CLK_EN = \"DONTCARE\";\n parameter CH1_FF_RX_H_CLK_EN = \"DONTCARE\";\n parameter CH0_FF_RX_F_CLK_DIS = \"DONTCARE\";\n parameter CH1_FF_RX_F_CLK_DIS = \"DONTCARE\";\n parameter CH0_FF_TX_H_CLK_EN = \"DONTCARE\";\n parameter CH1_FF_TX_H_CLK_EN = \"DONTCARE\";\n parameter CH0_FF_TX_F_CLK_DIS = \"DONTCARE\";\n parameter CH1_FF_TX_F_CLK_DIS = \"DONTCARE\";\n parameter CH0_RX_RATE_SEL = \"DONTCARE\";\n parameter CH1_RX_RATE_SEL = \"DONTCARE\";\n parameter CH0_TDRV_POST_EN = \"DONTCARE\";\n parameter CH1_TDRV_POST_EN = \"DONTCARE\";\n parameter CH0_TX_POST_SIGN = \"DONTCARE\";\n parameter CH1_TX_POST_SIGN = \"DONTCARE\";\n parameter CH0_TX_PRE_SIGN = \"DONTCARE\";\n parameter CH1_TX_PRE_SIGN = \"DONTCARE\";\n parameter CH0_RXTERM_CM = \"DONTCARE\";\n parameter CH1_RXTERM_CM = \"DONTCARE\";\n parameter CH0_RXIN_CM = \"DONTCARE\";\n parameter CH1_RXIN_CM = \"DONTCARE\";\n parameter CH0_LEQ_OFFSET_SEL = \"DONTCARE\";\n parameter CH1_LEQ_OFFSET_SEL = \"DONTCARE\";\n parameter CH0_LEQ_OFFSET_TRIM = \"DONTCARE\";\n parameter CH1_LEQ_OFFSET_TRIM = \"DONTCARE\";\n parameter D_TX_MAX_RATE = \"DONTCARE\";\n parameter CH0_CDR_MAX_RATE = \"DONTCARE\";\n parameter CH1_CDR_MAX_RATE = \"DONTCARE\";\n parameter CH0_TXAMPLITUDE = \"DONTCARE\";\n parameter CH1_TXAMPLITUDE = \"DONTCARE\";\n parameter CH0_TXDEPRE = \"DONTCARE\";\n parameter CH1_TXDEPRE = \"DONTCARE\";\n parameter CH0_TXDEPOST = \"DONTCARE\";\n parameter CH1_TXDEPOST = \"DONTCARE\";\n parameter CH0_PROTOCOL = \"DONTCARE\";\n parameter CH1_PROTOCOL = \"DONTCARE\";\n parameter D_ISETLOS = \"DONTCARE\";\n parameter D_SETIRPOLY_AUX = \"DONTCARE\";\n parameter D_SETICONST_AUX = \"DONTCARE\";\n parameter D_SETIRPOLY_CH = \"DONTCARE\";\n parameter D_SETICONST_CH = \"DONTCARE\";\n parameter D_REQ_ISET = \"DONTCARE\";\n parameter D_PD_ISET = \"DONTCARE\";\n parameter D_DCO_CALIB_TIME_SEL = \"DONTCARE\";\n parameter CH0_DCOCTLGI = \"DONTCARE\";\n parameter CH1_DCOCTLGI = \"DONTCARE\";\n parameter CH0_DCOATDDLY = \"DONTCARE\";\n parameter CH1_DCOATDDLY = \"DONTCARE\";\n parameter CH0_DCOATDCFG = \"DONTCARE\";\n parameter CH1_DCOATDCFG = \"DONTCARE\";\n parameter CH0_DCOBYPSATD = \"DONTCARE\";\n parameter CH1_DCOBYPSATD = \"DONTCARE\";\n parameter CH0_DCOSCALEI = \"DONTCARE\";\n parameter CH1_DCOSCALEI = \"DONTCARE\";\n parameter CH0_DCOITUNE4LSB = \"DONTCARE\";\n parameter CH1_DCOITUNE4LSB = \"DONTCARE\";\n parameter CH0_DCOIOSTUNE = \"DONTCARE\";\n parameter CH1_DCOIOSTUNE = \"DONTCARE\";\n parameter CH0_DCODISBDAVOID = \"DONTCARE\";\n parameter CH1_DCODISBDAVOID = \"DONTCARE\";\n parameter CH0_DCOCALDIV = \"DONTCARE\";\n parameter CH1_DCOCALDIV = \"DONTCARE\";\n parameter CH0_DCONUOFLSB = \"DONTCARE\";\n parameter CH1_DCONUOFLSB = \"DONTCARE\";\n parameter CH0_DCOIUPDNX2 = \"DONTCARE\";\n parameter CH1_DCOIUPDNX2 = \"DONTCARE\";\n parameter CH0_DCOSTEP = \"DONTCARE\";\n parameter CH1_DCOSTEP = \"DONTCARE\";\n parameter CH0_DCOSTARTVAL = \"DONTCARE\";\n parameter CH1_DCOSTARTVAL = \"DONTCARE\";\n parameter CH0_DCOFLTDAC = \"DONTCARE\";\n parameter CH1_DCOFLTDAC = \"DONTCARE\";\n parameter CH0_DCOITUNE = \"DONTCARE\";\n parameter CH1_DCOITUNE = \"DONTCARE\";\n parameter CH0_DCOFTNRG = \"DONTCARE\";\n parameter CH1_DCOFTNRG = \"DONTCARE\";\n parameter CH0_CDR_CNT4SEL = \"DONTCARE\";\n parameter CH1_CDR_CNT4SEL = \"DONTCARE\";\n parameter CH0_CDR_CNT8SEL = \"DONTCARE\";\n parameter CH1_CDR_CNT8SEL = \"DONTCARE\";\n parameter CH0_BAND_THRESHOLD = \"DONTCARE\";\n parameter CH1_BAND_THRESHOLD = \"DONTCARE\";\n parameter CH0_AUTO_FACQ_EN = \"DONTCARE\";\n parameter CH1_AUTO_FACQ_EN = \"DONTCARE\";\n parameter CH0_AUTO_CALIB_EN = \"DONTCARE\";\n parameter CH1_AUTO_CALIB_EN = \"DONTCARE\";\n parameter CH0_CALIB_CK_MODE = \"DONTCARE\";\n parameter CH1_CALIB_CK_MODE = \"DONTCARE\";\n parameter CH0_REG_BAND_OFFSET = \"DONTCARE\";\n parameter CH1_REG_BAND_OFFSET = \"DONTCARE\";\n parameter CH0_REG_BAND_SEL = \"DONTCARE\";\n parameter CH1_REG_BAND_SEL = \"DONTCARE\";\n parameter CH0_REG_IDAC_SEL = \"DONTCARE\";\n parameter CH1_REG_IDAC_SEL = \"DONTCARE\";\n parameter CH0_REG_IDAC_EN = \"DONTCARE\";\n parameter CH1_REG_IDAC_EN = \"DONTCARE\";\n parameter D_TXPLL_PWDNB = \"DONTCARE\";\n parameter D_SETPLLRC = \"DONTCARE\";\n parameter D_REFCK_MODE = \"DONTCARE\";\n parameter D_TX_VCO_CK_DIV = \"DONTCARE\";\n parameter D_PLL_LOL_SET = \"DONTCARE\";\n parameter D_RG_EN = \"DONTCARE\";\n parameter D_RG_SET = \"DONTCARE\";\n parameter D_CMUSETISCL4VCO = \"DONTCARE\";\n parameter D_CMUSETI4VCO = \"DONTCARE\";\n parameter D_CMUSETINITVCT = \"DONTCARE\";\n parameter D_CMUSETZGM = \"DONTCARE\";\n parameter D_CMUSETP2AGM = \"DONTCARE\";\n parameter D_CMUSETP1GM = \"DONTCARE\";\n parameter D_CMUSETI4CPZ = \"DONTCARE\";\n parameter D_CMUSETI4CPP = \"DONTCARE\";\n parameter D_CMUSETICP4Z = \"DONTCARE\";\n parameter D_CMUSETICP4P = \"DONTCARE\";\n parameter D_CMUSETBIASI = \"DONTCARE\";\n (* iopad_external_pin *)\n (* iopad_external_pin *)\n input CH0_HDINP;\n (* iopad_external_pin *)\n input CH1_HDINP;\n (* iopad_external_pin *)\n input CH0_HDINN;\n (* iopad_external_pin *)\n input CH1_HDINN;\n input D_TXBIT_CLKP_FROM_ND;\n input D_TXBIT_CLKN_FROM_ND;\n input D_SYNC_ND;\n input D_TXPLL_LOL_FROM_ND;\n input CH0_RX_REFCLK;\n input CH1_RX_REFCLK;\n input CH0_FF_RXI_CLK;\n input CH1_FF_RXI_CLK;\n input CH0_FF_TXI_CLK;\n input CH1_FF_TXI_CLK;\n input CH0_FF_EBRD_CLK;\n input CH1_FF_EBRD_CLK;\n input CH0_FF_TX_D_0;\n input CH1_FF_TX_D_0;\n input CH0_FF_TX_D_1;\n input CH1_FF_TX_D_1;\n input CH0_FF_TX_D_2;\n input CH1_FF_TX_D_2;\n input CH0_FF_TX_D_3;\n input CH1_FF_TX_D_3;\n input CH0_FF_TX_D_4;\n input CH1_FF_TX_D_4;\n input CH0_FF_TX_D_5;\n input CH1_FF_TX_D_5;\n input CH0_FF_TX_D_6;\n input CH1_FF_TX_D_6;\n input CH0_FF_TX_D_7;\n input CH1_FF_TX_D_7;\n input CH0_FF_TX_D_8;\n input CH1_FF_TX_D_8;\n input CH0_FF_TX_D_9;\n input CH1_FF_TX_D_9;\n input CH0_FF_TX_D_10;\n input CH1_FF_TX_D_10;\n input CH0_FF_TX_D_11;\n input CH1_FF_TX_D_11;\n input CH0_FF_TX_D_12;\n input CH1_FF_TX_D_12;\n input CH0_FF_TX_D_13;\n input CH1_FF_TX_D_13;\n input CH0_FF_TX_D_14;\n input CH1_FF_TX_D_14;\n input CH0_FF_TX_D_15;\n input CH1_FF_TX_D_15;\n input CH0_FF_TX_D_16;\n input CH1_FF_TX_D_16;\n input CH0_FF_TX_D_17;\n input CH1_FF_TX_D_17;\n input CH0_FF_TX_D_18;\n input CH1_FF_TX_D_18;\n input CH0_FF_TX_D_19;\n input CH1_FF_TX_D_19;\n input CH0_FF_TX_D_20;\n input CH1_FF_TX_D_20;\n input CH0_FF_TX_D_21;\n input CH1_FF_TX_D_21;\n input CH0_FF_TX_D_22;\n input CH1_FF_TX_D_22;\n input CH0_FF_TX_D_23;\n input CH1_FF_TX_D_23;\n input CH0_FFC_EI_EN;\n input CH1_FFC_EI_EN;\n input CH0_FFC_PCIE_DET_EN;\n input CH1_FFC_PCIE_DET_EN;\n input CH0_FFC_PCIE_CT;\n input CH1_FFC_PCIE_CT;\n input CH0_FFC_SB_INV_RX;\n input CH1_FFC_SB_INV_RX;\n input CH0_FFC_ENABLE_CGALIGN;\n input CH1_FFC_ENABLE_CGALIGN;\n input CH0_FFC_SIGNAL_DETECT;\n input CH1_FFC_SIGNAL_DETECT;\n input CH0_FFC_FB_LOOPBACK;\n input CH1_FFC_FB_LOOPBACK;\n input CH0_FFC_SB_PFIFO_LP;\n input CH1_FFC_SB_PFIFO_LP;\n input CH0_FFC_PFIFO_CLR;\n input CH1_FFC_PFIFO_CLR;\n input CH0_FFC_RATE_MODE_RX;\n input CH1_FFC_RATE_MODE_RX;\n input CH0_FFC_RATE_MODE_TX;\n input CH1_FFC_RATE_MODE_TX;\n input CH0_FFC_DIV11_MODE_RX;\n input CH1_FFC_DIV11_MODE_RX;\n input CH0_FFC_RX_GEAR_MODE;\n input CH1_FFC_RX_GEAR_MODE;\n input CH0_FFC_TX_GEAR_MODE;\n input CH1_FFC_TX_GEAR_MODE;\n input CH0_FFC_DIV11_MODE_TX;\n input CH1_FFC_DIV11_MODE_TX;\n input CH0_FFC_LDR_CORE2TX_EN;\n input CH1_FFC_LDR_CORE2TX_EN;\n input CH0_FFC_LANE_TX_RST;\n input CH1_FFC_LANE_TX_RST;\n input CH0_FFC_LANE_RX_RST;\n input CH1_FFC_LANE_RX_RST;\n input CH0_FFC_RRST;\n input CH1_FFC_RRST;\n input CH0_FFC_TXPWDNB;\n input CH1_FFC_TXPWDNB;\n input CH0_FFC_RXPWDNB;\n input CH1_FFC_RXPWDNB;\n input CH0_LDR_CORE2TX;\n input CH1_LDR_CORE2TX;\n input D_SCIWDATA0;\n input D_SCIWDATA1;\n input D_SCIWDATA2;\n input D_SCIWDATA3;\n input D_SCIWDATA4;\n input D_SCIWDATA5;\n input D_SCIWDATA6;\n input D_SCIWDATA7;\n input D_SCIADDR0;\n input D_SCIADDR1;\n input D_SCIADDR2;\n input D_SCIADDR3;\n input D_SCIADDR4;\n input D_SCIADDR5;\n input D_SCIENAUX;\n input D_SCISELAUX;\n input CH0_SCIEN;\n input CH1_SCIEN;\n input CH0_SCISEL;\n input CH1_SCISEL;\n input D_SCIRD;\n input D_SCIWSTN;\n input D_CYAWSTN;\n input D_FFC_SYNC_TOGGLE;\n input D_FFC_DUAL_RST;\n input D_FFC_MACRO_RST;\n input D_FFC_MACROPDB;\n input D_FFC_TRST;\n input CH0_FFC_CDR_EN_BITSLIP;\n input CH1_FFC_CDR_EN_BITSLIP;\n input D_SCAN_ENABLE;\n input D_SCAN_IN_0;\n input D_SCAN_IN_1;\n input D_SCAN_IN_2;\n input D_SCAN_IN_3;\n input D_SCAN_IN_4;\n input D_SCAN_IN_5;\n input D_SCAN_IN_6;\n input D_SCAN_IN_7;\n input D_SCAN_MODE;\n input D_SCAN_RESET;\n input D_CIN0;\n input D_CIN1;\n input D_CIN2;\n input D_CIN3;\n input D_CIN4;\n input D_CIN5;\n input D_CIN6;\n input D_CIN7;\n input D_CIN8;\n input D_CIN9;\n input D_CIN10;\n input D_CIN11;\n output CH0_HDOUTP;\n output CH1_HDOUTP;\n output CH0_HDOUTN;\n output CH1_HDOUTN;\n output D_TXBIT_CLKP_TO_ND;\n output D_TXBIT_CLKN_TO_ND;\n output D_SYNC_PULSE2ND;\n output D_TXPLL_LOL_TO_ND;\n output CH0_FF_RX_F_CLK;\n output CH1_FF_RX_F_CLK;\n output CH0_FF_RX_H_CLK;\n output CH1_FF_RX_H_CLK;\n output CH0_FF_TX_F_CLK;\n output CH1_FF_TX_F_CLK;\n output CH0_FF_TX_H_CLK;\n output CH1_FF_TX_H_CLK;\n output CH0_FF_RX_PCLK;\n output CH1_FF_RX_PCLK;\n output CH0_FF_TX_PCLK;\n output CH1_FF_TX_PCLK;\n output CH0_FF_RX_D_0;\n output CH1_FF_RX_D_0;\n output CH0_FF_RX_D_1;\n output CH1_FF_RX_D_1;\n output CH0_FF_RX_D_2;\n output CH1_FF_RX_D_2;\n output CH0_FF_RX_D_3;\n output CH1_FF_RX_D_3;\n output CH0_FF_RX_D_4;\n output CH1_FF_RX_D_4;\n output CH0_FF_RX_D_5;\n output CH1_FF_RX_D_5;\n output CH0_FF_RX_D_6;\n output CH1_FF_RX_D_6;\n output CH0_FF_RX_D_7;\n output CH1_FF_RX_D_7;\n output CH0_FF_RX_D_8;\n output CH1_FF_RX_D_8;\n output CH0_FF_RX_D_9;\n output CH1_FF_RX_D_9;\n output CH0_FF_RX_D_10;\n output CH1_FF_RX_D_10;\n output CH0_FF_RX_D_11;\n output CH1_FF_RX_D_11;\n output CH0_FF_RX_D_12;\n output CH1_FF_RX_D_12;\n output CH0_FF_RX_D_13;\n output CH1_FF_RX_D_13;\n output CH0_FF_RX_D_14;\n output CH1_FF_RX_D_14;\n output CH0_FF_RX_D_15;\n output CH1_FF_RX_D_15;\n output CH0_FF_RX_D_16;\n output CH1_FF_RX_D_16;\n output CH0_FF_RX_D_17;\n output CH1_FF_RX_D_17;\n output CH0_FF_RX_D_18;\n output CH1_FF_RX_D_18;\n output CH0_FF_RX_D_19;\n output CH1_FF_RX_D_19;\n output CH0_FF_RX_D_20;\n output CH1_FF_RX_D_20;\n output CH0_FF_RX_D_21;\n output CH1_FF_RX_D_21;\n output CH0_FF_RX_D_22;\n output CH1_FF_RX_D_22;\n output CH0_FF_RX_D_23;\n output CH1_FF_RX_D_23;\n output CH0_FFS_PCIE_DONE;\n output CH1_FFS_PCIE_DONE;\n output CH0_FFS_PCIE_CON;\n output CH1_FFS_PCIE_CON;\n output CH0_FFS_RLOS;\n output CH1_FFS_RLOS;\n output CH0_FFS_LS_SYNC_STATUS;\n output CH1_FFS_LS_SYNC_STATUS;\n output CH0_FFS_CC_UNDERRUN;\n output CH1_FFS_CC_UNDERRUN;\n output CH0_FFS_CC_OVERRUN;\n output CH1_FFS_CC_OVERRUN;\n output CH0_FFS_RXFBFIFO_ERROR;\n output CH1_FFS_RXFBFIFO_ERROR;\n output CH0_FFS_TXFBFIFO_ERROR;\n output CH1_FFS_TXFBFIFO_ERROR;\n output CH0_FFS_RLOL;\n output CH1_FFS_RLOL;\n output CH0_FFS_SKP_ADDED;\n output CH1_FFS_SKP_ADDED;\n output CH0_FFS_SKP_DELETED;\n output CH1_FFS_SKP_DELETED;\n output CH0_LDR_RX2CORE;\n output CH1_LDR_RX2CORE;\n output D_SCIRDATA0;\n output D_SCIRDATA1;\n output D_SCIRDATA2;\n output D_SCIRDATA3;\n output D_SCIRDATA4;\n output D_SCIRDATA5;\n output D_SCIRDATA6;\n output D_SCIRDATA7;\n output D_SCIINT;\n output D_SCAN_OUT_0;\n output D_SCAN_OUT_1;\n output D_SCAN_OUT_2;\n output D_SCAN_OUT_3;\n output D_SCAN_OUT_4;\n output D_SCAN_OUT_5;\n output D_SCAN_OUT_6;\n output D_SCAN_OUT_7;\n output D_COUT0;\n output D_COUT1;\n output D_COUT2;\n output D_COUT3;\n output D_COUT4;\n output D_COUT5;\n output D_COUT6;\n output D_COUT7;\n output D_COUT8;\n output D_COUT9;\n output D_COUT10;\n output D_COUT11;\n output D_COUT12;\n output D_COUT13;\n output D_COUT14;\n output D_COUT15;\n output D_COUT16;\n output D_COUT17;\n output D_COUT18;\n output D_COUT19;\n input D_REFCLKI;\n output D_FFS_PLOL;\nendmodule\n\n",
|
|
275
275
|
"cells_bb_xo2.v": "// Created by cells_xtra.py from Lattice models\n\n(* blackbox *) (* keep *)\nmodule GSR (...);\n input GSR;\nendmodule\n\n(* blackbox *) (* keep *)\nmodule SGSR (...);\n input GSR;\n input CLK;\nendmodule\n\n(* blackbox *)\nmodule DP8KC (...);\n parameter DATA_WIDTH_A = 9;\n parameter DATA_WIDTH_B = 9;\n parameter REGMODE_A = \"NOREG\";\n parameter REGMODE_B = \"NOREG\";\n parameter CSDECODE_A = \"0b000\";\n parameter CSDECODE_B = \"0b000\";\n parameter WRITEMODE_A = \"NORMAL\";\n parameter WRITEMODE_B = \"NORMAL\";\n parameter GSR = \"ENABLED\";\n parameter RESETMODE = \"SYNC\";\n parameter ASYNC_RESET_RELEASE = \"SYNC\";\n parameter INIT_DATA = \"STATIC\";\n parameter INITVAL_00 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_01 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_02 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_03 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_04 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_05 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_06 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_07 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_08 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_09 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0A = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0B = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0C = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0D = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0E = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0F = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_10 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_11 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_12 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_13 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_14 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_15 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_16 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_17 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_18 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_19 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1A = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1B = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1C = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1D = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1E = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1F = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n input DIA8;\n input DIA7;\n input DIA6;\n input DIA5;\n input DIA4;\n input DIA3;\n input DIA2;\n input DIA1;\n input DIA0;\n input ADA12;\n input ADA11;\n input ADA10;\n input ADA9;\n input ADA8;\n input ADA7;\n input ADA6;\n input ADA5;\n input ADA4;\n input ADA3;\n input ADA2;\n input ADA1;\n input ADA0;\n input CEA;\n input OCEA;\n input CLKA;\n input WEA;\n input CSA2;\n input CSA1;\n input CSA0;\n input RSTA;\n input DIB8;\n input DIB7;\n input DIB6;\n input DIB5;\n input DIB4;\n input DIB3;\n input DIB2;\n input DIB1;\n input DIB0;\n input ADB12;\n input ADB11;\n input ADB10;\n input ADB9;\n input ADB8;\n input ADB7;\n input ADB6;\n input ADB5;\n input ADB4;\n input ADB3;\n input ADB2;\n input ADB1;\n input ADB0;\n input CEB;\n input OCEB;\n input CLKB;\n input WEB;\n input CSB2;\n input CSB1;\n input CSB0;\n input RSTB;\n output DOA8;\n output DOA7;\n output DOA6;\n output DOA5;\n output DOA4;\n output DOA3;\n output DOA2;\n output DOA1;\n output DOA0;\n output DOB8;\n output DOB7;\n output DOB6;\n output DOB5;\n output DOB4;\n output DOB3;\n output DOB2;\n output DOB1;\n output DOB0;\nendmodule\n\n(* blackbox *)\nmodule PDPW8KC (...);\n parameter DATA_WIDTH_W = 18;\n parameter DATA_WIDTH_R = 9;\n parameter REGMODE = \"NOREG\";\n parameter CSDECODE_W = \"0b000\";\n parameter CSDECODE_R = \"0b000\";\n parameter GSR = \"ENABLED\";\n parameter RESETMODE = \"SYNC\";\n parameter ASYNC_RESET_RELEASE = \"SYNC\";\n parameter INIT_DATA = \"STATIC\";\n parameter INITVAL_00 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_01 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_02 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_03 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_04 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_05 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_06 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_07 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_08 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_09 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0A = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0B = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0C = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0D = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0E = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0F = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_10 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_11 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_12 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_13 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_14 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_15 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_16 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_17 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_18 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_19 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1A = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1B = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1C = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1D = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1E = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1F = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n input DI17;\n input DI16;\n input DI15;\n input DI14;\n input DI13;\n input DI12;\n input DI11;\n input DI10;\n input DI9;\n input DI8;\n input DI7;\n input DI6;\n input DI5;\n input DI4;\n input DI3;\n input DI2;\n input DI1;\n input DI0;\n input ADW8;\n input ADW7;\n input ADW6;\n input ADW5;\n input ADW4;\n input ADW3;\n input ADW2;\n input ADW1;\n input ADW0;\n input BE1;\n input BE0;\n input CEW;\n input CLKW;\n input CSW2;\n input CSW1;\n input CSW0;\n input ADR12;\n input ADR11;\n input ADR10;\n input ADR9;\n input ADR8;\n input ADR7;\n input ADR6;\n input ADR5;\n input ADR4;\n input ADR3;\n input ADR2;\n input ADR1;\n input ADR0;\n input CER;\n input OCER;\n input CLKR;\n input CSR2;\n input CSR1;\n input CSR0;\n input RST;\n output DO17;\n output DO16;\n output DO15;\n output DO14;\n output DO13;\n output DO12;\n output DO11;\n output DO10;\n output DO9;\n output DO8;\n output DO7;\n output DO6;\n output DO5;\n output DO4;\n output DO3;\n output DO2;\n output DO1;\n output DO0;\nendmodule\n\n(* blackbox *)\nmodule SP8KC (...);\n parameter DATA_WIDTH = 9;\n parameter REGMODE = \"NOREG\";\n parameter CSDECODE = \"0b000\";\n parameter WRITEMODE = \"NORMAL\";\n parameter GSR = \"ENABLED\";\n parameter RESETMODE = \"SYNC\";\n parameter ASYNC_RESET_RELEASE = \"SYNC\";\n parameter INIT_DATA = \"STATIC\";\n parameter INITVAL_00 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_01 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_02 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_03 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_04 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_05 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_06 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_07 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_08 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_09 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0A = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0B = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0C = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0D = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0E = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0F = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_10 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_11 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_12 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_13 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_14 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_15 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_16 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_17 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_18 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_19 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1A = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1B = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1C = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1D = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1E = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1F = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n input DI8;\n input DI7;\n input DI6;\n input DI5;\n input DI4;\n input DI3;\n input DI2;\n input DI1;\n input DI0;\n input AD12;\n input AD11;\n input AD10;\n input AD9;\n input AD8;\n input AD7;\n input AD6;\n input AD5;\n input AD4;\n input AD3;\n input AD2;\n input AD1;\n input AD0;\n input CE;\n input OCE;\n input CLK;\n input WE;\n input CS2;\n input CS1;\n input CS0;\n input RST;\n output DO8;\n output DO7;\n output DO6;\n output DO5;\n output DO4;\n output DO3;\n output DO2;\n output DO1;\n output DO0;\nendmodule\n\n(* blackbox *)\nmodule FIFO8KB (...);\n parameter DATA_WIDTH_W = 18;\n parameter DATA_WIDTH_R = 18;\n parameter REGMODE = \"NOREG\";\n parameter RESETMODE = \"ASYNC\";\n parameter ASYNC_RESET_RELEASE = \"SYNC\";\n parameter CSDECODE_W = \"0b00\";\n parameter CSDECODE_R = \"0b00\";\n parameter AEPOINTER = \"0b00000000000000\";\n parameter AEPOINTER1 = \"0b00000000000000\";\n parameter AFPOINTER = \"0b00000000000000\";\n parameter AFPOINTER1 = \"0b00000000000000\";\n parameter FULLPOINTER = \"0b00000000000000\";\n parameter FULLPOINTER1 = \"0b00000000000000\";\n parameter GSR = \"DISABLED\";\n input DI0;\n input DI1;\n input DI2;\n input DI3;\n input DI4;\n input DI5;\n input DI6;\n input DI7;\n input DI8;\n input DI9;\n input DI10;\n input DI11;\n input DI12;\n input DI13;\n input DI14;\n input DI15;\n input DI16;\n input DI17;\n input CSW0;\n input CSW1;\n input CSR0;\n input CSR1;\n input WE;\n input RE;\n input ORE;\n input CLKW;\n input CLKR;\n input RST;\n input RPRST;\n input FULLI;\n input EMPTYI;\n output DO0;\n output DO1;\n output DO2;\n output DO3;\n output DO4;\n output DO5;\n output DO6;\n output DO7;\n output DO8;\n output DO9;\n output DO10;\n output DO11;\n output DO12;\n output DO13;\n output DO14;\n output DO15;\n output DO16;\n output DO17;\n output EF;\n output AEF;\n output AFF;\n output FF;\nendmodule\n\n(* blackbox *)\nmodule CLKDIVC (...);\n parameter GSR = \"DISABLED\";\n parameter DIV = \"2.0\";\n input RST;\n input CLKI;\n input ALIGNWD;\n output CDIV1;\n output CDIVX;\nendmodule\n\n(* blackbox *)\nmodule DCMA (...);\n input CLK0;\n input CLK1;\n input SEL;\n output DCMOUT;\nendmodule\n\n(* blackbox *)\nmodule ECLKSYNCA (...);\n input ECLKI;\n input STOP;\n output ECLKO;\nendmodule\n\n(* blackbox *)\nmodule ECLKBRIDGECS (...);\n input CLK0;\n input CLK1;\n input SEL;\n output ECSOUT;\nendmodule\n\n(* blackbox *)\nmodule DCCA (...);\n input CLKI;\n input CE;\n output CLKO;\nendmodule\n\n(* blackbox *) (* keep *)\nmodule START (...);\n input STARTCLK;\nendmodule\n\n(* blackbox *)\nmodule EHXPLLJ (...);\n parameter CLKI_DIV = 1;\n parameter CLKFB_DIV = 1;\n parameter CLKOP_DIV = 8;\n parameter CLKOS_DIV = 8;\n parameter CLKOS2_DIV = 8;\n parameter CLKOS3_DIV = 8;\n parameter CLKOP_ENABLE = \"ENABLED\";\n parameter CLKOS_ENABLE = \"ENABLED\";\n parameter CLKOS2_ENABLE = \"ENABLED\";\n parameter CLKOS3_ENABLE = \"ENABLED\";\n parameter VCO_BYPASS_A0 = \"DISABLED\";\n parameter VCO_BYPASS_B0 = \"DISABLED\";\n parameter VCO_BYPASS_C0 = \"DISABLED\";\n parameter VCO_BYPASS_D0 = \"DISABLED\";\n parameter CLKOP_CPHASE = 0;\n parameter CLKOS_CPHASE = 0;\n parameter CLKOS2_CPHASE = 0;\n parameter CLKOS3_CPHASE = 0;\n parameter CLKOP_FPHASE = 0;\n parameter CLKOS_FPHASE = 0;\n parameter CLKOS2_FPHASE = 0;\n parameter CLKOS3_FPHASE = 0;\n parameter FEEDBK_PATH = \"CLKOP\";\n parameter FRACN_ENABLE = \"DISABLED\";\n parameter FRACN_DIV = 0;\n parameter CLKOP_TRIM_POL = \"RISING\";\n parameter CLKOP_TRIM_DELAY = 0;\n parameter CLKOS_TRIM_POL = \"RISING\";\n parameter CLKOS_TRIM_DELAY = 0;\n parameter PLL_USE_WB = \"DISABLED\";\n parameter PREDIVIDER_MUXA1 = 0;\n parameter PREDIVIDER_MUXB1 = 0;\n parameter PREDIVIDER_MUXC1 = 0;\n parameter PREDIVIDER_MUXD1 = 0;\n parameter OUTDIVIDER_MUXA2 = \"DIVA\";\n parameter OUTDIVIDER_MUXB2 = \"DIVB\";\n parameter OUTDIVIDER_MUXC2 = \"DIVC\";\n parameter OUTDIVIDER_MUXD2 = \"DIVD\";\n parameter PLL_LOCK_MODE = 0;\n parameter STDBY_ENABLE = \"DISABLED\";\n parameter DPHASE_SOURCE = \"DISABLED\";\n parameter PLLRST_ENA = \"DISABLED\";\n parameter MRST_ENA = \"DISABLED\";\n parameter DCRST_ENA = \"DISABLED\";\n parameter DDRST_ENA = \"DISABLED\";\n parameter INTFB_WAKE = \"DISABLED\";\n input CLKI;\n input CLKFB;\n input PHASESEL1;\n input PHASESEL0;\n input PHASEDIR;\n input PHASESTEP;\n input LOADREG;\n input STDBY;\n input PLLWAKESYNC;\n input RST;\n input RESETM;\n input RESETC;\n input RESETD;\n input ENCLKOP;\n input ENCLKOS;\n input ENCLKOS2;\n input ENCLKOS3;\n input PLLCLK;\n input PLLRST;\n input PLLSTB;\n input PLLWE;\n input PLLDATI7;\n input PLLDATI6;\n input PLLDATI5;\n input PLLDATI4;\n input PLLDATI3;\n input PLLDATI2;\n input PLLDATI1;\n input PLLDATI0;\n input PLLADDR4;\n input PLLADDR3;\n input PLLADDR2;\n input PLLADDR1;\n input PLLADDR0;\n output CLKOP;\n output CLKOS;\n output CLKOS2;\n output CLKOS3;\n output LOCK;\n output INTLOCK;\n output REFCLK;\n output PLLDATO7;\n output PLLDATO6;\n output PLLDATO5;\n output PLLDATO4;\n output PLLDATO3;\n output PLLDATO2;\n output PLLDATO1;\n output PLLDATO0;\n output PLLACK;\n output DPHSRC;\n output CLKINTFB;\nendmodule\n\n(* blackbox *)\nmodule OSCH (...);\n parameter NOM_FREQ = \"2.08\";\n input STDBY;\n output OSC;\n output SEDSTDBY;\nendmodule\n\n(* blackbox *) (* keep *)\nmodule TSALL (...);\n input TSALL;\nendmodule\n\n",
|
|
276
276
|
"cells_bb_xo3.v": "// Created by cells_xtra.py from Lattice models\n\n(* blackbox *) (* keep *)\nmodule GSR (...);\n input GSR;\nendmodule\n\n(* blackbox *) (* keep *)\nmodule SGSR (...);\n input GSR;\n input CLK;\nendmodule\n\n(* blackbox *)\nmodule DP8KC (...);\n parameter DATA_WIDTH_A = 9;\n parameter DATA_WIDTH_B = 9;\n parameter REGMODE_A = \"NOREG\";\n parameter REGMODE_B = \"NOREG\";\n parameter CSDECODE_A = \"0b000\";\n parameter CSDECODE_B = \"0b000\";\n parameter WRITEMODE_A = \"NORMAL\";\n parameter WRITEMODE_B = \"NORMAL\";\n parameter GSR = \"ENABLED\";\n parameter RESETMODE = \"SYNC\";\n parameter ASYNC_RESET_RELEASE = \"SYNC\";\n parameter INIT_DATA = \"STATIC\";\n parameter INITVAL_00 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_01 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_02 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_03 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_04 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_05 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_06 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_07 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_08 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_09 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0A = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0B = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0C = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0D = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0E = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0F = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_10 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_11 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_12 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_13 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_14 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_15 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_16 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_17 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_18 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_19 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1A = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1B = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1C = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1D = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1E = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1F = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n input DIA8;\n input DIA7;\n input DIA6;\n input DIA5;\n input DIA4;\n input DIA3;\n input DIA2;\n input DIA1;\n input DIA0;\n input ADA12;\n input ADA11;\n input ADA10;\n input ADA9;\n input ADA8;\n input ADA7;\n input ADA6;\n input ADA5;\n input ADA4;\n input ADA3;\n input ADA2;\n input ADA1;\n input ADA0;\n input CEA;\n input OCEA;\n input CLKA;\n input WEA;\n input CSA2;\n input CSA1;\n input CSA0;\n input RSTA;\n input DIB8;\n input DIB7;\n input DIB6;\n input DIB5;\n input DIB4;\n input DIB3;\n input DIB2;\n input DIB1;\n input DIB0;\n input ADB12;\n input ADB11;\n input ADB10;\n input ADB9;\n input ADB8;\n input ADB7;\n input ADB6;\n input ADB5;\n input ADB4;\n input ADB3;\n input ADB2;\n input ADB1;\n input ADB0;\n input CEB;\n input OCEB;\n input CLKB;\n input WEB;\n input CSB2;\n input CSB1;\n input CSB0;\n input RSTB;\n output DOA8;\n output DOA7;\n output DOA6;\n output DOA5;\n output DOA4;\n output DOA3;\n output DOA2;\n output DOA1;\n output DOA0;\n output DOB8;\n output DOB7;\n output DOB6;\n output DOB5;\n output DOB4;\n output DOB3;\n output DOB2;\n output DOB1;\n output DOB0;\nendmodule\n\n(* blackbox *)\nmodule PDPW8KC (...);\n parameter DATA_WIDTH_W = 18;\n parameter DATA_WIDTH_R = 9;\n parameter REGMODE = \"NOREG\";\n parameter CSDECODE_W = \"0b000\";\n parameter CSDECODE_R = \"0b000\";\n parameter GSR = \"ENABLED\";\n parameter RESETMODE = \"SYNC\";\n parameter ASYNC_RESET_RELEASE = \"SYNC\";\n parameter INIT_DATA = \"STATIC\";\n parameter INITVAL_00 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_01 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_02 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_03 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_04 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_05 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_06 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_07 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_08 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_09 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0A = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0B = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0C = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0D = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0E = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0F = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_10 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_11 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_12 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_13 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_14 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_15 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_16 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_17 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_18 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_19 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1A = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1B = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1C = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1D = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1E = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1F = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n input DI17;\n input DI16;\n input DI15;\n input DI14;\n input DI13;\n input DI12;\n input DI11;\n input DI10;\n input DI9;\n input DI8;\n input DI7;\n input DI6;\n input DI5;\n input DI4;\n input DI3;\n input DI2;\n input DI1;\n input DI0;\n input ADW8;\n input ADW7;\n input ADW6;\n input ADW5;\n input ADW4;\n input ADW3;\n input ADW2;\n input ADW1;\n input ADW0;\n input BE1;\n input BE0;\n input CEW;\n input CLKW;\n input CSW2;\n input CSW1;\n input CSW0;\n input ADR12;\n input ADR11;\n input ADR10;\n input ADR9;\n input ADR8;\n input ADR7;\n input ADR6;\n input ADR5;\n input ADR4;\n input ADR3;\n input ADR2;\n input ADR1;\n input ADR0;\n input CER;\n input OCER;\n input CLKR;\n input CSR2;\n input CSR1;\n input CSR0;\n input RST;\n output DO17;\n output DO16;\n output DO15;\n output DO14;\n output DO13;\n output DO12;\n output DO11;\n output DO10;\n output DO9;\n output DO8;\n output DO7;\n output DO6;\n output DO5;\n output DO4;\n output DO3;\n output DO2;\n output DO1;\n output DO0;\nendmodule\n\n(* blackbox *)\nmodule SP8KC (...);\n parameter DATA_WIDTH = 9;\n parameter REGMODE = \"NOREG\";\n parameter CSDECODE = \"0b000\";\n parameter WRITEMODE = \"NORMAL\";\n parameter GSR = \"ENABLED\";\n parameter RESETMODE = \"SYNC\";\n parameter ASYNC_RESET_RELEASE = \"SYNC\";\n parameter INIT_DATA = \"STATIC\";\n parameter INITVAL_00 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_01 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_02 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_03 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_04 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_05 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_06 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_07 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_08 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_09 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0A = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0B = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0C = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0D = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0E = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0F = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_10 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_11 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_12 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_13 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_14 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_15 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_16 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_17 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_18 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_19 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1A = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1B = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1C = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1D = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1E = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1F = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n input DI8;\n input DI7;\n input DI6;\n input DI5;\n input DI4;\n input DI3;\n input DI2;\n input DI1;\n input DI0;\n input AD12;\n input AD11;\n input AD10;\n input AD9;\n input AD8;\n input AD7;\n input AD6;\n input AD5;\n input AD4;\n input AD3;\n input AD2;\n input AD1;\n input AD0;\n input CE;\n input OCE;\n input CLK;\n input WE;\n input CS2;\n input CS1;\n input CS0;\n input RST;\n output DO8;\n output DO7;\n output DO6;\n output DO5;\n output DO4;\n output DO3;\n output DO2;\n output DO1;\n output DO0;\nendmodule\n\n(* blackbox *)\nmodule FIFO8KB (...);\n parameter DATA_WIDTH_W = 18;\n parameter DATA_WIDTH_R = 18;\n parameter REGMODE = \"NOREG\";\n parameter RESETMODE = \"ASYNC\";\n parameter ASYNC_RESET_RELEASE = \"SYNC\";\n parameter CSDECODE_W = \"0b00\";\n parameter CSDECODE_R = \"0b00\";\n parameter AEPOINTER = \"0b00000000000000\";\n parameter AEPOINTER1 = \"0b00000000000000\";\n parameter AFPOINTER = \"0b00000000000000\";\n parameter AFPOINTER1 = \"0b00000000000000\";\n parameter FULLPOINTER = \"0b00000000000000\";\n parameter FULLPOINTER1 = \"0b00000000000000\";\n parameter GSR = \"DISABLED\";\n input DI0;\n input DI1;\n input DI2;\n input DI3;\n input DI4;\n input DI5;\n input DI6;\n input DI7;\n input DI8;\n input DI9;\n input DI10;\n input DI11;\n input DI12;\n input DI13;\n input DI14;\n input DI15;\n input DI16;\n input DI17;\n input CSW0;\n input CSW1;\n input CSR0;\n input CSR1;\n input WE;\n input RE;\n input ORE;\n input CLKW;\n input CLKR;\n input RST;\n input RPRST;\n input FULLI;\n input EMPTYI;\n output DO0;\n output DO1;\n output DO2;\n output DO3;\n output DO4;\n output DO5;\n output DO6;\n output DO7;\n output DO8;\n output DO9;\n output DO10;\n output DO11;\n output DO12;\n output DO13;\n output DO14;\n output DO15;\n output DO16;\n output DO17;\n output EF;\n output AEF;\n output AFF;\n output FF;\nendmodule\n\n(* blackbox *)\nmodule CLKDIVC (...);\n parameter GSR = \"DISABLED\";\n parameter DIV = \"2.0\";\n input RST;\n input CLKI;\n input ALIGNWD;\n output CDIV1;\n output CDIVX;\nendmodule\n\n(* blackbox *)\nmodule DCMA (...);\n input CLK0;\n input CLK1;\n input SEL;\n output DCMOUT;\nendmodule\n\n(* blackbox *)\nmodule ECLKSYNCA (...);\n input ECLKI;\n input STOP;\n output ECLKO;\nendmodule\n\n(* blackbox *)\nmodule ECLKBRIDGECS (...);\n input CLK0;\n input CLK1;\n input SEL;\n output ECSOUT;\nendmodule\n\n(* blackbox *)\nmodule DCCA (...);\n input CLKI;\n input CE;\n output CLKO;\nendmodule\n\n(* blackbox *) (* keep *)\nmodule START (...);\n input STARTCLK;\nendmodule\n\n(* blackbox *)\nmodule EHXPLLJ (...);\n parameter CLKI_DIV = 1;\n parameter CLKFB_DIV = 1;\n parameter CLKOP_DIV = 8;\n parameter CLKOS_DIV = 8;\n parameter CLKOS2_DIV = 8;\n parameter CLKOS3_DIV = 8;\n parameter CLKOP_ENABLE = \"ENABLED\";\n parameter CLKOS_ENABLE = \"ENABLED\";\n parameter CLKOS2_ENABLE = \"ENABLED\";\n parameter CLKOS3_ENABLE = \"ENABLED\";\n parameter VCO_BYPASS_A0 = \"DISABLED\";\n parameter VCO_BYPASS_B0 = \"DISABLED\";\n parameter VCO_BYPASS_C0 = \"DISABLED\";\n parameter VCO_BYPASS_D0 = \"DISABLED\";\n parameter CLKOP_CPHASE = 0;\n parameter CLKOS_CPHASE = 0;\n parameter CLKOS2_CPHASE = 0;\n parameter CLKOS3_CPHASE = 0;\n parameter CLKOP_FPHASE = 0;\n parameter CLKOS_FPHASE = 0;\n parameter CLKOS2_FPHASE = 0;\n parameter CLKOS3_FPHASE = 0;\n parameter FEEDBK_PATH = \"CLKOP\";\n parameter FRACN_ENABLE = \"DISABLED\";\n parameter FRACN_DIV = 0;\n parameter CLKOP_TRIM_POL = \"RISING\";\n parameter CLKOP_TRIM_DELAY = 0;\n parameter CLKOS_TRIM_POL = \"RISING\";\n parameter CLKOS_TRIM_DELAY = 0;\n parameter PLL_USE_WB = \"DISABLED\";\n parameter PREDIVIDER_MUXA1 = 0;\n parameter PREDIVIDER_MUXB1 = 0;\n parameter PREDIVIDER_MUXC1 = 0;\n parameter PREDIVIDER_MUXD1 = 0;\n parameter OUTDIVIDER_MUXA2 = \"DIVA\";\n parameter OUTDIVIDER_MUXB2 = \"DIVB\";\n parameter OUTDIVIDER_MUXC2 = \"DIVC\";\n parameter OUTDIVIDER_MUXD2 = \"DIVD\";\n parameter PLL_LOCK_MODE = 0;\n parameter STDBY_ENABLE = \"DISABLED\";\n parameter DPHASE_SOURCE = \"DISABLED\";\n parameter PLLRST_ENA = \"DISABLED\";\n parameter MRST_ENA = \"DISABLED\";\n parameter DCRST_ENA = \"DISABLED\";\n parameter DDRST_ENA = \"DISABLED\";\n parameter INTFB_WAKE = \"DISABLED\";\n input CLKI;\n input CLKFB;\n input PHASESEL1;\n input PHASESEL0;\n input PHASEDIR;\n input PHASESTEP;\n input LOADREG;\n input STDBY;\n input PLLWAKESYNC;\n input RST;\n input RESETM;\n input RESETC;\n input RESETD;\n input ENCLKOP;\n input ENCLKOS;\n input ENCLKOS2;\n input ENCLKOS3;\n input PLLCLK;\n input PLLRST;\n input PLLSTB;\n input PLLWE;\n input PLLDATI7;\n input PLLDATI6;\n input PLLDATI5;\n input PLLDATI4;\n input PLLDATI3;\n input PLLDATI2;\n input PLLDATI1;\n input PLLDATI0;\n input PLLADDR4;\n input PLLADDR3;\n input PLLADDR2;\n input PLLADDR1;\n input PLLADDR0;\n output CLKOP;\n output CLKOS;\n output CLKOS2;\n output CLKOS3;\n output LOCK;\n output INTLOCK;\n output REFCLK;\n output PLLDATO7;\n output PLLDATO6;\n output PLLDATO5;\n output PLLDATO4;\n output PLLDATO3;\n output PLLDATO2;\n output PLLDATO1;\n output PLLDATO0;\n output PLLACK;\n output DPHSRC;\n output CLKINTFB;\nendmodule\n\n(* blackbox *)\nmodule OSCH (...);\n parameter NOM_FREQ = \"2.08\";\n input STDBY;\n output OSC;\n output SEDSTDBY;\nendmodule\n\n(* blackbox *) (* keep *)\nmodule TSALL (...);\n input TSALL;\nendmodule\n\n",
|
|
277
277
|
"cells_bb_xo3d.v": "// Created by cells_xtra.py from Lattice models\n\n(* blackbox *) (* keep *)\nmodule GSR (...);\n input GSR;\nendmodule\n\n(* blackbox *) (* keep *)\nmodule SGSR (...);\n input GSR;\n input CLK;\nendmodule\n\n(* blackbox *)\nmodule DP8KC (...);\n parameter DATA_WIDTH_A = 9;\n parameter DATA_WIDTH_B = 9;\n parameter REGMODE_A = \"NOREG\";\n parameter REGMODE_B = \"NOREG\";\n parameter CSDECODE_A = \"0b000\";\n parameter CSDECODE_B = \"0b000\";\n parameter WRITEMODE_A = \"NORMAL\";\n parameter WRITEMODE_B = \"NORMAL\";\n parameter GSR = \"ENABLED\";\n parameter RESETMODE = \"SYNC\";\n parameter ASYNC_RESET_RELEASE = \"SYNC\";\n parameter INIT_DATA = \"STATIC\";\n parameter INITVAL_00 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_01 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_02 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_03 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_04 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_05 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_06 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_07 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_08 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_09 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0A = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0B = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0C = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0D = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0E = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0F = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_10 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_11 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_12 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_13 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_14 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_15 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_16 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_17 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_18 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_19 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1A = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1B = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1C = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1D = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1E = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1F = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n input DIA8;\n input DIA7;\n input DIA6;\n input DIA5;\n input DIA4;\n input DIA3;\n input DIA2;\n input DIA1;\n input DIA0;\n input ADA12;\n input ADA11;\n input ADA10;\n input ADA9;\n input ADA8;\n input ADA7;\n input ADA6;\n input ADA5;\n input ADA4;\n input ADA3;\n input ADA2;\n input ADA1;\n input ADA0;\n input CEA;\n input OCEA;\n input CLKA;\n input WEA;\n input CSA2;\n input CSA1;\n input CSA0;\n input RSTA;\n input DIB8;\n input DIB7;\n input DIB6;\n input DIB5;\n input DIB4;\n input DIB3;\n input DIB2;\n input DIB1;\n input DIB0;\n input ADB12;\n input ADB11;\n input ADB10;\n input ADB9;\n input ADB8;\n input ADB7;\n input ADB6;\n input ADB5;\n input ADB4;\n input ADB3;\n input ADB2;\n input ADB1;\n input ADB0;\n input CEB;\n input OCEB;\n input CLKB;\n input WEB;\n input CSB2;\n input CSB1;\n input CSB0;\n input RSTB;\n output DOA8;\n output DOA7;\n output DOA6;\n output DOA5;\n output DOA4;\n output DOA3;\n output DOA2;\n output DOA1;\n output DOA0;\n output DOB8;\n output DOB7;\n output DOB6;\n output DOB5;\n output DOB4;\n output DOB3;\n output DOB2;\n output DOB1;\n output DOB0;\nendmodule\n\n(* blackbox *)\nmodule PDPW8KC (...);\n parameter DATA_WIDTH_W = 18;\n parameter DATA_WIDTH_R = 9;\n parameter REGMODE = \"NOREG\";\n parameter CSDECODE_W = \"0b000\";\n parameter CSDECODE_R = \"0b000\";\n parameter GSR = \"ENABLED\";\n parameter RESETMODE = \"SYNC\";\n parameter ASYNC_RESET_RELEASE = \"SYNC\";\n parameter INIT_DATA = \"STATIC\";\n parameter INITVAL_00 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_01 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_02 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_03 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_04 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_05 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_06 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_07 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_08 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_09 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0A = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0B = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0C = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0D = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0E = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0F = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_10 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_11 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_12 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_13 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_14 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_15 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_16 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_17 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_18 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_19 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1A = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1B = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1C = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1D = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1E = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1F = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n input DI17;\n input DI16;\n input DI15;\n input DI14;\n input DI13;\n input DI12;\n input DI11;\n input DI10;\n input DI9;\n input DI8;\n input DI7;\n input DI6;\n input DI5;\n input DI4;\n input DI3;\n input DI2;\n input DI1;\n input DI0;\n input ADW8;\n input ADW7;\n input ADW6;\n input ADW5;\n input ADW4;\n input ADW3;\n input ADW2;\n input ADW1;\n input ADW0;\n input BE1;\n input BE0;\n input CEW;\n input CLKW;\n input CSW2;\n input CSW1;\n input CSW0;\n input ADR12;\n input ADR11;\n input ADR10;\n input ADR9;\n input ADR8;\n input ADR7;\n input ADR6;\n input ADR5;\n input ADR4;\n input ADR3;\n input ADR2;\n input ADR1;\n input ADR0;\n input CER;\n input OCER;\n input CLKR;\n input CSR2;\n input CSR1;\n input CSR0;\n input RST;\n output DO17;\n output DO16;\n output DO15;\n output DO14;\n output DO13;\n output DO12;\n output DO11;\n output DO10;\n output DO9;\n output DO8;\n output DO7;\n output DO6;\n output DO5;\n output DO4;\n output DO3;\n output DO2;\n output DO1;\n output DO0;\nendmodule\n\n(* blackbox *)\nmodule SP8KC (...);\n parameter DATA_WIDTH = 9;\n parameter REGMODE = \"NOREG\";\n parameter CSDECODE = \"0b000\";\n parameter WRITEMODE = \"NORMAL\";\n parameter GSR = \"ENABLED\";\n parameter RESETMODE = \"SYNC\";\n parameter ASYNC_RESET_RELEASE = \"SYNC\";\n parameter INIT_DATA = \"STATIC\";\n parameter INITVAL_00 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_01 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_02 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_03 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_04 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_05 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_06 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_07 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_08 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_09 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0A = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0B = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0C = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0D = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0E = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_0F = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_10 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_11 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_12 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_13 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_14 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_15 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_16 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_17 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_18 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_19 = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1A = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1B = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1C = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1D = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1E = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n parameter INITVAL_1F = 320'h00000000000000000000000000000000000000000000000000000000000000000000000000000000;\n input DI8;\n input DI7;\n input DI6;\n input DI5;\n input DI4;\n input DI3;\n input DI2;\n input DI1;\n input DI0;\n input AD12;\n input AD11;\n input AD10;\n input AD9;\n input AD8;\n input AD7;\n input AD6;\n input AD5;\n input AD4;\n input AD3;\n input AD2;\n input AD1;\n input AD0;\n input CE;\n input OCE;\n input CLK;\n input WE;\n input CS2;\n input CS1;\n input CS0;\n input RST;\n output DO8;\n output DO7;\n output DO6;\n output DO5;\n output DO4;\n output DO3;\n output DO2;\n output DO1;\n output DO0;\nendmodule\n\n(* blackbox *)\nmodule FIFO8KB (...);\n parameter DATA_WIDTH_W = 18;\n parameter DATA_WIDTH_R = 18;\n parameter REGMODE = \"NOREG\";\n parameter RESETMODE = \"ASYNC\";\n parameter ASYNC_RESET_RELEASE = \"SYNC\";\n parameter CSDECODE_W = \"0b00\";\n parameter CSDECODE_R = \"0b00\";\n parameter AEPOINTER = \"0b00000000000000\";\n parameter AEPOINTER1 = \"0b00000000000000\";\n parameter AFPOINTER = \"0b00000000000000\";\n parameter AFPOINTER1 = \"0b00000000000000\";\n parameter FULLPOINTER = \"0b00000000000000\";\n parameter FULLPOINTER1 = \"0b00000000000000\";\n parameter GSR = \"DISABLED\";\n input DI0;\n input DI1;\n input DI2;\n input DI3;\n input DI4;\n input DI5;\n input DI6;\n input DI7;\n input DI8;\n input DI9;\n input DI10;\n input DI11;\n input DI12;\n input DI13;\n input DI14;\n input DI15;\n input DI16;\n input DI17;\n input CSW0;\n input CSW1;\n input CSR0;\n input CSR1;\n input WE;\n input RE;\n input ORE;\n input CLKW;\n input CLKR;\n input RST;\n input RPRST;\n input FULLI;\n input EMPTYI;\n output DO0;\n output DO1;\n output DO2;\n output DO3;\n output DO4;\n output DO5;\n output DO6;\n output DO7;\n output DO8;\n output DO9;\n output DO10;\n output DO11;\n output DO12;\n output DO13;\n output DO14;\n output DO15;\n output DO16;\n output DO17;\n output EF;\n output AEF;\n output AFF;\n output FF;\nendmodule\n\n(* blackbox *)\nmodule CLKDIVC (...);\n parameter GSR = \"DISABLED\";\n parameter DIV = \"2.0\";\n input RST;\n input CLKI;\n input ALIGNWD;\n output CDIV1;\n output CDIVX;\nendmodule\n\n(* blackbox *)\nmodule DCMA (...);\n input CLK0;\n input CLK1;\n input SEL;\n output DCMOUT;\nendmodule\n\n(* blackbox *)\nmodule ECLKSYNCA (...);\n input ECLKI;\n input STOP;\n output ECLKO;\nendmodule\n\n(* blackbox *)\nmodule ECLKBRIDGECS (...);\n input CLK0;\n input CLK1;\n input SEL;\n output ECSOUT;\nendmodule\n\n(* blackbox *)\nmodule DCCA (...);\n input CLKI;\n input CE;\n output CLKO;\nendmodule\n\n(* blackbox *) (* keep *)\nmodule START (...);\n input STARTCLK;\nendmodule\n\n(* blackbox *)\nmodule EHXPLLJ (...);\n parameter CLKI_DIV = 1;\n parameter CLKFB_DIV = 1;\n parameter CLKOP_DIV = 8;\n parameter CLKOS_DIV = 8;\n parameter CLKOS2_DIV = 8;\n parameter CLKOS3_DIV = 8;\n parameter CLKOP_ENABLE = \"ENABLED\";\n parameter CLKOS_ENABLE = \"ENABLED\";\n parameter CLKOS2_ENABLE = \"ENABLED\";\n parameter CLKOS3_ENABLE = \"ENABLED\";\n parameter VCO_BYPASS_A0 = \"DISABLED\";\n parameter VCO_BYPASS_B0 = \"DISABLED\";\n parameter VCO_BYPASS_C0 = \"DISABLED\";\n parameter VCO_BYPASS_D0 = \"DISABLED\";\n parameter CLKOP_CPHASE = 0;\n parameter CLKOS_CPHASE = 0;\n parameter CLKOS2_CPHASE = 0;\n parameter CLKOS3_CPHASE = 0;\n parameter CLKOP_FPHASE = 0;\n parameter CLKOS_FPHASE = 0;\n parameter CLKOS2_FPHASE = 0;\n parameter CLKOS3_FPHASE = 0;\n parameter FEEDBK_PATH = \"CLKOP\";\n parameter FRACN_ENABLE = \"DISABLED\";\n parameter FRACN_DIV = 0;\n parameter CLKOP_TRIM_POL = \"RISING\";\n parameter CLKOP_TRIM_DELAY = 0;\n parameter CLKOS_TRIM_POL = \"RISING\";\n parameter CLKOS_TRIM_DELAY = 0;\n parameter PLL_USE_WB = \"DISABLED\";\n parameter PREDIVIDER_MUXA1 = 0;\n parameter PREDIVIDER_MUXB1 = 0;\n parameter PREDIVIDER_MUXC1 = 0;\n parameter PREDIVIDER_MUXD1 = 0;\n parameter OUTDIVIDER_MUXA2 = \"DIVA\";\n parameter OUTDIVIDER_MUXB2 = \"DIVB\";\n parameter OUTDIVIDER_MUXC2 = \"DIVC\";\n parameter OUTDIVIDER_MUXD2 = \"DIVD\";\n parameter PLL_LOCK_MODE = 0;\n parameter STDBY_ENABLE = \"DISABLED\";\n parameter DPHASE_SOURCE = \"DISABLED\";\n parameter PLLRST_ENA = \"DISABLED\";\n parameter MRST_ENA = \"DISABLED\";\n parameter DCRST_ENA = \"DISABLED\";\n parameter DDRST_ENA = \"DISABLED\";\n parameter INTFB_WAKE = \"DISABLED\";\n input CLKI;\n input CLKFB;\n input PHASESEL1;\n input PHASESEL0;\n input PHASEDIR;\n input PHASESTEP;\n input LOADREG;\n input STDBY;\n input PLLWAKESYNC;\n input RST;\n input RESETM;\n input RESETC;\n input RESETD;\n input ENCLKOP;\n input ENCLKOS;\n input ENCLKOS2;\n input ENCLKOS3;\n input PLLCLK;\n input PLLRST;\n input PLLSTB;\n input PLLWE;\n input PLLDATI7;\n input PLLDATI6;\n input PLLDATI5;\n input PLLDATI4;\n input PLLDATI3;\n input PLLDATI2;\n input PLLDATI1;\n input PLLDATI0;\n input PLLADDR4;\n input PLLADDR3;\n input PLLADDR2;\n input PLLADDR1;\n input PLLADDR0;\n output CLKOP;\n output CLKOS;\n output CLKOS2;\n output CLKOS3;\n output LOCK;\n output INTLOCK;\n output REFCLK;\n output PLLDATO7;\n output PLLDATO6;\n output PLLDATO5;\n output PLLDATO4;\n output PLLDATO3;\n output PLLDATO2;\n output PLLDATO1;\n output PLLDATO0;\n output PLLACK;\n output DPHSRC;\n output CLKINTFB;\nendmodule\n\n(* blackbox *)\nmodule OSCJ (...);\n parameter NOM_FREQ = \"2.08\";\n input STDBY;\n output OSC;\n output SEDSTDBY;\n output OSCESB;\nendmodule\n\n(* blackbox *) (* keep *)\nmodule TSALL (...);\n input TSALL;\nendmodule\n\n",
|
package/gen/yosys.core.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yowasp/yosys",
|
|
3
|
-
"version": "0.57.
|
|
3
|
+
"version": "0.57.985",
|
|
4
4
|
"description": "Yosys Open SYnthesis Suite",
|
|
5
5
|
"author": "Catherine <whitequark@whitequark.org>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"scripts": {
|
|
34
34
|
"transpile": "jco new ../yosys-build/yosys.wasm --wasi-command --output yosys.wasm && jco transpile yosys.wasm --instantiation async --no-typescript --no-namespaced-exports --map 'wasi:io/*=runtime#io' --map 'wasi:cli/*=runtime#cli' --map 'wasi:clocks/*=runtime#*' --map 'wasi:filesystem/*=runtime#fs' --map 'wasi:random/*=runtime#random' --out-dir gen/",
|
|
35
35
|
"pack": "yowasp-pack-resources gen/resources-yosys.js gen ../yosys-build/share",
|
|
36
|
-
"build": "esbuild --bundle lib/api.js --outfile=gen/bundle.js --format=esm --platform=node --external:./resources-*.js --define:VERSION=\\\"0.57.
|
|
36
|
+
"build": "esbuild --bundle lib/api.js --outfile=gen/bundle.js --format=esm --platform=node --external:./resources-*.js --define:VERSION=\\\"0.57.985\\\"",
|
|
37
37
|
"all": "npm run transpile && npm run pack && npm run build"
|
|
38
38
|
}
|
|
39
39
|
}
|