Progress in icetime

This commit is contained in:
Clifford Wolf 2015-10-23 21:08:36 +02:00
parent d193e581d0
commit b862fd3f5f
3 changed files with 90 additions and 60 deletions

View File

@ -17,13 +17,20 @@ uninstall:
# View timing netlist:
# yosys -qp 'read_verilog -lib cells.v; prep; show' test0_ref.v
# yosys -qp 'read_verilog -lib cells.v; prep; show' test0_out.v
test0 test1 test2 test3 test4 test5 test6 test7 test8 test9: icetime
python3 mktest.py $@
test -f $@_ref.v || python3 mktest.py $@
./icetime -P tq144 -p $@.pcf $@.txt $@_out.v
yosys $@.ys
mktest: test0 test1 test2 test3 test4 test5 test6 test7 test8 test9
run0 run1 run2 run3 run4 run5 run6 run7 run8 run9: icetime
./icetime -P tq144 -p $(subst run,test,$@).pcf $(subst run,test,$@).txt $(subst run,test,$@)_out.v
show0 show1 show2 show3 show4 show5 show6 show7 show8 show9:
yosys -p ':equiv_purge; opt_clean -purge; show' $(subst show,test,$@).il
test: test0 test1 test2 test3 test4 test5 test6 test7 test8 test9
clean:
rm -f icetime

View File

@ -423,14 +423,14 @@ std::string make_lc40(int x, int y, int z)
return cell;
netlist_cell_types[cell] = "LogicCell40";
netlist_cells[cell]["carryin"] = "";
netlist_cells[cell]["carryin"] = "gnd";
netlist_cells[cell]["ce"] = "";
netlist_cells[cell]["clk"] = "";
netlist_cells[cell]["in0"] = "";
netlist_cells[cell]["in1"] = "";
netlist_cells[cell]["in2"] = "";
netlist_cells[cell]["in3"] = "";
netlist_cells[cell]["sr"] = "";
netlist_cells[cell]["clk"] = "gnd";
netlist_cells[cell]["in0"] = "gnd";
netlist_cells[cell]["in1"] = "gnd";
netlist_cells[cell]["in2"] = "gnd";
netlist_cells[cell]["in3"] = "gnd";
netlist_cells[cell]["sr"] = "gnd";
netlist_cells[cell]["carryout"] = "";
netlist_cells[cell]["lcout"] = "";
netlist_cells[cell]["ltout"] = "";
@ -653,15 +653,13 @@ struct make_interconn_worker_t
if (trg.name.substr(0, 6) == "span4_" || trg.name.substr(0, 4) == "sp4_")
{
bool non_io = trg.name.substr(0, 4) == "sp4_";
bool horiz_non_io = trg.name.substr(0, 6) == "sp4_h_";
int count_length = -1;
bool horiz = trg.name.substr(0, 6) == "sp4_h_";
int count_length = 0;
while (seg_parents.count(*cursor) && cursor->net == trg.net) {
non_io = non_io || (cursor->name.substr(0, 4) == "sp4_");
horiz_non_io = horiz_non_io || (cursor->name.substr(0, 6) == "sp4_h_");
horiz = horiz || (cursor->name.substr(0, 6) == "sp4_h_");
cursor = &seg_parents.at(*cursor);
count_length++;
// count_length++;
}
if (cursor->net == trg.net)
@ -671,18 +669,39 @@ struct make_interconn_worker_t
extra_vlog.push_back(stringf(" Sp12to4 conn_%d (.I(%s), .O(%s));\n",
iconn_cell_cnt++, seg_name(*cursor).c_str(), seg_name(trg).c_str()));
} else
if (non_io) {
extra_vlog.push_back(stringf(" Span4Mux_%c%d conn_%d (.I(%s), .O(%s));\n",
horiz_non_io ? 'h' : 'v', count_length, iconn_cell_cnt++,
seg_name(*cursor).c_str(), seg_name(trg).c_str()));
} else {
if (cursor->name.substr(0, 6) == "span4_") {
extra_vlog.push_back(stringf(" IoSpan4Mux conn_%d (.I(%s), .O(%s));\n",
iconn_cell_cnt++, seg_name(*cursor).c_str(), seg_name(trg).c_str()));
} else {
extra_vlog.push_back(stringf(" Span4Mux_%c%d conn_%d (.I(%s), .O(%s));\n",
horiz ? 'h' : 'v', count_length, iconn_cell_cnt++,
seg_name(*cursor).c_str(), seg_name(trg).c_str()));
}
goto continue_at_cursor;
}
if (trg.name.substr(0, 7) == "span12_" || trg.name.substr(0, 5) == "sp12_")
{
bool horiz = trg.name.substr(0, 7) == "sp12_h_";
int count_length = 0;
while (seg_parents.count(*cursor) && cursor->net == trg.net) {
horiz = horiz || (cursor->name.substr(0, 7) == "sp12_h_");
cursor = &seg_parents.at(*cursor);
// count_length++;
}
if (cursor->net == trg.net)
goto skip_to_cursor;
extra_vlog.push_back(stringf(" Span12Mux_%c%d conn_%d (.I(%s), .O(%s));\n",
horiz ? 'h' : 'v', count_length, iconn_cell_cnt++,
seg_name(*cursor).c_str(), seg_name(trg).c_str()));
goto continue_at_cursor;
}
// Default handler
while (seg_parents.count(*cursor))
@ -812,6 +831,10 @@ int main(int argc, char **argv)
for (auto net : extra_wires)
fprintf(fout, " wire %s;\n", net.c_str());
fprintf(fout, " wire gnd, vcc;\n");
fprintf(fout, " GND gnd_cell (.Y(gnd));\n");
fprintf(fout, " VCC vcc_cell (.Y(vcc));\n");
for (auto &str : extra_vlog)
fprintf(fout, "%s", str.c_str());

