Change pmgen default rule to reject, switch peepopt behavior to accept
authorClifford Wolf <clifford@clifford.at>
Thu, 15 Aug 2019 20:47:59 +0000 (22:47 +0200)
committerClifford Wolf <clifford@clifford.at>
Thu, 15 Aug 2019 20:47:59 +0000 (22:47 +0200)
Signed-off-by: Clifford Wolf <clifford@clifford.at>
passes/pmgen/demo_reduce.pmg
passes/pmgen/ice40_dsp.pmg
passes/pmgen/peepopt_muldiv.pmg
passes/pmgen/peepopt_shiftmul.pmg
passes/pmgen/pmgen.py

index ddc932de548a641d5495a734b8e237e6ecd90ce1..09856e9ae0fc758980884a7bdc77213ef26822ea 100644 (file)
@@ -23,6 +23,7 @@ code
 finally
        chain.pop_back();
        log_assert(chain.empty());
+       accept;
 endcode
 
 // ------------------------------------------------------------------
@@ -48,7 +49,6 @@ endmatch
 
 code
        non_first_cells.insert(next);
-       reject;
 endcode
 
 // ------------------------------------------------------------------
@@ -74,7 +74,6 @@ code
                if (GetSize(chain) > GetSize(longest_chain))
                        longest_chain = chain;
        }
-       reject;
 finally
        if (next)
                chain.pop_back();
index 1f3590d4ecd84610d1bf99bac8fca35267dbe773..7003092bb05d521bc59cea7fa5e524dc423e00bf 100644 (file)
@@ -159,4 +159,5 @@ code clock clock_pol clock_vld
                clock_pol = cp;
                clock_vld = true;
        }
+       accept;
 endcode
index 06c275834e5f1282fa2005619c8d4818640faaa5..7cad759d0e5555d486fbc99299b4244bd8c236ca 100644 (file)
@@ -32,5 +32,5 @@ code
        log("muldiv pattern in %s: mul=%s, div=%s\n", log_id(module), log_id(mul), log_id(div));
        module->connect(div_y, val_y);
        autoremove(div);
-       reject;
+       accept;
 endcode
index d766d9e4ade022ee91d3f9612fb7a6d91d27258d..d4748ae19e4fd9e9980cd3d777b64a094fd7bb65 100644 (file)
@@ -91,6 +91,6 @@ code
        shift->setParam(\B_WIDTH, GetSize(new_b));
 
        blacklist(shift);
-       reject;
+       accept;
 }
 endcode
index 22a7a5225367943f641b80e465e614a5811a81f1..c6e9a9cbfc2735dc6234819cae6c0efc2e3109d5 100644 (file)
@@ -494,8 +494,6 @@ with open(outfile, "w") as f:
         current_pattern, current_subpattern = block["pattern"]
 
         if block["type"] == "final":
-            print("    on_accept();", file=f)
-            print("    check_blacklist_{}();".format(current_pattern), file=f)
             print("  }", file=f)
             if index+1 != len(blocks):
                 print("", file=f)
@@ -556,7 +554,7 @@ with open(outfile, "w") as f:
             print("#define reject do {{ check_blacklist_{}(); goto rollback_label; }} while(0)".format(current_pattern), file=f)
             print("#define accept do {{ on_accept(); check_blacklist_{}(); if (rollback) goto rollback_label; }} while(0)".format(current_pattern), file=f)
             print("#define branch do {{ block_{}(); if (rollback) goto rollback_label; }} while(0)".format(index+1), file=f)
-            print("#define subpattern(pattern_name) block_subpattern_{}_ ## pattern_name ()".format(current_pattern), file=f)
+            print("#define subpattern(pattern_name) do {{ block_subpattern_{}_ ## pattern_name (); if (rollback) goto rollback_label; }} while(0)".format(current_pattern), file=f)
 
             for line in block["code"]:
                 print("  " + line, file=f)