diff options
author | Clifford Wolf <clifford@clifford.at> | 2019-12-05 08:24:24 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-05 08:24:24 -0800 |
commit | 7dece7955e9682dddec67eb99d4f99742e637a07 (patch) | |
tree | 79edd5c9a3f5846d1da74859cea8d1e037b5366c /kernel/rtlil.cc | |
parent | fcce94010f3282e7f7d3f602b3e710cb7ce524ee (diff) | |
parent | e97e33d00df9d702643a82152aa1becc611ef823 (diff) | |
download | yosys-7dece7955e9682dddec67eb99d4f99742e637a07.tar.gz yosys-7dece7955e9682dddec67eb99d4f99742e637a07.tar.bz2 yosys-7dece7955e9682dddec67eb99d4f99742e637a07.zip |
Merge pull request #1551 from whitequark/manual-cell-operands
Clarify semantics of comb cells, in particular shifts
Diffstat (limited to 'kernel/rtlil.cc')
-rw-r--r-- | kernel/rtlil.cc | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc index bd2fd91a3..7c73f94c8 100644 --- a/kernel/rtlil.cc +++ b/kernel/rtlil.cc @@ -783,6 +783,14 @@ namespace { return v; } + int param_bool(RTLIL::IdString name, bool expected) + { + int v = param_bool(name); + if (v != expected) + error(__LINE__); + return v; + } + void param_bits(RTLIL::IdString name, int width) { param(name); @@ -869,13 +877,23 @@ namespace { return; } - if (cell->type.in(ID($shl), ID($shr), ID($sshl), ID($sshr), ID($shift), ID($shiftx))) { + if (cell->type.in(ID($shl), ID($shr), ID($sshl), ID($sshr))) { + param_bool(ID(A_SIGNED)); + param_bool(ID(B_SIGNED), /*expected=*/false); + port(ID::A, param(ID(A_WIDTH))); + port(ID::B, param(ID(B_WIDTH))); + port(ID::Y, param(ID(Y_WIDTH))); + check_expected(/*check_matched_sign=*/false); + return; + } + + if (cell->type.in(ID($shift), ID($shiftx))) { param_bool(ID(A_SIGNED)); param_bool(ID(B_SIGNED)); port(ID::A, param(ID(A_WIDTH))); port(ID::B, param(ID(B_WIDTH))); port(ID::Y, param(ID(Y_WIDTH))); - check_expected(false); + check_expected(/*check_matched_sign=*/false); return; } @@ -957,7 +975,7 @@ namespace { port(ID::A, param(ID(A_WIDTH))); port(ID::B, param(ID(B_WIDTH))); port(ID::Y, param(ID(Y_WIDTH))); - check_expected(false); + check_expected(/*check_matched_sign=*/false); return; } |