From b862fd3f5f11797bc60178917993cadf784eeb1c Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Fri, 23 Oct 2015 21:08:36 +0200 Subject: Progress in icetime --- icetime/Makefile | 11 ++++++-- icetime/icetime.cc | 59 ++++++++++++++++++++++++++++------------ icetime/mktest.py | 80 +++++++++++++++++++++++++++--------------------------- 3 files changed, 90 insertions(+), 60 deletions(-) (limited to 'icetime') diff --git a/icetime/Makefile b/icetime/Makefile index 9423f84..5d0ecee 100644 --- a/icetime/Makefile +++ b/icetime/Makefile @@ -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 diff --git a/icetime/icetime.cc b/icetime/icetime.cc index 74426d0..271110a 100644 --- a/icetime/icetime.cc +++ b/icetime/icetime.cc @@ -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,15 +669,36 @@ 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; } @@ -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()); diff --git a/icetime/mktest.py b/icetime/mktest.py index ba71c83..80760b7 100644 --- a/icetime/mktest.py +++ b/icetime/mktest.py @@ -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) -- cgit v1.2.3