gowin: split cells_xtra by family

This commit is contained in:
Pepijn de Vos 2024-11-26 15:42:22 +01:00
parent 98b4affc4a
commit be836f4af3
7 changed files with 6324 additions and 6308 deletions

View File

@ -3,7 +3,9 @@ OBJS += techlibs/gowin/synth_gowin.o
$(eval $(call add_share_file,share/gowin,techlibs/gowin/cells_map.v)) $(eval $(call add_share_file,share/gowin,techlibs/gowin/cells_map.v))
$(eval $(call add_share_file,share/gowin,techlibs/gowin/cells_sim.v)) $(eval $(call add_share_file,share/gowin,techlibs/gowin/cells_sim.v))
$(eval $(call add_share_file,share/gowin,techlibs/gowin/cells_xtra.v)) $(eval $(call add_share_file,share/gowin,techlibs/gowin/cells_xtra_gw1n.v))
$(eval $(call add_share_file,share/gowin,techlibs/gowin/cells_xtra_gw2a.v))
$(eval $(call add_share_file,share/gowin,techlibs/gowin/cells_xtra_gw5a.v))
$(eval $(call add_share_file,share/gowin,techlibs/gowin/arith_map.v)) $(eval $(call add_share_file,share/gowin,techlibs/gowin/arith_map.v))
$(eval $(call add_share_file,share/gowin,techlibs/gowin/brams_map.v)) $(eval $(call add_share_file,share/gowin,techlibs/gowin/brams_map.v))
$(eval $(call add_share_file,share/gowin,techlibs/gowin/brams.txt)) $(eval $(call add_share_file,share/gowin,techlibs/gowin/brams.txt))

View File

@ -63,16 +63,17 @@ if __name__ == '__main__':
parser.add_argument('gowin_dir', nargs='?', default='/opt/gowin/') parser.add_argument('gowin_dir', nargs='?', default='/opt/gowin/')
args = parser.parse_args() args = parser.parse_args()
dirs = [ families = {
os.path.join(args.gowin_dir, 'IDE/simlib/gw1n/'), 'gw1n': os.path.join(args.gowin_dir, 'IDE/simlib/gw1n/'),
os.path.join(args.gowin_dir, 'IDE/simlib/gw2a/'), 'gw2a': os.path.join(args.gowin_dir, 'IDE/simlib/gw2a/'),
os.path.join(args.gowin_dir, 'IDE/simlib/gw5a/'), 'gw5a': os.path.join(args.gowin_dir, 'IDE/simlib/gw5a/'),
] }
with open('cells_xtra.v', 'w') as fout: for family, dir in families.items():
fout.write('// Created by cells_xtra.py\n') if not os.path.isdir(dir):
fout.write('\n') print(f'{dir} is not a directory')
for dir in dirs: else:
if not os.path.isdir(dir): with open(f'cells_xtra_{family}.v', 'w') as fout:
print(f'{dir} is not a directory') fout.write('// Created by cells_xtra.py\n')
xtract_cells_decl(dir, fout) fout.write('\n')
xtract_cells_decl(dir, fout)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -86,17 +86,22 @@ struct SynthGowinPass : public ScriptPass
log(" read/write collision\" (same result as setting the no_rw_check\n"); log(" read/write collision\" (same result as setting the no_rw_check\n");
log(" attribute on all memories).\n"); log(" attribute on all memories).\n");
log("\n"); log("\n");
log(" -family <family>\n");
log(" sets the gowin family to the specified value. The default is 'gw1n'.\n");
log(" The following families are supported:\n");
log(" 'gw1n', 'gw2a', 'gw5a'.\n");
log("\n"); log("\n");
log("The following commands are executed by this synthesis command:\n"); log("The following commands are executed by this synthesis command:\n");
help_script(); help_script();
log("\n"); log("\n");
} }
string top_opt, vout_file, json_file; string top_opt, vout_file, json_file, family;
bool retime, nobram, nolutram, flatten, nodffe, nowidelut, abc9, noiopads, noalu, no_rw_check; bool retime, nobram, nolutram, flatten, nodffe, nowidelut, abc9, noiopads, noalu, no_rw_check;
void clear_flags() override void clear_flags() override
{ {
family = "gw1n";
top_opt = "-auto-top"; top_opt = "-auto-top";
vout_file = ""; vout_file = "";
json_file = ""; json_file = "";
@ -132,6 +137,10 @@ struct SynthGowinPass : public ScriptPass
json_file = args[++argidx]; json_file = args[++argidx];
continue; continue;
} }
if (args[argidx] == "-family" && argidx+1 < args.size()) {
family = args[++argidx];
continue;
}
if (args[argidx] == "-run" && argidx+1 < args.size()) { if (args[argidx] == "-run" && argidx+1 < args.size()) {
size_t pos = args[argidx+1].find(':'); size_t pos = args[argidx+1].find(':');
if (pos == std::string::npos) if (pos == std::string::npos)
@ -210,7 +219,7 @@ struct SynthGowinPass : public ScriptPass
if (check_label("begin")) if (check_label("begin"))
{ {
run("read_verilog -specify -lib +/gowin/cells_sim.v"); run("read_verilog -specify -lib +/gowin/cells_sim.v");
run("read_verilog -specify -lib +/gowin/cells_xtra.v"); run(stringf("read_verilog -specify -lib +/gowin/cells_xtra_%s.v", help_mode ? "<family>" : family.c_str()));
run(stringf("hierarchy -check %s", help_mode ? "-top <top>" : top_opt.c_str())); run(stringf("hierarchy -check %s", help_mode ? "-top <top>" : top_opt.c_str()));
} }