Documentation
¶
Index ¶
- func GetCacheLineID(addr uint64, blockSizeAsPowerOf2 uint64) (cacheLineID, offset uint64)
- type BankedLowModuleFinder
- type Block
- type Builder
- type Directory
- type DirectoryImpl
- type Evictor
- type InterleavedLowModuleFinder
- type LRUEvictor
- type LowModuleFinder
- type MSHR
- type MSHREntry
- type MSHRImpl
- type MockDirectory
- func (d *MockDirectory) AllExpectedCalled() bool
- func (d *MockDirectory) Evict(address uint64) *Block
- func (d *MockDirectory) ExpectEvict(addr uint64, block *Block)
- func (d *MockDirectory) ExpectLookup(addr uint64, block *Block)
- func (d *MockDirectory) Lookup(address uint64) *Block
- func (d *MockDirectory) Reset()
- func (d *MockDirectory) TotalSize() uint64
- func (d *MockDirectory) WayAssociativity() int
- type ProcessMSHRReturnEvent
- type ReadCompleteEvent
- type ReadForEvictEvent
- type ReadFromMSHREvent
- type SendEvent
- type Set
- type SetBankCycleLeftToZeroEvent
- type SingleLowModuleFinder
- type WriteAroundCache
- type WriteBackCache
- type WriteCompleteEvent
- type WriteFromBottomCompleteEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCacheLineID ¶
Types ¶
type BankedLowModuleFinder ¶
BankedLowModuleFinder defines the lower level modules by address banks
func NewBankedLowModuleFinder ¶
func NewBankedLowModuleFinder(bankSize uint64) *BankedLowModuleFinder
type Block ¶
type Block struct { Tag uint64 WayID int SetID int CacheAddress uint64 IsValid bool IsDirty bool IsLocked bool }
A Block of a cache is the information that is associated with a cache line
type Builder ¶
type Builder struct { Engine akita.Engine LowModuleFinder LowModuleFinder }
A Builder can build different types of cache components
func (*Builder) BuildWriteAroundCache ¶
func (b *Builder) BuildWriteAroundCache( name string, wayAssociativity int, byteSize uint64, numMSHREntry int, ) *WriteAroundCache
BuildWriteAroundCache creates a write-around cache
func (*Builder) BuildWriteBackCache ¶
func (b *Builder) BuildWriteBackCache( name string, wayAssociativity int, byteSize uint64, numMSHREntry int, ) *WriteBackCache
BuildWriteBackCache creates a write-back cache
type Directory ¶
type Directory interface { TotalSize() uint64 Lookup(address uint64) *Block Evict(address uint64) *Block WayAssociativity() int Reset() }
A Directory stores the information about what is stored in the cache.
type DirectoryImpl ¶
type DirectoryImpl struct { NumSets int NumWays int BlockSize int Sets []Set // contains filtered or unexported fields }
A DirectoryImpl is the default implementation of a Directory
The directory can translate from the request address (can be either virtual addree or physical address) to the cache based address.
func NewDirectory ¶
func NewDirectory(set int, way int, blockSize int, evictor Evictor) *DirectoryImpl
NewDirectory returns a new directory object
func (*DirectoryImpl) Evict ¶
func (d *DirectoryImpl) Evict(reqAddr uint64) *Block
Evict returns a block that can be used to stored the data at reqAddr.
If it is valid, the cache controller need to decide what to do to evict the the data in the block
func (*DirectoryImpl) Lookup ¶
func (d *DirectoryImpl) Lookup(reqAddr uint64) *Block
Lookup finds the block that stores the reqAddr. If the reqAddr is valid in the cache, return the block information. Otherwise, return nil
func (*DirectoryImpl) Reset ¶
func (d *DirectoryImpl) Reset()
Reset will mark all the blocks in the directory invalid
func (*DirectoryImpl) TotalSize ¶
func (d *DirectoryImpl) TotalSize() uint64
TotalSize returns the maximum number of bytes can be stored in the cache
func (*DirectoryImpl) WayAssociativity ¶
func (d *DirectoryImpl) WayAssociativity() int
WayAssociativity returns the number of ways per set in the cache.
type InterleavedLowModuleFinder ¶
type InterleavedLowModuleFinder struct { UseAddressSpaceLimitation bool LowAddress uint64 HighAddress uint64 InterleavingSize uint64 LowModules []akita.Port ModuleForOtherAddresses akita.Port }
InterleavedLowModuleFinder helps find the low module when the low modules maintains interleaved address space
func NewInterleavedLowModuleFinder ¶
func NewInterleavedLowModuleFinder(interleavingSize uint64) *InterleavedLowModuleFinder
NewInterleavedLowModuleFinder creates a new finder for interleaved lower modules
type LRUEvictor ¶
type LRUEvictor struct { }
LRUEvictor structure
func NewLRUEvictor ¶
func NewLRUEvictor() *LRUEvictor
NewLRUEvictor returns a newly constructed lru evictor
func (*LRUEvictor) Evict ¶
func (e *LRUEvictor) Evict(set *Set) *Block
Evict implements the eviction method
type LowModuleFinder ¶
LowModuleFinder helps a cache unit or a akita to find the low module that should hold the data at a certain address
type MSHR ¶
type MSHR interface { Query(addr uint64) *MSHREntry QueryByBlockTag(addr uint64) *MSHREntry Add(addr uint64) *MSHREntry Remove(addr uint64) *MSHREntry IsFull() bool }
MSHR is an interface that controls MSHR
type MSHRImpl ¶
type MSHRImpl struct { *akita.ComponentBase CapacityInNumEntries int // contains filtered or unexported fields }
MSHRImpl is a default implementation of MSHR
func (*MSHRImpl) Add ¶
Add creats a new entry in the mshr. The Address passed in needs to be the block ID.
func (*MSHRImpl) Query ¶
Query returns the entry mapped by the input address. If the address is not in MSHR, return nil
func (*MSHRImpl) QueryByBlockTag ¶
type MockDirectory ¶
type MockDirectory struct { Resetted bool // contains filtered or unexported fields }
func (*MockDirectory) AllExpectedCalled ¶
func (d *MockDirectory) AllExpectedCalled() bool
func (*MockDirectory) Evict ¶
func (d *MockDirectory) Evict(address uint64) *Block
func (*MockDirectory) ExpectEvict ¶
func (d *MockDirectory) ExpectEvict(addr uint64, block *Block)
func (*MockDirectory) ExpectLookup ¶
func (d *MockDirectory) ExpectLookup(addr uint64, block *Block)
func (*MockDirectory) Lookup ¶
func (d *MockDirectory) Lookup(address uint64) *Block
func (*MockDirectory) Reset ¶
func (d *MockDirectory) Reset()
func (*MockDirectory) TotalSize ¶
func (d *MockDirectory) TotalSize() uint64
func (*MockDirectory) WayAssociativity ¶
func (d *MockDirectory) WayAssociativity() int
type ProcessMSHRReturnEvent ¶
ProcessMSHRReturnEvent is an event to let the cache to process the requests associate with an MSHREntry
func NewProcessMSHRReturnEvent ¶
func NewProcessMSHRReturnEvent( time akita.VTimeInSec, handler akita.Handler, ) *ProcessMSHRReturnEvent
NewProcessMSHRReturnEvent creates a new ProcessMSHRReturnEvent
type ReadCompleteEvent ¶
A ReadCompleteEvent marks the completion of a cache read
func NewReadCompleteEvent ¶
func NewReadCompleteEvent( time akita.VTimeInSec, handler akita.Handler, ) *ReadCompleteEvent
NewReadCompleteEvent creates a new ReadCompleteEvent
type ReadForEvictEvent ¶
type ReadForEvictEvent struct { *akita.EventBase DataReady *mem.DataReadyRsp EvictBlock *Block NewBlock *Block ReadBottomReq *mem.ReadReq }
A ReadForEvictEvent marks the completion of a cache read. The data read is going to be written to the low module
func NewReadForEvictEvent ¶
func NewReadForEvictEvent( time akita.VTimeInSec, handler akita.Handler, ) *ReadForEvictEvent
NewReadForEvictEvent creates a new ReadForEvictEvent
type ReadFromMSHREvent ¶
ReadFromMSHREvent will respond data ready to the sender with the data that has not been written into the cache storage
func NewReadFromMSHREvent ¶
func NewReadFromMSHREvent( time akita.VTimeInSec, handler akita.Handler, ) *ReadFromMSHREvent
NewReadFromMSHREvent creates a new ReadFromMSHREvent
type SendEvent ¶
SendEvent triggers a cache to check its buffer and send requests out.
func NewSendEvent ¶
func NewSendEvent( time akita.VTimeInSec, handler akita.Handler, ) *SendEvent
NewSendEvent creates a new SendEvent
type SetBankCycleLeftToZeroEvent ¶
type SetBankCycleLeftToZeroEvent struct { *akita.EventBase // contains filtered or unexported fields }
func NewSetBankCycleLeftToZeroEvent ¶
func NewSetBankCycleLeftToZeroEvent( time akita.VTimeInSec, handler akita.Handler, bankNum int, ) *SetBankCycleLeftToZeroEvent
type SingleLowModuleFinder ¶
SingleLowModuleFinder is used when a unit is connected with only one low module
type WriteAroundCache ¶
type WriteAroundCache struct { *akita.ComponentBase ToTop akita.Port ToBottom akita.Port LowModuleFinder LowModuleFinder Freq akita.Freq DirectoryLatency int Latency int NumBank int BlockSizeAsPowerOf2 uint64 // contains filtered or unexported fields }
A WriteAroundCache is a cache that performs the write-through policy
func NewWriteAroundCache ¶
func NewWriteAroundCache( name string, engine akita.Engine, directory Directory, mshr MSHR, lowModuleFinder LowModuleFinder, storage *mem.Storage, ) *WriteAroundCache
NewWriteAroundCache creates a new write-through cache, injecting the dependency of the engine, the directory and the storage.
func (*WriteAroundCache) NotifyPortFree ¶
func (c *WriteAroundCache) NotifyPortFree(now akita.VTimeInSec, port akita.Port)
func (*WriteAroundCache) NotifyRecv ¶
func (c *WriteAroundCache) NotifyRecv(now akita.VTimeInSec, port akita.Port)
func (*WriteAroundCache) Reset ¶
func (c *WriteAroundCache) Reset()
func (*WriteAroundCache) SetNumBanks ¶
func (c *WriteAroundCache) SetNumBanks(n int)
type WriteBackCache ¶
type WriteBackCache struct { *akita.ComponentBase ToTop akita.Port ToBottom akita.Port Directory Directory Storage *mem.Storage Freq akita.Freq DirectoryLatency int Latency int NumBank int BlockSizeAsPowerOf2 uint64 // contains filtered or unexported fields }
A WriteBackCache is a cache that performs the write-through policy
func NewWriteBackCache ¶
func NewWriteBackCache( name string, engine akita.Engine, directory Directory, mshr MSHR, lowModuleFinder LowModuleFinder, storage *mem.Storage, ) *WriteBackCache
NewWriteBackCache creates a new write-through cache, injecting the dependency of the engine, the directory and the storage.
func (*WriteBackCache) NotifyPortFree ¶
func (c *WriteBackCache) NotifyPortFree(now akita.VTimeInSec, port akita.Port)
func (*WriteBackCache) NotifyRecv ¶
func (c *WriteBackCache) NotifyRecv(now akita.VTimeInSec, port akita.Port)
func (*WriteBackCache) SetNumBanks ¶
func (c *WriteBackCache) SetNumBanks(n int)
type WriteCompleteEvent ¶
type WriteCompleteEvent struct { *akita.EventBase WriteReq *mem.WriteReq Block *Block Offset uint64 }
A WriteCompleteEvent marks the completion of a write completion
func NewWriteCompleteEvent ¶
func NewWriteCompleteEvent( time akita.VTimeInSec, handler akita.Handler, ) *WriteCompleteEvent
NewWriteCompleteEvent creates a new WriteCompleteEvent
type WriteFromBottomCompleteEvent ¶
type WriteFromBottomCompleteEvent struct { *akita.EventBase DataReadyRsp *mem.DataReadyRsp ReadReq *mem.ReadReq Block *Block }
WriteFromBottomCompleteEvent is the event that represents a cache write operation triggered by a DataReadyRsp from the bottom
func NewWriteFromBottomCompleteEvent ¶
func NewWriteFromBottomCompleteEvent( time akita.VTimeInSec, handler akita.Handler, ) *WriteFromBottomCompleteEvent
NewWriteFromBottomCompleteEvent creates a new WriteCompleteEvent