leap scratchpads: automatic memory and cache management...

13
Computer Science and Artificial Intelligence Laboratory Technical Report massachusetts institute of technology, cambridge, ma 02139 usa — www.csail.mit.edu MIT-CSAIL-TR-2010-054 November 23, 2010 LEAP Scratchpads: Automatic Memory and Cache Management for Reconfigurable Logic [Extended Version] Michael Adler, Kermin E. Fleming, Angshuman Parashar, Michael Pellauer, and Joel Emer

Upload: others

Post on 13-Jul-2020

23 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: LEAP Scratchpads: Automatic Memory and Cache Management ...people.csail.mit.edu/emer/papers/2011.02.isfpga.leap_scratchpads.pdf · LEAP scratchpads for recon gurable logic dynamically

Computer Science and Artificial Intelligence Laboratory

Technical Report

m a s s a c h u s e t t s i n s t i t u t e o f t e c h n o l o g y, c a m b r i d g e , m a 0 213 9 u s a — w w w. c s a i l . m i t . e d u

MIT-CSAIL-TR-2010-054 November 23, 2010

LEAP Scratchpads: Automatic Memory and Cache Management for Reconfigurable Logic [Extended Version]Michael Adler, Kermin E. Fleming, Angshuman Parashar, Michael Pellauer, and Joel Emer

Page 2: LEAP Scratchpads: Automatic Memory and Cache Management ...people.csail.mit.edu/emer/papers/2011.02.isfpga.leap_scratchpads.pdf · LEAP scratchpads for recon gurable logic dynamically

LEAP Scratchpads: Automatic Memory and CacheManagement for Reconfigurable Logic [Extended Version] ‡

Michael Adler† Kermin E. Fleming¶ Angshuman Parashar† Michael Pellauer¶ Joel Emer†¶†Intel Corporation

VSSAD Group{michael.adler, angshuman.parashar,

joel.emer}@intel.com

¶Massachusetts Institute of TechnologyComputer Science and A.I. Laboratory

Computation Structures Group{kfleming, pellauer, emer}@csail.mit.edu

ABSTRACTDevelopers accelerating applications on FPGAs or other re-configurable logic have nothing but raw memory devicesin their standard toolkits. Each project typically includestedious development of single-use memory management. Soft-ware developers expect a programming environment to in-clude automatic memory management. Virtual memory pro-vides the illusion of very large arrays and processor cachesreduce access latency without explicit programmer instruc-tions.

LEAP scratchpads for reconfigurable logic dynamicallyallocate and manage multiple, independent, memory arraysin a large backing store. Scratchpad accesses are cached au-tomatically in multiple levels, ranging from shared on-board,RAM-based, set-associative caches to private caches storedin FPGA RAM blocks. In the LEAP framework, scratch-pads share the same interface as on-die RAM blocks andare plug-in replacements. Additional libraries support heapmanagement within a storage set. Like software developers,accelerator authors using scratchpads may focus more oncore algorithms and less on memory management.

Two uses of FPGA scratchpads are analyzed: buffer man-agement in an H.264 decoder and memory managementwithin a processor microarchitecture timing model.

Categories and Subject DescriptorsC.5.m [Computer System Implementation]: Miscella-neous

General TermsAlgorithms, Performance

KeywordsFPGA, memory management, caches

‡This is an extended version of a paper presented at FPGA 2011: Proceed-ings of the 19th Annual ACM/SIGDA International Symposium on FieldProgrammable Gate Arrays (ISFPGA).

1. INTRODUCTIONFPGAs are increasingly employed as coprocessors along-

side general purpose CPUs. The combination of large memoryand ease of programming a general purpose machine alongwith the abundant parallelism and low communication latencyin an FPGA make the pair attractive for hybrid algorithmsthat split computation across both engines.

Memory management in software development is supportedby a rich set of OS and library features. Describing overlays[6, 16], a method of swapping regions of code or data to fit inlimited physical memory, elicits pitying chuckles from evenwell-educated computer scientists who began their careersafter virtual memory became pervasive. Software design-ers targeting general purpose hardware long ago acceptedthat the gain in programmer efficiency from using compilers,support libraries and operating systems outweighs possibleperformance gains of hand-coding raw instructions.

The memory subsystem in general purpose hardware offersa hierarchy of storage, ranging from fast but small cachesembedded in the processor to large external RAM arrays onmemory buses, and to swap files on disks. Management ofcache state is controlled by fixed hardware algorithms chosenfor their overall performance. Explicit, hand-tuned cachemanagement instructions are typically added only to themost performance-sensitive programs. Tremendous effort hasbeen spent building compilers capable of automatic cache-management, e.g. [12, 13]. As general purpose processorsadd more parallel processing, language designers continue toadd abstract memory management to design tools in orderto split algorithmic design from the grunt work of memorymanagement [3].

The gap between the programming environment on thegeneral purpose half and the reconfigurable half of a hybridmachine is stark. Most FPGA developers still code in lowlevel languages equivalent to assembly language on generalpurpose machines. Those optimizing a set of loop kernelsmay use C or Java-like languages [8, 10, 11, 14] and a handfulare beginning to use languages such as Bluespec [2, 19] thatsupport language-based static elaboration and polymorphicmodule definitions.

The state of memory management on reconfigurable logic issimilarly primitive. FPGA synthesis tools support relativelyeasy management of on-die memory arrays. The interface toon-die RAM blocks is simple: a method for writing a value toan address and a two-phase pair of read request and responsemethods. This interface may be made timing insensitive bypredicating the methods with ready and enable flags and

Page 3: LEAP Scratchpads: Automatic Memory and Cache Management ...people.csail.mit.edu/emer/papers/2011.02.isfpga.leap_scratchpads.pdf · LEAP scratchpads for recon gurable logic dynamically

buffering state on pipeline stalls [5].

1.1 Scratchpad memory hierarchiesWhat if an algorithm needs more memory than is available

on-die? At best, designers are offered low-level device driversfor embedded memory controllers, PCIe DMA controllers orsome other bus. Building an FPGA-side memory hierarchy istreated as an application-specific problem. Even methods formapping memory management as basic as malloc and free toon-die RAM for C-like synthesis languages are a very recentinnovation [22]. On general purpose hardware the memoryhierarchy is invisible to an application, except for timing.A similar memory abstraction, identical to the interface toon-die RAM blocks but implementing a full storage hierarchy,is equally useful for a range of FPGA-based applications.

Our project began as an effort to accelerate processormicroarchitecture timing models using FPGAs. We quicklyrealized that some effort writing a general programmingframework would make our task more tractable. The resultingplatform is in active use for timing models and has beenadopted for other algorithmic accelerators, such as an H.264decoder. Both of these applications are considered in thispaper.

