The Sparta Modeling Framework
Loading...
Searching...
No Matches
sparta::ArchDataSegment Class Reference

#include <ArchDataSegment.hpp>

Inheritance diagram for sparta::ArchDataSegment:

Public Types

typedef uint64_t offset_type
 
typedef uint32_t ident_type
 

Public Member Functions

 ArchDataSegment (const ArchDataSegment &)=delete
 
 ArchDataSegment (const ArchDataSegment &&)=delete
 
ArchDataSegmentoperator= (const ArchDataSegment &)=delete
 
 ArchDataSegment (ArchData *data, offset_type size, ident_type id, ident_type subset_of=INVALID_ID, offset_type subset_offset=0)
 Constructor.
 
virtual ~ArchDataSegment ()
 Virtual destructor.
 
void place (offset_type offset)
 Sets the offset of this DataView within its ArchData then invokes the place_ method for subclasses to handle.
 
void writeInitial ()
 Invokes writeInitial_, giving subclasses a chance to write a value to memory during initialization or reset of an ArchData.
 
bool isPlaced () const
 Has this segment been placed yet.
 
offset_type getOffset () const
 Gets the offset of this segment once placed.
 
offset_type getLayoutSize () const
 Gets the layout size of this segment (number of bytes)
 
ident_type getLayoutID () const
 Gets the layout Identifier of this segment.
 
ident_type getSubsetOf () const
 Gets the segment of which this segment is a subset.
 
offset_type getSubsetOffset () const
 Gets the offset into the segment of which this segment is a subset.
 
ArchDatagetArchData ()
 Gets the ArchData associated with this segment.
 
const ArchDatagetArchData () const
 Gets the ArchData associated with this segment.
 

Static Public Attributes

static const ident_type INVALID_ID = ~(ident_type)0
 Indicates an invalid ID for an ArchDataSegment or any refinement.
 

Protected Member Functions

virtual void place_ (offset_type offset)
 Allows subclasses to observe placement in an ArchData. Do not write an initial value from within this method. Use writeInitial_ instead.
 
virtual void writeInitial_ ()
 Write initial value of this segment into ArchData. This occurrs immediately after placement and may occur multiple times later if the owning ArchData is reset.
 

Detailed Description

Layout interface used by ArchData class Noncopyable. ArchData will track these segments by pointer.

Definition at line 19 of file ArchDataSegment.hpp.

Member Typedef Documentation

◆ ident_type

typedef uint32_t sparta::ArchDataSegment::ident_type

Definition at line 24 of file ArchDataSegment.hpp.

◆ offset_type

typedef uint64_t sparta::ArchDataSegment::offset_type

Definition at line 23 of file ArchDataSegment.hpp.

Constructor & Destructor Documentation

◆ ArchDataSegment()

sparta::ArchDataSegment::ArchDataSegment ( ArchData data,
offset_type  size,
ident_type  id,
ident_type  subset_of = INVALID_ID,
offset_type  subset_offset = 0 
)
inline

Constructor.

Parameters
dataData which this view will access
sizesize of <data> accessed by this view. Must be a power of 2 greater than 0 and less than or equal to the line size of <data> (sparta::ArchData::getLineSize)
subset_ofSegment of which this segment is a subset (refers to only a subset of the same bytes in this other register).
subset_offsetOffset into the register indicated by subset_of if subset_of is not INVALID_ID. Otherwise, is ignored.

Definition at line 44 of file ArchDataSegment.hpp.

Here is the call graph for this function:

◆ ~ArchDataSegment()

virtual sparta::ArchDataSegment::~ArchDataSegment ( )
inlinevirtual

Virtual destructor.

Definition at line 72 of file ArchDataSegment.hpp.

Member Function Documentation

◆ getArchData() [1/2]

ArchData * sparta::ArchDataSegment::getArchData ( )
inline

Gets the ArchData associated with this segment.

Definition at line 150 of file ArchDataSegment.hpp.

