mem

package module
v1.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 10, 2021 License: MIT Imports: 4 Imported by: 28

README

Akita Memory Model

Discord

Go Report Card Test Coverage

This repository contains the definition and the implementation for memory system components.

Please check here For detailed documentation.

Documentation

Overview

Package mem and its subpackages provide definitions for memoy systems.

Index

Constants

View Source
const (
	KB uint64 = 1 << (10 * iota)
	MB
	GB
	TB
)

For capacity

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessReq

type AccessReq interface {
	akita.Msg
	GetAddress() uint64
	GetByteSize() uint64
	GetPID() ca.PID
}

AccessReq abstracts read and write requests that are sent to the cache modules or memory controllers.

type AccessRsp added in v1.3.0

type AccessRsp interface {
	akita.Msg
	GetRespondTo() string
}

A AccessRsp is a respond in the memory system.

type ControlMsg added in v1.8.5

type ControlMsg struct {
	akita.MsgMeta

	DiscardTransations bool
	Restart            bool
	NotifyDone         bool
}

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 added in v1.8.5

func (m *ControlMsg) Meta() *akita.MsgMeta

Meta returns the meta data assocated with the ControlMsg.

type ControlMsgBuilder added in v1.8.5

type ControlMsgBuilder struct {
	// contains filtered or unexported fields
}

A ControlMsgBuilder can build control messages.

func (ControlMsgBuilder) Build added in v1.8.5

func (b ControlMsgBuilder) Build() *ControlMsg

func (ControlMsgBuilder) ToDiscardTransactions added in v1.8.5

func (b ControlMsgBuilder) ToDiscardTransactions() ControlMsgBuilder

ToDiscardTransactions sets the discard transactions bit of the control messages to 1.

func (ControlMsgBuilder) ToNotifyDone added in v1.8.5

func (b ControlMsgBuilder) ToNotifyDone() ControlMsgBuilder

ToNotifyDone sets the "notify done" bit of the control messages to 1.

func (ControlMsgBuilder) ToRestart added in v1.8.5

func (b ControlMsgBuilder) ToRestart() ControlMsgBuilder

ToRestart sets the restart bit of the control messages to 1.

func (ControlMsgBuilder) WithDst added in v1.8.5

WithDst sets the destination of the request to build.

func (ControlMsgBuilder) WithSendTime added in v1.8.5

func (b ControlMsgBuilder) WithSendTime(
	t akita.VTimeInSec,
) ControlMsgBuilder

WithSendTime sets the send time of the message to build.

func (ControlMsgBuilder) WithSrc added in v1.8.5

WithSrc sets the source of the request to build.

type DataReadyRsp

type DataReadyRsp struct {
	akita.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) GetRespondTo

func (r *DataReadyRsp) GetRespondTo() string

GetRespondTo returns the ID if the request that the respond is resonding to.

func (*DataReadyRsp) Meta added in v1.3.0

func (r *DataReadyRsp) Meta() *akita.MsgMeta

Meta returns the meta data attached to each message.

type DataReadyRspBuilder added in v1.3.0

type DataReadyRspBuilder struct {
	// contains filtered or unexported fields
}

DataReadyRspBuilder can build data ready responds.

func (DataReadyRspBuilder) Build added in v1.3.0

func (b DataReadyRspBuilder) Build() *DataReadyRsp

Build creates a new DataReadyRsp

func (DataReadyRspBuilder) WithData added in v1.3.0

func (b DataReadyRspBuilder) WithData(data []byte) DataReadyRspBuilder

WithData sets the data of the request to build.

func (DataReadyRspBuilder) WithDst added in v1.3.0

WithDst sets the destination of the request to build.

func (DataReadyRspBuilder) WithRspTo added in v1.3.0

WithRspTo sets ID of the request that the respond to build is replying to.

func (DataReadyRspBuilder) WithSendTime added in v1.3.0

WithSendTime sets the send time of the request to build.

func (DataReadyRspBuilder) WithSrc added in v1.3.0

WithSrc sets the source of the request to build.

type GL0InvalidateReq added in v1.12.0

type GL0InvalidateReq struct {
	akita.MsgMeta
	PID ca.PID
}

func (*GL0InvalidateReq) GetAddress added in v1.12.0

func (r *GL0InvalidateReq) GetAddress() uint64

GetAddress returns the address that the request is accessing

func (*GL0InvalidateReq) GetByteSize added in v1.12.0

func (r *GL0InvalidateReq) GetByteSize() uint64

GetByteSize returns the number of byte that the request is accessing.

func (*GL0InvalidateReq) GetPID added in v1.12.0

