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

Support for OpenQASM 3.0 classical bits and registers #29

Closed
burgholzer opened this issue Dec 16, 2021 · 0 comments · Fixed by #309
Closed

Support for OpenQASM 3.0 classical bits and registers #29

burgholzer opened this issue Dec 16, 2021 · 0 comments · Fixed by #309
Labels
Core Anything related to the Core library and IR enhancement New feature or request

Comments

@burgholzer
Copy link
Member

burgholzer commented Dec 16, 2021

The new OpenQASM standard introduces many additional datatypes besides quantum and classical registers. This allows to describe classical components of quantum algorithms in a very intuitive way. As a first step, support for all kinds of new types should be added to the QFR library and, correspondingly, to the QuantumComputation class. For details on all the new typed provided by the standard, see https://qiskit.github.io/openqasm/language/classical.html.

Classical bits and registers could previously just be used as the target of a measurement and (in a very limited fashion) as the classical control in an if statement. The new OpenQASM 3.0 standard enriches these capabilities by allowing to:

  • assign bitstrings to classical registers, e.g., bit[8] a = "10001111";
  • execute bitwise operations such as and (&), or |, xor ^ and the corresponding assignment operators &=, |=, ^=
  • left and right shift << and >>, as well as <<= and >>= by an unsigned integer
  • not ~
  • circular shifts rotl and rotr

First of all, the QuantumComputation class needs to be capable of allocating and maintaining classical registers.
Most certainly, the manipulation of these registers will require the introduction of a new kind of operation, e.g., ClassicalOperation.
Such an operation will not be unitary. As a consequence, the concept of the NonUnitaryOperation as it is now may need to be revisited/refactored.

Depends on #28 for the availability of the bit keyword in the parser.

@burgholzer burgholzer added enhancement New feature or request good first issue Good for newcomers labels Dec 16, 2021
@burgholzer burgholzer removed the good first issue Good for newcomers label Dec 16, 2021
@burgholzer burgholzer added this to the OpenQASM 3.0 Support milestone Jun 15, 2023
@burgholzer burgholzer added the Core Anything related to the Core library and IR label Jun 15, 2023
@burgholzer burgholzer linked a pull request Dec 11, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core Anything related to the Core library and IR enhancement New feature or request
Projects
Status: Done
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant