Instruction Cache Compression for Embedded Systems by Yujia Jin and Rong Chen

Similar documents
Profile-driven Selective Code Compression

Evaluation of a High Performance Code Compression Method

Fast Software-managed Code Decompression

Efficient Placement of Compressed Code for Parallel Decompression

An Efficient Code Compression Technique using Application-Aware Bitmask and Dictionary Selection Methods

Design and Simulation of a Pipelined Decompression Architecture for Embedded Systems

Code Compression for Low Power Embedded System Design

Reducing Code Size with Run-time Decompression

Reducing Code Size with Run-time Decompression

EMBEDDED computing systems are space and cost sensitive.

MEMORY is one of the key driving factors in embeddedsystem

Compact Binaries with Code Compression in a Software Dynamic Translator

Compact Binaries with Code Compression in a Software Dynamic Translator

Reduction of Bitstream Transfer Time in FPGA

GOLOMB Compression Technique For FPGA Configuration

AddressBus 32. D-cache. Main Memory. D- Engine CPU. DataBus 1. DataBus 2. I-cache

A Hybrid Code Compression Technique using Bitmask and Prefix Encoding with Enhanced Dictionary Selection

EMBEDDED systems have become more and more important

A Study on Algorithm for Compression and Decompression of Embedded Codes using Xilinx

MEMORY is one of the most constrained resources in an

Energy Savings Through Compression in Embedded Java Environments

Matrix-based software test data decompression for systems-on-a-chip

A Novel Decode-Aware Compression Technique for Improved Compression and Decompression

The Implementation and Evaluation of Dynamic Code Decompression Using DISE

Decompression Method For Massive Compressed Files In Mobile Rich Media Applications

Computing s Energy Problem:

SUPPLEMENT MATERIALS

Decompression of run-time compressed PE-files

A Single Cycle Processor. ECE4680 Computer Organization and Architecture. Designing a Pipeline Processor. Overview of a Multiple Cycle Implementation

Introduction. AI and Searching. Simple Example. Simple Example. Now a Bit Harder. From Hammersmith to King s Cross

An Architecture of Embedded Decompressor with Reconfigurability for Test Compression

Fast Floating Point Compression on the Cell BE Processor

International Journal of Engineering Trends and Technology (IJETT) Volume 18 Number2- Dec 2014

COMPRESSION OF FPGA BIT STREAMS USING EFFECTIVE RUN LENGTH ENCODING TECHIQUES AND ITS PERFORMANCE ESTIMATION

A 64 Bit Pipeline Based Decimal Adder Using a New High Speed BCD Adder

An Architecture for Combined Test Data Compression and Abort-on-Fail Test

Uninformed search methods

Compression of FPGA Bitstreams Using Improved RLE Algorithm

Arithmetic Coding Modification to Compress SMS

Design-for-Testability for Path Delay Faults in Large Combinational Circuits Using Test-Points

Light Loss-Less Data Compression, With GPU Implementation

MICROPROCESSOR ARCHITECTURE

ECE 757. Homework #2

82C288 BUS CONTROLLER FOR PROCESSORS (82C C C288-8)

Recycling Bits in LZ77-Based Compression

Evaluating chaff fire pattern algorithms in a simulation environment. JP du Plessis Institute for Maritime Technology South Africa

Uninformed Search (Ch )

ELE 455/555 Computer System Engineering. Section 2 The Processor Class 4 Pipelining with Hazards

Data Extraction from Damage Compressed File for Computer Forensic Purposes

Application of Dijkstra s Algorithm in the Evacuation System Utilizing Exit Signs

Uninformed Search (Ch )

Queue analysis for the toll station of the Öresund fixed link. Pontus Matstoms *

PREDICTING the outcomes of sporting events

Analyzing the Processor Bottlenecks in SPEC CPU 2000

ACCURATE PRESSURE MEASUREMENT FOR STEAM TURBINE PERFORMANCE TESTING

A SEMI-PRESSURE-DRIVEN APPROACH TO RELIABILITY ASSESSMENT OF WATER DISTRIBUTION NETWORKS

JPEG-Compatibility Steganalysis Using Block-Histogram of Recompression Artifacts

Laboratory 2(a): Interfacing WiiMote. Authors: Jeff C. Jensen (National Instruments) Trung N. Tran (National Instruments)

Post-Placement Functional Decomposition for FPGAs

CS650 Computer Architecture. Lecture 5-1 Branch Hazards

DEPARTMENT OF THE NAVY DIVISION NEWPORT OFFICE OF COUNSEL PHONE: FAX: DSN:

Code Compression for Low Power Embedded System Design

Shearwater GF Computer

COMPRESSORS WITH SIDE STREAM

AccuRAID iscsi Auto-Tiering Best Practice

CT PET-2018 Part - B Phd COMPUTER APPLICATION Sample Question Paper

Efficient Gait Generation using Reinforcement Learning

Uninformed search methods

A Point-Based Algorithm to Generate Final Table States of Football Tournaments

Critical Systems Validation

Calculation of Trail Usage from Counter Data

WildCat RF unit (0.5W), full 32-byte transmissions with built-in checksum

Software Design of the Stiquito Micro Robot

Uninformed search methods II.

MIKE NET AND RELNET: WHICH APPROACH TO RELIABILITY ANALYSIS IS BETTER?

Satoshi Yoshida and Takuya Kida Graduate School of Information Science and Technology, Hokkaido University

Flyweight Pattern. Flyweight: Intent. Use sharing to support large numbers of fine-grained objects efficiently. CSIE Department, NTUT Chien-Hung Liu

Problem Solving Agents

HumiSys HF High Flow RH Generator

1.1 The size of the search space Modeling the problem Change over time Constraints... 21

STUDY OF SLUG CONTROL TECHNIQUES IN PIPELINE SYSTEMS

/435 Artificial Intelligence Fall 2015

Roller AC Servo System

IEEE TRANSACTIONS ON COMPUTERS, VOL.54, NO.11, NOVEMBER The VPC Trace-Compression Algorithms

Tokyo: Simulating Hyperpath-Based Vehicle Navigations and its Impact on Travel Time Reliability

Transposition Table, History Heuristic, and other Search Enhancements

Examples of Carter Corrected DBDB-V Applied to Acoustic Propagation Modeling

#19 MONITORING AND PREDICTING PEDESTRIAN BEHAVIOR USING TRAFFIC CAMERAS

LOCOMOTION CONTROL CYCLES ADAPTED FOR DISABILITIES IN HEXAPOD ROBOTS

The system design must obey these constraints. The system is to have the minimum cost (capital plus operating) while meeting the constraints.

Appendix A COMPARISON OF DRAINAGE ALGORITHMS UNDER GRAVITY- DRIVEN FLOW DURING GAS INJECTION

ENHANCED PARKWAY STUDY: PHASE 2 CONTINUOUS FLOW INTERSECTIONS. Final Report

Using MATLAB with CANoe

A4 Operation Manual. Fig.1-1 Controller Socket Diagram

VPC3: A Fast and Effective Trace-Compression Algorithm

The HumiSys. RH Generator. Operation. Applications. Designed, built, and supported by InstruQuest Inc.

Autodesk Moldflow Communicator Process settings

Self-Organizing Signals: A Better Framework for Transit Signal Priority

Dwell Time and Immersion Depth Optimization For Immediate Defect Reduction

Word-based Statistical Compressors as Natural Language Compression Boosters

Transcription:

