ChampSim
CACHE Class Reference

#include <cache.h>

Inheritance diagram for CACHE:
[legend]
Collaboration diagram for CACHE:
[legend]

Classes

struct  BLOCK
 
class  Builder
 
class  builder_conversion_tag
 
struct  module_concept
 
struct  module_model
 
struct  mshr_type
 
struct  tag_lookup_type
 

Public Types

using stats_type = cache_stats
 

Public Member Functions

long operate () override final
 
void initialize () override final
 
void begin_phase () override final
 
void end_phase (unsigned cpu) override final
 
std::size_t get_occupancy (uint8_t queue_type, uint64_t address)
 
std::size_t get_size (uint8_t queue_type, uint64_t address)
 
std::size_t get_mshr_occupancy () const
 
std::size_t get_mshr_size () const
 
double get_mshr_occupancy_ratio () const
 
std::vector< std::size_t > get_rq_occupancy () const
 
std::vector< std::size_t > get_rq_size () const
 
std::vector< double > get_rq_occupancy_ratio () const
 
std::vector< std::size_t > get_wq_occupancy () const
 
std::vector< std::size_t > get_wq_size () const
 
std::vector< double > get_wq_occupancy_ratio () const
 
std::vector< std::size_t > get_pq_occupancy () const
 
std::vector< std::size_t > get_pq_size () const
 
std::vector< double > get_pq_occupancy_ratio () const
 
uint64_t get_set (uint64_t address) const
 
uint64_t get_way (uint64_t address, uint64_t set) const
 
uint64_t invalidate_entry (uint64_t inval_addr)
 
int prefetch_line (uint64_t pf_addr, bool fill_this_level, uint32_t prefetch_metadata)
 
int prefetch_line (uint64_t ip, uint64_t base_addr, uint64_t pf_addr, bool fill_this_level, uint32_t prefetch_metadata)
 
void print_deadlock () override
 
void impl_prefetcher_initialize ()
 
uint32_t impl_prefetcher_cache_operate (uint64_t addr, uint64_t ip, uint8_t cache_hit, bool useful_prefetch, uint8_t type, uint32_t metadata_in)
 
uint32_t impl_prefetcher_cache_fill (uint64_t addr, uint32_t set, uint32_t way, uint8_t prefetch, uint64_t evicted_addr, uint32_t metadata_in)
 
void impl_prefetcher_cycle_operate ()
 
void impl_prefetcher_final_stats ()
 
void impl_prefetcher_branch_operate (uint64_t ip, uint8_t branch_type, uint64_t branch_target)
 
void impl_initialize_replacement ()
 
uint32_t impl_find_victim (uint32_t triggering_cpu, uint64_t instr_id, uint32_t set, const BLOCK *current_set, uint64_t ip, uint64_t full_addr, uint32_t type)
 
void impl_update_replacement_state (uint32_t triggering_cpu, uint32_t set, uint32_t way, uint64_t full_addr, uint64_t ip, uint64_t victim_addr, uint32_t type, uint8_t hit)
 
void impl_replacement_final_stats ()
 
template<unsigned long long P_FLAG, unsigned long long R_FLAG>
 CACHE (Builder< P_FLAG, R_FLAG > b)
 
- Public Member Functions inherited from champsim::operable
 operable (double scale)
 
long _operate ()
 

Public Attributes

std::vector< channel_type * > upper_levels
 
channel_typelower_level
 
channel_typelower_translate
 
uint32_t cpu = 0
 
const std::string NAME
 
const uint32_t NUM_SET
 
const uint32_t NUM_WAY
 
const uint32_t MSHR_SIZE
 
const std::size_t PQ_SIZE
 
const uint64_t HIT_LATENCY
 
const uint64_t FILL_LATENCY
 
const unsigned OFFSET_BITS
 
set_type block {NUM_SET * NUM_WAY}
 
const long int MAX_TAG
 
const long int MAX_FILL
 
const bool prefetch_as_load
 
const bool match_offset_bits
 
const bool virtual_prefetch
 
bool ever_seen_data = false
 
const unsigned pref_activate_mask = (1 << champsim::to_underlying(access_type::LOAD)) | (1 << champsim::to_underlying(access_type::PREFETCH))
 
stats_type sim_stats
 
stats_type roi_stats
 
std::deque< mshr_typeMSHR
 
std::deque< mshr_typeinflight_writes
 
std::unique_ptr< module_conceptmodule_pimpl
 
- Public Attributes inherited from champsim::operable
const double CLOCK_SCALE
 
double leap_operation = 0
 
uint64_t current_cycle = 0
 
bool warmup = true
 

Private Types

enum  FILL_LEVEL {
  FILL_L1 = 1 , FILL_L2 = 2 , FILL_LLC = 4 , FILL_DRC = 8 ,
  FILL_DRAM = 16
}
 
using channel_type = champsim::channel
 
using request_type = typename channel_type::request_type
 
using response_type = typename channel_type::response_type
 
using set_type = std::vector< BLOCK >
 

Private Member Functions

