Documentation
¶
Overview ¶
Package cache provides the basic commonly used utility data structures for cache implementation.
Index ¶
- type BankedLowModuleFinder
- type Block
- type Directory
- type DirectoryImpl
- func (d *DirectoryImpl) FindVictim(addr uint64) *Block
- func (d *DirectoryImpl) GetSets() []Set
- func (d *DirectoryImpl) Lookup(PID ca.PID, reqAddr uint64) *Block
- func (d *DirectoryImpl) Reset()
- func (d *DirectoryImpl) TotalSize() uint64
- func (d *DirectoryImpl) Visit(block *Block)
- func (d *DirectoryImpl) WayAssociativity() int
- type FlushReq
- type FlushReqBuilder
- func (b FlushReqBuilder) Build() *FlushReq
- func (b FlushReqBuilder) DiscardInflight() FlushReqBuilder
- func (b FlushReqBuilder) InvalidateAllCacheLines() FlushReqBuilder
- func (b FlushReqBuilder) PauseAfterFlushing() FlushReqBuilder
- func (b FlushReqBuilder) WithDst(dst akita.Port) FlushReqBuilder
- func (b FlushReqBuilder) WithSendTime(t akita.VTimeInSec) FlushReqBuilder
- func (b FlushReqBuilder) WithSrc(src akita.Port) FlushReqBuilder
- type FlushRsp
- type FlushRspBuilder
- func (b FlushRspBuilder) Build() *FlushRsp
- func (b FlushRspBuilder) WithDst(dst akita.Port) FlushRspBuilder
- func (b FlushRspBuilder) WithRspTo(id string) FlushRspBuilder
- func (b FlushRspBuilder) WithSendTime(t akita.VTimeInSec) FlushRspBuilder
- func (b FlushRspBuilder) WithSrc(src akita.Port) FlushRspBuilder
- type InterleavedLowModuleFinder
- type LRUVictimFinder
- type LowModuleFinder
- type MSHR
- type MSHREntry
- type RestartReq
- type RestartReqBuilder
- type RestartRsp
- type RestartRspBuilder
- func (b RestartRspBuilder) Build() *RestartRsp
- func (b RestartRspBuilder) WithDst(dst akita.Port) RestartRspBuilder
- func (b RestartRspBuilder) WithRspTo(id string) RestartRspBuilder
- func (b RestartRspBuilder) WithSendTime(t akita.VTimeInSec) RestartRspBuilder
- func (b RestartRspBuilder) WithSrc(src akita.Port) RestartRspBuilder
- type Set
- type SingleLowModuleFinder
- type VictimFinder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BankedLowModuleFinder ¶
BankedLowModuleFinder defines the lower level modules by address banks
func NewBankedLowModuleFinder ¶
func NewBankedLowModuleFinder(bankSize uint64) *BankedLowModuleFinder
NewBankedLowModuleFinder returns a new BankedLowModuleFinder.
type Block ¶
type Block struct { PID ca.PID Tag uint64 WayID int SetID int CacheAddress uint64 IsValid bool IsDirty bool ReadCount int IsLocked bool DirtyMask []bool }
A Block of a cache is the information that is associated with a cache line
type Directory ¶
type Directory interface { Lookup(pid ca.PID, address uint64) *Block FindVictim(address uint64) *Block Visit(block *Block) TotalSize() uint64 WayAssociativity() int GetSets() []Set 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 address or physical address) to the cache based address.
func NewDirectory ¶
func NewDirectory( set, way, blockSize int, victimFinder VictimFinder, ) *DirectoryImpl
NewDirectory returns a new directory object
func (*DirectoryImpl) FindVictim ¶ added in v1.1.5
func (d *DirectoryImpl) FindVictim(addr uint64) *Block
FindVictim returns a block that can be used to stored data at address addr.
If it is valid, the cache controller need to decide what to do to evict the the data in the block
func (*DirectoryImpl) GetSets ¶ added in v1.1.5
func (d *DirectoryImpl) GetSets() []Set
GetSets returns all the sets in a directory
func (*DirectoryImpl) Lookup ¶
func (d *DirectoryImpl) Lookup(PID ca.PID, reqAddr uint64) *Block
Lookup finds the block that 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) Visit ¶ added in v1.1.5
func (d *DirectoryImpl) Visit(block *Block)
Visit moves the block to the end of the LRUQueue
func (*DirectoryImpl) WayAssociativity ¶
func (d *DirectoryImpl) WayAssociativity() int
WayAssociativity returns the number of ways per set in the cache.
type FlushReq ¶ added in v1.1.5
type FlushReq struct { akita.MsgMeta InvalidateAllCachelines bool DiscardInflight bool PauseAfterFlushing bool }
FlushReq is the request send to a cache unit to request it to flush all the cache lines.
type FlushReqBuilder ¶ added in v1.3.0
type FlushReqBuilder struct {
// contains filtered or unexported fields
}
FlushReqBuilder can build flush requests.
func (FlushReqBuilder) Build ¶ added in v1.3.0
func (b FlushReqBuilder) Build() *FlushReq
Build creates a new FlushReq
func (FlushReqBuilder) DiscardInflight ¶ added in v1.3.0
func (b FlushReqBuilder) DiscardInflight() FlushReqBuilder
DiscardInflight allows the flush request to build to discard all inflight requests.
func (FlushReqBuilder) InvalidateAllCacheLines ¶ added in v1.3.0
func (b FlushReqBuilder) InvalidateAllCacheLines() FlushReqBuilder
InvalidateAllCacheLines allows the flush request to build to invalidate all the cachelines in a cache unit.
func (FlushReqBuilder) PauseAfterFlushing ¶ added in v1.3.0
func (b FlushReqBuilder) PauseAfterFlushing() FlushReqBuilder
PauseAfterFlushing sets the flush request to build to pause the cache unit from processing future request until restart request is received.
func (FlushReqBuilder) WithDst ¶ added in v1.3.0
func (b FlushReqBuilder) WithDst(dst akita.Port) FlushReqBuilder
WithDst sets the destination of the message to build.
func (FlushReqBuilder) WithSendTime ¶ added in v1.3.0
func (b FlushReqBuilder) WithSendTime(t akita.VTimeInSec) FlushReqBuilder
WithSendTime sets the send time of the message to build.
func (FlushReqBuilder) WithSrc ¶ added in v1.3.0
func (b FlushReqBuilder) WithSrc(src akita.Port) FlushReqBuilder
WithSrc sets the source of the message to build
type FlushRsp ¶ added in v1.1.5
FlushRsp is the respond sent from the a cache unit for finishing a cache flush
type FlushRspBuilder ¶ added in v1.3.0
type FlushRspBuilder struct {
// contains filtered or unexported fields
}
FlushRspBuilder can build data ready responds.
func (FlushRspBuilder) Build ¶ added in v1.3.0
func (b FlushRspBuilder) Build() *FlushRsp
Build creates a new FlushRsp
func (FlushRspBuilder) WithDst ¶ added in v1.3.0
func (b FlushRspBuilder) WithDst(dst akita.Port) FlushRspBuilder
WithDst sets the destination of the request to build.
func (FlushRspBuilder) WithRspTo ¶ added in v1.3.0
func (b FlushRspBuilder) WithRspTo(id string) FlushRspBuilder
WithRspTo sets ID of the request that the respond to build is replying to.
func (FlushRspBuilder) WithSendTime ¶ added in v1.3.0
func (b FlushRspBuilder) WithSendTime( t akita.VTimeInSec, ) FlushRspBuilder
WithSendTime sets the send time of the message to build.
func (FlushRspBuilder) WithSrc ¶ added in v1.3.0
func (b FlushRspBuilder) WithSrc(src akita.Port) FlushRspBuilder
WithSrc sets the source of the request to build.
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 LRUVictimFinder ¶ added in v1.1.5
type LRUVictimFinder struct { }
LRUVictimFinder evicts the least recently used block to evict
func NewLRUVictimFinder ¶ added in v1.1.5
func NewLRUVictimFinder() *LRUVictimFinder
NewLRUVictimFinder returns a newly constructed lru evictor
func (*LRUVictimFinder) FindVictim ¶ added in v1.1.5
func (e *LRUVictimFinder) FindVictim(set *Set) *Block
FindVictim returns the least recently used block in a set
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(pid ca.PID, addr uint64) *MSHREntry Add(pid ca.PID, addr uint64) *MSHREntry Remove(pid ca.PID, addr uint64) *MSHREntry AllEntries() []*MSHREntry IsFull() bool Reset() }
MSHR is an interface that controls MSHR entries
type MSHREntry ¶
type MSHREntry struct { PID ca.PID Address uint64 Requests []interface{} Block *Block ReadReq *mem.ReadReq DataReady *mem.DataReadyRsp Data []byte }
MSHREntry is an entry in MSHR
type RestartReq ¶ added in v1.2.3
RestartReq is the request send to a cache unit to request it unpause the cache
func (*RestartReq) Meta ¶ added in v1.3.0
func (r *RestartReq) Meta() *akita.MsgMeta
Meta returns the meta data associated with the message.
type RestartReqBuilder ¶ added in v1.3.0
type RestartReqBuilder struct {
// contains filtered or unexported fields
}
RestartReqBuilder can build data ready responds.
func (RestartReqBuilder) Build ¶ added in v1.3.0
func (b RestartReqBuilder) Build() *RestartReq
Build creates a new RestartReq
func (RestartReqBuilder) WithDst ¶ added in v1.3.0
func (b RestartReqBuilder) WithDst(dst akita.Port) RestartReqBuilder
WithDst sets the destination of the request to build.
func (RestartReqBuilder) WithSendTime ¶ added in v1.3.0
func (b RestartReqBuilder) WithSendTime( t akita.VTimeInSec, ) RestartReqBuilder
WithSendTime sets the send time of the message to build.
func (RestartReqBuilder) WithSrc ¶ added in v1.3.0
func (b RestartReqBuilder) WithSrc(src akita.Port) RestartReqBuilder
WithSrc sets the source of the request to build.
type RestartRsp ¶ added in v1.2.3
RestartRsp is the respond sent from the a cache unit for finishing a cache flush
func (*RestartRsp) Meta ¶ added in v1.3.0
func (r *RestartRsp) Meta() *akita.MsgMeta
Meta returns the meta data accociated with the message.
type RestartRspBuilder ¶ added in v1.3.0
type RestartRspBuilder struct {
// contains filtered or unexported fields
}
RestartRspBuilder can build data ready responds.
func (RestartRspBuilder) Build ¶ added in v1.3.0
func (b RestartRspBuilder) Build() *RestartRsp
Build creates a new RestartRsp
func (RestartRspBuilder) WithDst ¶ added in v1.3.0
func (b RestartRspBuilder) WithDst(dst akita.Port) RestartRspBuilder
WithDst sets the destination of the request to build.
func (RestartRspBuilder) WithRspTo ¶ added in v1.3.0
func (b RestartRspBuilder) WithRspTo(id string) RestartRspBuilder
WithRspTo sets ID of the request that the respond to build is replying to.
func (RestartRspBuilder) WithSendTime ¶ added in v1.3.0
func (b RestartRspBuilder) WithSendTime( t akita.VTimeInSec, ) RestartRspBuilder
WithSendTime sets the send time of the message to build.
func (RestartRspBuilder) WithSrc ¶ added in v1.3.0
func (b RestartRspBuilder) WithSrc(src akita.Port) RestartRspBuilder
WithSrc sets the source of the request to build.
type SingleLowModuleFinder ¶
SingleLowModuleFinder is used when a unit is connected with only one low module
type VictimFinder ¶ added in v1.1.5
A VictimFinder decides with block should be evicted