Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect QASM from conditional RangePredicate #1508

Open
yao-cqc opened this issue Jul 31, 2024 · 0 comments
Open

Incorrect QASM from conditional RangePredicate #1508

yao-cqc opened this issue Jul 31, 2024 · 0 comments
Assignees
Labels
bug Something isn't working classical-logic issues related to classical logical expressions

Comments

@yao-cqc
Copy link
Contributor

yao-cqc commented Jul 31, 2024

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 yao-cqc self-assigned this Jul 31, 2024
@yao-cqc yao-cqc added the bug Something isn't working label Jul 31, 2024
@CalMacCQ CalMacCQ added the classical-logic issues related to classical logical expressions label Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working classical-logic issues related to classical logical expressions
Projects
None yet
Development

No branches or pull requests

2 participants