FPGA Emulation of Quantum Circuits
Total Page:16
File Type:pdf, Size:1020Kb
FPGA Emulation of Quantum Circuits Ahmed Usman Khalid Zeljko Zilic Katarzyna Radecka Microelectronics and Computer Microelectronics and Computer Department of Electrical and Systems Laboratory Systems Laboratory Computer Engineering McGill University McGill University Concordia University Montreal, Quebec Montreal, Quebec Montreal, Quebec Email: [email protected] Email: [email protected] Email: [email protected] Abstract— Quantum computing offers immense speedup in tems, it is advantageous to have a hardware emulator which performing tasks such as data encryption and searching. The approximates quantum effects, but mimics the parallel nature quantum algorithms can be modeled using classical computing of quantum computation more closely than software-based devices, however classical computer simulations cannot deal efficiently with the parallelism present in quantum algorithms. simulators. The quantum circuit model for quantum algorithms is sufficient Quantum circuits are one convenient way of describing to describe the known quantum algorithms. Using analogies quantum algorithms. Such circuits comprise of analogues to between quantum and digital circuits, we design the emulator of digital bits and gates. These components can be emulated quantum algorithms in FPGAs that allows efficient experimen- in existing FPGAs, which can map inherently parallel com- tation with new quantum algorithms. This paper concentrates on new techniques for modeling quantum circuits, including the putational tasks more efficiently than software simulations. entanglement and probabilistic computing realization, as well as For this reason, we investigate the design of quantum circuit the critical issues in the required precision of computing. emulators by classical circuits, and devise an FPGA-based quantum circuit emulator. Using quantum circuit primitives, I. INTRODUCTION the construction of new quantum algorithms becomes intuitive There is an increased interest in quantum computing and and similar to the common software library approaches. algorithms [5]. Many quantum algorithms outperform their The paper is organized as follows. In Section II, we provide classical counterparts through parallelism that is impossible in the background on quantum computation. In Section III, we classical computing. Quantum algorithms use physical effects give details of our quantum circuit emulation system, followed like entanglement and super-position to achieve the speedup. by several case studies and performance analysis in Section IV. These effects are hard to replicate at large scale and lead to reliability and precision issues, as well as to the need to II. BACKGROUND employ suitable quantum measurement procedures [1]. Nev- ertheless, some of the quantum effects have been successfully In this section, we provide a brief review of the concepts used in practical applications such as data encryption and com- in quantum computing that have implications to the design of munication [5]. Further, several quantum-computing systems a quantum circuit emulator. are being developed [7]. IBM has developed a small-scale A. Probabilistic vs. Deterministic Computing quantum machine that is able to execute the celebrated Shor’s algorithms for factoring numbers. However, creating larger One of the major distinctions of quantum computing is and more practical quantum computers is still not possible, that it is probabilistic and that quantum algorithms have to as knowledge about building quantum systems is still in its deal with the reality of measurement errors. Surprisingly, infancy. To develop quantum algorithms, simulation models this difference often gets overlooked when modeling quantum nevertheless suffice. circuits and most modeling approaches still try to make the Feynman noted that a quantum computer can be modeled simulations fit within the deterministic mode of computation. efficiently only by another quantum machine. In absence Deterministic circuits present a computation model where of large-scale quantum machines, quantum algorithms are results of the computation can be obtained without any mea- currently being simulated by classical computers. Modeling surement error. A classical (non-quantum) probabilistic circuit of quantum processes in software is the arduous task that is runs a series of inputs through the network of gates and outputs currently facilitated mostly by quantum computing libraries the bits according to the probability distribution induced by the [3], [11], [12]. The challenge here comes from the need for given network. Hence, in probabilistic computing the result using approximations of quantum processes, as their exact of computation cannot be determined correctly every time a representation in classical computing is not possible. Even by measurement of the result is made. Consequently, there is using approximations, it is estimated that a single simulation a probability of an error in measuring probabilistic circuit run over a 20-bit quantum system requires a day of computing outputs, and the computation has to be performed a sufficient time on modern computers [8]. For developing quantum sys- number of times to make the expected error acceptable. In this paper, we address both modes of modeling by FPGA is a key design issue. The second goal is to emulate the emulators. parallelism in quantum computing using FPGAs. Finally, it is desired that the modeling tool be simple to use and that the B. Quantum Information Representation construction of the model does not require significant effort The second major difference to classical computing arises from the developer. from the types of signal values required to perform computing. While the basic information units for classical circuits are 0 Import quantum and 1, quantum computing uses complex numbers as bearers of circuit package to design information. Hence, representing a single quantum information unit might require a large number of classical bits, depending on the precision required. Construct quantum circuit More formally, the states of the quantum system belong to using gates provided a vector space over complex numbers in which there exists an inner product of vectors. Such a vector space is usually referred to as the Hilbert Space H. For our purposes, it suffices Synthesize circuit on FPGA to say that the quantum states are depicted as vectors of Simulate circuit using VHDL for hardware emulation of simulation tools the quantum circuit complex numbers. In denoting these vectors, commonly used is the Dirac bra- ket notation. Elements of H are ”ket” vectors given by |xi ∈ Fig. 1. Modeling quantum circuits using the VHDL quantum gate library H. A corresponding ”bra” vector hx| is an element of the dual space H∗ of all operators on the vector space that act on The overall design process is illustrated in Figure 1. Quan- vectors and produce scalar values. tum circuits are constructed from the quantum gate com- ponents provided in the library that we have created. The C. Quantum Bits correctness of the circuit can be verified either by software The basic units of quantum information can be viewed as simulation or by FPGA emulation. We thus, have a technique simple two-state systems, such as magnetic spin of plus/minus for modeling quantum ciruits using VHDL and then synthe- one half. The state of a spin is given as a continuous quantity sizing the circuit in hardware to achieve performance needed represented by two real numbers. It is exactly this continuity to make the whole process more practical. in spin representation that contributes to the ability of storing We next show how the fundamental constructs of quantum the infinite classical information by a single quantum system. circuits and the rules governing quantum computation are Quantum bits defined this way are commonly referred to as simulated by classical technology. qubits. Qubits can be realized by means such as NMR and α trapped ion interactions. real αimaginary Sign Decimal Sign Decimal Binary qubits have two computational base states denoted N bit Mantissa N bit Mantissa as |0i and |1i. Unlike classical bits, quantum bits are in a Bit bit Bit bit linear superposition of the basis states |0i and |1i. βreal βimaginary Sign Decimal Sign Decimal N bit Mantissa N bit Mantissa |ψi = α|0i + β|1i (1) Bit bit Bit bit where α and β are complex coefficients related as Fig. 2. Fixed-point quantum bit representation |α|2 + |β|2 = 1. (2) B. Emulation of Pure Quantum Bits The superposition phenomena, by which the qubits simulta- The quantum bit is implemented using Equation 1. Thus, we neously exist in states |0i and |1i is explained by considering need to store the values of α and β to describe a qubit. The 2 2 |α| and |β| as probabilities of being in |0i and |1i, respec- finite precision description of α and β introduces imprecision tively. However, when a measurement is performed on a qubit, errors, as quantum gates involve operations like add and it collapses to either of the two basis states. multiply on α and β. To keep the size of the quantum circuit to a manageable proportion, we implement the α and β using III. FPGA QUANTUM CIRCUIT EMULATOR the fixed point scheme described in Figure 2. A. Challenges in Emulating Quantum Circuits Each qubit is represented by four fixed point numbers. Emulation of quantum circuits requires mapping concepts The fixed point scheme was chosen over the floating point from quantum physics to classical technologies. The main goal representations because α and β can have a decimal part is to simulate quantum