Gabe Black has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/21046 )
Change subject: fastmodel: Let the EVS set an attribute for
getSendFunctional to return.
......................................................................
fastmodel: Let the EVS set an attribute for getSendFunctional to return.
The iris CPU model doesn't necessarily know the best way to send
functional packets (what port? what type is that port?), but only has
a generic sc_module pointer to the EVS and so can't call specialized
methods on it. There also isn't any common base class for EVSes to cast
into in a generic way.
This attribute mechanism lets the EVS set up its own sendFunctional
implementation however it needs to using facilities that are built
into generic sc_objects.
Change-Id: I69bf364908c2a5360bd6ce7d3e49ce67c6f771b0
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/21046
Tested-by: kokoro <[email protected]>
Reviewed-by: Giacomo Travaglini <[email protected]>
Maintainer: Giacomo Travaglini <[email protected]>
---
M src/arch/arm/fastmodel/iris/cpu.cc
M src/arch/arm/fastmodel/iris/cpu.hh
2 files changed, 20 insertions(+), 0 deletions(-)
Approvals:
Giacomo Travaglini: Looks good to me, approved; Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/arch/arm/fastmodel/iris/cpu.cc
b/src/arch/arm/fastmodel/iris/cpu.cc
index 234a1ca..246fe0c 100644
--- a/src/arch/arm/fastmodel/iris/cpu.cc
+++ b/src/arch/arm/fastmodel/iris/cpu.cc
@@ -61,6 +61,14 @@
panic_if(base && !periodAttribute,
"The EVS clock period attribute is not of type "
"sc_attribute<Tick>.");
+
+ base = evs->get_attribute(SendFunctionalAttributeName);
+ sendFunctional =
+ dynamic_cast<sc_core::sc_attribute<PortProxy::SendFunctionalFunc>
*>(
+ base);
+ panic_if(base && !sendFunctional,
+ "The EVS send functional attribute is not of type "
+ "sc_attribute<PortProxy::SendFunctionalFunc>.");
}
BaseCPU::~BaseCPU()
diff --git a/src/arch/arm/fastmodel/iris/cpu.hh
b/src/arch/arm/fastmodel/iris/cpu.hh
index c6c75a2..f7be5cb 100644
--- a/src/arch/arm/fastmodel/iris/cpu.hh
+++ b/src/arch/arm/fastmodel/iris/cpu.hh
@@ -49,6 +49,9 @@
// The name of the attribute the subsystem should create which will be set
to
// a pointer to its corresponding gem5 CPU.
static const std::string Gem5CpuAttributeName = "gem5_cpu";
+// The name of the attribute the subsystem should create to hold the
+// sendFunctional delegate for port proxies.
+static const std::string SendFunctionalAttributeName
= "gem5_send_functional";
// This CPU class adds some mechanisms which help attach the gem5 and fast
// model CPUs to each other. It acts as a base class for the gem5 CPU, and
@@ -83,12 +86,21 @@
Counter totalInsts() const override;
Counter totalOps() const override { return totalInsts(); }
+ PortProxy::SendFunctionalFunc
+ getSendFunctional() override
+ {
+ if (sendFunctional)
+ return sendFunctional->value;
+ return ::BaseCPU::getSendFunctional();
+ }
+
protected:
sc_core::sc_module *evs;
private:
sc_core::sc_event *clockEvent;
sc_core::sc_attribute<Tick> *periodAttribute;
+ sc_core::sc_attribute<PortProxy::SendFunctionalFunc> *sendFunctional;
protected:
void
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/21046
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I69bf364908c2a5360bd6ce7d3e49ce67c6f771b0
Gerrit-Change-Number: 21046
Gerrit-PatchSet: 6
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Chun-Chen TK Hsu <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Giacomo Travaglini <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev