flatten, techmap: don't canonicalize tpl driven bits via sigmap.
authorwhitequark <whitequark@whitequark.org>
Wed, 26 Aug 2020 16:20:32 +0000 (16:20 +0000)
committerwhitequark <whitequark@whitequark.org>
Wed, 26 Aug 2020 16:29:42 +0000 (16:29 +0000)
commit9f0892159ebb88964839ea2cb5313ef1b87c624d
treeafc5f41b1f62874253621d052e4a55eb4aab5987
parent08a226c9e728557f8b8c970a3a25b55ba5fc00cf
flatten, techmap: don't canonicalize tpl driven bits via sigmap.

For connection `assign a = b;`, `sigmap(a)` returns `b`. This is
exactly the opposite of the desired canonicalization for driven bits.
Consider the following code:

    module foo(inout a, b);
      assign a = b;
    endmodule
    module bar(output c);
      foo f(c, 1'b0);
    endmodule

Before this commit, the inout ports would be swapped after flattening
(and cause a crash while attempting to drive a constant value).

This issue was introduced in 9f772eb9.

Fixes #2183.
passes/techmap/flatten.cc
passes/techmap/techmap.cc
tests/techmap/bug2183.ys [new file with mode: 0644]