bool try_hit (const tag_lookup_type &handle_pkt)
 
bool handle_fill (const mshr_type &fill_mshr)
 
bool handle_miss (const tag_lookup_type &handle_pkt)
 
bool handle_write (const tag_lookup_type &handle_pkt)
 
void finish_packet (const response_type &packet)
 
void finish_translation (const response_type &packet)
 
void issue_translation ()
 
std::pair< set_type::iterator, set_type::iterator > get_set_span (uint64_t address)
 
std::pair< set_type::const_iterator, set_type::const_iterator > get_set_span (uint64_t address) const
 
std::size_t get_set_index (uint64_t address) const
 
template<typename T >
bool should_activate_prefetcher (const T &pkt) const
 
template<bool >
auto initiate_tag_check (champsim::channel *ul=nullptr)
 

Private Attributes

std::deque< tag_lookup_typeinternal_PQ {}
 
std::deque< tag_lookup_typeinflight_tag_check {}
 
std::deque< tag_lookup_typetranslation_stash {}
 

Member Typedef Documentation

◆ channel_type

◆ request_type

◆ response_type

◆ set_type

using CACHE::set_type = std::vector<BLOCK>
private

◆ stats_type

Member Enumeration Documentation

◆ FILL_LEVEL

enum CACHE::FILL_LEVEL
private
Enumerator
FILL_L1 
FILL_L2 
FILL_LLC 
FILL_DRC 
FILL_DRAM 

Constructor & Destructor Documentation

◆ CACHE()

template<unsigned long long P_FLAG, unsigned long long R_FLAG>
CACHE::CACHE ( Builder< P_FLAG, R_FLAG >  b)
inlineexplicit

Member Function Documentation

◆ begin_phase()

void CACHE::begin_phase ( )
finaloverridevirtual

Reimplemented from champsim::operable.

◆ end_phase()

void CACHE::end_phase ( unsigned  cpu)
finaloverridevirtual

Reimplemented from champsim::operable.

◆ finish_packet()

void CACHE::finish_packet ( const response_type packet)
private

◆ finish_translation()

void CACHE::finish_translation ( const response_type packet)
private

◆ get_mshr_occupancy()

std::size_t CACHE::get_mshr_occupancy ( ) const

◆ get_mshr_occupancy_ratio()

double CACHE::get_mshr_occupancy_ratio ( ) const

◆ get_mshr_size()

std::size_t CACHE::get_mshr_size ( ) const

◆ get_occupancy()

std::size_t CACHE::get_occupancy ( uint8_t  queue_type,
uint64_t  address 
)

◆ get_pq_occupancy()

std::vector< std::size_t > CACHE::get_pq_occupancy ( ) const

◆ get_pq_occupancy_ratio()

std::vector< double > CACHE::get_pq_occupancy_ratio ( ) const

◆ get_pq_size()

std::vector< std::size_t > CACHE::get_pq_size ( ) const

◆ get_rq_occupancy()

std::vector< std::size_t > CACHE::get_rq_occupancy ( ) const

◆ get_rq_occupancy_ratio()

std::vector< double > CACHE::get_rq_occupancy_ratio ( ) const

◆ get_rq_size()

std::vector< std::size_t > CACHE::get_rq_size ( ) const

◆ get_set()

uint64_t CACHE::get_set ( uint64_t  address) const

◆ get_set_index()

std::size_t CACHE::get_set_index ( uint64_t  address) const
private

◆ get_set_span() [1/2]

auto CACHE::get_set_span ( uint64_t  address)
private

◆ get_set_span() [2/2]

auto CACHE::get_set_span ( uint64_t  address) const
private

◆ get_size()

std::size_t CACHE::get_size ( uint8_t  queue_type,
uint64_t  address 
)

◆ get_way()

uint64_t CACHE::get_way ( uint64_t  address,
uint64_t  set 
) const

◆ get_wq_occupancy()

std::vector< std::size_t > CACHE::get_wq_occupancy ( ) const

◆ get_wq_occupancy_ratio()

std::vector< double > CACHE::get_wq_occupancy_ratio ( ) const

◆ get_wq_size()

std::vector< std::size_t > CACHE::get_wq_size ( ) const

◆ handle_fill()

bool CACHE::handle_fill ( const mshr_type fill_mshr)
private

◆ handle_miss()

bool CACHE::handle_miss ( const tag_lookup_type handle_pkt)
private

◆ handle_write()

bool CACHE::handle_write ( const tag_lookup_type handle_pkt)
private

◆ impl_find_victim()

uint32_t CACHE::impl_find_victim ( uint32_t  triggering_cpu,
uint64_t  instr_id,
uint32_t  set,
const BLOCK current_set,
uint64_t  ip,
uint64_t  full_addr,
uint32_t  type 
)
inline

◆ impl_initialize_replacement()

void CACHE::impl_initialize_replacement ( )
inline

◆ impl_prefetcher_branch_operate()

void CACHE::impl_prefetcher_branch_operate ( uint64_t  ip,
uint8_t  branch_type,
uint64_t  branch_target 
)
inline

