Fixed assertion failure for non-inferrable counters in some cases
authorAndrew Zonenberg <azonenberg@drawersteak.com>
Thu, 7 Apr 2016 06:42:22 +0000 (23:42 -0700)
committerAndrew Zonenberg <azonenberg@drawersteak.com>
Thu, 7 Apr 2016 06:42:22 +0000 (23:42 -0700)
techlibs/greenpak4/greenpak4_counters.cc

index 394f3dab1b4b879570387736d9e0d137c7d338c7..7b5646bf2009ec21bdd662beca5fc744aa2c4693 100644 (file)
@@ -248,8 +248,12 @@ void greenpak4_counters_worker(
        if (cell->type != "$alu")
                return;
        
-       //A input is the count value. Check if it has COUNT_EXTRACT set
-       RTLIL::Wire* a_wire = sigmap(cell->getPort("\\A")).as_wire();
+       //A input is the count value. Check if it has COUNT_EXTRACT set.
+       //If it's not a wire, don't even try
+       auto port = sigmap(cell->getPort("\\A"));
+       if(!port.is_wire())
+               return;
+       RTLIL::Wire* a_wire = port.as_wire();
        bool force_extract = false;
        bool never_extract = false;
        string count_reg_src = a_wire->attributes["\\src"].decode_string().c_str();