◆ getArchData() [2/2]

const ArchData * sparta::ArchDataSegment::getArchData ( ) const
inline

Gets the ArchData associated with this segment.

Definition at line 155 of file ArchDataSegment.hpp.

◆ getLayoutID()

ident_type sparta::ArchDataSegment::getLayoutID ( ) const
inline

Gets the layout Identifier of this segment.

Returns
segment ID - unique within parent.

Definition at line 130 of file ArchDataSegment.hpp.

◆ getLayoutSize()

offset_type sparta::ArchDataSegment::getLayoutSize ( ) const
inline

Gets the layout size of this segment (number of bytes)

Returns
Number of bytes contained in this segment

Definition at line 124 of file ArchDataSegment.hpp.

◆ getOffset()

offset_type sparta::ArchDataSegment::getOffset ( ) const
inline

Gets the offset of this segment once placed.

Returns
Offset if placed. Otherwise 0.

Definition at line 115 of file ArchDataSegment.hpp.

◆ getSubsetOf()

ident_type sparta::ArchDataSegment::getSubsetOf ( ) const
inline

Gets the segment of which this segment is a subset.

Returns
segment ID. Valid ID if this segment is a subset of some other, INVALID_ID if not.

Definition at line 137 of file ArchDataSegment.hpp.

◆ getSubsetOffset()

offset_type sparta::ArchDataSegment::getSubsetOffset ( ) const
inline

Gets the offset into the segment of which this segment is a subset.

Returns
offset into containing segment. Valid ID if this segment is a subset of some other, INVALID_ID if not.

Definition at line 145 of file ArchDataSegment.hpp.

◆ isPlaced()

bool sparta::ArchDataSegment::isPlaced ( ) const
inline

Has this segment been placed yet.

Returns
true if placed

Definition at line 109 of file ArchDataSegment.hpp.

◆ place()

void sparta::ArchDataSegment::place ( offset_type  offset)
inline

Sets the offset of this DataView within its ArchData then invokes the place_ method for subclasses to handle.

Parameters
offsetOffset into ArchData (data_) where this segment resides now.
Exceptions
SpartaExceptionif already placed. Re-placing is illegal.

Definition at line 81 of file ArchDataSegment.hpp.

Here is the call graph for this function:

◆ place_()

virtual void sparta::ArchDataSegment::place_ ( offset_type  offset)
inlineprotectedvirtual

Allows subclasses to observe placement in an ArchData. Do not write an initial value from within this method. Use writeInitial_ instead.

Subclasses may override and then indirectly invoke this method to respond to the placement. Actual placement may not be modified, however. I

At this point, it is not yet safe to read and write from the ArchData at the specified <offset> with the registered size (size_). Wait until the ArchData completes its layout (adata_.isLaidOut()).

Reimplemented in sparta::DataView.

Definition at line 172 of file ArchDataSegment.hpp.

◆ writeInitial()

void sparta::ArchDataSegment::writeInitial ( )
inline

Invokes writeInitial_, giving subclasses a chance to write a value to memory during initialization or reset of an ArchData.

Precondition
Must be laid out

Definition at line 98 of file ArchDataSegment.hpp.

Here is the call graph for this function:

◆ writeInitial_()

virtual void sparta::ArchDataSegment::writeInitial_ ( )
inlineprotectedvirtual

Write initial value of this segment into ArchData. This occurrs immediately after placement and may occur multiple times later if the owning ArchData is reset.

Precondition
isPlaced() will return true

Subclasses may overwrite to supply an initial value after placement.

Reimplemented in sparta::DataView.

Definition at line 184 of file ArchDataSegment.hpp.

Member Data Documentation

◆ INVALID_ID

const ident_type sparta::ArchDataSegment::INVALID_ID = ~(ident_type)0
static

Indicates an invalid ID for an ArchDataSegment or any refinement.

Definition at line 27 of file ArchDataSegment.hpp.


The documentation for this class was generated from the following file: