Documentation ¶
Overview ¶
Package mem and its subpackages provide definitions for memoy systems.
Index ¶
- Constants
- type AccessReq
- type AccessRsp
- type AddressConverter
- type BankedLowModuleFinder
- type ControlMsg
- type ControlMsgBuilder
- func (b ControlMsgBuilder) Build() *ControlMsg
- func (b ControlMsgBuilder) ToDiscardTransactions() ControlMsgBuilder
- func (b ControlMsgBuilder) ToNotifyDone() ControlMsgBuilder
- func (b ControlMsgBuilder) ToRestart() ControlMsgBuilder
- func (b ControlMsgBuilder) WithDst(dst sim.Port) ControlMsgBuilder
- func (b ControlMsgBuilder) WithSendTime(t sim.VTimeInSec) ControlMsgBuilder
- func (b ControlMsgBuilder) WithSrc(src sim.Port) ControlMsgBuilder
- type DataReadyRsp
- type DataReadyRspBuilder
- func (b DataReadyRspBuilder) Build() *DataReadyRsp
- func (b DataReadyRspBuilder) WithData(data []byte) DataReadyRspBuilder
- func (b DataReadyRspBuilder) WithDst(dst sim.Port) DataReadyRspBuilder
- func (b DataReadyRspBuilder) WithRspTo(id string) DataReadyRspBuilder
- func (b DataReadyRspBuilder) WithSendTime(t sim.VTimeInSec) DataReadyRspBuilder
- func (b DataReadyRspBuilder) WithSrc(src sim.Port) DataReadyRspBuilder
- type GL0InvalidateReq
- type GL0InvalidateReqBuilder
- func (b GL0InvalidateReqBuilder) Build() *GL0InvalidateReq
- func (b GL0InvalidateReqBuilder) WithDst(dst sim.Port) GL0InvalidateReqBuilder
- func (b GL0InvalidateReqBuilder) WithPID(pid vm.PID) GL0InvalidateReqBuilder
- func (b GL0InvalidateReqBuilder) WithSendTime(t sim.VTimeInSec) GL0InvalidateReqBuilder
- func (b GL0InvalidateReqBuilder) WithSrc(src sim.Port) GL0InvalidateReqBuilder
- type GL0InvalidateRsp
- type GL0InvalidateRspBuilder
- func (b GL0InvalidateRspBuilder) Build() *GL0InvalidateRsp
- func (b GL0InvalidateRspBuilder) WithDst(dst sim.Port) GL0InvalidateRspBuilder
- func (b GL0InvalidateRspBuilder) WithPID(pid vm.PID) GL0InvalidateRspBuilder
- func (b GL0InvalidateRspBuilder) WithRspTo(id string) GL0InvalidateRspBuilder
- func (b GL0InvalidateRspBuilder) WithSendTime(t sim.VTimeInSec) GL0InvalidateRspBuilder
- func (b GL0InvalidateRspBuilder) WithSrc(src sim.Port) GL0InvalidateRspBuilder
- type InterleavedLowModuleFinder
- type InterleavingConverter
- type LowModuleFinder
- type ReadReq
- type ReadReqBuilder
- func (b ReadReqBuilder) Build() *ReadReq
- func (b ReadReqBuilder) CanWaitForCoalesce() ReadReqBuilder
- func (b ReadReqBuilder) WithAddress(address uint64) ReadReqBuilder
- func (b ReadReqBuilder) WithByteSize(byteSize uint64) ReadReqBuilder
- func (b ReadReqBuilder) WithDst(dst sim.Port) ReadReqBuilder
- func (b ReadReqBuilder) WithInfo(info interface{}) ReadReqBuilder
- func (b ReadReqBuilder) WithPID(pid vm.PID) ReadReqBuilder
- func (b ReadReqBuilder) WithSendTime(t sim.VTimeInSec) ReadReqBuilder
- func (b ReadReqBuilder) WithSrc(src sim.Port) ReadReqBuilder
- type SingleLowModuleFinder
- type Storage
- type WriteDoneRsp
- type WriteDoneRspBuilder
- func (b WriteDoneRspBuilder) Build() *WriteDoneRsp
- func (b WriteDoneRspBuilder) WithDst(dst sim.Port) WriteDoneRspBuilder
- func (b WriteDoneRspBuilder) WithRspTo(id string) WriteDoneRspBuilder
- func (b WriteDoneRspBuilder) WithSendTime(t sim.VTimeInSec) WriteDoneRspBuilder
- func (b WriteDoneRspBuilder) WithSrc(src sim.Port) WriteDoneRspBuilder
- type WriteReq
- type WriteReqBuilder
- func (b WriteReqBuilder) Build() *WriteReq
- func (b WriteReqBuilder) CanWaitForCoalesce() WriteReqBuilder
- func (b WriteReqBuilder) WithAddress(address uint64) WriteReqBuilder
- func (b WriteReqBuilder) WithData(data []byte) WriteReqBuilder
- func (b WriteReqBuilder) WithDirtyMask(mask []bool) WriteReqBuilder
- func (b WriteReqBuilder) WithDst(dst sim.Port) WriteReqBuilder
- func (b WriteReqBuilder) WithInfo(info interface{}) WriteReqBuilder
- func (b WriteReqBuilder) WithPID(pid vm.PID) WriteReqBuilder
- func (b WriteReqBuilder) WithSendTime(t sim.VTimeInSec) WriteReqBuilder
- func (b WriteReqBuilder) WithSrc(src sim.Port) WriteReqBuilder
Constants ¶
const ( KB uint64 = 1 << (10 * iota) MB GB TB )
For capacity
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessReq ¶
AccessReq abstracts read and write requests that are sent to the cache modules or memory controllers.
type AddressConverter ¶
type AddressConverter interface { ConvertExternalToInternal(external uint64) uint64 ConvertInternalToExternal(internal uint64) uint64 }
AddressConverter can translate the address between two domains
type BankedLowModuleFinder ¶
BankedLowModuleFinder defines the lower level modules by address banks
func NewBankedLowModuleFinder ¶
func NewBankedLowModuleFinder(bankSize uint64) *BankedLowModuleFinder
NewBankedLowModuleFinder returns a new BankedLowModuleFinder.
type ControlMsg ¶
ControlMsg is the commonly used message type for controlling the components on the memory hierarchy. It is also used for resonpding the original requester with the Done field.
func (*ControlMsg) Meta ¶
func (m *ControlMsg) Meta() *sim.MsgMeta
Meta returns the meta data assocated with the ControlMsg.
type ControlMsgBuilder ¶
type ControlMsgBuilder struct {
// contains filtered or unexported fields
}
A ControlMsgBuilder can build control messages.
func (ControlMsgBuilder) Build ¶
func (b ControlMsgBuilder) Build() *ControlMsg
Build creates a new ControlMsg.
func (ControlMsgBuilder) ToDiscardTransactions ¶
func (b ControlMsgBuilder) ToDiscardTransactions() ControlMsgBuilder
ToDiscardTransactions sets the discard transactions bit of the control messages to 1.
func (ControlMsgBuilder) ToNotifyDone ¶
func (b ControlMsgBuilder) ToNotifyDone() ControlMsgBuilder
ToNotifyDone sets the "notify done" bit of the control messages to 1.
func (ControlMsgBuilder) ToRestart ¶
func (b ControlMsgBuilder) ToRestart() ControlMsgBuilder
ToRestart sets the restart bit of the control messages to 1.
func (ControlMsgBuilder) WithDst ¶
func (b ControlMsgBuilder) WithDst(dst sim.Port) ControlMsgBuilder
WithDst sets the destination of the request to build.
func (ControlMsgBuilder) WithSendTime ¶
func (b ControlMsgBuilder) WithSendTime( t sim.VTimeInSec, ) ControlMsgBuilder
WithSendTime sets the send time of the message to build.
func (ControlMsgBuilder) WithSrc ¶
func (b ControlMsgBuilder) WithSrc(src sim.Port) ControlMsgBuilder
WithSrc sets the source of the request to build.
type DataReadyRsp ¶
type DataReadyRsp struct { sim.MsgMeta RespondTo string // The ID of the request it replies Data []byte }
A DataReadyRsp is the respond sent from the lower module to the higher module that carries the data loaded.
func (*DataReadyRsp) GetRspTo ¶
func (r *DataReadyRsp) GetRspTo() string
GetRspTo returns the ID if the request that the respond is responding to.
func (*DataReadyRsp) Meta ¶
func (r *DataReadyRsp) Meta() *sim.MsgMeta
Meta returns the meta data attached to each message.
type DataReadyRspBuilder ¶
type DataReadyRspBuilder struct {
// contains filtered or unexported fields
}
DataReadyRspBuilder can build data ready responds.
func (DataReadyRspBuilder) Build ¶
func (b DataReadyRspBuilder) Build() *DataReadyRsp
Build creates a new DataReadyRsp
func (DataReadyRspBuilder) WithData ¶
func (b DataReadyRspBuilder) WithData(data []byte) DataReadyRspBuilder
WithData sets the data of the request to build.
func (DataReadyRspBuilder) WithDst ¶
func (b DataReadyRspBuilder) WithDst(dst sim.Port) DataReadyRspBuilder
WithDst sets the destination of the request to build.
func (DataReadyRspBuilder) WithRspTo ¶
func (b DataReadyRspBuilder) WithRspTo(id string) DataReadyRspBuilder
WithRspTo sets ID of the request that the respond to build is replying to.
func (DataReadyRspBuilder) WithSendTime ¶
func (b DataReadyRspBuilder) WithSendTime( t sim.VTimeInSec, ) DataReadyRspBuilder
WithSendTime sets the send time of the request to build.
func (DataReadyRspBuilder) WithSrc ¶
func (b DataReadyRspBuilder) WithSrc(src sim.Port) DataReadyRspBuilder
WithSrc sets the source of the request to build.
type GL0InvalidateReq ¶
GL0InvalidateReq is a request that invalidates the L0 cache.
func (*GL0InvalidateReq) GetAddress ¶
func (r *GL0InvalidateReq) GetAddress() uint64
GetAddress returns the address that the request is accessing
func (*GL0InvalidateReq) GetByteSize ¶
func (r *GL0InvalidateReq) GetByteSize() uint64
GetByteSize returns the number of byte that the request is accessing.
func (*GL0InvalidateReq) GetPID ¶
func (r *GL0InvalidateReq) GetPID() vm.PID
GetPID returns the process ID that the request is working on.
func (*GL0InvalidateReq) Meta ¶
func (r *GL0InvalidateReq) Meta() *sim.MsgMeta
Meta returns the meta data associated with the message.
type GL0InvalidateReqBuilder ¶
GL0InvalidateReqBuilder can build new GL0InvalidReq.
func (GL0InvalidateReqBuilder) Build ¶
func (b GL0InvalidateReqBuilder) Build() *GL0InvalidateReq
Build creates a new GL0InvalidateReq
func (GL0InvalidateReqBuilder) WithDst ¶
func (b GL0InvalidateReqBuilder) WithDst(dst sim.Port) GL0InvalidateReqBuilder
WithDst sets the destination of the request to build.
func (GL0InvalidateReqBuilder) WithPID ¶
func (b GL0InvalidateReqBuilder) WithPID(pid vm.PID) GL0InvalidateReqBuilder
WithPID sets the PID of the request to build.
func (GL0InvalidateReqBuilder) WithSendTime ¶
func (b GL0InvalidateReqBuilder) WithSendTime( t sim.VTimeInSec, ) GL0InvalidateReqBuilder
WithSendTime sets the send time of the request to build.
func (GL0InvalidateReqBuilder) WithSrc ¶
func (b GL0InvalidateReqBuilder) WithSrc(src sim.Port) GL0InvalidateReqBuilder
WithSrc sets the source of the request to build.
type GL0InvalidateRsp ¶
GL0InvalidateRsp is a response to a GL0InvalidateReq.
func (*GL0InvalidateRsp) GetAddress ¶
func (r *GL0InvalidateRsp) GetAddress() uint64
GetAddress returns the address that the request is accessing
func (*GL0InvalidateRsp) GetByteSize ¶
func (r *GL0InvalidateRsp) GetByteSize() uint64
GetByteSize returns the number of byte that the request is accessing.
func (*GL0InvalidateRsp) GetPID ¶
func (r *GL0InvalidateRsp) GetPID() vm.PID
GetPID returns the process ID that the request is working on.
func (*GL0InvalidateRsp) GetRespondTo ¶
func (r *GL0InvalidateRsp) GetRespondTo() string
GetRespondTo returns the ID if the request that the respond is responding to.
func (*GL0InvalidateRsp) GetRspTo ¶
func (r *GL0InvalidateRsp) GetRspTo() string
GetRspTo returns the ID of the request that this response is responding to.
func (*GL0InvalidateRsp) Meta ¶
func (r *GL0InvalidateRsp) Meta() *sim.MsgMeta
Meta returns the meta data associated with the message.
type GL0InvalidateRspBuilder ¶
GL0InvalidateRspBuilder can build new GL0 Invalid Rsp Builder
func (GL0InvalidateRspBuilder) Build ¶
func (b GL0InvalidateRspBuilder) Build() *GL0InvalidateRsp
Build creates a new CUPipelineRestartReq
func (GL0InvalidateRspBuilder) WithDst ¶
func (b GL0InvalidateRspBuilder) WithDst(dst sim.Port) GL0InvalidateRspBuilder
WithDst sets the destination of the request to build.
func (GL0InvalidateRspBuilder) WithPID ¶
func (b GL0InvalidateRspBuilder) WithPID(pid vm.PID) GL0InvalidateRspBuilder
WithPID sets the PID of the request to build.
func (GL0InvalidateRspBuilder) WithRspTo ¶
func (b GL0InvalidateRspBuilder) WithRspTo(id string) GL0InvalidateRspBuilder
WithRspTo sets ID of the request that the respond to build is replying to.
func (GL0InvalidateRspBuilder) WithSendTime ¶
func (b GL0InvalidateRspBuilder) WithSendTime( t sim.VTimeInSec, ) GL0InvalidateRspBuilder
WithSendTime sets the send time of the request to build.:w
func (GL0InvalidateRspBuilder) WithSrc ¶
func (b GL0InvalidateRspBuilder) WithSrc(src sim.Port) GL0InvalidateRspBuilder
WithSrc sets the source of the request to build.
type InterleavedLowModuleFinder ¶
type InterleavedLowModuleFinder struct { UseAddressSpaceLimitation bool LowAddress uint64 HighAddress uint64 InterleavingSize uint64 LowModules []sim.Port ModuleForOtherAddresses sim.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 InterleavingConverter ¶
type InterleavingConverter struct { InterleavingSize uint64 TotalNumOfElements int CurrentElementIndex int Offset uint64 }
InterleavingConverter is an address converter that can converts the address from an continuous address space to interleaved addresses.
For example, DRAM is divided into multiple banks, the internal address of each bank starts from 0, while the global address is continuous. In this case, we can use the InterleavingConverter to convert the external addresses from/ to internal addresses.
func (InterleavingConverter) ConvertExternalToInternal ¶
func (c InterleavingConverter) ConvertExternalToInternal(external uint64) uint64
ConvertExternalToInternal converts from external address to internal address
func (InterleavingConverter) ConvertInternalToExternal ¶
func (c InterleavingConverter) ConvertInternalToExternal(internal uint64) uint64
ConvertInternalToExternal converts from internal address to external address
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 ReadReq ¶
type ReadReq struct { sim.MsgMeta Address uint64 AccessByteSize uint64 PID vm.PID CanWaitForCoalesce bool Info interface{} }
A ReadReq is a request sent to a memory controller to fetch data
func (*ReadReq) GetAddress ¶
GetAddress returns the address that the request is accessing
func (*ReadReq) GetByteSize ¶
GetByteSize returns the number of byte that the request is accessing.
type ReadReqBuilder ¶
type ReadReqBuilder struct {
// contains filtered or unexported fields
}
ReadReqBuilder can build read requests.
func (ReadReqBuilder) CanWaitForCoalesce ¶
func (b ReadReqBuilder) CanWaitForCoalesce() ReadReqBuilder
CanWaitForCoalesce allow the request to build to wait for coalesce.
func (ReadReqBuilder) WithAddress ¶
func (b ReadReqBuilder) WithAddress(address uint64) ReadReqBuilder
WithAddress sets the address of the request to build.
func (ReadReqBuilder) WithByteSize ¶
func (b ReadReqBuilder) WithByteSize(byteSize uint64) ReadReqBuilder
WithByteSize sets the byte size of the request to build.
func (ReadReqBuilder) WithDst ¶
func (b ReadReqBuilder) WithDst(dst sim.Port) ReadReqBuilder
WithDst sets the destination of the request to build.
func (ReadReqBuilder) WithInfo ¶
func (b ReadReqBuilder) WithInfo(info interface{}) ReadReqBuilder
WithInfo sets the Info of the request to build.
func (ReadReqBuilder) WithPID ¶
func (b ReadReqBuilder) WithPID(pid vm.PID) ReadReqBuilder
WithPID sets the PID of the request to build.
func (ReadReqBuilder) WithSendTime ¶
func (b ReadReqBuilder) WithSendTime(t sim.VTimeInSec) ReadReqBuilder
WithSendTime sets the send time of the request to build.
func (ReadReqBuilder) WithSrc ¶
func (b ReadReqBuilder) WithSrc(src sim.Port) ReadReqBuilder
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 Storage ¶
A Storage keeps the data of the guest system.
A storage is an abstraction of all different type of storage including registers, main memory, and hard drives.
The storage implementation manages the storage in units. The unit can is similar to the concept of page in memory management. For the units that it not touched by Read and Write function, no memory will be allocated.
func NewStorage ¶
NewStorage creates a storage object with the specified capacity
func NewStorageWithUnitSize ¶
NewStorageWithUnitSize creates a storage object with the specified capacity. The unit size is specified in bytes. Using unit size can reduces the memory consumption of storage.
type WriteDoneRsp ¶
A WriteDoneRsp is a respond sent from the lower module to the higher module to mark a previous requests is completed successfully.
func (*WriteDoneRsp) GetRspTo ¶
func (r *WriteDoneRsp) GetRspTo() string
GetRspTo returns the ID of the request that the respond is responding to.
func (*WriteDoneRsp) Meta ¶
func (r *WriteDoneRsp) Meta() *sim.MsgMeta
Meta returns the meta data associated with the message.
type WriteDoneRspBuilder ¶
type WriteDoneRspBuilder struct {
// contains filtered or unexported fields
}
WriteDoneRspBuilder can build data ready responds.
func (WriteDoneRspBuilder) Build ¶
func (b WriteDoneRspBuilder) Build() *WriteDoneRsp
Build creates a new WriteDoneRsp
func (WriteDoneRspBuilder) WithDst ¶
func (b WriteDoneRspBuilder) WithDst(dst sim.Port) WriteDoneRspBuilder
WithDst sets the destination of the request to build.
func (WriteDoneRspBuilder) WithRspTo ¶
func (b WriteDoneRspBuilder) WithRspTo(id string) WriteDoneRspBuilder
WithRspTo sets ID of the request that the respond to build is replying to.
func (WriteDoneRspBuilder) WithSendTime ¶
func (b WriteDoneRspBuilder) WithSendTime( t sim.VTimeInSec, ) WriteDoneRspBuilder
WithSendTime sets the send time of the message to build.
func (WriteDoneRspBuilder) WithSrc ¶
func (b WriteDoneRspBuilder) WithSrc(src sim.Port) WriteDoneRspBuilder
WithSrc sets the source of the request to build.
type WriteReq ¶
type WriteReq struct { sim.MsgMeta Address uint64 Data []byte DirtyMask []bool PID vm.PID CanWaitForCoalesce bool Info interface{} }
A WriteReq is a request sent to a memory controller to write data
func (*WriteReq) GetAddress ¶
GetAddress returns the address that the request is accessing
func (*WriteReq) GetByteSize ¶
GetByteSize returns the number of byte that the request is writing.
type WriteReqBuilder ¶
type WriteReqBuilder struct {
// contains filtered or unexported fields
}
WriteReqBuilder can build read requests.
func (WriteReqBuilder) Build ¶
func (b WriteReqBuilder) Build() *WriteReq
Build creates a new WriteReq
func (WriteReqBuilder) CanWaitForCoalesce ¶
func (b WriteReqBuilder) CanWaitForCoalesce() WriteReqBuilder
CanWaitForCoalesce allow the request to build to wait for coalesce.
func (WriteReqBuilder) WithAddress ¶
func (b WriteReqBuilder) WithAddress(address uint64) WriteReqBuilder
WithAddress sets the address of the request to build.
func (WriteReqBuilder) WithData ¶
func (b WriteReqBuilder) WithData(data []byte) WriteReqBuilder
WithData sets the data of the request to build.
func (WriteReqBuilder) WithDirtyMask ¶
func (b WriteReqBuilder) WithDirtyMask(mask []bool) WriteReqBuilder
WithDirtyMask sets the dirty mask of the request to build.
func (WriteReqBuilder) WithDst ¶
func (b WriteReqBuilder) WithDst(dst sim.Port) WriteReqBuilder
WithDst sets the destination of the request to build.
func (WriteReqBuilder) WithInfo ¶
func (b WriteReqBuilder) WithInfo(info interface{}) WriteReqBuilder
WithInfo sets the information attached to the request to build.
func (WriteReqBuilder) WithPID ¶
func (b WriteReqBuilder) WithPID(pid vm.PID) WriteReqBuilder
WithPID sets the PID of the request to build.
func (WriteReqBuilder) WithSendTime ¶
func (b WriteReqBuilder) WithSendTime(t sim.VTimeInSec) WriteReqBuilder
WithSendTime sets the send time of the message to build.
func (WriteReqBuilder) WithSrc ¶
func (b WriteReqBuilder) WithSrc(src sim.Port) WriteReqBuilder
WithSrc sets the source of the request to build.