Instruction Cache Compression for Embedded Systems by Yujia Jin and Rong Chen Abstract Code compression could lead to less overall system die area and therefore less cost. This is significant in the embedded system field where cost is very sensitive. In most of the recent approaches for code compression, only instruction ROM is compressed. Decompression is done between the cache and memory, and instruction cache is kept uncompressed. Additional saving could be achieved if the decompression unit is moved to between CPU and cache, and keep the instruction cache compressed as well. In this project we explored the issues for compressing the instruction cache. In the process, we constructed a high level implementation for a -bit, 5-stage pipeline MIPS like processor with compressed instruction cache. We developed a compression algorithm with instruction level random access within the compressed file. In addition we devised a branch compensation cache, a small cache mechanism to alleviate the unique branching penalties that branch prediction cannot reduce.. Introduction Code compression is a general technique. A common method is the Compressed Code RISC Processor (CCRP)[], which is show in figure. It breaks the program into blocks of n, where n corresponds to the cache line size. Each blocks is compressed individually by a sui algorithm. A Line Address Table (LAT) is used to record the address of each compressed cache line within the compressed program. Cache Lookaside Buffer () is added to alleviate LAT lookup cost. During program execution, upon each cache miss, LAT entry cached in is used to calculate the compressed cache line address. The compressed cache line is then fetched from memory, decompressed, and placed into the instruction cache. The most commonly used algorithms for block compression are variations of Huffman and arithmetic that compresses serially within the block, byte wise. A few of such algorithm can be found in [], [5], and []. In this project we modify CCRP to compress the instruction cache. The organization of rest of the paper is as follow. In section, necessary modifications for the processor are discussed. In section 3, compression algorithm is discussed. In section, branch compensation cache is discussed. In section 5, results are shown. Finally, in section, our conclusions are stated.. Pipeline Design is done on the -bit simple scalar instruction set, which is similar to MIPS. We assume a simple 5-stage pipeline processor for ease of development. In order to compress the instruction cache, decompression must be done after the cache. Therefore the CPU must now be modified to include additional functions. ) Address translation from the uncompressed version to the compressed version for each instruction. () ) Instruction decompression. () These additional sections are added to the usual 5-stage pipeline as shown in figure. The section implements ) above, and implements ) above. The IF stage will now fetch the compressed instruction instead of the uncompressed instruction. The stage length for and are both dependent on the compression algorithm. The additional and sections are both before the ID stage. Thus stages within these sections will add to branch penalty. In addition, these penalties cannot be reduced by branch prediction since they are before the ID stage, where instruction opcode is first being identified. C P U I $ ular address com pressed address IF C L B Compressed instruction O riginal instruction Cache(compressed address) com pressed instruction C a c h e R efill E n g ine fig u r e Instruction M e m o r y L A T IF ID IE M EM W B figure 3. Compression Algorithm 3.. Problem Compression algorithm used must have simple and sections, or it will lead to large branch penalty. The usual CCRP compression algorithm that compresses serially within the block, byte wise, will translate to stage, even with the assumption of single stage byte decompression, for our -bit instruction. Another problem with the standard CCRP compression algorithm is its granularity of random access. With CCRP, random access is only at block level. If the program counter jumps from one compressed block to another and it is the very last instruction in the block that it is jumping to, then all instructions within the block must be decompressed before the actual instruction will be fetched. This will lead to additional (n- )*( + ) stages of delay, where n is the number of instruction within the block, and are

number of stages within the and section, respectively. Therefore the best compression algorithm in term of branch penalty is one with instruction level random access, or n=, and and of a single stage. 3.. Algorithm We devise such an algorithm. It can be thought of as a binary Huffman with only two compressed symbol length, but due to its similarity to lookup we refer to it as Table. It uses s, each with 5, -bit entries. Each -bit instruction is compressed individually as follow. ) Divide the -bit instruction into sections of -bit. ) Search content of for section of the instruction. If found, record the entry number. 3) Repeat ) for section with, section 3 with 3, and section with. ) If all four sections can be replaced by an entry number into the corresponding, then the instruction is compressed by replacing it with the four, bit entry numbers. Otherwise, the instruction remains uncompressed. 5) A 9 bit LAT entry is used for tracking every instructions. It starts with a 3-bit base, which equals the compressed address for the first instruction. The rest of bits are on or off depending on whether the corresponding instruction is compressed or not. Since this method tracts each instruction individually, the inter-block jump problem is gone. For the section, decompression is either nothing or lookups in parallel. So one stage is sufficient. For the section, it is simply a lookup follow by some adding in a tree of adders. Similar structure is used in []. They assume it could be done in one cycle, with lookup taking half and adding taking another half. So we make the same assumption. 3.3. Details With the Table compression algorithm, the compressed instructions can be either or byte long. This could lead to misalignment problem for instruction cache access in case of -byte instruction. For example, an - byte instruction can have its first byte in the end of one cache line and its last byte in the start of another cache line. This will result cache accesses for a single instruction fetch. To solve this, instruction cache is divided into two banks, with each bank -byte wide. The first bank is used to store the upper half word of the - bit word. The second bank is used to store the lower half. Since every -byte instruction must have its two byte halves in different banks, simple logic can be used to ensure each bank is accessed correctly to fetch the instruction in one cycle. The determination of the content for the s is critical in achieving a good compression for this method. Between the s, they can keep 5, or gig entries of distinct instructions. However, for every entry within a, 5 3, or meg entries of instructions will take on that same section. So it is quantity without quality. The problem is to determine the content such that maximum number of program instructions can be compressed. Mathematically, we are maximizing Σ i Σ j Σ k Σ l f(a i B j C k D l ), where A i, B j, C k, D l are entries in,, 3,, respectively, and f(a i B j C k D l ) is the occurrence frequency within the program for instruction A i B j C k D l. This is like an unate covering problem. So it is potentially NP complete. Therefore we use the following heuristic. The 5 most frequently occurring bit symbols in section i of all the program instructions is placed into i. 3.. Result In figure 3 is the compression result for Table compression with the heuristic. Applications used are programs in spec95. On average Table can compress to 7% of the original size. In comparison to CCRP with Huffman byte serial compression at block size of, we loose about % on average. This % lost is partly due to the smaller granularity of random access we have achieved. In general the smaller granularity of random access, the less compression will be achieved. This can compression rate (cmp/orig).... be observed again with gzip s result, which does not provide any random access. On average it compresses to % of the original size, which is 3% better than CCRP with Huffman.. Branch Compensation Cache (BCC).. Problem Find out it s a jump, has to flush wave5 Gzip Vs. Huff Vs. Table IF ijpeg IF Restart the pipeline compress95 figure 3 figure more branch penalty for modified pipeline As mentioned earlier, in order to perform decompression after instruction cache (between the I-cache and the CPU), we add two more stages into the pipeline before ID: (cache lookaside buffer) and cc gzip man