We have written LEAP (Logic-based Environment for Ap-plication Programming) [17], a platform for application de-velopment on reconfigurable logic. LEAP runs on any set ofreconfigurable logic connected to general purpose machines.Like an operating system, LEAP is layered on top of device-specific drivers. It presents a consistent virtual platformon any hardware. Application writers may then target thevirtual platform, rendering their code portable across com-munication fabrics. LEAP presents the same interface overconnections as diverse as FPGAs plugged directly into IntelFront Side Bus sockets and FPGAs connected to a host overa JTAG cable. The virtual platform provides a rich set ofservices, including streaming I/O devices, application controlprimitives, and an asynchronous hybrid procedural interfacesimilar to remote procedure calls [18]. The platform alsoprovides automatic instantiation of processor-like memory hi-erarchies, ranging from private caches, through shared cachesand down to host memory. In this paper we focus on theautomatically constructed memory stack.

LEAP defines a single, timing insensitive, interface toscratchpad memory hierarchies. The same write, read re-quest and read response interface methods are used for anymemory implementation defined by the platform, along withthe predicates governing whether the methods may be in-voked in a given FPGA cycle. The simplest memory deviceallocates an on-die RAM block. However, LEAP memorystacks sharing the same interface can be configured for avariety of hierarchies. The most complicated has three levels:a large storage region such as virtual memory in a host sys-tem, a medium sized intermediate latency memory such asSDRAM controlled by an FPGA, and fast, small memoriessuch as on-FPGA RAM blocks. Converting a client from us-ing on-die memory to a complex memory hierarchy is simplya matter of instantiating a different memory module withidentical connections.

For a given set of hardware, low-level device drivers mustbe provided for each level in a physical hierarchy. Virtualdevices and services are layered on top of these physical de-vice drivers, thus providing a consistent programming modelindependent of the underlying physical devices. Our goal is

to make programming an FPGA more like software develop-ment on general purpose hardware. Programmers target anabstract set of virtual services similar to general purpose ker-nel and user-space libraries. Like general purpose hardware,programmers may get an algorithm working with genericcode and then, optionally, tune their application for specifichardware latencies and sizes.

1.2 Related workMany researchers have considered the problem of cache

hierarchies in reconfigurable logic and embedded systems.Automatic generators build a variety of cache types and sizes,treating caches as building blocks [25]. Panda et al. pre-sented an algoritm for computing application-specific cachehierarchies designed to minimize off-chip references [15].

CoRAM, a current research effort, is an investigation ofapplication interfaces to memory hierarchies within reconfig-urable logic [4]. CoRAM defines both a memory API and acontrol thread model for managing traffic between on-die andoff-die memory. The CoRAM model could be implementedwithin the LEAP framework. LEAP scratchpads are a struc-tured, hierarchical cache topology connected to applicationsthrough a relatively simple interface. In LEAP, the specifichierarchy instantiated is configurable from building blocksof both direct mapped and set associative caches. Clientsmay either accept the default private caches or may plug intheir own, taking advantage of the sorts of access patternoptimizations considered in [15]. A CoRAM implementationwithin LEAP would replace the default, private, on-die cachewith a CoRAM memory and control thread.

Other projects, such as hthreads [1], have also built hybridcomputation frameworks. Hthreads offers a hybrid pthreads-style thread management environment layered on coherentmemory. The automatic instantiation of cached memory hier-archies we describe for LEAP scratchpads could be insertedinto an hthreads stack as well.

2. SCRATCHPAD ARCHITECTURE

2.1 FPGA On-Die RAM BlocksOn-die FPGA RAM blocks can be configured quite flexibly.

Xilinx RAM blocks are organized as 18Kb or 36Kb blocksin data widths of 1, 2, 4, 9, 18 or 36 bits [24]. Altera RAMblocks have similar widths. Synthesis tools automaticallyprovide the illusion of arbitrary size and width by groupingmultiple blocks into a single logical block and mapping intothe closest available bit width. A large Xilinx Virtex 6 FPGAhas about 32Mb of RAM.

Access to RAM blocks is simple: a single cycle write oper-ation and a two phase read request / read response protocol.Even a naıve implementation can be dual ported, permittingsimultaneous reads and writes. RAM blocks are fast, flexibleand easy to access as private storage within a module. Unfor-tunately, they are finite. What are we to do for algorithmswith memory footprints too large for on-FPGA RAM?

2.2 On-Board RAMMany FPGA platforms have on-board RAM and have

memory controllers available as logic blocks. Compared to anFPGA’s internal RAM blocks, on-board memory is plentiful:typically measured in megabytes or gigabytes. Unlike FPGARAM blocks, on-board memory is a monolithic resource. Atmost only a few banks are available, managed by individual

Page 4: LEAP Scratchpads: Automatic Memory and Cache Management ...people.csail.mit.edu/emer/papers/2011.02.isfpga.leap_scratchpads.pdf · LEAP scratchpads for recon gurable logic dynamically

Client ClientClient

RAMBlock

App

licat

ion

Pla

tform Scratchpad

ControllerLocal

Memory

RAMBlock

Client ClientClient

ScratchpadInterface

App

licat

ion

PlatformConnector

a) Private RAM blocks

b) Scratchpads with a ring interconnect

Request Ring

Response Ring

ScratchpadInterface

ClientClient

RAMBlock

Memory Interface

Memory Interface

Client

ScratchpadInterface

Figure 1: Transforming private RAM blocks toscratchpads. The memory interface between clientsand storage is unchanged following the transforma-tion. Only timing is different.

controllers. In order to share on-board RAM among multi-ple clients the memory must be partitioned and managedby a central controller. We call this service the scratchpadcontroller. The controller is responsible for partitioning alarge memory into individual scratchpads, corresponding toprivate memories requested by clients. The controller thenroutes requests from scratchpads to their unique memorysegments. This is implemented using an indirection table,mapping scratchpads to memory base offsets.

Except for latency, moving storage to a different level in thememory hierarchy is invisible to software written for generalpurpose hardware. The change could range from missing inan L1 cache to suffering a page fault and swapping data infrom a disk. While not an absolute requirement for FPGA-based scratchpads, having the ability to express memory I/Ooperations independent of their underlying implementationand latency is equally convenient on reconfigurable logic. Inour implementation, the difference between a client usinga private on-die RAM block and a scratchpad in a sharedmemory is only a single source line (see Section 2.7). Theclient using a RAM block invokes a module that instantiateson-die memory. To use a scratchpad instead, the client re-places this instantiation with a module that connects itselfto the scratchpad controller.

Each client requesting a scratchpad memory instantiatesa scratchpad interface. This interface is private to a singleclient, transforming client-side references to requests in the

