FPGA-Based Circuit Model Emulation of Quantum Algorithms
FPGA-Based Circuit Model Emulation of Quantum Algorithms
400
Authorized licensed use limited to: Universidad Federal de Pernambuco. Downloaded on May 06,2025 at 14:09:41 UTC from IEEE Xplore. Restrictions apply.
(for example see [11]-[15]) that only consist of X, Y, Z,
and CNOT gates are simulated quickly with significant
decrease in the required resources.
Based on the required operations, the used library of
this paper is divided into two separated parts, where
the first one includes the gates H, PS, R, and CR, and
the second one contains the gates X, Y, Z, and CNOT.
For the sake of simplicity, these two sets are named
HRC and XYZC, respectively.
To represent complex coefficients of each qubit,
fixed-point numbers are represented as Figure 2. Since
each qubit has two complex coefficients, it can be
represented by four fixed-point numbers. In addition,
Figure 1. Symbols of quantum gates, (a) X, (b) Y, (c) the number of mantissa bits in Figure 2 can be
Z, (d) Controlled-NOT, (e) Hadamard, (f) Phase-Shift, increased to attain more emulation accuracy.
(g) Rotate, (h) Controlled-Rotate
3. Previous Work
Figure 2. Representation of fixed-point numbers
When qubits are entangled, the size of required
QMatrix is increased. As an example, for a system with 4.1. The HRC group
three entangled qubits, the size of a basic 2×2 H
QMatrix is changed to 23×23. Therefore, to implement Based on (7), H needs four multiplications and four
it on a classical computer, too many resources will be additions on fixed-point numbers. Similarly, the
needed. As a result, software simulation cannot be implementation of PS gate needs four multiplications
done efficiently due to exponential increase in the size and two additions. As R can be seen as a special case
of matrices [7]. of PS gate, the same number of resources should be
The authors of [7] used the circuit model of a assigned.
quantum algorithm to evaluate the functionality of a The two inputs CR gate rotating the target qubit if
circuit using FPGA. In this method, the complex the control line is equal to 1 produces an entanglement
numbers C1 and C2 in (1) are represented as fixed point state. When the entanglement occurs, more resources
numbers and the gates X, Z, CNOT, PS and H are are needed for simulating. For example, applying a 1-
implemented based on multiply and add operations and input H gate on three entangled qubits needs sixteen
several coefficient swapping. At each state, the gate multipliers and sixteen adders while applying this gate
outputs are saved using intermediate registers, while, it on one qubit needs four multipliers and four adders.
consumes too many registers to save.
In [8] DSP techniques are used to implement
quantum gates. In other words, gates that can be
implemented by a coefficient swapping operation are
emulated based on the Network of Butterflies model
Figure 3. Added bits to qubit coefficient for the XYZC
[8]. However, only a small set of gates including gate family
classical reversible gates can be implemented by this
method.
4.2. The XYZC group
In [9], [10], a hardware emulation technique was
proposed to implement a limited group of quantum
The gates of the XYZC group are implemented using
algorithms. In other words, emulation of the algorithms
three extra bits added to each qubit coefficient as
containing an H in the first stage and a CNOT in the
shown in Figure 3. This method causes that needed
second stage is the main topic of this paper.
registers to save intermediate coefficients become zero.
Therefore, these gates are efficiently manipulated as
4. Proposed method shown in Figure 4.
The goal of this paper is to relax gate type limitation
of previous emulation methods. By adding several new
bits to stored coefficients, a lot of quantum algorithms
401
Authorized licensed use limited to: Universidad Federal de Pernambuco. Downloaded on May 06,2025 at 14:09:41 UTC from IEEE Xplore. Restrictions apply.
As shown in the experimental results section, the
implementation of XYZC gates needs a few gates and
registers for both distinct and entangled qubits (Table
1). When a quantum circuit includes only X, Y, Z, and
CNOT gates, it is better to use entangled qubits from
the beginning, as the cost of distinct to entangled qubit
Figure 4. Implementation of X, Y, Z gates in the bit conversion is too high. In the next section, the
mode experimental results are shown.
However, in the case of CNOT gate, entangled
qubits are produced and additional bits should also be 6. Experimental results
considered as shown in Figure 5 where n is the number
of qubits. In the case of entanglement, the number of The proposed emulation method was implemented
additional bits will be too small. CNOT gate is using VHDL and evaluated for various library gates in
implemented by XORing the control and target bits for both distinct and entangled qubits.
this case. Table 1 depicts logic cell usage for the
implementation of each gate with two different
mantissa sizes. In addition, the proposed method was
compared with another hardware emulation method
proposed in [7]. ALTERA STRATIX EP1S80B956C6
[19] device was chosen for all of the experiments. For
Figure 5. Added bits to entangled qubits coefficients
CNOT gate, a two entangled qubits circuit was
attempted. Furthermore, the number of intermediate
This strategy is used when a given circuit is built
registers was computed for the method of [7]. In this
from only XYZC group gates. When both XYZC and
table, the percentage of LC usage improvement is
HRC gates are used, the applied policy is different and
denoted as Imp.
gate operations are implemented by a coefficient
swapping operator using intermediate registers as
Table 1. LC usage on STRATIX EP1S80B956C6
stated below: device
1) The gate X swaps the complex coefficients C1 and
C2. Therefore, it needs four registers. Mantissa = 8 bits Mantissa = 16 bits
2) The gate Z is implemented by multiplying -1 to the
complex coefficient C2. Gate
Proposed Imp Proposed Imp
3) For the gate Y, in addition to swapping coefficients, method
[7]
% method
[7]
%
multiplying the complex number i (or –i) is also
required. It is implemented by swapping the real
H 398 704 43 808 1284 37
and imaginary parts of the coefficients and
inverting the sign bit if needed. PS 200 386 48 405 708 43
4) The outputs of a CNOT gate are produced in an
entangled format as shown in Figure 6. To emulate X 2 40 95 2 72 97
it, the tensor product of distinct qubits should be
used to create several new entangled qubits where Y 6 - - 6 - -
four complex number multiplications are needed.
Furthermore, applying the CNOT gate on two Z 2 40 95 2 72 97
entangled qubits needs swapping the coefficients
C2C1’ and C2C2’. CNOT 4 120 96 4 375 99
ψ 1 = a1 0 + a2 1
As shown in Table 1, the improvements for some
ψ 2 = b1 0 + b2 1 circuits (e.g. Z gate), are much more than others (e.g. H
gate), this is because the emulation method for circuits
ψ 1ψ 2 = a1b1 00 + a1b2 01 + a 2 b1 10 + a 2 b2 11 with XYZC gates are more efficient.
Figure 6. Producing two entangled qubits using the The Quantum Fourier Transform (QFT) is an
tensor product important quantum algorithm with great applications in
402
Authorized licensed use limited to: Universidad Federal de Pernambuco. Downloaded on May 06,2025 at 14:09:41 UTC from IEEE Xplore. Restrictions apply.
phase estimation, order-finding and factoring Table 4. Specification of benchmark circuits
algorithms [1], [7], [16]. An N-qubit QFT circuit is
shown in Figure 7. This circuit is constructed using H # of # of # of # of # of # of
Circuit Qubits Gates NOT CNOT C2NOT C3NOT
and CR gates where the CR gate produces an entangled
state.
Full Adder 5 6 0 3 3 0
3_17tc 3 6 1 3 2 0
graycode6 6 5 0 5 0 0
Ham3tc 3 5 0 4 1 0
Hwb4-11-
4 11 0 8 3 0
23
Mod5adder-
6 15 6 0 5 4
15
xor5d1 5 4 0 4 0 0
403
Authorized licensed use limited to: Universidad Federal de Pernambuco. Downloaded on May 06,2025 at 14:09:41 UTC from IEEE Xplore. Restrictions apply.
Note that the synthesis results of [7] were not [9] M. Fujishima, K. Saito, M. Onouchi, H. Hoh, “High-
reported in the paper. To make it possible to compare Speed Processor for Quantum-Computing Emulation and its
the results of the proposed method with [7], we Applications”, International Symposium on Circuits and
implemented it and its results are compared to those of Systems, Volume 4, 2003, PP. IV-884 - IV-887.
[10] M. Fujishima, “FPGA-Based High-Speed Emulator of
our method in Table 5. The following notations were
Quantum Computing”, International Conference on Field-
used for this table: M as mantissa, E as required Programmable Technology, 2003, PP. 21 - 26.
emulation time in nanosecond, T as total synthesis time [11] K. Iwama, Y. Kambayashi, S. Yamashita,
in minutes and U to mean that it is impossible to fit a “Transformation Rules for Designing CNOT-Based Quantum
circuit in the selected device. As shown in Table 5, it Circuits”, Design Automation Conference, 2002, PP. 419-
can be verified that the required LCs as well as the 424.
emulation time for the proposed method are fewer than [12] M. Saeedi, M. Sedighi, M. Saheb Zamani, “A New
the method of [7], significantly. Methodology for Quantum Circuit Synthesis: CNOT-Based
Circuits as an Example”, International Workshop on Logic
Synthesis, 2007.
7. Conclusion [13] A. Younes, J. Miller, “Automated method for building
CNOT based quantum circuits for Boolean functions”, Los
In this paper, an efficient quantum circuit emulation Alamos physics preprint archive, quant-ph/0304099, 2003.
technique is proposed. As this method uses the [14] A. Younes, J. Miller, “Representation of Boolean
parallelism of quantum algorithms, it offers more Quantum Circuits as Reed-Muller Expansions”, Los Alamos
efficiency than software simulation. Compared with Physics preprint archive, quant-ph/0305134, 2003.
the available hardware emulation methods, the [15] M. Saeedi, M. Sedighi, M. Saheb Zamani, “A Novel
Synthesis Algorithm for Reversible Circuits”, International
proposed technique uses fewer logic cells for the
Conference on Computer-Aided Design, 2007, PP. 65-68.
implementation of various quantum algorithms. In [16] Z. Zilic, K. Radecka, “The Role of Super-fast
other words, by using a novel representation schema Transforms in Speeding up Quantum Computations”,
and simulating the behaviors of various quantum gates International Symposium on Multiple-Valued Logic, 2002,
using simple logical gates, a great improvement is PP. 129 - 135.
obtained. Due to the efficiency of the proposed [17] Wikipedia, “Quantum Computer”, July 2007.
method, the simulation of large size quantum [18] “LibQuantum”, Online Quantum Library
algorithms is also possible. Documentation, Available: http://www.enyo.de/libquantum/
[19] http://www.altera.com/
[20] D. Maslov, “Reversible Logic Synthesis Benchmarks”,
10. References Available: http://webhome.cs.uvic.ca/~dmaslov/
404
Authorized licensed use limited to: Universidad Federal de Pernambuco. Downloaded on May 06,2025 at 14:09:41 UTC from IEEE Xplore. Restrictions apply.