(decompression). As a result, branch penalty is increased to three cycles. This is illustrated in figure. Originally, in ular five-stage pipeline, the branch penalty is only one stage (IF), but in our seven-stage pipeline, the branch penalty increases to three stages (, IF, ). Obviously it is not good, so we need a solution... Solution The solution is to add a branch compensation cache (BCC) and try to pre-store the target instructions there. Whenever we encounter a branch (or more precisely, a PC jump), go to the BCC and check if the target instruction is there. The basic idea is shown in figure 5. In figure 5, a PC jump is found at the ID stage, so we go to check BCC to see if the target instruction is pre-stored there. If no, then we have to go through, and ID pipeline stages; but if yes, then we simply fetch it and keep going, no branch penalty at all in such case. we also go to the BCC to check if the required target instruction is pre-stored there. If no, then keep running the restarted pipeline; if yes, then we directly fetch the target instruction from BCC and flush/restart the pipeline for a nd time. The nd restarted pipeline is used to provide the sequential instructions after the jump. In order to completely eliminate the penalty incurred by a jump, we require T, T+, T+, T+ instructions are all prestored in BCC upon a hit. So the nd restarted pipeline starts stage with T+3 instruction, where T is the target instruction, T+ is the next instruction, and so on....... 5 5 9 9 3 37 CPU addr addr I $ ID jump figure 7 compress in spec95 ID I $ addr no Is target instr. in BCC?.5..5..5 IE BCC yes 5 5 9 9 3 37 figure ijpeg in spec95 figure 5 use BCC to reduce branch penalty Find out it s a jump The following stages are flushed PC PC+ IF PC+ IF PC+..35.3.5..5..5 5 5 9 9 3 37 Restart a new pipeline, try to get target instruction figure 9 gcc in spec95 st restarted pipeline T T+ BCC At the same time, check if T is pre-stored in BCC. If no, continue; If yes,flush and restart the pipeline again....... 5 5 9 9 3 37 T+ nd restarted pipeline T+ figure wave5 in spec95 figure details of BCC implementation Figure shows a more detailed pipeline implementation, where the key points are: At ID stage we find out a jump instruction being taken, so we must flush the current pipeline and restart. The restarted pipeline is used to get the target instruction through normal stages, i.e. using to get the compressed address from the ular address, using IF to fetch the decompressed instruction, using to decompress it to get target instruction. Simultaneously, 5. Result 5.. Experiment Setup Simple Scalar 3. is modified to simulate compressed instruction cache and branch compensation cache behaviors. configuration of entries is used where relevant. Instruction cache format of direct map, byte block size with random replacement policy is used. 5.. BCC Performance To quantify the BCC performance, we simulate it on several applications such as spec95 compress, ijpeg, gcc