scratchpad controller. The scratchpad controller is a sharedresource. Connecting multiple clients to the controller re-quires an interconnect and arbitration. For a small number ofscratchpads, a set of point-to-point connections from scratch-pad interfaces to the controller along with a round-robinarbiter works perfectly well. As the number of clients grows,the burden on FPGA routing becomes too great and a moresophisticated network is required. We have built a pair oftoken rings, using self-assembling rings described in [19]. Thetransformation from private RAM blocks to scratchpad mem-ories is illustrated in Figure 1. Deadlocks are avoided byassigning requests to one ring and responses to the other. Apair of rings was chosen instead of a single ring with virtualrequest and response channels both to increase network band-width and because the FPGA overheads of channel bufferingand multiplexing are similar to the simpler, multi-ring, so-lution. One ring stop is responsible for forwarding messagesbetween the rings and the scratchpad controller.

2.2.1 Identifying scratchpadsThe scratchpad controller must have a way of identifying

individual scratchpads. Each scratchpad interface must beassigned a unique identifier that we call a scratchpad ID. Eachinstantiation of a scratchpad interface module takes a compile-time constant argument specifying a unique scratchpad ID.Every request from an interface module to the scratchpadcontroller is tagged with an ID.

Reconfigurable logic and table sizes are minimized if thescratchpad ID space is dense. LEAP provides a namespacemanagement tool for generating unique identifiers. This dic-tionary tool was originally conceived for mapping integeridentifiers to strings in order to trigger printing of messageson a host from an FPGA without having to specify hardwarelogic for passing variable length strings. We have extended itto solve the general problem of managing identifier spaces,including syntax for managing numerically dense subspaces.

Using LEAP dictionaries and conventions, an implementorallocating scratchpad IDs would specify:

def VDEV.SCRATCH.FBUF_Y "Frame buffer Y";

def VDEV.SCRATCH.FBUF_U "Frame buffer U";

def VDEV.SCRATCH.FBUF_V "Frame buffer V";

in order to allocate a group of scratchpads named FBUF Y,FBUF U and FBUF V. The dotted notation represents nu-merically dense subregions.

2.2.2 Initialization and addressingAn initialization step is required in order to subdivide on-

board memory into individual scratchpads. At start-up, eachscratchpad interface computes the size of its scratchpad array.The interfaces then send allocation requests to the scratchpadcontroller. The controller receives allocation requests andbuilds a partition table, mapping individual scratchpads tounique regions of memory. An error is signaled if the sizeof all allocation requests exceeds available memory. Eachscratchpad interface operates in its own private, zero-basedaddress space. Within the common controller, addresses arecomputed as the sum of the private address and a scratchpad’son-board memory offset from the partition table.

The mapping from private scratchpad array indices toon-board memory addresses is fully contained within thescratchpad controller. Although our current controller imple-mentation maps all scratchpads dynamically at start-up and

Page 5: LEAP Scratchpads: Automatic Memory and Cache Management ...people.csail.mit.edu/emer/papers/2011.02.isfpga.leap_scratchpads.pdf · LEAP scratchpads for recon gurable logic dynamically

has no protocol for releasing regions, it would be relativelyeasy to extend the private protocol between scratchpad in-terfaces and the controller to permit dynamic release andreallocation of memory. Only the partition table must beupdated. An ambitious implementation could even rebaseregion mappings in order to combine fragmented free memoryblocks into larger chunks.

2.3 MarshalingAstute readers will have noticed a problem in our transfor-

mation of RAM block clients to scratchpad clients. Synthesistools permit FPGA RAM allocation in any bit width. Whilethe underlying hardware does not support arbitrary width, itis sufficiently flexible that memory is allocated relatively effi-ciently. In contrast, on-board memory is presented in chunksof words and lines, with some hardware adding write masksto support byte-sized writes.

An easy, but unacceptably inefficient solution would befixed mapping of RAM block addresses to word-sized on-board memory chunks. The fixed mapping would not supportdata widths larger than a memory word. It would also wastenearly the entire word for small data widths, turning a dense1024 x 1-bit RAM block into a 64KB chunk, assuming a 64bit word!

To solve this mapping problem, the scratchpad interfaceinterposes a marshaling layer between the client and requeststo the platform interface. When objects are smaller than thememory word size, multiple objects are grouped into a singlememory word. When objects are larger than the memoryword size, the marshaling layer spreads objects across multiplewords. In the first case the marshaler is forced to request read-modify-write operations in order to update an entry. In thesecond case the marshaler must emit multiple read or writerequests in order to reference all memory words correspondingto a scratchpad location. From the client’s perspective, theword size remains the size originally requested.

The LEAP platform provides a marshaling library module.Compile-time parameters declare the memory word size alongwith the desired scratchpad width and number of elements.The marshaler computes the dimensions of an on-board-memory-sized container for holding the equivalent data anddetermines whether read-modify-write or group reads andwrites are required. It also exports read and write methodsthat act on the requested array’s data type. The methodsautomatically trigger either read-modify-write or group readsand writes when needed.

2.4 Private CachesWith the addition of marshaling we now have an architec-

tural description for replacing RAM blocks with on-boardmemory scratchpads that is fully functional. Unfortunately,it will perform terribly. RAM block references that were for-merly single cycle references and parallel for each block havebeen converted into a shared, high contention, higher latencyresource. A cache is needed, both to provide lower latencyand to reduce the number of requests that reach on-boardmemory. LEAP provides low latency, direct mapped, caches,though developers may specify their own cache implementa-tions optimized for particular access patterns.

The position of the cache, above or below the marshaler, isa compromise. Choosing to insert the cache between the clientand the marshaler would eliminate many read-modify-writeoperations in the marshaler. However, read-modify-write

App

licat

ion

Client ClientClient

ScratchpadInterface

PlatformConnector

Marshaler

PrivateCache

PrivateCache

Marshaler

Request Ring

Response Ring

ScratchpadInterface

Client

PrivateCache

Marshaler

ScratchpadInterface

Memory Interface

Figure 2: Client-facing model hierarchy, includingmarshaling from client data to on-board memoryword-sized accesses, private L1 caching and a tokenring networking scratchpad interfaces. The platforminterface at the bottom of the stack forwards mes-sages between the ring network and the scratchpadmanager (not shown).

operations are required because the data width above themarshaler is small. Consider a scratchpad of boolean values.Caching above the marshaler would require tag sizes to coverthe address space but would have only one bit data buckets.This ratio of meta-data to actual cache data is unacceptable.

In our implementation, both the private cache and themarshaler present the same interface to the client. The rel-ative order of the marshaler and a cache is invisible to thescratchpad client. A compile-time heuristic could choose a lo-cally optimal topology based on a scratchpad’s size and datatype, placing the cache either above or below the marshaler.In our current implementation the cache is always insertedbelow the marshaler. The full hierarchy is shown in Figure 2.

2.5 Host MemoryThe hierarchy has now expanded available FPGA-side

memory from the capacity of on-die RAM blocks to thecapacity of on-board RAM. This solution is fully functionalon both stand-alone FPGAs and on FPGAs connected to ahost computer. For scratchpad memories, on-die RAM blockusage is reduced to fixed sized caches. Now we face the samequestion asked at the end of Section 2.1: What are we to dofor algorithms with memory footprints too large for on-boardRAM?