View File

@ -32,9 +32,9 @@ with open("%s.ys" % sys.argv[1], "w") as f:
print("hierarchy -top equiv", file=f)
print("rename -hide w:N_*", file=f)
print("equiv_struct", file=f)
print("# equiv_purge", file=f)
print("opt_clean -purge", file=f)
print("show -format dot -prefix %s" % sys.argv[1], file=f)
print("opt_clean", file=f)
print("write_ilang %s.il" % sys.argv[1], file=f)
print("equiv_status -assert", file=f)
os.system("bash ../icefuzz/icecube.sh %s.v" % sys.argv[1])
os.rename("%s.v" % sys.argv[1], "%s_in.v" % sys.argv[1])
@ -44,46 +44,46 @@ with open("%s_ref.v" % sys.argv[1], "w") as f:
if line.find("defparam") >= 0:
continue
line = line.replace(" Span4Mux_s0_h ", " Span4Mux_h0 ")
line = line.replace(" Span4Mux_s1_h ", " Span4Mux_h1 ")
line = line.replace(" Span4Mux_s2_h ", " Span4Mux_h2 ")
line = line.replace(" Span4Mux_s3_h ", " Span4Mux_h3 ")
line = line.replace(" Span4Mux_h ", " Span4Mux_h4 ")
line = line.replace(" Span4Mux_s0_h ", " Span4Mux_h0 ") # " Span4Mux_h0 ")
line = line.replace(" Span4Mux_s1_h ", " Span4Mux_h0 ") # " Span4Mux_h1 ")
line = line.replace(" Span4Mux_s2_h ", " Span4Mux_h0 ") # " Span4Mux_h2 ")
line = line.replace(" Span4Mux_s3_h ", " Span4Mux_h0 ") # " Span4Mux_h3 ")
line = line.replace(" Span4Mux_h ", " Span4Mux_h0 ") # " Span4Mux_h4 ")
line = line.replace(" Span4Mux_s0_v ", " Span4Mux_v0 ")
line = line.replace(" Span4Mux_s1_v ", " Span4Mux_v1 ")
line = line.replace(" Span4Mux_s2_v ", " Span4Mux_v2 ")
line = line.replace(" Span4Mux_s3_v ", " Span4Mux_v3 ")
line = line.replace(" Span4Mux_v ", " Span4Mux_v4 ")
line = line.replace(" Span4Mux ", " Span4Mux_v4 ")
line = line.replace(" Span4Mux_s0_v ", " Span4Mux_v0 ") # " Span4Mux_v0 ")
line = line.replace(" Span4Mux_s1_v ", " Span4Mux_v0 ") # " Span4Mux_v1 ")
line = line.replace(" Span4Mux_s2_v ", " Span4Mux_v0 ") # " Span4Mux_v2 ")
line = line.replace(" Span4Mux_s3_v ", " Span4Mux_v0 ") # " Span4Mux_v3 ")
line = line.replace(" Span4Mux_v ", " Span4Mux_v0 ") # " Span4Mux_v4 ")
line = line.replace(" Span4Mux ", " Span4Mux_v0 ") # " Span4Mux_v4 ")
line = line.replace(" Span12Mux_s0_h ", " Span12Mux_h0 ")
line = line.replace(" Span12Mux_s1_h ", " Span12Mux_h1 ")
line = line.replace(" Span12Mux_s2_h ", " Span12Mux_h2 ")
line = line.replace(" Span12Mux_s3_h ", " Span12Mux_h3 ")
line = line.replace(" Span12Mux_s4_h ", " Span12Mux_h4 ")
line = line.replace(" Span12Mux_s5_h ", " Span12Mux_h5 ")
line = line.replace(" Span12Mux_s6_h ", " Span12Mux_h6 ")
line = line.replace(" Span12Mux_s7_h ", " Span12Mux_h7 ")
line = line.replace(" Span12Mux_s8_h ", " Span12Mux_h8 ")
line = line.replace(" Span12Mux_s9_h ", " Span12Mux_h9 ")
line = line.replace(" Span12Mux_s10_h ", " Span12Mux_h10 ")
line = line.replace(" Span12Mux_s11_h ", " Span12Mux_h11 ")
line = line.replace(" Span12Mux ", " Span12Mux_h12 ")
line = line.replace(" Span12Mux_s0_h ", " Span12Mux_h0 ") # " Span12Mux_h0 ")
line = line.replace(" Span12Mux_s1_h ", " Span12Mux_h0 ") # " Span12Mux_h1 ")
line = line.replace(" Span12Mux_s2_h ", " Span12Mux_h0 ") # " Span12Mux_h2 ")
line = line.replace(" Span12Mux_s3_h ", " Span12Mux_h0 ") # " Span12Mux_h3 ")
line = line.replace(" Span12Mux_s4_h ", " Span12Mux_h0 ") # " Span12Mux_h4 ")
line = line.replace(" Span12Mux_s5_h ", " Span12Mux_h0 ") # " Span12Mux_h5 ")
line = line.replace(" Span12Mux_s6_h ", " Span12Mux_h0 ") # " Span12Mux_h6 ")
line = line.replace(" Span12Mux_s7_h ", " Span12Mux_h0 ") # " Span12Mux_h7 ")
line = line.replace(" Span12Mux_s8_h ", " Span12Mux_h0 ") # " Span12Mux_h8 ")
line = line.replace(" Span12Mux_s9_h ", " Span12Mux_h0 ") # " Span12Mux_h9 ")
line = line.replace(" Span12Mux_s10_h ", " Span12Mux_h0 ") # " Span12Mux_h10 ")
line = line.replace(" Span12Mux_s11_h ", " Span12Mux_h0 ") # " Span12Mux_h11 ")
line = line.replace(" Span12Mux ", " Span12Mux_h0 ") # " Span12Mux_h12 ")
line = line.replace(" Span12Mux_s0_v ", " Span12Mux_v0 ")
line = line.replace(" Span12Mux_s1_v ", " Span12Mux_v1 ")
line = line.replace(" Span12Mux_s2_v ", " Span12Mux_v2 ")
line = line.replace(" Span12Mux_s3_v ", " Span12Mux_v3 ")
line = line.replace(" Span12Mux_s4_v ", " Span12Mux_v4 ")
line = line.replace(" Span12Mux_s5_v ", " Span12Mux_v5 ")
line = line.replace(" Span12Mux_s6_v ", " Span12Mux_v6 ")
line = line.replace(" Span12Mux_s7_v ", " Span12Mux_v7 ")
line = line.replace(" Span12Mux_s8_v ", " Span12Mux_v8 ")
line = line.replace(" Span12Mux_s9_v ", " Span12Mux_v9 ")
line = line.replace(" Span12Mux_s10_v ", " Span12Mux_v10 ")
line = line.replace(" Span12Mux_s11_v ", " Span12Mux_v11 ")
line = line.replace(" Span12Mux_v ", " Span12Mux_v12 ")
line = line.replace(" Span12Mux_s0_v ", " Span12Mux_v0 ") # " Span12Mux_v0 ")
line = line.replace(" Span12Mux_s1_v ", " Span12Mux_v0 ") # " Span12Mux_v1 ")
line = line.replace(" Span12Mux_s2_v ", " Span12Mux_v0 ") # " Span12Mux_v2 ")
line = line.replace(" Span12Mux_s3_v ", " Span12Mux_v0 ") # " Span12Mux_v3 ")
line = line.replace(" Span12Mux_s4_v ", " Span12Mux_v0 ") # " Span12Mux_v4 ")
line = line.replace(" Span12Mux_s5_v ", " Span12Mux_v0 ") # " Span12Mux_v5 ")
line = line.replace(" Span12Mux_s6_v ", " Span12Mux_v0 ") # " Span12Mux_v6 ")
line = line.replace(" Span12Mux_s7_v ", " Span12Mux_v0 ") # " Span12Mux_v7 ")
line = line.replace(" Span12Mux_s8_v ", " Span12Mux_v0 ") # " Span12Mux_v8 ")
line = line.replace(" Span12Mux_s9_v ", " Span12Mux_v0 ") # " Span12Mux_v9 ")
line = line.replace(" Span12Mux_s10_v ", " Span12Mux_v0 ") # " Span12Mux_v10 ")
line = line.replace(" Span12Mux_s11_v ", " Span12Mux_v0 ") # " Span12Mux_v11 ")
line = line.replace(" Span12Mux_v ", " Span12Mux_v0 ") # " Span12Mux_v12 ")
f.write(line)