and wave5. In the simulation, the cache block size is kept as -byte long, while the block number varies from,,,,, to 9 to give different cache size. Directly mapped cache is used and the replacement policy is least recently used (LRU). Figure 7 - show the results. From the simulation results we can see that for a fairly small branch compensation cache (KB ~ KB), the branch penalty is significantly reduced, which indicates our approach is very effective...... -. 3 C a c h e P e rform a n c e (JP E G ) 5 9 37 in stru c tio n siz e (b y te ) C a c h e C o m p a r is o n ( c o m p r e s s 9 5 ) ula r diff 5.. Area Versus CPI Analysis Area versus CPI analysis is carried out for the following configurations on wave5, ijpeg, compress95, and cc applications. ) Regular -bit, 5-stage pipelined MIPS processor without any code compression. ) Code compression only in instruction ROM by Huffman encoding as in CCRP. 3) Code compression with Table method to keep both the instruction ROM and instruction cache compressed. ) Same as in configuration 3) with BCC added..5 µm technology is assumed. Total die area is increase by increasing instruction cache size. Results are shown in figure. It is clear in all cases that code A r e a P e r f o r m a n c e A n a lysis (jpeg)..... ula r d iff ular ta b le ta b le w b $ -. 3 5 9 s iz e ( b y t e ) 37 total area (m m in.5 um ) Area Performance Analysis (compression95)......... 5 C a c h e C o m p a r is o n ( c c ) 9 37 s i z e (b y te ) C a c h e C o m p a rison (w a v e 5 ) 9 3 s i z e (b y te ) ula r diff re g f i g u r e p e r f o r ma n c e a n a l y s i s 5.3. Compressed Cache Performance Experiments are performed on wave5, ijpeg, compress95, and cc within the spec95 benchmark. Results are displayed in graph figure which shows compressed cache with Table algorithm do outperform uncompressed cache, especially within a ion of instruction cache size where uncompressed cache is getting from to 9 %. The improvement could go as high as near %, which is shown in compress95 s result. This is as expected since compressed cache contains more instructions and this translates to better hit rate. The reason that there is a window of sizes where cache compression is more effective is because this is the thrashing ion and a small increase in cache size could give big improvement. Compression in cache is like a virtual cache increase. For example 7% compression in cache could give a cache that is. times the original size. Therefore cache compression is especially effective within this thrashing ion. So the original idea that compressed instruction cache can lead to smaller instruction cache is valid. d iff die size (m m in.5 um ) Area Performance Analysis (cc) 5 5 die size (m m in.5 um ) Area Performace Analysis (wave5) die size (m m in.5 um ) w b$ w b$ with b$ f i g u r e a r e a p e r f o r m a n c e a n a l y s i s compression at any level results smaller die size for similar CPI performance machines. The cache compression configurations are worse in die area against the CCRP configuration in ), except in very low CPI ion, because the excess loss in ROM offset the saving in instruction cache. The addition of BCC doesn t improve much except in the low CPI ion because branching penalty is less of a factor than the cache miss when determining CPI outside this ion.. Conclusions We observe a tradeoff between granularity of random access and compression rate, where smaller granularity implies less compression. To avoid access branch penalty, smaller granularity of random access than CCRP (at cache line granularity) is forced in order to compress the cache. Consequently, compression is less in instruction ROM than CCRP scenario. This drawback offsets any saving in instruction cache, except in ion where instruction cache is big relative to overall system

and CPI is very low. Consequently, in the interest of embedded system, where cache size is always small relative to the overall system, instruction cache compression is not useful in comparison to the CCRP approach. Although instruction cache compression is not effective in embedded system, it can be important in area where cache performance is more important than the instruction ROM die area. For example, in high performance computing, where large instruction cache is useful in improving, but painful in dealing with the critical path analysis. Here with instruction cache compression, one could potentially provide a cache performance that is /(compression rate-lat) times the physical size. Our current Table method can be improved by following. ) Provide optimal entries, which enable us to compress more instructions. Since entries calculations are done in preprocessing, the potential exponential amount of time required may not be a problem. If it does become a time problem, better heuristics can definitely be devised. ) Provide multiple levels of s, which can give us more compression. Current Table method has a lower compression limit of about 5% of the original size. If multiple levels of s are used, for example entries s, entries s and 5 entries s, then we can compress with entries s first. If it falls then use the next level of s. The advantage here is higher level s with lease entries can compress more since pointer into the has less bits. [7] C. Lefurgy, E. Piccininni and T. Mudge, Reducing code size with run-time decompression, EECS Dept., Univ. of Michigan,. 7. Reference [] Haris Lekatsas and Wayne Wolf. Random access decompression using binary arithmetic coding. In Proc. Data Compression Conference, pages 3-35, March 999. [] Y. Yoshida, B.-Y. Song, H. Okuhata, T. Onoye, and I. Shirakawa. An object code compression approach to embedded processors. In International Symposium on Low Power Electronics and Design (ISLPED), pages 5-. ACM, August 997. [3] Martin Benes, Steven M. Nowick, and Andrew Wolfe. A fast asynchronous Huffman decoder for compressed-code embedded processors. In Proc. International Symposium on Advanced Research in Asynchronous Circuits and Systems, September 99. [] Stan Liao, Srinivas Devadas, Kurt Keutzer, Steve Tjiang, and Albert Wang. Code optimization techniques for embedded DSP microprocessors. In Proc. ACM/IEEE Design Automation Conference, 995. [5] Haris Lekatsas and Wayne Wolf. Code Compression for Embedded Systems. In Proc. 35 th Design Automation Conference, 99. [] A. Wolfe and A. Chanin. Executing compressed programs on an embedded RISC architecture. In Proc. Int'l Symp. on Microarchitecture, 99.