If the FPGA is connected via a high speed bus to a hostcomputer, the solution is the same as when we ran out ofon-die memory: push the backing storage one level down inthe hierarchy, using host memory as the home for scratchpaddata. The method is essentially identical to the method forthe on-board memory scratchpad controller in Section 2.2.2.An indirection table must map scratchpad memories to host

Page 6: LEAP Scratchpads: Automatic Memory and Cache Management ...people.csail.mit.edu/emer/papers/2011.02.isfpga.leap_scratchpads.pdf · LEAP scratchpads for recon gurable logic dynamically

Scr

atch

pad

Clie

nts

Client ClientClient

ScratchpadInterface

PlatformConnector

Marshaler

PrivateCache

PrivateCache

Marshaler

Pla

tform

ScratchpadController

CentralCache

Hos

t

ScratchpadMemory

LocalMemory

Client Client... Client

CentralCache Ifc

PlatformConnector

Marshaler

PrivateCache

PrivateCache

Marshaler

ClientFill / Spill

ClientFill / Spill

Cen

tral C

ache

Clie

nts

Request Ring Request Ring

Response Ring Response Ring

ScratchpadInterface

CentralCache Ifc

Client

PrivateCache

Marshaler

ScratchpadInterface

Memory Interface

Figure 3: Full client-facing model hierarchy. Scratchpad clients (top-left) marshal requests to memory-sizedchunks and are filtered by private caches. The scratchpad controller handles central cache spill and fill requests,transforming them into operations on the host scratchpad memory. Central cache clients (top-right) mustprovide their own spill and fill drivers, which likely connect to drivers on the host. The central cache protocoltags each request and cached line with a specific client, enabling proper routing of responses and spill or fillrequests.

addresses. Instead of reading and writing data from on-boardmemory, the scratchpad controller reads and writes hostmemory using either direct memory access or a protocol overan I/O channel.

2.6 Central CacheMoving the backing storage from on-board RAM to host

memory offers more space at the expense of access time.Configuring the now unused on-board RAM as a last-levelcache can reduce this penalty. Because only one central cachecontroller is instantiated we can afford a more complicatedcontroller. The platform’s central cache controller is set asso-ciative with LRU replacement.

Clients connecting to the central cache identify themselvesusing a dictionary-based mechanism similar to the scratchpadID allocation scheme described in Section 2.2.1. Like thescratchpad controller, the central cache constructs a uniqueaddress space for each client by concatenating client IDs andaddress requests from clients. This internal address spaceenables the central cache to associate entries with specificclients.

Clients connecting to the central cache must provide func-tions for spilling and filling memory lines. Pushing the detailsof spills and fills out of the central cache allows a variety ofclients to connect, all sharing the same on-board RAM, eachwith unique methods of reading and writing their backingstorage. The LRU central cache policy automatically opti-

mizes the footprint of each client in the central cache basedon the global access pattern of all clients.

Figure 3 shows the full caching hierarchy. The scratchpadcontroller, shown at the left in the platform, is one client ofthe central cache. Misses from all L1 scratchpad clients arepassed by the scratchpad controller to the central cache. Thescratchpad controller provides spill and fill functions to thecentral cache that write and read lines from the scratchpadmemory stored on the host. Other clients of the central cacheare shown in the top right of the figure. In this exampleconfiguration, each client instantiates a private L1 cache andprovides its own spill and fill methods that communicate withthe host. While not currently implemented in the platform,the spill and fill methods could be extended with coherencemessages. Along with coherence messages, the central cachetag structure could be enhanced to represent line ownership.Hybrid algorithms sharing data between the FPGA andthe host could then communicate and force synchronizationbetween FPGA-side caches and host memory.

2.7 LanguageLEAP is written in Bluespec SystemVerilog [2]. While the

platform framework is language independent, some Bluespecfeatures simplified our implementation. The language offerspowerful static elaboration and type algebra, enabling predi-cate functions that govern whether operations that invokepredicated methods will fire within an FPGA cycle. As long

Page 7: LEAP Scratchpads: Automatic Memory and Cache Management ...people.csail.mit.edu/emer/papers/2011.02.isfpga.leap_scratchpads.pdf · LEAP scratchpads for recon gurable logic dynamically

as the user adopts a latency insensitive programming style,predicates defined within our implementation of scratchpadread request and response methods make it simple to replacea RAM block with a scratchpad by changing only a singleline of source code. The method interfaces for RAM blocksand scratchpads are identical. Externally, they differ only intheir timing and, consequently, their public methods’ predi-cates. All LEAP RAM block and scratchpad classes sharethe following interface:

1 interface MEMORY_IFC#(type t_ADDR,

2 type t_DATA);

3 method Action readReq(t_ADDR addr);

4 method ActionValue#(t_DATA) readRsp();

5

6 method Action write(t_ADDR addr,

7 t_DATA val);

8 endinterface

The definition above declares the interface to the classMEMORY IFC. The class uses two abstract type names,t ADDR and t DATA, that will be bound to explicit typeswhen instantiated. Three methods are defined: readReq re-quests a memory read, readRsp receives the read responseand write updates the value at a location. Consider a trivialpipeline that reads a RAM block:

1 typedef Bit#(8) ADDR_T;

2 typedef Bit#(4) DATA_T;

3

4 // Allocate 256 4-bit elements

5 MEMORY_IFC#(ADDR_T, DATA_T) mem

6 <- mkBRAM();

7

8 FIFO#(ADDR_T) inQ <- mkFIFO();

9 FIFO#(DATA_T) outQ <- mkFIFO();

10

11 rule recvInReq;

12 let addr = inQ.first();

13 inQ.deq();

14 mem.readReq(addr);

15 endrule

16

17 rule sendOutRsp;

18 let val <- mem.readRsp();

19 outQ.enq(val);

20 endrule

This pipeline defines a 256 entry RAM block of four bitobjects on line 5. An input FIFO is defined on line 8 and anoutput FIFO on line 9. recvInReq consumes incoming requestson inQ and initiates a memory read request. sendOutRspconsumes the memory value response and forwards it to outQ,the output FIFO.

Rules in Bluespec are like always blocks in Verilog : theyfire as a group in a single cycle, predicated by a booleanexpression. Unlike Verilog, the predicate may be a functionof the methods invoked inside the rule. The recvInReq ruleworks because the FIFO first method allows an enclosingrule to fire only when the FIFO is not empty and the memoryreadReq method may fire only when the request queue is notfull. Similarly, the outbound FIFO permits its enq method tofire only when the FIFO is not full and the memory readRspmethod requires that a response be available.

Transforming the pipeline to use scratchpads requires onlya change to the instantiation of mem:

4 // Allocate 256 4-bit elements

