MFMv2.0.10
Movable Feast Machine Simulator 2.0.10
|
#include <Tile.h>
Public Member Functions | |
void | ReportTileStatus (Logger::Level level) |
const char * | GetLabel () |
OString16 & | GetLabelPrinter () |
Tile () | |
void | SetIgnoreThreadingProblems (bool value) |
void | Reinit () |
void | ClearAtoms () |
void | CheckCacheFromDir (Dir direction, const Tile &otherTile) |
void | SetGeneration (u8 generation) |
u8 | GetGeneration () const |
void | Connect (Tile< CC > &other, Dir toCache) |
Connection * | GetConnection (Dir cache) |
u32 | GetSites () const |
u32 | GetTileWidth () |
Random & | GetRandom () |
ElementTable< CC > & | GetElementTable () |
const ElementTable< CC > & | GetElementTable () const |
const Element< CC > * | GetElement (const u32 elementType) const |
bool | IsConnected (Dir dir) const |
bool | HasAnyConnections (Dir regionDir) const |
bool | IsLiveSite (const SPoint &location) const |
u64 | GetEventsExecuted () const |
Dir | RegionAt (const SPoint &pt, u32 reach) const |
Dir | CacheAt (const SPoint &pt) const |
Dir | SharedAt (const SPoint &pt) const |
Dir | VisibleAt (const SPoint &pt) const |
const T * | GetAtom (const SPoint &pt) const |
T * | GetWritableAtom (const SPoint &pt) |
const T * | GetAtom (s32 x, s32 y) const |
T * | GetWritableAtom (s32 x, s32 y) |
const T * | GetUncachedAtom (const SPoint &pt) const |
const T * | GetUncachedAtom (s32 x, s32 y) const |
u64 | GetUncachedSiteEvents (const SPoint site) const |
u32 | GetUncachedWriteAge (const SPoint site) const |
void | SendAcknowledgmentPacket (Packet< T > &packet) |
void | ReceivePacket (Packet< T > &packet) |
void | FillLastExecutedAtom (SPoint &out) |
void | PlaceAtom (const T &atom, const SPoint &pt) |
void | PlaceInternalAtom (const T &atom, const SPoint &pt) |
bool | FlushAndWaitOnAllBuffers (u32 dirWaitWord) |
void | ReportIfBuffersAreNonEmpty () |
void | SetExecuteOwnEvents (bool value) |
bool | GetExecutingOwnEvents () const |
void | Execute () |
u32 | GetAtomCount (ElementType atomType) const |
void | InternalPutAtom (const T &atom, s32 x, s32 y) |
void | SetAtomCount (ElementType atomType, s32 count) |
void | Start () |
void | Pause () |
bool | IsRunReady () |
void | Run () |
bool | IsPauseReady () |
void | RequestPause () |
void | IncrAtomCount (ElementType atomType, s32 delta) |
void | AssertValidAtomCounts () const |
void | RecountAtomsIfNeeded () |
void | RecountAtoms () |
u64 | WriteEPSRasterLine (ByteSink &outstrm, u32 lineIdx) |
void | RegisterElement (const Element< CC > &anElement) |
void | SetBackgroundRadiation (bool value) |
void | SingleXRay () |
void | SingleXRay (u32 x, u32 y) |
void | XRay (u32 siteOdds, u32 bitOdds) |
Static Public Member Functions | |
static bool | IsInCache (const SPoint &pt) |
static bool | IsOwnedSite (const SPoint &location) |
static bool | IsInTile (const SPoint &pt) |
static bool | IsInUncachedTile (const SPoint &pt) |
static void * | ExecuteThreadHelper (void *tilePtr) |
Static Public Attributes | |
static const u32 | EVENT_WINDOW_RADIUS = R |
static const u32 | TILE_WIDTH = W |
static const u32 | TILE_SIZE = TILE_WIDTH * TILE_WIDTH |
static const u32 | ELEMENT_TABLE_BITS = B |
static const u32 | ELEMENT_TABLE_SIZE = 1u<<ELEMENT_TABLE_BITS |
static const u32 | OWNED_SIDE = TILE_WIDTH-2*R |
Friends | |
class | EventWindow< CC > |
The representation of a single indefinitely scalable hardware tile (whether real or simulated).
void MFM::Tile< CC >::AssertValidAtomCounts | ( | ) | const |
Do a full count of atom types and FAIL unless the atom histogram in m_atomCount is consistent with the content of m_atoms.
void MFM::Tile< CC >::CheckCacheFromDir | ( | Dir | direction, |
const Tile< CC > & | otherTile | ||
) |
Checks part of this Tile's cache assuming the given otherTile
lies in the given direction
from this tile, and the two tiles are connected. Logs debug messages if cache mismatches are found.
void MFM::Tile< CC >::ClearAtoms | ( | ) |
Resets all Atoms and their counts to the Empty atom.
void MFM::Tile< CC >::Execute | ( | ) |
Executes a single new EventWindow at a randomly chosen location.
|
static |
Used during thread execution to call the execution loop.
tilePtr | A pointer to the tile wished to put into an execution loop. |
Fills a specified Point with the coordinates of the last EventWindow center.
out | The Point to fill with the coordinates of the last EventWindow center. All previous data held within this Point will be erased. |
bool MFM::Tile< CC >::FlushAndWaitOnAllBuffers | ( | u32 | dirWaitWord | ) |
|
inline |
u32 MFM::Tile< CC >::GetAtomCount | ( | ElementType | atomType | ) | const |
Connection * MFM::Tile< CC >::GetConnection | ( | Dir | cache | ) |
Finds the Connection which corresponds to one of this tile's caches.
cache | The direction of the held Connection to find. |
|
inline |
Looks up an element type in this Tile's ElementTable.
|
inline |
Gets a reference to this Tile's ElementTable.
|
inline |
Gets a const reference to this Tile's ElementTable.
|
inline |
|
inline |
|
inline |
Gets the tile generation
|
inline |
Returns this Tile's label, if any. May return an empty string, never returns null.
Get access to reset or set the Tile's label.
|
inline |
Gets the number of sites in this Tile in sites, excluding caches.
|
inline |
Gets the width of this Tile in sites, including caches.
|
inline |
Gets an Atom from a specified point in this Tile. Indexing ignores the cache boundary, so possible range is (0,0) to (OWNED_SIDE-1,OWNED_SIDE-1).
x | The x coordinate of the location of the Atom to retrieve. |
y | The y coordinate of the location of the Atom to retrieve. |
Gets the site event count for a specified point in this Tile. Indexing ignores the cache boundary, so possible range is (0,0) to (OWNED_SIDE-1,OWNED_SIDE-1).
site | The coordinates of the location of the site whose event count should be retrieved. |
y | The y coordinate of the location of the site whose event count should be retrieved. |
Gets the 'write age' of a specified point in this Tile. Indexing ignores the cache boundary, so possible range is (0,0) to (OWNED_SIDE-1,OWNED_SIDE-1). The write age is the number of events on this tilesince the contents of the specified point changed. To obtain AEPS, divide this value by Tile::GetSites().
site | The coordinates of the location of the site whose write age should be retrieved. |
y | The y coordinate of the location of the site whose write age should be retrieved. |
|
inline |
void MFM::Tile< CC >::IncrAtomCount | ( | ElementType | atomType, |
s32 | delta | ||
) |
Adds an offset to the count of a particular type of Atom.
atomType | The ElementType of the Atoms of which the count will change. |
delta | The offset to add to the count of all Atoms of type atomType. |
void MFM::Tile< CC >::InternalPutAtom | ( | const T & | atom, |
s32 | x, | ||
s32 | y | ||
) |
|
inline |
Checks to see if a specified local point is contained within a Tile's caches.
pt | The local location which is in question of being inside of a cache. |
Checks to see if a specified local point is contained within a Tile's sites, including caches. If this method returns true, then the GetAtom methods, applied to this location, will not FAIL.
pt | The local location which is in question of being inside the bounds of this Tile |
Checks to see if a specified coordinate is contained within a Tile's sites excluding the caches. Indexing ignores the cache boundary, so possible range is (0,0) to (OWNED_SIDE-1,OWNED_SIDE-1). If this method returns true, then the 'Uncached' methods, applied to this location, will not FAIL.
pt | The coordinate which is in question of being a legal uncached site index in this Tile |
Checks to see if a specified local point is a site that currently might receive events in this particular Tile. Note this method is not static, because liveness depends on the connectivity of this Tile. Therefore, even given the same location as argument, the return value from this method could change over time, if the connectivity of this Tile changes.
pt | The local location which is in question of being a live site that receives events in this Tile |
bool MFM::Tile< CC >::IsPauseReady | ( | ) |
|
inline |
void MFM::Tile< CC >::Pause | ( | ) |
Store an atom anywhere in the Tile, using the 'raw' coordinate system in which (0,0) is in the Tile cache.
|
inline |
Store an atom in the 'locally-owned' portion of a Tile, using the 'natural' coordinate system in which (0,0) is the upper left of the sites that this Tile owns.
atom | The Atom to place within this Tile. |
pt | The local location in which to store atom, beginning in this Tile's main memory. |
void MFM::Tile< CC >::RecountAtoms | ( | ) |
Resets all atom counts and refreshes the atoms counts inside this tile.
void MFM::Tile< CC >::RecountAtomsIfNeeded | ( | ) |
Calls RecountAtoms if anybody has signaled a need to do so. this tile.
Checks to see if a specified SPoint is in a given region of this Tile (i.e. cache, shared, visible, or hidden).
pt | The SPoint to check region membership for. |
reach | The size, in sites from the edge of the tile, of this region. For example, a reach of R would specify searching for Atoms in this Tile's cache. 2*R includes the shared region, and 3*R includes the visible region. |
Registers an Element into this Tile's ElementTable.
the | Element to register into this Tile's ElementTable. |
void MFM::Tile< CC >::Reinit | ( | ) |
Reinitializes a Tile to a like-new (actually, like-OnceOnlyInit()ed) state.
void MFM::Tile< CC >::ReportIfBuffersAreNonEmpty | ( | ) |
Log warnings if connection buffers are not empty.
|
inline |
Advances this Tile from THREADSTATE_RUN_READY to THREADSTATE_RUNNING.
void MFM::Tile< CC >::SetAtomCount | ( | ElementType | atomType, |
s32 | count | ||
) |
Sets the internal count of Atoms of a specified ElementType.
atomType | The ElementType of the Atoms of which the count will change. |
count | The new count of all Atoms of type atomType. |
|
inline |
Sets whether or not background radiation will begin mutating the Atoms of this Tile upon writing.
|
inline |
|
inline |
Sets the tile generation to generation
void MFM::Tile< CC >::SetIgnoreThreadingProblems | ( | bool | value | ) |
Sets a value in this Tile corresponding to its tolerance of threading problems.
value | If true , allows this Tile to ignore threading problems encountered during Tile execution. This is not normally recommended because since it will cause cache inconsistencies, but it will most likely keep your instance of the MFM from crashing if this is set. If false , will crash upon detecting a threading problem. |
Finds the region of shared memory in this Tile which contains a specified SPoint.
pt | The SPoint which should specify a location within shared memory. |
|
inline |
|
inline |
void MFM::Tile< CC >::Start | ( | ) |
Finds the region of visible memory in this Tile which contains a specified SPoint.
pt | The SPoint which should specify a location within visible memory. |
void MFM::Tile< CC >::XRay | ( | u32 | siteOdds, |
u32 | bitOdds | ||
) |
|
static |
The radius of all events taking place in this Tile.
|
static |
|
static |
The area of this Tile in sites.
|
static |
The full length, in sites, of a Tile, including neighbor caches.