-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCacheConfig.hh
More file actions
35 lines (24 loc) · 837 Bytes
/
Copy pathCacheConfig.hh
File metadata and controls
35 lines (24 loc) · 837 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#pragma once
#include <iostream>
#include <map>
#include <string>
using ConfigMap = std::map<std::string, std::string>;
enum class CacheType { Infinite, DirectMapped, SetAssociative };
struct CacheConfig {
CacheType type;
/* Total size in bytes */
uint64_t size;
/* Cache line size in bytes */
int line_size;
/* The size of a cache set, i.e. the "number of ways" */
int set_size;
CacheConfig(const CacheType type, const uint64_t size, const int line_size,
const int set_size = 1);
/* Construct a `CacheConfig` from a configuration file */
CacheConfig(std::istream&& config_file);
/* Construct a `CacheConfig` from a parameter mapping, as it would appear in a config
* file */
CacheConfig(const ConfigMap& config_map);
private:
void read_config_map_(const ConfigMap& config_map);
};