5 MEMORY_IFC#(ADDR_T, DATA_T) mem

6 <- mkScratchpad(VDEV.SCRATCH.FBUF_Y,

7 SCRATCHPAD_CACHED);

In this case, mem is instantiated as a scratchpad with a pri-vate L1 cache, stored in on-die RAM blocks, and a shared L2,stored in on-board RAM. The rules that invoke the readReqand readRsp methods are unchanged because the predicatesthat enable them are encoded in the mkScratchpad imple-mentation. Like software on general purpose hardware, thetiming may change when moving from one memory hierar-chy to another without requiring a changes to source code.Developers may choose to optimize for a particular memorytiming, but changes are not required for accuracy.

3. USING SCRATCHPADSScratchpads are intended to be useful for a wide variety

of client algorithms and access patterns. LEAP provides anumber of configuration options. Clients may request auto-matic instantiation of private caches or may, instead, connectdirectly with the central cache. Streaming clients, wherecaching would not improve performance, may bypass thecentral cache and communicate directly with host memory.

Our work with FPGAs began with the goal of buildinghigh-performance processor timing models. In the process,we recognized the potential from generalizing the platforminterface. As a test of scratchpad performance, we analyzed apair of distinct algorithms: an H.264 decoder and a multi-coreprocessor timing model. We implemented both applicationsfor a Virtex-5 LX330 on a Nallatech Intel Xeon FSB Acceler-ated Computing Platform. This module has 8MB of on-boardDDR SDRAM and is plugged into a CPU socket on a hostcomputer. The central cache is stored in the 8MB on-boardRAM.

3.1 H.264 DecodingSome implementation of H.264 [9, 21] is deployed on nearly

every new device capable of displaying a video, includingsmart phones, graphics cards, and, of course, televisions. Thecomputational requirements of decoding H.264 video varydepending on video resolution, frame rate, and level of com-pression used. At the low end, mobile phone applicationsfavor videos encoded in low resolution formats at low framerates, as small as QCIF (176× 144) at 15 frames per second.At the high end of the spectrum, Blu-ray discs are encoded at1080p (1920× 1080) at 24 frames per second. At the low end,decoding may be handled by software. However, decodingHD streams typically requires specialized hardware as eventhe most recent processors strain under the burden of 1080p.

H.264 reconstructs video at the granularity of 16×16 pixelmacroblocks, which may be further subdivided in some decod-ing steps. Although H.264 employs several other compressiontechniques, the highest levels of compression are derived frompixel prediction and correction. This technique involves thedecoder predicting future pixels based on pixels it has alreadydecoded. Because the decoder is deterministic, the encoderknows the behavior of the decoder at encoding time, and caninclude corrections if the decoder prediction will be incor-rect. These corrective factors tend to have small magnituderelative to a whole pixel, yielding a high compression ratio.

Page 8: LEAP Scratchpads: Automatic Memory and Cache Management ...people.csail.mit.edu/emer/papers/2011.02.isfpga.leap_scratchpads.pdf · LEAP scratchpads for recon gurable logic dynamically

Stream QCIF 720p

Input 0.01 2.75Output 0.50 26.5Interprediction 1.00 67.0

Figure 4: H.264 Bandwidth Requirements For Sam-ple Streams (MB/s)

H.264 can source pixels for prediction in two ways: In-traprediction predicts macroblocks in a frame from otherpreviously decoded, spatially local, macroblocks in the sameframe. Interprediction predicts macroblocks from motion-indexed pixels in previously decoded frames. Intrapredictiontakes advantage of spatial locality within a frame – colorsand textures are similar across a frame. Interprediction takesadvantage of temporal locality across a frames – adjacentframes tend to depict similar images. In the context of mem-ory management, this second kind of prediction is of thegreatest interest, since it necessarily involves retrieving datafrom previously computed, stored frames.

3.1.1 Memory RequirementsH.264 has three distinct memory streams: input, output,

and interprediction. As shown in Figure 4, the interpredictionstream dominates memory bandwidth usage. This dominancearises from the method by which blocks are interpredicted inH.264. Previous standards permitted only whole pixel motionvectors: interprediction of a macro block only involved copy-ing some other macroblock and then applying a correctivefactor to it. The bandwidth requirements of this style ofinterprediction must be strictly less than the output band-width, since not all blocks are interpredicted. However, H.264permits sub-pixel motion vectors. To provide better imagereconstruction in this case, H.264 applies blurring filters topixels from as many as five different adjacent macroblocksto produce a single predicted pixel. In the worst case pixeldependency, thirty-six pixels must be accessed to computea single output pixel. Interprediction requires high memorybandwidth, and, unlike the input and output streams, itsaccess pattern is dynamic. Whole, half, and quarter pixelmotion vectors may be present at any point in the frame.

3.1.2 Design ExplorationFortunately, H.264 exhibits a number of properties that can

be exploited to develop an efficient memory system. First, thememory streams for the intensity (luminance) and coloration(chrominance) fields are independent. Second, motion vectorstend to be spatially homogeneous, yielding a high degreeof regional locality in pixel accesses. Third, interpredictionfeedback occurs at the granularity of a frame, thus simplifyingmanagement of coherence across multiple caches.

These properties result in an interesting design explorationspace for memory hierarchies in H.264, both because H.264is present on platforms with diverse performance and powercharacteristics and because of its significant memory require-ments. A number of architectures are feasible, depending onthe desired resolution, throughput, area, and power require-ments of a design. For example, a cheap but power-hungrydecoder might use a minimally sized cache, while a moreexpensive, but power efficient decoder might use multiplelarge caches to cut down on off-chip memory accesses. Itis beyond the scope of our present study to find optimalsolutions to these problems. Rather, we demonstrate, by pro-

ducing a number of disparate designs, that the scratchpadabstraction is an effective means of exploring the memoryhierarchy design space without substantial coding overhead.

For our memory hierarchy explorations, we use an existingH.264 implementation [7]. This codec originally targeted anASIC implementation, but performance increases in FPGAspermit us to reuse the codec without significant modifications.The original design assumed a request-response memory hier-archy similar to scratchpads, but only implemented a simpleSRAM-based L1 cache even though it partitioned its memoryrequests into three separate streams: one for the luminancefield and for each of the two chrominance fields. As a result,the original hierarchy suffered from performance issues in thepresence of slower backing storage, like DRAM, and couldonly achieve sufficient memory for HD decoding if the framebuffer was stored in a high-bandwidth, low-latency SRAM.

