Blk access fn

From Msim

Jump to: navigation, search

blk_access_fn is a function structure that is used by the caches to make requests to later caches (or main memory).

Contents

Simulation Of

Each cache uses blk_access_fn to access a successive cache. Loads use this to handle misses, stores use this for write-back.

Definitions

unsigned long long (*blk_access_fn)(mem_cmd cmd, md_addr_t baddr, unsigned int bsize, cache_blk_t * blk, tick_t now, int context_id)

Basic Implementation

For non-last level caches:

  • if next level cache exists
    • latency = cache_access of the next level cache
    • adjust for power usage
    • if Read, return latency
    • else, return 0 (assumes unlimited write buffers)
  • else, access main memory
    • if Read, return memory access latency
    • else, return 0 (assumes unlimited write buffers)

For last level caches

  • Access main memory
    • if Read, return memory access latency
    • else, return 0 (assumes unlimited write buffers)

For TLBS

  • Check that user data exists (not really useful)
  • return tlb access latency

Usage

At cache creation time, this is provided to the cache constructor.
These are defined in sim-outorder.c.

Abstraction

blk_access_fn is defined as follows:

  • Return type: unsigned long long, represents the latency of the access to the next level cache.
  • mem_cmd cmd -> The type of request to the next level cache (Read/Write, this is an enum defined in memory.h)
  • md_addr_t baddr -> Address of the memory request
  • unsigned int bsize -> Size of the memory request in bytes
  • cache_blk_t * blk -> A pointer to the block (of the current cache) - used by tlbs to extract user_data, although, doesn't actually do anything.
  • tick_t now -> The time that the request is made
  • int context_id -> The thread that has made the request

Dependencies

  • memory.h
  • cache.h

Files

  • Prototyped by cache.h
  • Used by cache.c
  • Defined by sim-outorder.c
Personal tools