28#ifndef __SIM_SIGNAL_HH__
29#define __SIM_SIGNAL_HH__
39template <
typename State>
40class SignalSourcePort;
42template <
typename State>
60 set(
const State &new_state,
const bool bypass_on_change =
false)
83 "incompatible pin %s",
name(), peer.
name());
96template <
typename State>
112 const State &init_state)
121 set(
const State &new_state,
const bool bypass_on_change =
false)
124 sink->set(new_state, bypass_on_change);
134 "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.
void set(const State &new_state, const bool bypass_on_change=false)
std::function< void(const State &new_val)> OnChangeFunc
const State & state() const
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 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
const PortID InvalidPortID
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.