Because the original algorithm connects to a standard,timing-independent, memory interface, we can easily inte-grate a scratchpad-based hierarchy. We implemented threedistinct memory hierarchies and attached them to the H.264decoder, illustrated in Figure 5. First, we implemented a sim-ple, shared, on-die, RAM-based frame buffer. This buffer isconstrained by both the size of on-die RAM available on theFPGA and offered bandwidth, which must be multiplexedamong the three field streams. It is worth noting that thismemory architecture is chosen by many published H.264implementations. Second, we implemented a single scratch-pad memory hierarchy backed by the central cache. Whilethe architecture makes use of the automatic mid-level cacheprovided by scratchpads, the lowest-level cache is still multi-plexed among many users. Third, we used separate scratch-pads to implement the storage for the luma and chromacomponents. Although this architecture requires a largernumber of caches, the bandwidth offered by the hierarchy issubstantially higher due to the distribution of requests acrosscaches. Additionally, individual caches experience better per-formance due to the removal of conflict misses. In configuringthe designs, we attempted to size memory parameters toachieve similar levels of on-die memory usage in each design.

3.1.3 ResultsThe performance results for the various memory hierarchy

implementations are shown in Figure 6. Results are not shownfor higher resolutions using on-die RAM blocks because theyare not synthesizable on the FPGA, due to the size of theon-die RAM frame buffer. Unlike direct implementationsemploying on-die memory, the scratchpad versions requireonly caches on the FPGA and remain synthesizable as theproblem size grows. As expected, the memory hierarchy inwhich only a single scratchpad is used offers less performancethan the hierarchy in which the field memory streams aresplit across multiple platforms. However, the performanceincrease is much larger than a factor of three. This largerdifference is a result of head-of-line blocking in the singlescratchpad hierarchy. High-latency misses prevent faster, un-related hits from exiting the in-order memory response queue,thereby stalling the processor pipeline. To determine the im-plementation area of the different memory hierarchies, shownin Figure 7, we combine the areas of the FPGA platformand H.264 memory control. Because of our complex synthesisprocess, it is difficult to separate individual components ofthe FPGA platform from one another, so an FPGA platformwithout any memory hierarchy is provided as a reference.

Page 9: LEAP Scratchpads: Automatic Memory and Cache Management ...people.csail.mit.edu/emer/papers/2011.02.isfpga.leap_scratchpads.pdf · LEAP scratchpads for recon gurable logic dynamically

Fram

e B

uffe

r

Frame Buffer Control

H.2

64 H.264 Interpolator

ScratchpadInterface

PrivateCache

Frame Buffer Control

H.264 Interpolator

Frame Buffer Control

H.264 Interpolator

Private CachePrivateCache

PrivateCache

PrivateCache

PrivateCache

PrivateCache

ScratchpadInterface

ScratchpadInterface

ScratchpadInterface

a) On-Die Frame Buffer b) Single Scratchpad c) Multiple Scratchpads

Memory Interface

Figure 5: H.264 memory hierarchies explored. (a) Stores all interpolation data on the FPGA. (b) Storesthe same data in a single scratchpad, allowing the decoder to work on larger frame resolutions. (c) Storesthe data in multiple scratchpads, increasing memory I/O parallelism and reducing cache conflict misses andhead-of-line blocking.

0.1

1

10

100

1000

QCIF VGA 720p 1080p

Fra

mes

per

Sec

ond

Frame Resolution

H.264 Decoding Performance Using Scratchpads

On-die Frame Buffer

Single Scratchpad

Multiple Scratchpad

Figure 6: H.264 performance, plotted on a log scale.

3.2 Multi-Core Processor Timing ModelThe second memory hungry workload we consider is a pro-

cessor timing model. FPGAs are a well-known solution foremulating and prototyping designs after the RTL has beenwritten. Recently, a new application has emerged: using FP-GAs for accelerating architectural design-space exploration.This scenario presents two problems: not every circuit trans-lates efficiently into an FPGA and FPGA capacity becomesa concern as it should not artificially limit architectural ex-ploration. The solution to these problems is separation of the

Memory Hierarchy Registers LUTs On-DieRAM KB

Platform Components 9599 11239 8On-die Frame Buffer 22834 31880 244Single Scratchpad 53941 66184 208Multiple Scratchpads 37815 52748 208

Figure 7: H.264 synthesis results, targeting Nallat-ech ACP.

FPGA clock from the model clock [20]. This allows us to useFPGA-efficient circuits such as RAM blocks while simulatingthe timings of FPGA-inefficient circuits such as CAMs andmulti-ported register files. RAM configured to model a CAMmay be searched sequentially, and the model clock cycle isnot incremented until the search concludes.

In separating the FPGA clock from the model clock wetreat the FPGA as a highly parallel programming substrate.Like a software-based timing model, the FPGA is configuredto compute model time algorithmically, independent of theFPGA’s hardware clock. This programmatic computationof model time offers the model writer many opportunitiesfor choosing space-efficient structures. For example, multipleinstances of the same target model circuit may be representedby time-multiplexing a single physical instance in the model.A multi-core target processor may be modeled using a singlephysical instance of the core, with the multiplexed modelingalgorithm stepping round robin through the logical targetcores. Only the data for each core, such as the register filestate, must be replicated. The modeling algorithm is typicallyimplemented as many stages in an FPGA pipeline. Time-multiplexed instances then run in parallel along the pipeline,in the same fashion as instruction execution in standardprocessor pipelines [23].

3.2.1 Scratchpads in Timing ModelsTime-multiplexing solves only one space problem: logic

for many instances of the same target processor now fits onan FPGA. Another problem remains: the data representingthe state for each multiplexed object is proportional to thenumber of instances. What if the required data does not fiton-board the FPGA? Once again, we take advantage of theseparation between the FPGA clock and the model clock.There is no specific FPGA-clock timing required for simulatoraccesses to modeling data. A target model’s register file andcache states may be stored anywhere in an FPGA or hostmemory hierarchy. High latency storage may adversely affectsimulator performance, but long latencies will have no effecton the results of simulation.

Timing models of processor caches are obvious candidatesfor off-FPGA storage. There is insufficient on-die RAM tohold modeled cache state, especially when many simulated

Page 10: LEAP Scratchpads: Automatic Memory and Cache Management ...people.csail.mit.edu/emer/papers/2011.02.isfpga.leap_scratchpads.pdf · LEAP scratchpads for recon gurable logic dynamically

processors are multiplexed on a single FPGA. We employscratchpad memories to store modeled cache states.

In our simulator we split the model into two components:functional and timing. Both run on the FPGA. The func-tional model is responsible for architecturally correct exe-cution of instructions according to the target instructionset architecture. The timing model is solely responsible forcomputing the time required for instructions to complete onthe target microarchitecture. Only data required to computetarget model cycles flows through the timing model’s FPGApipelines. Addresses of memory references are present in thetiming model because they are required to compute cacheoccupancy. The values actually loaded and stored by memoryreferences do not flow through the timing model becausethey do not affect timing. The values loaded and stored flowonly through the functional model. Consequently, a timingmodel of a cache need store only the tags associated witheach cache line. The data for the line itself is unnecessary,since it is redundant with the functional model state. Whilethis optimization significantly reduces the complexity andmemory footprints of cache timing models, tag arrays formulti-core simulation are still relatively large compared toFPGA RAM block sizes.

