summaryrefslogtreecommitdiff
path: root/inc/cache.h
blob: e808727d26f59f5a23d53d161f459766aca5bdca (plain)
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
#ifndef CACHE_H
#define CACHE_H
#include <storage.h>

class Cache : public Storage
{
  public:
  /**
   * Constructor.
   * @param The number of `lines` contained in memory. The total number of
   * words is this number multiplied by 4.
   * @param The next lowest level in storage. Methods from this object are
   * called in case of a cache miss.
   * @param The number of clock cycles each access takes.
   * @return A new cache object.
   */
  Cache(int lines, Storage *lower, int delay);
  ~Cache();

  Response *write(Accessor accessor, signed int data, int address) override;
  Response *read(Accessor accessor, int address) override;
  int **view(int base, int lines) override;
};

#endif /* CACHE_H_INCLUDED */