168 1-4244-1027-4/07/$25.00 ©2007 IEEE Automatic Generation and Optimisation of Reconfigurable Financial Monte-Carlo Simulations David B. Thomas, Jacob A. Bower, Wayne Luk {dt10,wl}@doc.ic.ac.uk Department of Computing Imperial College London Abstract Monte-Carlo simulations are used in many applications, such as option pricing and portfolio evaluation. Due to their high computational load and intrinsic parallelism, they are ideal candidates for acceleration using reconfig- urable hardware. However, for maximum efficiency the hardware configuration must be parametrised to match the characteristics of both the simulation task and the plat- form on which it will be executed. This paper presents a methodology for the automatic implementation of Monte- Carlo simulations, starting from a high-level mathemati- cal description of the simulation and resulting in an opti- mised hardware configuration for a given platform. This process automatically generates fully-pipelined hardware for maximum performance; it also maximises thread-level parallelism by instantiating multiple pipelines to optimise device utilisation. The configured hardware is used by an associated software component to execute simulations us- ing run-time supplied parameters. The proposed method- ology is demonstrated by five different Monte-Carlo simu- lations, including log-normal price movements, correlated asset Value-at-Risk calculation, and price movements un- der the GARCH model. Our results show that hardware implementations from our approach, on a Xilinx Virtex-4 XC4VSX55 FPGA at 150 MHz, can run on-average 80 times faster than software on a 2.66GHz Xeon PC. 1 Introduction Monte-Carlo simulations are popular in financial appli- cations, as they are able to value multi-dimensional options and portfolios without an exponential growth in run-time and memory use. The simulations are easy to specify math- ematically, with an obvious translation to sequential code, and so can be easily implemented in software. However, as The support of UK Engineering and Physical Science Research Council, Celoxica and Xilinx is gratefully acknowledged. financial instruments become more complex, it is necessary to increase the speed of option valuation. Reconfigurable hardware is one possibility, but it is much harder to trans- late simulations into pipelined hardware. This paper presents a methodology for describing and implementing financial Monte-Carlo simulations in recon- figurable hardware, allowing a simple mathematical de- scription to be automatically translated to a fast fully- pipelined implementation. Our contributions are: a framework for precisely specifying simulations using a mathematical description, allowing a large and im- portant subset of financial simulations to be described; a design-flow for automatically translating mathe- matical simulation descriptions into high-performance pipelined hardware implementations; an evaluation of the proposed methodology in a Virtex- 4 FPGA, showing that speed-ups of 80 times over soft- ware can be achieved. 2 Framework for Simulation Paths In this section we propose a framework for capturing fi- nancial simulations such as option pricing and portfolio val- uation. This framework enables the automatic design-flow presented in Section 3 to be applied, allowing the abstract specification to be directly compiled into pipelined hard- ware. Although the framework imposes some restrictions on the types of simulation path that can be described, we give a number of examples of random walks and exotic op- tion valuation paths that can be specified in this manner. The types of simulation this framework addresses are those that examine the aggregate properties of the paths of many independent random walks. These random walks all start from some common starting state, then a stochastic transition function is applied until a terminal state is en- countered, ending the path. A simple example of this type of simulation is shown in Figure 1, which examines the behaviour of a one-dimensional random walk that evolves