3.2.2 Experimental ConfigurationOur timing models are modular and may be configured

into a variety of target topologies, ranging from simple single-model-cycle cores to detailed out-of-order cores. Cores mayoptionally have private instruction and data caches. Coresmay be connected together using a variety of network topolo-gies, including rings and meshes.

To understand the impact of scratchpads we are interestedin the performance of the simulator itself, not the perfor-mance of any particular modeled microarchitecture. For thisstudy we picked a simple target architecture: a set of inde-pendent cores. Each core is connected to a private memorycontroller. The performance of the architecture thus scaleslinearly with the number of cores in the target. This microar-chitecture is well suited for measuring simulator performanceas the problem size varies. For this target, a multiplexedsimulator with access to infinite on-die memory and withfully utilized FPGA pipelines should have a constant simula-tion speed, measured in simulated instructions per wall-clocksecond, as the number of target cores varies. This is duedo the multiplexing. While the available parallelism withinthe target varies relative to the number of target cores, theparallelism within the simulator implementation is limitedby the single multiplexed core model. Of course there is notinfinite on-die memory within the FPGA, which is why weemploy scratchpads. With this simulator configuration theimpact of varying FPGA memory hierarchies on run-timecan be tested. By adjusting the number of target cores wevary the memory footprint.

We tested a model configuration in which each core has asimulated private, physically indexed, 128KB, direct mappedinstruction and also a 128KB, direct mapped, data cachewith 32 byte lines. Each cache is represented only by theaddress tags corresponding to references. For a 34 bit physicaladdress space, each processor requires 2KB of storage for eachcache model. The model is multiplexed, with only a singlephysical instance of a core described on the FPGA. Likewise,the cache tag arrays are multiplexed. A single multiplexedarray holds the storage representing the cache tag array for

all processor instruction caches and another holds the tagsfor all data caches. The arrays grow linearly with the numberof simulated cores. We varied the problem size between 8and 64 simulated cores, translating to total cache tag arrayfootprints between 32KB and 256KB.

As a test of scratchpad performance we configured twoflavors: one in which the cache tag arrays are stored directlyin FPGA RAM blocks and another in which the arrays arestored in scratchpads. As noted in Section 2.7, these varia-tions differ only in a single source line that either instantiatesstorage as on-die RAM or as a scratchpad. The algorithmaccessing the storage is written deliberately to function cor-rectly independent of timing. The scratchpads are frontedby 4KB of private L1 scratchpads caches, stored in RAMblocks on the FPGA. Note that these are physical caches onthe FPGA to speed up scratchpad references, not part of thetiming model target architecture.

The functional model also has data storage requirements.While both virtual to physical address translation and func-tional memory are managed by a connected software-basedsimulator, they are cached on the FPGA to improve simula-tor performance. Both the translation lookaside buffer (TLB)used for virtual to physical translation and functional mem-ory are clients of the central cache. The TLB employs a 4KBprivate cache and functional memory is fronted by a 32KBcache to reduce pressure on the central cache. SynthesizedFPGA resource requirements are shown in Figure 8.

Model Registers LUTs On-DieRAM KB

16 Cores / On-die RAM 79729 97736 567016 Cores / Scratchpads 94341 114220 358232 Cores / Scratchpads 101230 126114 397864 Cores / Scratchpads 108491 148630 5130

Figure 8: Timing model synthesis results, targetingNallatech ACP.

A workload consisting of eight reference programs fromSPEC 2000 was run through the simulator: ammp, applu,gcc, mcf, mesa, parser, perlbmk and wupwise. Because we areinterested in simulator performance and not the performanceof the modeled target architecture, we simply need programsto generate scratchpad traffic. The simulator was run for 500million instructions on each target core. The eight workloadswere replicated for configurations with more than eight cores.Each core was allocated a private physical address space, sono memory was shared and the problem size grew linearlywith the number of cores.

3.2.3 ResultsThe simulation rate, varying the number of cores in the

target architecture, is shown in Figure 9. We measure simu-lator performance as the number of instructions simulatedrelative to wall clock time. Because the simulator is a sin-gle, multiplexed, instance, the simulation rate on unlimitedmemory is mostly constant and independent of the numberof simulated cores. (In fact, because the simulator itself ispipelined on the FPGA, simulation rates measured in MIPSmay improve as more cores are simulated. We see this in thespeedup between 8 and 16 cores.)

For 8 and 16 core models it was possible to build equivalentsimulators using both scratchpads and RAM blocks to holdthe timing model’s cache tag arrays. For those configurations,

Page 11: LEAP Scratchpads: Automatic Memory and Cache Management ...people.csail.mit.edu/emer/papers/2011.02.isfpga.leap_scratchpads.pdf · LEAP scratchpads for recon gurable logic dynamically

0

1

2

3

4

5

6

7

8

8 16 32 64

Sim

ulat

ion

Rat

e (M

IPS

)

Simulated Cores

Timing Model Performance Using Scratchpads

Scratchpads

RAM Block

Figure 9: Timing model throughput, measured insimulation rate (millions of instructions per second)relative to wall clock time. For 8 and 16 core simula-tions it is physically possible to synthesize cache tagarrays in RAM blocks. Above 16 cores, the arraysno longer fit on the FPGA.

the performance with scratchpads was nearly identical tothe direct implementation. The FPGA’s RAM block areais simply not large enough for 32 and 64 core models. Wesee interesting results for those two configurations. Simula-tor performance drops for two reasons. First, central cachecapacity is a problem, as seen in the miss rates in Figure 10.Second, the FPGA pipeline becomes saturated, leaving noroom for additional parallelism. While performance clearlydecreases as central cache pressure grows due to the sizes ofscratchpads and functional memory, it should be noted thatwithout these techniques the simulator would simply havefailed to synthesize for the FPGA. Performance degradationdue to cache footprint growth is similarly problematic ongeneral purpose hardware. We have achieved our goal of anFPGA platform with a general purpose programming model.

4. CONCLUSIONAutomatic cache instantiation frees the FPGA application

developer to concentrate more on algorithmic design and lesson memory management. A platform-provided memory hier-archy automatically partitions the on-board memory amongcompeting clients. Without it, application writers would beforced to manage access to on-die RAM blocks and sharedDDR RAM explicitly. Designers would most likely hard par-tition memory among clients. Like application developmenton general purpose machines, core algorithms may be writtenand then tuned for their particular memory access patterns.

LEAP scratchpads are in active use in projects as diverseas H.264 decoders and micro-architectural timing models.We have found them to be particularly useful for managingstorage in applications that require multiple, large, randomaccess buffers.

0

5

10

15

20

25

8 16 32 64

Mis

ses

per

1000

Cor

e C

ycle

s

Simulated Cores

Central Cache Miss Rate

Scratchpads