func (r *GL0InvalidateReq) GetPID() ca.PID

GetPID returns the process ID that the request is working on.

func (*GL0InvalidateReq) Meta added in v1.12.0

func (m *GL0InvalidateReq) Meta() *akita.MsgMeta

Meta returns the meta data associated with the message.

type GL0InvalidateReqBuilder added in v1.12.0

type GL0InvalidateReqBuilder struct {
	PID ca.PID
	// contains filtered or unexported fields
}

CUPipelineRestartReqBuilder can build new CU restart reqs

func (GL0InvalidateReqBuilder) Build added in v1.12.0

Build creats a new CUPipelineRestartReq

func (GL0InvalidateReqBuilder) WithDst added in v1.12.0

WithDst sets the destination of the request to build.

func (GL0InvalidateReqBuilder) WithPID added in v1.12.0

WithPID sets the PID of the request to build.

func (GL0InvalidateReqBuilder) WithSendTime added in v1.12.0

WithSendTime sets the send time of the request to build.:w

func (GL0InvalidateReqBuilder) WithSrc added in v1.12.0

WithSrc sets the source of the request to build.

type GL0InvalidateRsp added in v1.12.0

type GL0InvalidateRsp struct {
	akita.MsgMeta
	PID       ca.PID
	RespondTo string
}

func (*GL0InvalidateRsp) GetAddress added in v1.12.0

func (r *GL0InvalidateRsp) GetAddress() uint64

GetAddress returns the address that the request is accessing

func (*GL0InvalidateRsp) GetByteSize added in v1.12.0

func (r *GL0InvalidateRsp) GetByteSize() uint64

GetByteSize returns the number of byte that the request is accessing.

func (*GL0InvalidateRsp) GetPID added in v1.12.0

func (r *GL0InvalidateRsp) GetPID() ca.PID

GetPID returns the process ID that the request is working on.

func (*GL0InvalidateRsp) GetRespondTo added in v1.12.0

func (r *GL0InvalidateRsp) GetRespondTo() string

GetRespondTo returns the ID if the request that the respond is resonding to.

func (*GL0InvalidateRsp) Meta added in v1.12.0

func (m *GL0InvalidateRsp) Meta() *akita.MsgMeta

Meta returns the meta data associated with the message.

type GL0InvalidateRspBuilder added in v1.12.0

type GL0InvalidateRspBuilder struct {
	PID ca.PID
	// contains filtered or unexported fields
}

CUPipelineRestartReqBuilder can build new CU restart reqs

func (GL0InvalidateRspBuilder) Build added in v1.12.0

Build creats a new CUPipelineRestartReq

func (GL0InvalidateRspBuilder) WithDst added in v1.12.0

WithDst sets the destination of the request to build.

func (GL0InvalidateRspBuilder) WithPID added in v1.12.0

WithPID sets the PID of the request to build.

func (GL0InvalidateRspBuilder) WithRspTo added in v1.12.0

WithRspTo sets ID of the request that the respond to build is replying to.

func (GL0InvalidateRspBuilder) WithSendTime added in v1.12.0

WithSendTime sets the send time of the request to build.:w

func (GL0InvalidateRspBuilder) WithSrc added in v1.12.0

WithSrc sets the source of the request to build.

type ReadReq

type ReadReq struct {
	akita.MsgMeta

	Address            uint64
	AccessByteSize     uint64
	PID                ca.PID
	CanWaitForCoalesce bool
	Info               interface{}
}

A ReadReq is a request sent to a memory controller to fetch data

func (*ReadReq) GetAddress

func (r *ReadReq) GetAddress() uint64

GetAddress returns the address that the request is accessing

func (*ReadReq) GetByteSize

func (r *ReadReq) GetByteSize() uint64

GetByteSize returns the number of byte that the request is accessing.

func (*ReadReq) GetPID added in v1.1.6

func (r *ReadReq) GetPID() ca.PID

GetPID returns the process ID that the request is working on.

func (*ReadReq) Meta added in v1.3.0

func (r *ReadReq) Meta() *akita.MsgMeta

Meta returns the message meta.

type ReadReqBuilder added in v1.3.0

type ReadReqBuilder struct {
	// contains filtered or unexported fields
}

ReadReqBuilder can build read requests.

func (ReadReqBuilder) Build added in v1.3.0

func (b ReadReqBuilder) Build() *ReadReq

Build creates a new ReadReq

func (ReadReqBuilder) CanWaitForCoalesce added in v1.3.0

func (b ReadReqBuilder) CanWaitForCoalesce() ReadReqBuilder

CanWaitForCoalesce allow the request to build to wait for coalesce.

func (ReadReqBuilder) WithAddress added in v1.3.0

func (b ReadReqBuilder) WithAddress(address uint64) ReadReqBuilder

WithAddress sets the address of the request to build.

func (ReadReqBuilder) WithByteSize added in v1.3.0

func (b ReadReqBuilder) WithByteSize(byteSize uint64) ReadReqBuilder

WithByteSize sets the byte size of the request to build.

func (ReadReqBuilder) WithDst added in v1.3.0

func (b ReadReqBuilder) WithDst(dst akita.Port) ReadReqBuilder

WithDst sets the destination of the request to build.

func (ReadReqBuilder) WithInfo added in v1.8.7

func (b ReadReqBuilder) WithInfo(info interface{}) ReadReqBuilder

WithInfo sets the Info of the request to build.

func (ReadReqBuilder) WithPID added in v1.3.0

func (b ReadReqBuilder) WithPID(pid ca.PID) ReadReqBuilder

WithPID sets the PID of the request to build.

func (ReadReqBuilder) WithSendTime added in v1.3.0

func (b ReadReqBuilder) WithSendTime(t akita.VTimeInSec) ReadReqBuilder

WithSendTime sets the send time of the request to build.

func (ReadReqBuilder) WithSrc added in v1.3.0

func (b ReadReqBuilder) WithSrc(src akita.Port) ReadReqBuilder

WithSrc sets the source of the request to build.

type Storage

type Storage struct {
	sync.Mutex
	Capacity uint64
	// contains filtered or unexported fields
}

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 mmemory management. For the units that it not touched by Read and Write function, no memory will be allocated.

func NewStorage

func NewStorage(capacity uint64) *Storage

NewStorage creates a storage object with the specified capacity

func (*Storage) Read

func (s *Storage) Read(address uint64, len uint64) ([]byte, error)

func (*Storage) Write

func (s *Storage) Write(address uint64, data []byte) error

type WriteBuffer added in v1.1.6

type WriteBuffer interface {
	Tick(now akita.VTimeInSec) bool
	CanEnqueue() bool
	Enqueue(write *WriteReq)
	Query(read *ReadReq) *WriteReq
	SetWriteCombineGranularity(size uint64)
}

WriteBuffer is a place where the write can be transferred at a later time.

func NewWriteBuffer added in v1.1.6

func NewWriteBuffer(capacity int, port akita.Port) WriteBuffer

NewWriteBuffer creates and returns a default write buffer

type WriteDoneRsp added in v1.3.0

type WriteDoneRsp struct {
	akita.MsgMeta

	RespondTo string
}

A WriteDoneRsp is a respond sent from the lower module to the higher module to mark a previous requests is completed successfully.

func (*WriteDoneRsp) GetRespondTo added in v1.3.0

func (r *WriteDoneRsp) GetRespondTo() string

GetRespondTo returns the ID of the request that the respond is responding to.

func (*WriteDoneRsp) Meta added in v1.3.0

func (r *WriteDoneRsp) Meta() *akita.MsgMeta

Meta returns the meta data accociated with the message.

type WriteDoneRspBuilder added in v1.3.0

type WriteDoneRspBuilder struct {
	// contains filtered or unexported fields
}

WriteDoneRspBuilder can build data ready responds.

func (WriteDoneRspBuilder) Build added in v1.3.0

func (b WriteDoneRspBuilder) Build() *WriteDoneRsp

Build creates a new WriteDoneRsp

func (WriteDoneRspBuilder) WithDst added in v1.3.0

WithDst sets the destination of the request to build.

func (WriteDoneRspBuilder) WithRspTo added in v1.3.0

WithRspTo sets ID of the request that the respond to build is replying to.

func (WriteDoneRspBuilder) WithSendTime added in v1.3.0

WithSendTime sets the send time of the message to build.

func (WriteDoneRspBuilder) WithSrc added in v1.3.0

WithSrc sets the source of the request to build.

type WriteReq

type WriteReq struct {
	akita.MsgMeta

	Address            uint64
	Data               []byte
	DirtyMask          []bool
	PID                ca.PID
	CanWaitForCoalesce bool
	Info               interface{}
}

A WriteReq is a request sent to a memory controller to write data

func (*WriteReq) GetAddress

func (r *WriteReq) GetAddress() uint64

GetAddress returns the address that the request is accessing

func (*WriteReq) GetByteSize

func (r *WriteReq) GetByteSize() uint64

GetByteSize returns the number of byte that the request is writing.

func (*WriteReq) GetPID added in v1.1.6

