diff options
author | Gabe Black <gabeblack@google.com> | 2019-08-17 01:40:39 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2019-08-28 08:25:51 +0000 |
commit | 7584c390ebbb890642468a7cfd40aaa52699684e (patch) | |
tree | 205c6735a3a8460249dfe57308996cab06e811a3 /src/cpu/minor | |
parent | 642489740985f2804e8229c69edeb46f2432d8f9 (diff) | |
download | gem5-7584c390ebbb890642468a7cfd40aaa52699684e.tar.xz |
cpu: Make get(Data|Inst)Port return a Port and not a MasterPort.
No caller uses any of the MasterPort specific properties of these
function's return values, so we can instead return a reference to the
base Port class. This makes it possible for the data and inst ports
to be of any port type, not just gem5 style MasterPorts. This makes
life simpler for, for example, systemc based CPUs which might have TLM
ports.
It also makes it possible for any two CPUs which have compatible ports
to be switched between, as long as the ports they use support being
unbound. Unfortunately that does not include TLM or systemc ports which
are bound permanently.
Change-Id: I98fce5a16d2ef1af051238e929dd96d57a4ac838
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/20240
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/cpu/minor')
-rw-r--r-- | src/cpu/minor/cpu.cc | 6 | ||||
-rw-r--r-- | src/cpu/minor/cpu.hh | 4 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/cpu/minor/cpu.cc b/src/cpu/minor/cpu.cc index 63efde2dc..ddba0cdaa 100644 --- a/src/cpu/minor/cpu.cc +++ b/src/cpu/minor/cpu.cc @@ -321,12 +321,14 @@ MinorCPUParams::create() return new MinorCPU(this); } -MasterPort &MinorCPU::getInstPort() +Port & +MinorCPU::getInstPort() { return pipeline->getInstPort(); } -MasterPort &MinorCPU::getDataPort() +Port & +MinorCPU::getDataPort() { return pipeline->getDataPort(); } diff --git a/src/cpu/minor/cpu.hh b/src/cpu/minor/cpu.hh index 4e4762390..e85b67fbe 100644 --- a/src/cpu/minor/cpu.hh +++ b/src/cpu/minor/cpu.hh @@ -114,10 +114,10 @@ class MinorCPU : public BaseCPU Enums::ThreadPolicy threadPolicy; protected: /** Return a reference to the data port. */ - MasterPort &getDataPort() override; + Port &getDataPort() override; /** Return a reference to the instruction port. */ - MasterPort &getInstPort() override; + Port &getInstPort() override; public: MinorCPU(MinorCPUParams *params); |