◆ impl_prefetcher_cache_fill()

uint32_t CACHE::impl_prefetcher_cache_fill ( uint64_t  addr,
uint32_t  set,
uint32_t  way,
uint8_t  prefetch,
uint64_t  evicted_addr,
uint32_t  metadata_in 
)
inline

◆ impl_prefetcher_cache_operate()

uint32_t CACHE::impl_prefetcher_cache_operate ( uint64_t  addr,
uint64_t  ip,
uint8_t  cache_hit,
bool  useful_prefetch,
uint8_t  type,
uint32_t  metadata_in 
)
inline

◆ impl_prefetcher_cycle_operate()

void CACHE::impl_prefetcher_cycle_operate ( )
inline

◆ impl_prefetcher_final_stats()

void CACHE::impl_prefetcher_final_stats ( )
inline

◆ impl_prefetcher_initialize()

void CACHE::impl_prefetcher_initialize ( )
inline

◆ impl_replacement_final_stats()

void CACHE::impl_replacement_final_stats ( )
inline

◆ impl_update_replacement_state()

void CACHE::impl_update_replacement_state ( uint32_t  triggering_cpu,
uint32_t  set,
uint32_t  way,
uint64_t  full_addr,
uint64_t  ip,
uint64_t  victim_addr,
uint32_t  type,
uint8_t  hit 
)
inline

◆ initialize()

void CACHE::initialize ( )
finaloverridevirtual

Reimplemented from champsim::operable.

◆ initiate_tag_check()

template<bool UpdateRequest>
auto CACHE::initiate_tag_check ( champsim::channel ul = nullptr)
private

◆ invalidate_entry()

uint64_t CACHE::invalidate_entry ( uint64_t  inval_addr)

◆ issue_translation()

void CACHE::issue_translation ( )
private

◆ operate()

long CACHE::operate ( )
finaloverridevirtual

Implements champsim::operable.

◆ prefetch_line() [1/2]

int CACHE::prefetch_line ( uint64_t  ip,
uint64_t  base_addr,
uint64_t  pf_addr,
bool  fill_this_level,
uint32_t  prefetch_metadata 
)

◆ prefetch_line() [2/2]

int CACHE::prefetch_line ( uint64_t  pf_addr,
bool  fill_this_level,
uint32_t  prefetch_metadata 
)

◆ print_deadlock()

void CACHE::print_deadlock ( )
overridevirtual

Reimplemented from champsim::operable.

◆ should_activate_prefetcher()

template<typename T >
bool CACHE::should_activate_prefetcher ( const T &  pkt) const
private

◆ try_hit()

bool CACHE::try_hit ( const tag_lookup_type handle_pkt)
private

Member Data Documentation

◆ block

set_type CACHE::block {NUM_SET * NUM_WAY}

◆ cpu

uint32_t CACHE::cpu = 0

◆ ever_seen_data

bool CACHE::ever_seen_data = false

◆ FILL_LATENCY

const uint64_t CACHE::FILL_LATENCY

◆ HIT_LATENCY

const uint64_t CACHE::HIT_LATENCY

◆ inflight_tag_check

std::deque<tag_lookup_type> CACHE::inflight_tag_check {}
private

◆ inflight_writes

std::deque<mshr_type> CACHE::inflight_writes

◆ internal_PQ

std::deque<tag_lookup_type> CACHE::internal_PQ {}
private

◆ lower_level

channel_type* CACHE::lower_level

◆ lower_translate

channel_type* CACHE::lower_translate

◆ match_offset_bits

const bool CACHE::match_offset_bits

◆ MAX_FILL

const long int CACHE::MAX_FILL

◆ MAX_TAG

const long int CACHE::MAX_TAG

◆ module_pimpl

std::unique_ptr<module_concept> CACHE::module_pimpl

◆ MSHR

std::deque<mshr_type> CACHE::MSHR

◆ MSHR_SIZE

const uint32_t CACHE::MSHR_SIZE

◆ NAME

const std::string CACHE::NAME

◆ NUM_SET

const uint32_t CACHE::NUM_SET

◆ NUM_WAY

const uint32_t CACHE::NUM_WAY

◆ OFFSET_BITS

const unsigned CACHE::OFFSET_BITS

◆ PQ_SIZE

const std::size_t CACHE::PQ_SIZE

◆ pref_activate_mask

const unsigned CACHE::pref_activate_mask = (1 << champsim::to_underlying(access_type::LOAD)) | (1 << champsim::to_underlying(access_type::PREFETCH))

◆ prefetch_as_load

const bool CACHE::prefetch_as_load

◆ roi_stats

stats_type CACHE::roi_stats

◆ sim_stats

stats_type CACHE::sim_stats

◆ translation_stash

std::deque<tag_lookup_type> CACHE::translation_stash {}
private

◆ upper_levels

std::vector<channel_type*> CACHE::upper_levels

◆ virtual_prefetch

const bool CACHE::virtual_prefetch

The documentation for this class was generated from the following files: