diff --git a/xls/codegen/block_generator.cc b/xls/codegen/block_generator.cc index d990187cfa..a98cc502c2 100644 --- a/xls/codegen/block_generator.cc +++ b/xls/codegen/block_generator.cc @@ -527,13 +527,63 @@ class BlockGenerator { return false; } + // Returns whether the given operand appears multiple times in the emitted + // verilog expression/statement(s) for the given node. + bool OperandAppearsMultipleTimesInExpression(Node* n, int64_t operand_no) { + switch (n->op()) { + case Op::kArraySlice: + case Op::kArrayUpdate: + case Op::kArrayConcat: + return true; + // Select operations have multiple comparisons to the selector. Priority + // select is emitted as a separate function and doesn't have this + // property. + case Op::kSel: + return n->As