deminout: Don't demote inouts with unused bits
authorDavid Shah <dave@ds0.me>
Tue, 25 Feb 2020 14:14:45 +0000 (14:14 +0000)
committerDavid Shah <dave@ds0.me>
Wed, 4 Mar 2020 18:44:38 +0000 (18:44 +0000)
Signed-off-by: David Shah <dave@ds0.me>
passes/techmap/deminout.cc
tests/various/deminout_unused.ys [new file with mode: 0644]

index b976b401b0db72ce755e8f7fee31de636481eb2b..35d43b1066742b1f9f9e26da74da4a2aff48ed4f 100644 (file)
@@ -121,8 +121,7 @@ struct DeminoutPass : public Pass {
                                                                        goto tribuf_bit;
                                                        } else {
                                                tribuf_bit:
-                                                               if (bits_used.count(bit))
-                                                                       new_input = true;
+                                                               new_input = true;
                                                        }
                                                }
 
diff --git a/tests/various/deminout_unused.ys b/tests/various/deminout_unused.ys
new file mode 100644 (file)
index 0000000..5ed0050
--- /dev/null
@@ -0,0 +1,14 @@
+read_verilog <<EOT
+module top(input clk, inout [7:0] x);
+
+reg [3:0] ctr;
+always @(posedge clk) ctr <= ctr + 1'b1;
+
+assign x[7:4] = ctr;
+endmodule
+EOT
+proc
+tribuf
+deminout
+select -assert-count 1 i:x o:x %i
+