Synthesis and Optimization by Quantum Circuit Description Language Mariam Zomorodi-Moghadam1 , Mohammad-Amin Taherkhani2 , and Keivan Navi2(B) 1
2
Ferdowsi university of Mashhad, Mashhad, Iran Faculty of Electrical and Computer Engineering, Shahid Beheshti University, G.C., 1983963113 Evin, Tehran, Iran
[email protected]
Abstract. This paper describes the infrastructure of synthesizing quantum circuits via a quantum description language and for this purpose a new quantum circuit description language named QCDL is introduced which comprises instructions for quantum unitary operations and high-level structures which are synthesized into quantum logic level architecture. Next to introducing this language, we describe our synthesis approach to build up the quantum circuits out of a QCDL program. Although there are some languages like QCDL that work in the same way, but they lack all required instruction set, optimization step and/or support for distributed quantum circuits like the one in QCDL. More importantly, this paper describes a synthesis method for the specified language which is not completely included in other works in the field. Keywords: Quantum computing · Quantum circuit description language · HDL-based quantum circuit synthesis · Quantum circuit optimization
1
Introduction
Quantum computing is an emerging field in computing which has attracted the attention of many researchers from different fields including computer engineering, physics and mathematics. One of the main motivations of quantum computing is the ability of specific quantum algorithms to perform computations significantly faster than the classical ones. Quantum computing comprises applying unitary operations or quantum gates on quantum bits or qubits. The qubit is a generalization of a classical bit as an elementary unit of information. It represents a state defined by a pair of complex numbers. A qubit can be in the state ‘0’ or ‘1’, but also it can be in a superposition state of them, which in general is represented as: |ψ = α|0 + β|1 and satisfies: α2 + β 2 = 1. The state |0 usually is identified with the vector (1, 0), and the state |1 is identified with the vector (0, 1). An operation applied to a qubit or a quantum register, transforms it into another qubit or quantum register. Only unitary c Springer-Verlag Berlin Heidelberg 2014 M.L. Gavrilova et al. (Eds.): Trans. on Comput. Sci. XXIV, LNCS 8911, pp. 74–91, 2014. DOI: 10.1007/978-3-662-45711-5 5
Synthesis and Optimization by Quantum Circuit Description Language
75
operations are allowed in quantum computing and because unitary operations are reversible, the quantum circuits are also reversible. Quantum circuits are built to perform either a classical reversible or a quantum computation. In this way, many approaches have been proposed to synthesize and optimize quantum circuits. Many of these approaches are heuristic algorithms and work on simple circuits that their specification is given as truth tables. Other representations include BDD representation (e.g. [1,2]) and PDD (positive Davio Diagram) representation (e.g. [3,4]). The current approaches are good for simple computations, but there is a need for more sophisticated specifications such as algorithmic approaches which synthesize a quantum circuit from a language description of it. Reversible languages have been studied for many years. One of the first languages is Janus [5] and was designed to specify reversible software and is one of the first reversible languages. In the domain of reversible hardware description languages, one of the first ones is based on Janus. This reversible language named SyReC [6] supports only reversible operations and also non-reversible classical operations which are reduced to reversible operations when they are written in SyReC. The reversible language SyRec does not support quantum operators in its syntax. Another language called QHDL [7] defines only the same gate types to be implemented in hardware and it works much like a simulator. The other high level language for developing quantum programming languages can be found in [8] and has been implemented in GNU Octave language. Basically it is a quantum package incorporated in Octave and it is like a simulator with no specific synthesis method and does not offer a synthesis approach for the language. Actually we can see that the majority of the works in software techniques of quantum computing are high-level imperative or functional quantum languages for programming quantum algorithms [9–12]. On the other side, there are some researches based on embedded language for automatic generation of quantum circuit. In [13], a Chisel based hardware description language, Chisel-Q has been proposed. The authors focused on generation of pure quantum circuits and there is no consideration about specification of classical/quantum circuits in addition to quantum hardware and software partitioning. Another work, Quipper, has been presented in [14,15] which is based on Haskell language. Similar to Chisel-Q, development of quantum circuits based on this language is not as straightforward as famous languages, due to skills required for developers to learn the base language. In [16], Scaffold presented as an embedded language based on pure-C language, but the authors didn’t mention optimization techniques for generation of quantum circuit. Other works in the field of quantum languages are just extending VHDL to work for quantum circuits too. But because of essential differences between quantum hardware and classical hardware, using HDLs for quantum hardware lacks the complete requirements for designing quantum hardware. In this paper the structure of a high-level quantum description language called QCDL is described, including high-level instructions as well as elementary quantum operations and incorporated quantum algorithms and a synthesis approach for transforming them to a circuit realization is proposed. This paper is organized as follows. First, in Sect. 2 the language general structure, its
76
M. Zomorodi-Moghadam et al.
quantum computational model and the level of abstraction is described. Afterwards, in Sect. 3 we more highlight the structure of QCDL, including its instruction set and the circuit implementation of important instructions. Then in Sect. 4 the synthesis method of a QCDL program is described and then in Sect. 5 we conclude the paper and bring up some suggestions for future works.
2
The Language Structure and Its Computational Model
To represent the concept of a quantum computer, several models can be used each of which corresponds to different scientific approaches. As mentioned in [9], one of the 4 general models can be used depending on the design level requirements. These models include mathematical model which uses quantum operators to describe the system, machine model which is the quantum equivalent of Turing machine, circuit model which uses quantum gates for its description and finally algorithmic model which uses quantum programming language as a base. With quantum programming language we mean a hardware description language which is synthesized into circuit model and not a purely high-level program intended to execute on a quantum processor. We use this later model in our description of the quantum computer and then we transform it to the circuit model by means of synthesis process. In the later model we consider two distinct levels as architectural and unitary levels. The synthesis process works on these two levels. Although one can imagine more quantum hardware levels especially like physical level which is technology-dependent level. The CAD flow for automatic generation of quantum circuits using the proposed embedded language “QCDL” is shown in Fig. 1: The instructions in QCDL have a sequential structure but they can be executed concurrently in the synthesis level if they are independent of each other. The language structure as the algorithmic model is defined as follows. • The language supports both classical and quantum operations • The instructions are appeared as they are interpreted into quantum circuit from left to right. But the synthesis procedure may put some of them in one timestep. • The language has a concurrent structure for executing the gates which are in the same timeslots. A quantum circuit has S timeslots and every gate is exactly in one of them. • The concurrency is applied by synthesis procedure. • The language supports multicomputer quantum machine and each of them are defined in one module. In our definition of Quantum Computing Description Language (QCDL), we consider quantum and classical parts. The classical part uses classical reversible operators and bits and the quantum part uses quantum matrices and qubits for implementing quantum operations. However these two parts does not necessarily have to be separated physically. By using a partial quantum circuit the quantum
Synthesis and Optimization by Quantum Circuit Description Language
77
Fig. 1. Synthesis and optimization flow
effect of decoherence which destroys information can be mitigated because of limited use of them. Our method for quantum circuit synthesis is to use a quantum circuit description language to describe a system including quantum and classical parts and then building an equivalent quantum circuit for it. The level of abstraction defined in QCDL language can lead to different results and different quantum circuits. If the basic quantum operators are used then it is simple to build an equivalent circuit not very different from the language description of it, however the underlying technology is important and leads to different implementations. But if a more high level description is used, then there is a need for more sophisticated synthesis methods to build the quantum circuit. Technology dependency has some advantages in quantum circuit implementation. We can use specific structures for design that may be led to better optimizations and better use of resources. Finer granularity can help the designer to improve the quantum circuit. We use syntax like C and C++ as the basis for QCDL language although its semantic is basically different from a C or C++ program.
3
Instructions in QCDL: Definition and Their Circuit Implementation
In this section, we describe the basic structures, variable and operator definitions as defined in QCDL language and their equivalent implementation in circuit model.
78
M. Zomorodi-Moghadam et al.
In Table 1 sample declarations and operations of QCDL are listed. The instructions are defined in a high-level language and are transformed into the citcuit model by means of a synthesizer. Table 1. List of QCDL declarations and operations Expression:
Definitions:
qreg qr [size]
Defines a quantum register qr of length ‘size’
qbit qb
Defines a single quantum bit qb
q . shr (n)
Shifting register q, ‘n’ qubits to the right
q . shl (n)
Shifting register q, ‘n’ qubits to the left
q1 . swap (q2)
Swaping qubits q1 and q2
t . toffoli (c1, c2)
Applying toffoli gate to the inputs; ‘t’ is negated if c1 and c2 are set
t . cnot (c)
Applying CNOT to the inputs; ‘t’ is negated if c is set
q1 . cswap (c, q2) (Fredkin)
Applying Controlled-SWAP to the inputs; q1 and q2 are swaped if c is set
a . rotx
Rotation about x axis
a . roty
Rotation about y axis
a . rotz
Rotation about z axis
pi
Pauli-I gate or identity
px
Pauli-X gate or NOT
py
Pauli-Y gate
pz
pauli-Z gate
q.h
Hadamard operation on qubit ‘q’
q . u (U)
applies operation U on qubit ‘q’ (For U be a 2 × 2 unitary matrix)
q . cu (U, c)
Controlled-U operation on qubit ‘q’ where the operator ‘u’ is applied on it. (For U be a 2 × 2 unitary matrix)
3.1
Qubit and Operator Definitions
One of the most important things in every computational model is definition of information. In QCDL we define a quantum register ‘qreg’ as the quantum mechanical analogous of a classical register which its individual qubits are separable and are not entangled. For example qreg qr [4] defines a quantum register of size 4 of separable states. In QCDL, let us consider working with quantum registers of maximum 4 qubits because of technology limitations of physical realization of more qubits, however theoretically more lengths are supported. To define a single qubit, the keyword ‘qbit’ is used. Related to each qubit is two parameters alpha and beta which are the probability of being zero and one
Synthesis and Optimization by Quantum Circuit Description Language
79
respectively. So each quantum register of length ‘q’ is associated with ‘2q’ values, but because these two parameters of a qubit are related to each other, one of them is sufficient to know the state of the qubit. Also there are classical variables for doing classical calculations. For qubit or quantum register initializtion the value in the parenthesis shows the square of the coefficient of the state |0, i.e. α2 which is also the probability of being in state |0. Also if the equal sign is used for initialization it only can take the value 0 which means that the qubit is in the state |0. Like C and C++ language syntax, quantum variables can be defined as global or local. Global variables are defined to be used in more than one module or as a shared variable between different modules. Variables other than qubits and quantum registers do not constitute quantum circuit lines. Operators are applied to different sizes of qubits. When a quantum operator is applied to more than one qubit simultaneously, the input state of such operator is just the tensor product of the all qubits. So when a quantum operator is going to operate on an entangled quantum register, the input is defined by keyword entangled qreg as – entangled qreg qreg name [size] - an entangled input of size larger than one. For example, entangled qreg q [2] = q1 ⊗ q2 ; where ⊗ is the tensor product of two qubits, means that ‘q’ is an entangled quantum input or variable. Moreover we define arbitrary operators as the quantum gates operating on qbits. However, in the next section the most frequently used operators in quantum computing are defined as predefined existing operators in QCDL. The operators used in this language are unitary operators. This is because unitary operators describe the time evolution of a quantum state [17] and therefore quantum computing is based on them and this is why quantum circuits are reversible. A quantum operator of a given size is defined as follows – qop operator name [size] - a quantum operator acting on a quantum register of size size. Like the qubits which can be combined to create entangled quantum registers of sizes larger than one, the quantum operators can be combined in the same manner. For example, the following instruction in QCDL defines a quantum operator as the tensor product of two Hadamard operators. qop op [2] = H ⊗ H; where ⊗ is the tensor product of two Hadamard gates. 3.2
Predefined Operators
In QCDL, the standard quantum operators are defined as keywords of the language. The syntax of operators is basically in the form
80
M. Zomorodi-Moghadam et al.
q var.operator-name(arg1, arg2, ...) where q var is a quantum basic variable defined by qreg or qbit data types and args are essential quantum variables or parameters which have to be provided for the execution of the operator. For the shift operator the single element in the parenthesis is the number of required shifts and for the cu (controlled-U) operation the element in the parenthesis is the operation to be applied. These operators or quantum gates are given in Table 1 plus the other keywords of the language. Assignment: Assigning the value of one variable to another is one of the mostly used operations in computing. In quantum computation this operation is done differently from the classical assignment. In order to assign a qubit value to another one, we propose the set of the following quantum operations: First using an ancilla qubit prepared in the state zero which at the end holds the value of the source qubit. The sequence of circuit lines are as: qbit qconst = 0; qbit q0 , q1 ; With the line 0 initially holds the qubit 0, line 1 holds the qubit q0 and line 2 the qubit q1 the code for assignment operation is as follows: Assignment operation: q0 = q1 q1 . cnot (qconst); q0 . swap (q1 ); qconst . swap (q1 ) Using this technique, the value of q1 is not changed and the early value of q0 is preserved at line 0. So one ancillary line is wasted to insure the reversibility of the assignment is obtained. Figure 2 shows the circuit obtained by the synthesis procedure. Actually the QCDL programmer does not need to write the above instructions, however it is supported by the language.
Fig. 2. Quantum circuit for assignment operation
FAN-OUT circuit: In quantum mechanics, according to the no-cloning theorem, it turns out that it is impossible to copy an unknown quantum state or qubit. So we cannot use fan-out circuits in general. But in classical reversible circuits it can be done using CNOT gate. Figure 3 represents such reversible circuit for copying a given input.
Synthesis and Optimization by Quantum Circuit Description Language
81
Fig. 3. Fan-out circuit
Shift operation: One of the useful operations in the set of quantum arithmetic operations is qubit shift to left or right. Shifting a qubit can be done with a set of swap operations in quantum circuits. The instruction for doing this is as qreg qr [n]; qr . shl (l); It means that the quantum register qr is shifted l locations to the left. In QCDL, the shift operation is like rotation in conventional programming. Our synthesis idea of combinational shift is as follows: With the line 0 initially holds the qubit q0, line 1 holds the qubit q1, etc., the set of operations which are taken by synthesizer are as follows: swap (line 0, line 1); swap (line 0, line 2);... swap (line 0, line n-1); These operations are not the standard syntax of QCDL, but the synthesized operations of a QCDL program. This procedure is repeated l times for shifting the register l locations to the left. Also shifting the register to right is similar to shifting right except that the order of swaping is reversed. If one requires to shift the register one location and the length of the register is N, then there is a need for N-1 swap gates. An example for a three-qubit register is illustrated in Fig. 4.
Fig. 4. Implementation of shift operation with two swap gates
Qubit initialization: For initializing a qubit to a given state, the synthesizer uses the probability splitter circuit of [18] to halve the probability of a given state until its probability becomes the desired one. The synthesizer checks the amplitudes of the desired qubit to find the number of levels and the value of switches for the probability splitter circuit. This circuit results the qubit in a state with desired amplitudes in the last stage of the circuit. Implementing if-then structures: In programming languages ’if-thenelse’ is a basic programming structure that almost every programming language
82
M. Zomorodi-Moghadam et al.
has an equivalent definition for it. In quantum circuit model this structure can be mapped to a series of CNOT gates. For example the following if-then-else structure in QCDL can be mapped to the equivalent circuit of Fig. 5. if (q1 == 1) q2 . u (U1); else q2 . u (U2);
Fig. 5. Quantum circuit for if-then-else structure
If there are multiple choices and more than one qubit is involved in the ‘ifthen-else’ structure then the synthesized subcircuit contains multiple controlledU gates where U is applied on a quantum register. For the case where the control and target registers both are of size 3 a quantum circuit such as the one in Fig. 6 is obtained after synthesizing the circuit. The gates involved in this figure are similar to the generalized Toffoli gates with 3-qubit controlled-NOT gates except that ‘NOT’ is substituted with 3-qubit unitary operations. In order to minimize the number of required NOT operations for control register, the location of each clause execution operation is as illustrated in Fig. 6.
if (qureg1==0) qreg2 . u (U0); else if (qureg1==1) qreg2 . u (U1); . . . else qreg2 . u (Un) In this case at most 2n C n U operations are used. In this case U is a subcircuit composed of some quantum gates and this subcircuit is executed if all n control lines are set. If the function that should be executed as if clause, is composed of more than one quantum gate then the synthesizer places the same control line of the corresponding if clause for each gate of the function. For simple if-then-else structures where the length of the control input is one, the synthesizer may also use the Fredkin or Fredkin-family gates. Using Fredkin-familiy gates instead of the above circuits is suitable for the cases where
Synthesis and Optimization by Quantum Circuit Description Language
83
Fig. 6. Quantum circuit for nested if-then-else structure
the circuit equivalents of the functions are large enough to put one controlled gate for each of its gates. The circuit for doing this is illustrated in Fig. 7.
Fig. 7. Implementing if-then-structures with fredkin gate
In Sect. 4 we compare this design with the previous ones of Figs. 5 and 6. 3.3
Quantum Operators in QCDL Language
Quantum operators can be thought of as reversible operators too. This is because any quantum transform is a unitary transform and hence it is reversible. Some of these operators have no equivalent in classical reversible gates. The following is the list of quantum operators in QCDL language which are usual in the design of quantum circuits. Single qubit gates: Between single qubit gates, Pauli matrices are of special importance, because any 1-qubit Hamiltonian can be decomposed into Pauli matrices. In QCDL they are identified as: Pi, Px, Py and Pz respectively for Pauli-I, Pauli-X, Pauli-Y and Pauli-Z operations. Other quantum operators are: • Rotation about X axis
Rx (θ) =
cos θ2 −isin θ2
−isin θ2 cos θ2
(1)
84
M. Zomorodi-Moghadam et al.
• Rotation about Y axis
Ry (θ) =
cos θ2 −sin θ2
sin θ2 cos θ2
• Rotation about Z axis
Rz (θ) =
• Phase Gate
φ
e−i 2 0 φ 0 ei 2
S=
• Phase Shift Gate
P =
• Discrete Phase Gate
Rk =
10 0i
(2)
(3)
1 0 0 eiθ
(4)
1 0 k 0 e(2πi/2 )
(5) (6)
• Hadamard Gate
1 1 1 H=√ (7) 2 1 −1 • A unitary operation for conditional phase shift where every computational basis state except state |0 receiving a phase shift of −1. This operator is defined to be used in Grover algorithm. • Measurement gate which is a non-unitary quantum evolution and is usually executed as a final step in quantum computation. The outcome of this gate is just ‘0’ or ‘1’. If each of these one-qubit gates are applied to ‘n’ qubits, then the order-‘n’ tensor product of these operators is applied to the tensor product of ‘n’ qubits. 3.4
Arithmetic and Logical Units in QCDL Language
There are many works in designing arithmetic and logic units from basic quantum operators (e.g. [19–21]). We have created an optimized library taking the best ones from the existing literature. In arithmetic design one method is to use quantum counterparts of classical designs and then using optimization approaches specific to quantum circuits for optimizing them. In one other method which first proposed by Draper in [22] a structure which uses the Quantum Fourier Transform (QFT) operation is utilized for quantum addition. The proposed design uses just a set of controlled rotations for implementing quantum addition. This method reduces the number of qubits by removing the need for extra carry qubits, having massive parallelism in execution and allowing a hybrid system of classical and quantum numbers while the final outputs are deterministic. Because of these advantages we use QFT in our synthesis program to implement adder, multiplier and the one called MAC [5]. Because of its
Synthesis and Optimization by Quantum Circuit Description Language
85
regular structure, using only controlled rotation gates and fast execution time, Draper’s quantum addition circuit is suitable for QCDL circuit implementation. Quantum Fourier Transform (QFT) can be implemented with a set of Hadamard, Controlled-Rk gates and swaps. Controlled-Rk gate applies Rk to the target qubit if the control qubit is in the state |1 otherwise it is not changed. The implementation of QFT in QCDL for 3 qubits is as follows: qureg i [3]; qureg qureg qureg qureg qureg qureg 3.5
[0] [0] [0] [1] [1] [2]
. . . . . .
H; cu (R2 , qureg [1]); cu (R3 , qureg [2]); H; cu (R2 , qureg [2]); H
Iteration Statements
One of the most important structures in each programming language is iteration. Iteration is of essential importance in programming languages. In such structure we need a loop control. Also the reversibility of the loop control is not an issue. Frank [23] has developed a technique that could be used for constructing a reversible CPU and proved that feedback can be implemented in sequential circuits these circuits can be made reversible without dissipating energy and losing reversibility and showed there are no fundamental architectural barriers to designing a reversible CPU. Moreover we consider the situations were specific quantum algorithms and quantum computation can do parallel instructions and loops extremely efficiently. One of these situations is where iterations are independent of each other and this task can be done in parallel on a quantum computer. We see it in the following small block of instructions: qreg qr [4]; int n = 10; qr = 0; for (i = 0; i < 4; i++) { qr [i] = (i); }
By using the quantum memory the result of each loop statement is stored in the memory and every time that the content of the referred entries are altered, then a new computation is done automatically. To realize iterations in QCDL the synthesizer needs to use a comparator to control the execution of the loop. The best comparator based on quantum gates which we know is in [24]. This circuit is used as a library in the synthesizer and helps for building the quantum circuit where needed.
86
4
M. Zomorodi-Moghadam et al.
Circuit Synthesis and Optimization
After defining the instruction set of QCDL language and creating the synthesized quantum subcircuits for each of them, now they can be put together in order to perform the whole quantum hardware. In synthesizing a QCDL program, instructions are traversed and they are reduced to an intermediate file composed of low level instructions which can immediately be transformed to the equivalent quantum gates. One important issue in synthesizing the circuit is the need for sequential execution of instructions in the presence of dependencies. The first step of program processing, transforms the instructions into their equivalent basic quantum operations and making the intermediate program. The next step is to put this low level program into an optimized quantum circuit. The QCDL supports distributed quantum circuits and for this purpose the QCDL program can have as many separate modules as needed. It works as follows: Module definition: In QCDL language distributed modules work with each other by teleporting the quantum states to each other. Each set of instructions intended to be executed in one monolithic quantum circuit are defined in a separate module. The teleport circuit such as the one given in [25] is used for teleporting one state from a source module to a destination module and returning back the modified result state to its source. The synthesis algorithm works according to the following rules however some of the proposed techniques like instruction dependencies are not incorporated in the synthesis time and are considered as a post-synthesis step after producing the quantum circuit. 1. The program consists of a few processes which are called from the main program. They are treated as separate modules of a quantum circuit. If a process needs the outcome of another process then their corresponding modules are put sequentially by synthesizer, otherwise their subcircuits are put in the same time steps. 2. Using the state definitions, the synthesizer determines the number of required wires and assigns qubits to appropriate lines or wires. 3. The order of lines is the same as the order of qubit or qureg definition instructions. For qureg assignments they are numbered from the least index qubit to the most significant one. 4. The synthesizer reads the instructions sequentially beginning from the first instruction in the program. 5. The synthesizer puts the gates sequentially from left to right in the quantum circuit realization. 6. If all of the inputs of two consecutive instructions are different, then their corresponding subcircuits are put in the same timestep of the quantum circuit by the synthesizer and are executed in parallel.
Synthesis and Optimization by Quantum Circuit Description Language
87
7. If a process consists of classical reversible instructions, their inputs are defined just as classical bits and their corresponding operations are classical reversible gates. 8. By considering instruction dependencies, quantum circuit parallelism is implemented in one module and leads to execution of quantum gates in fewer time steps. 9. For known quantum operators like addition and multiplication the synthesizer takes the existing implementations of them. For example the quantum adder circuit of [26,27] and the reversible design of BCD-adder of [21,28] are used to add two quantum qubits or classical reversible bits. Also for sequential circuits the synthesizer uses designs presented in [29]. For if-then-else structures where the number of corresponding low level instructions for each clause are large, the synthesizer replaces the circuit of Fig. 7. For a simple if-then-else if U1 and U2 are one-qubit gates, by using the circuit of Fig. 5, two controlled-U plus one NOT gates are used. If it is accomplished by the circuit of Fig. 7, it contains the following gates – one CNOT gate, – two one-qubit U gates, and – one Fredkin gate. If U is composed of more than one elementary gates, then in each if or else statements there are more than one controlled-U operations. If the number of elementary gates for U1 is n and for U2 is m then the following number of gates are used for implementing it with the circuit of Fig. 5. – one NOT gate, – n + m controlled-U gates, and And if it is implemented with the circuit of Fig. 7 we have the following number of gates in the circuit – one CNOT gate, – one Fredkin gate and – n + m U gates. As NOT, CNOT and Fredkin have constant quantum cost, they don’t increase the cost when the system becomes large. So in such instructions the synthesizer compares two cases for implementations and picks the one with lower number of gates and quantum cost. In Fig. 8 the representation of a sample QCDL program for 3-qubit quantum addition is shown. Its synthesized circuit has been demonstrated in Fig. 9. The description of its synthesis method is as follows: First the circuit lines are defined according to qubit definitions in the program. Then two distinct quantum circuits are considered and since the second module is dependent to the outcome of the first module, so they are put sequentially from left to right. Because of limited space they are placed top to down in
88
M. Zomorodi-Moghadam et al.
Fig. 8. A sample QCDL program
Synthesis and Optimization by Quantum Circuit Description Language
89
Fig. 9. The synthesized circuit of the program of Fig. 8
Fig. 9. In the first module, the first 3 instructions have dependency to each other and cannot put in the same time steps. The fourth instruction is dependent to the outcome of the second instruction and its corresponding hadamard gate can be placed after the first R2 gate. The dashed lines in Fig. 9 represent the time steps assigned to gates that can be executed simultaneously.
5
Conclusions and Future Work
In this paper a new hardware description language named QCDL has been introduced for describing quantum circuits and transforming high-level structures to quantum hardware. The synthesis approach of a QCDL program for realization of quantum circuits has been explained. We defined the syntax of this language similar to C and C++ syntax. Considering the whole elementary quantum operations as language instructions and standard classical high-level instructions are some of the basic features of this quantum language. Also the parallel execution of quantum circuit blocks and considering their eventual dependencies has not been seen in other quantum hardware description languages. As future work, we are thinking about incorporating more quantum operations in the synthesis process such as using elementary quantum operations
90
M. Zomorodi-Moghadam et al.
for high-level instructions or defining some restrictions for synthesis process such as synthesizing the circuit as linear nearest neighbor architecture.
References 1. Wille, R., Drechsler, R.: BDD-based synthesis of reversible logic for large functions. In: Proceedings of the 46th Annual Design Automation Conference, pp. 270–275. ACM (2009) 2. Kerntopf, P.: A new heuristic algorithm for reversible logic synthesis. In: Proceedings of the 41st Annual Design Automation Conference, pp. 834–837. ACM (2004) 3. Takahashi, K., Hirayama, T.: Reversible logic synthesis from positive Davio trees of logic functions. In: TENCON 2009–2009 IEEE Region 10 Conference, pp. 1–4. IEEE (2009) 4. Pang, Y., Wang, S., He, Z., Lin, J., Sultana, S., Radecka, K.: Positive Daviobased synthesis algorithm for reversible logic. In: 2011 IEEE 29th International Conference on Computer Design (ICCD), pp. 212–218. IEEE (2011) 5. Yokoyama, T., Gluck, R.: A reversible programming language and its invertible self-interpreter. In: Symposium on Partial Evaluation and Semanticsbased Program Manipulation, pp. 144–153 (2007) 6. Wille, R., Offermann, S., Drechsler, R.: SyReC: a programming language for synthesis of reversible circuits. In: System Specification and Design Languages, pp. 207–222. Springer, New York (2012) 7. Chakrabarti, A., Sur-Kolay, S., Mandal, S.B.: Design of a hardware description language based quantum circuit simulator. Int. J. Recent Trends Eng. Technol. 1 (2009) 8. Gawron, P., Klamka, J., Miszczak, J., Winiarczyk, R.: Extending scientific computing system with structural quantum programming capabilities. Bull. Pol. Acad. Sci. Tech. Sci. 58, 77–88 (2010) ¨ 9. Omer, B.: Structured quantum programming. Inf. Syst. 130 (2003) 10. Bettelli, S., Calarco, T., Serafini, L.: Toward an architecture for quantum programming. Eur. Phys. J. D-Anat. Mol. Opt. Plasma Phys. 25, 181–200 (2003) 11. Ying, M., Feng, Y.: A flowchart language for quantum programming. IEEE Trans. Softw. Eng. 37, 466–485 (2011) 12. Selinger, P.: A brief survey of quantum programming languages. In: Kameyama, Y., Stuckey, P.J. (eds.) FLOPS 2004. LNCS, vol. 2998, pp. 1–6. Springer, Heidelberg (2004) 13. Liu, X., Kubiatowicz, J.: Chisel-Q: Designing quantum circuits with a scala embedded language. In: 2013 IEEE 31st International Conference on Computer Design (ICCD). IEEE (2013) 14. Green, A.S., Lumsdaine, P.L.F., Ross, N.J., Selinger, P., Valiron, B.: An introduction to quantum programming in quipper. In: Dueck, G.W., Miller, D.M. (eds.) RC 2013. LNCS, vol. 7948, pp. 110–124. Springer, Heidelberg (2013) 15. Green, A.S., Lumsdaine, P. L., Ross, N.J., Selinger, P., Valiron, B.: Quipper: a scalable quantum programming language. In: ACM SIGPLAN Notices, vol. 48, pp. 333–342. ACM (2013) 16. Abhari, A.J., Faruque, A., Dousti, M.J., Svec, L., Catu, O., Chakrabati, A., Chiang, C.-F., Vanderwilt, S., Black, J., Chong, F.: Scaffold: quantum programming language. Technical Report TR-934-12, Princeton University (2012) 17. McMahon, D.: Quantum Computing Explained. Wiley, Hoboken (2007)
Synthesis and Optimization by Quantum Circuit Description Language
91
18. Sgarbas, K.N.: A quantum probability splitter and its application to qubit preparation. Quantum Inf. Process. 12, 601–610 (2013) 19. Maynard, C.M., Einar, P.: Integer Arithmetic With Hybrid Quantum-Classical Circuits (2013). arXiv preprint http://arxiv.org/abs/1304.4069arXiv:1304.4069 20. Florio, G., Picca, D.: Quantum implementation of elementary arithmetic operations (2004). arXiv preprint http://arxiv.org/abs/quant-ph/0403048quant-ph/ 0403048 √ 21. Choi, B.S., Van Meter, R.: A Θ ( n)-depth quantum adder on the 2D NTC quantum computer architecture. ACM J. Emerg. Technol. Comput. Syst. (JETC) 8(3), 24:1–24:22 (2012) 22. Draper, T.G.: Addition on a Quantum Computer (2000). arXiv preprint http:// arxiv.org/abs/quant-ph/0008033quant-ph/0008033 23. Frank, M.P., Thomas F.K. Jr.: Reversibility for efficient computing. Diss. Massachusetts Institute of Technology, Department of Electrical Engineering and Computer Science (1999) 24. Oliveira, D.S., Ramos, R.V.: Quantum bit string comparator: circuits and applications. Quantum Comput. Comput. 7, 17–26 (2007) 25. Nielsen, M.A., Chuang, I.L.: Quantum Computation and Quantum Information. Cambridge University Press, New York (2000) 26. Draper, T.G., Kutin, S.A., Rains, E.M., Svore, K.M.: A logarithmic-depth quantum carry-lookahead adder. Quantum Inf. Comput. 6, 351–369 (2006) 27. Thapliyal, H., Ranganathan, N.: Design of efficient reversible logic-based binary and BCD adder circuits. ACM J. Emerg. Technol. Comput. Syst. 9(3) (2013) 28. Thapliyal, H., Ranganathan, N.: A new reversible design of bcd adder. In: Design, Automation & Test in Europe Conference & Exhibition (DATE), pp. 1–4. IEEE (2011) 29. Thapliyal, H.: Ranganathan. N.: Design of reversible sequential circuits optimizing quantum cost, delay, and garbage outputs. ACM J. Emerg. Technol. Comput. Syst. 6(4), 14:1–14:35 (2010)