tket icon indicating copy to clipboard operation
tket copied to clipboard

Incorrect QASM from conditional `RangePredicate`

Open yao-cqc opened this issue 6 months ago • 0 comments

range_predicate = RangePredicateOp(6, 0, 27)
c = Circuit(0, 8)
c.add_gate(range_predicate, [0, 1, 2, 3, 4, 5, 6], condition=Bit(7))
qasm = circuit_to_qasm_str(c, header="hqslib1")

prints

OPENQASM 2.0;
include "hqslib1.inc";

creg c[8];
if(c[7]==1) if(c<=27) c[6] = 1;
if(c>27) c[6] = 0;

First of all, there shouldn't be two ifs in one line, and secondly the second assignment has incomplete conditions. The latter is caused by #1491 .

yao-cqc avatar Jul 31 '24 13:07 yao-cqc