generic: Add support for disabling IOB insertion

Signed-off-by: David Shah <dave@ds0.me>
diff --git a/generic/main.cc b/generic/main.cc
index 7dfc6aa..bb78099 100644
--- a/generic/main.cc
+++ b/generic/main.cc
@@ -46,6 +46,7 @@
 {
     po::options_description specific("Architecture specific options");
     specific.add_options()("generic", "set device type to generic");
+    specific.add_options()("no-iobs", "disable automatic IO buffer insertion");
     return specific;
 }
 
@@ -59,7 +60,10 @@
         if (arch_name != "generic")
             log_error("Unsuported architecture '%s'.\n", arch_name.c_str());
     }
-    return std::unique_ptr<Context>(new Context(chipArgs));
+    auto ctx = std::unique_ptr<Context>(new Context(chipArgs));
+    if (vm.count("no-iobs"))
+        ctx->settings[ctx->id("disable_iobs")] = Property::State::S1;
+    return ctx;
 }
 
 int main(int argc, char *argv[])
diff --git a/generic/pack.cc b/generic/pack.cc
index 69f248d..19266ab 100644
--- a/generic/pack.cc
+++ b/generic/pack.cc
@@ -249,6 +249,10 @@
                         delete_nets.insert(net2->name);
                     }
                 }
+            } else if (bool_or_default(ctx->settings, ctx->id("disable_iobs"))) {
+                // No IO buffer insertion; just remove nextpnr_[io]buf
+                for (auto &p : ci->ports)
+                    disconnect_port(ctx, ci, p.first);
             } else {
                 // Create a GENERIC_IOB buffer
                 std::unique_ptr<CellInfo> ice_cell =