RAM Block

Figure 10: Central cache miss rate.

5. REFERENCES[1] D. Andrews, R. Sass, E. Anderson, J. Agron, W. Peck,

J. Stevens, F. Baijot, and E. Komp. AchievingProgramming Model Abstractions for ReconfigurableComputing. IEEE Trans. Very Large Scale Integr.Syst., 16(1):34–44, 2008.

[2] Arvind. Bluespec: A Language for Hardware Design,Simulation, Synthesis and Verification. InMEMOCODE ’03: Proceedings of the First ACM andIEEE International Conference on Formal Methods andModels for Co-Design, page 249. IEEE ComputerSociety, 2003.

[3] Z. Budimlic, A. M. Chandramowlishwaran, K. Knobe,G. N. Lowney, V. Sarkar, and L. Treggiari. DeclarativeAspects of Memory Management in the ConcurrentCollections Parallel Programming Model. In DAMP ’09:Proceedings of the 4th Workshop on Declarative Aspectsof Multicore Programming, pages 47–58. ACM, 2008.

[4] H. J. C. Chung, Eric S. and K. Mai. CoRAM: AnIn-Fabric Memory Abstraction for FPGA-basedComputing. In FPGA ’11: Proceedings of the 19thAnnual ACM/SIGDA International Symposium onField Programmable Gate Arrays, 2011.

[5] N. Dave, M. C. Ng, M. Pellauer, and Arvind. A designflow based on modular refinement. In Formal Methodsand Models for Codesign (MEMOCODE), 2010 8thIEEE/ACM International Conference on, pages 11 –20,Jul. 2010.

[6] J. B. Dennis. Segmentation and the Design ofMultiprogrammed Computer Systems. J. ACM,12(4):589–602, 1965.

[7] K. Fleming, C.-C. Lin, N. Dave, Arvind, G. Raghavan,and J. Hicks. H.264 Decoder: A Case Study in MultipleDesign Points. In Formal Methods and Models forCo-Design, 2008. MEMOCODE 2008. 6th ACM/IEEEInternational Conference on, pages 165 –174, Jun. 2008.

[8] M. B. Gokhale, J. M. Stone, J. Arnold, andM. Kalinowski. Stream-Oriented FPGA Computing inthe Streams-C High Level Language. In FCCM ’00:Proceedings of the 2000 IEEE Symposium onField-Programmable Custom Computing Machines,

Page 12: LEAP Scratchpads: Automatic Memory and Cache Management ...people.csail.mit.edu/emer/papers/2011.02.isfpga.leap_scratchpads.pdf · LEAP scratchpads for recon gurable logic dynamically

page 49. IEEE Computer Society, 2000.

[9] I.-T. V. C. E. Group. Draft ITU-T Recommendationand Final Draft International Standard of Joint VideoSpecification, May, 2003.

[10] S. Gupta, N. Dutt, R. Gupta, and A. Nicolau. SPARK:A High-Lev l Synthesis Framework for ApplyingParallelizing Compiler Transformations. In VLSID ’03:Proceedings of the 16th International Conference onVLSI Design, page 461. IEEE Computer Society, 2003.

[11] S. S. Huang, A. Hormati, D. F. Bacon, and R. Rabbah.Liquid Metal: Object-Oriented Programming Acrossthe Hardware/Software Boundary. In ECOOP ’08:Proceedings of the 22nd European conference onObject-Oriented Programming, pages 76–103.Springer-Verlag, 2008.

[12] W. W. Hwu and P. P. Chang. Achieving HighInstruction Cache Performance with an OptimizingCompiler. SIGARCH Comput. Archit. News,17(3):242–251, 1989.

[13] C.-K. Luk and T. C. Mowry. Cooperative Prefetching:Compiler and Hardware Support for EffectiveInstruction Prefetching in Modern Processors. InMICRO 31: Proceedings of the 31st Annual ACM/IEEEInternational Symposium on Microarchitecture, pages182–194. IEEE Computer Society Press, 1998.

[14] W. A. Najjar, W. Bohm, B. A. Draper, J. Hammes,R. Rinker, J. R. Beveridge, M. Chawathe, and C. Ross.High-Level Language Abstraction for ReconfigurableComputing. Computer, 36(8):63–69, 2003.

[15] P. Panda, N. Dutt, and A. Nicolau. Local MemoryExploration and Optimization in Embedded Systems.Computer-Aided Design of Integrated Circuits andSystems, IEEE Transactions on, 18(1):3 –13, Jan. 1999.

[16] R. J. Pankhurst. Operating Systems: Program OverlayTechniques. Commun. ACM, 11(2):119–125, 1968.

[17] A. Parashar, M. Adler, K. Fleming, M. Pellauer, andJ. Emer. LEAP: A Virtual Platform Architecture forFPGAs. In CARL ’10: The 1st Workshop on theIntersections of Computer Architecture andReconfigurable Logic, 2010.

[18] A. Parashar, M. Adler, M. Pellauer, and J. Emer.Hybrid CPU/FPGA Performance Models. In WARP’08: The 3rd Workshop on Architectural ResearchPrototyping, 2008.

[19] M. Pellauer, M. Adler, D. Chiou, and J. Emer. SoftConnections: Addressing the Hardware-DesignModularity Problem. In DAC ’09: Proceedings of the46th Annual Design Automation Conference, pages276–281. ACM, 2009.

[20] M. Pellauer, M. Vijayaraghavan, M. Adler, Arvind, andJ. Emer. A-Port Networks: Preserving the TimedBehavior of Synchronous Systems for Modeling onFPGAs. ACM Trans. Reconfigurable Technol. Syst.,2(3):1–26, 2009.

[21] I. E. Richardson. H.264 and MPEG-4 VideoCompression. John Willey & Sons, 2003.

[22] J. Simsa and S. Singh. Designing Hardware withDynamic Memory Abstraction. In FPGA ’10:Proceedings of the 18th Annual ACM/SIGDAInternational Symposium on Field Programmable GateArrays, pages 69–72. ACM, 2010.

[23] Z. Tan, A. Waterman, R. Avizienis, Y. Lee, H. Cook,

D. Patterson, and K. Asanovic. RAMP Gold: anFPGA-Based Architecture Simulator forMultiprocessors. In DAC ’10: Proceedings of the 47thDesign Automation Conference, pages 463–468. ACM,2010.

[24] Xilinx, Inc. UG363: Virtex-6 FPGA Memory ResourcesUser Guide. 2010.

[25] P. Yiannacouras and J. Rose. A ParameterizedAutomatic Cache Generator for FPGAs. In Proc.Field-Programmable Technology (FPT), pages 324–327,2003.

Page 13: LEAP Scratchpads: Automatic Memory and Cache Management ...people.csail.mit.edu/emer/papers/2011.02.isfpga.leap_scratchpads.pdf · LEAP scratchpads for recon gurable logic dynamically