28#ifndef __SIM_SIGNAL_HH__
29#define __SIM_SIGNAL_HH__
39template <
typename State>
40class SignalSourcePort;
42template <
typename State>
59 set(
const State &new_state,
const bool bypass_on_change =
false)
84 "incompatible pin %s",
name(), peer.
name());
97template <
typename State>
113 const State &init_state)
122 set(
const State &new_state,
const bool bypass_on_change =
false)
125 sink->set(new_state, bypass_on_change);
135 "incompatible pin %s",
name(), peer.
name());
Ports are used to interface objects to each other.
const std::string name() const
Return port name (for DPRINTF).
virtual void unbind()
Dettach from a peer port.
virtual void bind(Port &peer)
Attach to a peer port.
std::function< void(const State &new_val)> OnChangeFunc
const State & state() const
virtual void set(const State &new_state, const bool bypass_on_change=false)
void onChange(OnChangeFunc func)
void bind(Port &peer) override
Attach to a peer port.
SignalSourcePort< State > * _source
SignalSinkPort(const std::string &_name, PortID _id=InvalidPortID)
void unbind() override
Dettach from a peer port.
void bind(Port &peer) override
Attach to a peer port.
const State & state() const
SignalSourcePort(const std::string &_name, PortID _id, const State &init_state)
void unbind() override
Dettach from a peer port.
void set(const State &new_state, const bool bypass_on_change=false)
SignalSourcePort(const std::string &_name, PortID _id=InvalidPortID)
SignalSinkPort< State > * sink
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
Copyright (c) 2024 Arm Limited All rights reserved.
const PortID InvalidPortID
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.