func (r *WriteReq) GetPID() ca.PID

GetPID returns the PID of the read address

func (*WriteReq) Meta added in v1.3.0

func (r *WriteReq) Meta() *akita.MsgMeta

Meta returns the meta data attached to a request.

type WriteReqBuilder added in v1.3.0

type WriteReqBuilder struct {
	// contains filtered or unexported fields
}

WriteReqBuilder can build read requests.

func (WriteReqBuilder) Build added in v1.3.0

func (b WriteReqBuilder) Build() *WriteReq

Build creates a new WriteReq

func (WriteReqBuilder) CanWaitForCoalesce added in v1.3.0

func (b WriteReqBuilder) CanWaitForCoalesce() WriteReqBuilder

CanWaitForCoalesce allow the request to build to wait for coalesce.

func (WriteReqBuilder) WithAddress added in v1.3.0

func (b WriteReqBuilder) WithAddress(address uint64) WriteReqBuilder

WithAddress sets the address of the request to build.

func (WriteReqBuilder) WithData added in v1.3.0

func (b WriteReqBuilder) WithData(data []byte) WriteReqBuilder

WithData sets the data of the request to build.

func (WriteReqBuilder) WithDirtyMask added in v1.3.0

func (b WriteReqBuilder) WithDirtyMask(mask []bool) WriteReqBuilder

WithDirtyMask sets the dirty mask of the request to build.

func (WriteReqBuilder) WithDst added in v1.3.0

func (b WriteReqBuilder) WithDst(dst akita.Port) WriteReqBuilder

WithDst sets the destination of the request to build.

func (WriteReqBuilder) WithInfo added in v1.8.7

func (b WriteReqBuilder) WithInfo(info interface{}) WriteReqBuilder

WithInfo sets the information attached to the request to build.

func (WriteReqBuilder) WithPID added in v1.3.0

func (b WriteReqBuilder) WithPID(pid ca.PID) WriteReqBuilder

WithPID sets the PID of the request to build.

func (WriteReqBuilder) WithSendTime added in v1.3.0

func (b WriteReqBuilder) WithSendTime(t akita.VTimeInSec) WriteReqBuilder

WithSendTime sets the send time of the message to build.

func (WriteReqBuilder) WithSrc added in v1.3.0

func (b WriteReqBuilder) WithSrc(src akita.Port) WriteReqBuilder

WithSrc sets the source of the request to build.

Directories

Path Synopsis
Package acceptancetests provides utility data structure definitions for writing memory system acceptance tests.
Package acceptancetests provides utility data structure definitions for writing memory system acceptance tests.
dram command
writebackcache command
Package cache provides the basic commonly used utility data structures for cache implementation.
Package cache provides the basic commonly used utility data structures for cache implementation.
writeback
Package writeback implements a writeback cache.
Package writeback implements a writeback cache.
Package dram defines detailed DRAM modeling.
Package dram defines detailed DRAM modeling.
internal/addressmapping
Package addressmapping defines how to maps an address to a localtion.
Package addressmapping defines how to maps an address to a localtion.
internal/cmdq
Package cmdq provides command queue implementations
Package cmdq provides command queue implementations
internal/org
Package org defines the DRAM organization related sub-component definitions, such as Channels and Banks.
Package org defines the DRAM organization related sub-component definitions, such as Channels and Banks.
internal/signal
Package signal defines the common data structures used in the dram system, including transactions, sub-transactions, and commands.
Package signal defines the common data structures used in the dram system, including transactions, sub-transactions, and commands.
internal/trans
Package trans defines concepts related to DRAM transactions and subtransactions.
Package trans defines concepts related to DRAM transactions and subtransactions.
Package idealmemcontroller provides an implementation of an ideal memory controller, which has a fix latency and unlimited concurrency.
Package idealmemcontroller provides an implementation of an ideal memory controller, which has a fix latency and unlimited concurrency.
Package trace provides a tracer that can trace memory system tasks.
Package trace provides a tracer that can trace memory system tasks.
vm
Package vm provides the models for address translations
Package vm provides the models for address translations
addresstranslator
Package addresstranslator implements a component that can forward the translated read and write request to the bottom memory unit.
Package addresstranslator implements a component that can forward the translated read and write request to the bottom memory unit.
mmu
Package mmu provides a Memory Management Unit implementation.
Package mmu provides a Memory Management Unit implementation.
tlb
Package tlb provides a TLB component implementation.
Package tlb provides a TLB component implementation.
tlb/internal
Package internal provides the definition required for defining TLB.
Package internal provides the definition required for defining TLB.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL