SILICON
Loading...
Searching...
No Matches
Wire Class Reference

#include <wire.hpp>

Public Member Functions

 Wire ()
 Wire (State s)
 Wire (uint64_t id, State s)
 Wire (const Wire &other)
 Copies a wire while preserving its existing identifier and authorization.
Wire & operator= (const Wire &other)
 Assigns state, authorization, and identifier from another wire.
State getCurrentState () const
 Reads the current state safely while simulation may update it.
uint64_t getId () const
void forceSetCurrentState (State newState)
void clearAuthorizedComponent ()
 Clears the component currently authorized to drive this wire.
void forceSetCurrentState (State newState, const Component_weakPtr &authorizedBy)
 Forces the wire state without authorization check.
void setCurrentState (State newState, const Component_weakPtr &requestedBy)

Static Public Member Functions

static void safeSetCurrentState (const std::weak_ptr< Wire > &w, State newState, const Component_weakPtr &requestedBy)
static State safeGetCurrentState (const std::weak_ptr< Wire > &w)

Private Attributes

std::atomic< State > currentState
 State shared between the simulation worker and UI readers.
Component_weakPtr authorizedComponent
uint64_t id

Static Private Attributes

static std::atomic< uint64_t > nextId {0}

Detailed Description

Definition at line 56 of file wire.hpp.

Constructor & Destructor Documentation

◆ Wire() [1/4]

Wire ( )

Definition at line 155 of file wire.cpp.

◆ Wire() [2/4]

Wire ( State s)
explicit

Definition at line 161 of file wire.cpp.

◆ Wire() [3/4]

Wire ( uint64_t id,
State s )

Definition at line 167 of file wire.cpp.

◆ Wire() [4/4]

Wire ( const Wire & other)

Copies a wire while preserving its existing identifier and authorization.

Explicitly defined because std::atomic is not implicitly copyable.

Parameters
otherWire to copy

Definition at line 174 of file wire.cpp.

Member Function Documentation

◆ clearAuthorizedComponent()

void clearAuthorizedComponent ( )

Clears the component currently authorized to drive this wire.

Runtime elaboration uses this when a source-level root wire is intentionally shared with newly cloned runtime components. The next runtime driver then claims authorization through the normal state-update path.

Definition at line 206 of file wire.cpp.

◆ forceSetCurrentState() [1/2]

void forceSetCurrentState ( State newState)

Definition at line 201 of file wire.cpp.

◆ forceSetCurrentState() [2/2]

void forceSetCurrentState ( State newState,
const Component_weakPtr & authorizedBy )

Forces the wire state without authorization check.

Parameters
newStateThe new state to set
authorizedByThe component that authorized this change

Definition at line 211 of file wire.cpp.

◆ getCurrentState()

State getCurrentState ( ) const
nodiscard

Reads the current state safely while simulation may update it.

Returns
Current logic state

Definition at line 194 of file wire.cpp.

◆ getId()

uint64_t getId ( ) const
inlinenodiscard

Definition at line 90 of file wire.hpp.

◆ operator=()

Wire & operator= ( const Wire & other)

Assigns state, authorization, and identifier from another wire.

Parameters
otherWire to assign
Returns
This wire

Definition at line 183 of file wire.cpp.

◆ safeGetCurrentState()

State safeGetCurrentState ( const std::weak_ptr< Wire > & w)
static

Definition at line 245 of file wire.cpp.

◆ safeSetCurrentState()

void safeSetCurrentState ( const std::weak_ptr< Wire > & w,
State newState,
const Component_weakPtr & requestedBy )
static

Definition at line 237 of file wire.cpp.

◆ setCurrentState()

void setCurrentState ( State newState,
const Component_weakPtr & requestedBy )

Definition at line 218 of file wire.cpp.

Member Data Documentation

◆ authorizedComponent

Component_weakPtr authorizedComponent
private

Definition at line 62 of file wire.hpp.

◆ currentState

std::atomic<State> currentState
private

State shared between the simulation worker and UI readers.

Definition at line 61 of file wire.hpp.

◆ id

uint64_t id
private

Definition at line 63 of file wire.hpp.

◆ nextId

std::atomic<uint64_t> nextId {0}
inlinestaticprivate

Definition at line 58 of file wire.hpp.


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