ice40: Add better stats on LC packing

Signed-off-by: David Shah <dave@ds0.me>
diff --git a/ice40/chains.cc b/ice40/chains.cc
index 1b556f6..c8e9890 100644
--- a/ice40/chains.cc
+++ b/ice40/chains.cc
@@ -32,6 +32,7 @@
 class ChainConstrainer
 {
   private:
+    int feedio_lcs = 0;
     Context *ctx;
     // Split a carry chain into multiple legal chains
     std::vector<CellChain> split_carry_chain(CellChain &carryc)
@@ -55,6 +56,7 @@
                     CellInfo *feedin = make_carry_feed_in(cell, cell->ports.at(ctx->id("CIN")));
                     chains.back().cells.push_back(feedin);
                     tile.push_back(feedin);
+                    ++feedio_lcs;
                 }
             }
             tile.push_back(cell);
@@ -78,6 +80,7 @@
                                                                 at_end ? nullptr : *(curr_cell + 1));
                         chains.back().cells.push_back(passout);
                         tile.push_back(passout);
+                        ++feedio_lcs;
                     }
                 }
                 ++curr_cell;
@@ -281,6 +284,7 @@
                 chain.cells.at(0)->constr_children.push_back(chain.cells.at(i));
             }
         }
+        log_info("    %4d LCs used to legalise carry chains.\n", feedio_lcs);
     }
 
   public:
diff --git a/ice40/pack.cc b/ice40/pack.cc
index 4386d2a..f411aee 100644
--- a/ice40/pack.cc
+++ b/ice40/pack.cc
@@ -34,7 +34,7 @@
 static void pack_lut_lutffs(Context *ctx)
 {
     log_info("Packing LUT-FFs..\n");
-
+    int lut_only = 0, lut_and_ff = 0;
     std::unordered_set<IdString> packed_cells;
     std::vector<std::unique_ptr<CellInfo>> new_cells;
     for (auto cell : sorted(ctx->cells)) {
@@ -62,6 +62,7 @@
                 } else {
                     lut_to_lc(ctx, ci, packed.get(), false);
                     dff_to_lc(ctx, dff, packed.get(), false);
+                    ++lut_and_ff;
                     ctx->nets.erase(o->name);
                     if (dff_bel != dff->attrs.end())
                         packed->attrs[ctx->id("BEL")] = dff_bel->second;
@@ -73,6 +74,7 @@
             }
             if (!packed_dff) {
                 lut_to_lc(ctx, ci, packed.get(), true);
+                ++lut_only;
             }
             new_cells.push_back(std::move(packed));
         }
@@ -83,6 +85,8 @@
     for (auto &ncell : new_cells) {
         ctx->cells[ncell->name] = std::move(ncell);
     }
+    log_info("    %4d LCs used as LUT4 only\n", lut_only);
+    log_info("    %4d LCs used as LUT4 and DFF\n", lut_and_ff);
 }
 
 // Pack FFs not packed as LUTFFs
@@ -92,6 +96,7 @@
 
     std::unordered_set<IdString> packed_cells;
     std::vector<std::unique_ptr<CellInfo>> new_cells;
+    int ff_only = 0;
 
     for (auto cell : sorted(ctx->cells)) {
         CellInfo *ci = cell.second;
@@ -104,6 +109,7 @@
             packed_cells.insert(ci->name);
             dff_to_lc(ctx, ci, packed.get(), true);
             new_cells.push_back(std::move(packed));
+            ++ff_only;
         }
     }
     for (auto pcell : packed_cells) {
@@ -112,6 +118,7 @@
     for (auto &ncell : new_cells) {
         ctx->cells[ncell->name] = std::move(ncell);
     }
+    log_info("    %4d LCs used as DFF only\n", ff_only);
 }
 
 static bool net_is_constant(const Context *ctx, NetInfo *net, bool &value)
@@ -133,6 +140,7 @@
     std::unordered_set<IdString> exhausted_cells;
     std::unordered_set<IdString> packed_cells;
     std::vector<std::unique_ptr<CellInfo>> new_cells;
+    int carry_only = 0;
 
     for (auto cell : sorted(ctx->cells)) {
         CellInfo *ci = cell.second;
@@ -209,6 +217,7 @@
                     i1_net->users.push_back(pr);
                 }
                 new_cells.push_back(std::move(created_lc));
+                ++carry_only;
             }
             carry_lc->params[ctx->id("CARRY_ENABLE")] = Property::State::S1;
             replace_port(ci, ctx->id("CI"), carry_lc, ctx->id("CIN"));
@@ -250,6 +259,7 @@
     for (auto &ncell : new_cells) {
         ctx->cells[ncell->name] = std::move(ncell);
     }
+    log_info("    %4d LCs used as CARRY only\n", carry_only);
 }
 
 // "Pack" RAMs