dev: avoid intpin to reset value at binding stage
By design SimObject should initialize its state at init() stage. However, the original intpin design will try to reset the sink side when binding. This could cause unexpected issue as the other side does not init() yet. To align with the design, the call to upper()/lower() should be left to the initiator in the init() function instead of constructor. Change-Id: Iec8b228715d093381a33e747849119562bd634e1 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/60751 Maintainer: Jason Lowe-Power <power.jg@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Yu-hsin Wang <yuhsingw@google.com> Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
This commit is contained in:
@@ -55,11 +55,6 @@ IntSourcePinBase::bind(Port &peer)
|
||||
fatal_if(!sink, "Attempt to bind interrupt source pin %s to "
|
||||
"incompatible port %s.", name(), peer.name());
|
||||
Port::bind(peer);
|
||||
|
||||
if (_state)
|
||||
raise();
|
||||
else
|
||||
lower();
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -94,11 +94,10 @@ class IntSourcePinBase : public Port
|
||||
{
|
||||
private:
|
||||
IntSinkPinBase *sink = nullptr;
|
||||
bool _state = false;
|
||||
|
||||
public:
|
||||
IntSourcePinBase(const std::string &_name, PortID _id, bool def_state) :
|
||||
Port(_name, _id), _state(def_state)
|
||||
IntSourcePinBase(const std::string &_name, PortID _id):
|
||||
Port(_name, _id)
|
||||
{}
|
||||
|
||||
void raise() { sink->raise(); }
|
||||
@@ -112,9 +111,8 @@ template <class Device>
|
||||
class IntSourcePin : public IntSourcePinBase
|
||||
{
|
||||
public:
|
||||
IntSourcePin(const std::string &_name, PortID _id, Device *owner,
|
||||
bool def_state=false) :
|
||||
IntSourcePinBase(_name, _id, def_state)
|
||||
IntSourcePin(const std::string &_name, PortID _id, Device *owner) :
|
||||
IntSourcePinBase(_name, _id)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user