10. MMU Package

typedef MMU::32 MaxNumSGLists
typedef MMU::Bit#(TLog#(MaxNumSGLists)) SGListId
typedef MMU::12 SGListPageShift0
typedef MMU::16 SGListPageShift4
typedef MMU::20 SGListPageShift8
typedef MMU::24 SGListPageShift12
typedef MMU::Bit#(TLog#(MaxNumSGLists)) RegionsIdx
typedef MMU::8 IndexWidth

10.1. Address Translation

struct MMU::AddrTransRequest

Address translation request type

id → SGListId

Which object identifier to use.

off → Bit#(MemOffsetSize)

The address to translate.

interface MMU::MMU(numeric type addrWidth)

An address translator

request → MMURequest

The interface of the MMU that is exposed to software as a portal.

addr → Vector#(2,Server#(AddrTransRequest,Bit#(addrWidth)))

The address translation servers

interface MMU::MMURequest;

The Connectal MMU maps linear offsets on objects identified by sglId to dmaAddress. It is constructed from a list of segments, where the segments are sorted by size in descending order. Each segment must be one of the supported sizes.

sglist(Bit#(32) sglId, Bit#(32) segmentIndex, Bit#(64) addr, Bit#(32) len)) → Action

Updates the address of the segment number segmentIndex for object identified by sglId. The address has been preshifted so that the final address may be constructed by concatenating addr and offset within the segment.

region(Bit#(32) sglId, Bit#(64) barr12, Bit#(32) idxOffset12, Bit#(64) barr8, Bit#(32) idxOffset8, Bit#(64) barr4, Bit#(32) idxOffset4, Bit#(64) barr0, Bit#(32) idxOffset0)) → Action

Updates the boundaries between the segments of different sizes for the object identified by sglId.

For example, if an offset to be translated is less than barr12, then the target segment is of size SGListPageShift12 (2^24 bytes). If the offset is less than barr12, then idxOffset12 points to the first translation table entry for segments of that size

pbase = offset >> segAddrSize + idxOffset segNumber = pbase + idxOffset dmaBase = translationTable[sglId,segNumber] dmaAddress = {dmaBase[physAddrSize-segAddrSize-1:0],offset[segAddrSize-1:0]}

idRequest(SpecialTypeForSendingFd fd)) → Action

Requests a new object identifier.

idReturn(Bit#(32) sglId)) → Action

Indicates that the designated object is no longer in use. The MMU clears the translation entries for this object.

setInterface(Bit#(32) interfaceId, Bit#(32) sglId)) → Action

This method is only implemented in software responders.

interface MMU::MMUIndication;
interface MMU::.. bsv:method:: Action idResponse(Bit((32) sglId);)

Response from idRequest indicating the new object identifier sglId.

configResp(Bit#(32) sglId)) → Action
error(Bit#(32) code, Bit#(32) sglId, Bit#(64) offset, Bit#(64) extra)) → Action

Sent from the MMU when there is a translation error.

struct MMU::DmaErrorType
DmaErrorNone

Code 0 indicates no error.

DmaErrorSGLIdOutOfRange_r

Code 1 indicates object identifier was out of range during a read request.

DmaErrorSGLIdOutOfRange_w

Code 2 indicates object identifier was out of range during a read request.

DmaErrorMMUOutOfRange_r

Code 3 indicates MMU identifier was out of range during a read request.

DmaErrorMMUOutOfRange_w

Code 4 indicates MMU identifier was out of range during a read request.

DmaErrorOffsetOutOfRange

Code 5 indicates offset was out of range for the designated object.

DmaErrorSGLIdInvalid

Code 6 indicates the object identifier was out of range.

DmaErrorTileTagOutOfRange

Code 7 indicates the tag was out of range for the requesting platform application tile.

module MMU::mkMMU(Integer iid, Bool hostMapped, MMUIndication mmuIndication) → (MMU#(addrWidth)

Instantiates an address translator that stores a scatter-gather list to define the logical to physical address mapping.

Parameter iid is the portal identifier of the MMURequest interface.

Parameter hostMapped is true for simulation.

interface MMU::MemServerRequest;
addrTrans(Bit#(32) sglId, Bit#(32) offset)) → Action

Requests an address translation

setTileState(TileControl tc)) → Action

Changes tile status

stateDbg(ChannelType rc) → Action

Requests debug info for the specified channel type

memoryTraffic(ChannelType rc)) → Action
interface MMU::MemServerIndication;
interface MMU::.. bsv:method:: Action addrResponse(Bit((64) physAddr);)
interface MMU::.. bsv:method:: Action reportStateDbg(DmaDbgRec rec);
interface MMU::.. bsv:method:: Action reportMemoryTraffic(Bit((64) words);)
interface MMU::.. bsv:method:: Action error(Bit((32) code, Bit#(32) sglId, Bit#(64) offset, Bit#(64) extra);)