diff options
author | Korey Sewell <ksewell@umich.edu> | 2011-02-18 14:29:02 -0500 |
---|---|---|
committer | Korey Sewell <ksewell@umich.edu> | 2011-02-18 14:29:02 -0500 |
commit | 72b5233112a41cb879ca63866f9f0ecf8638dbfb (patch) | |
tree | 088819d58becadf24d185f560242abca83c50090 /src/cpu/inorder | |
parent | d5961b2b20b498db28c0598f4344f5cb31be850f (diff) | |
download | gem5-72b5233112a41cb879ca63866f9f0ecf8638dbfb.tar.xz |
inorder: remove events for zero-cycle resources
if a resource has a zero cycle latency (e.g. RegFile write), then dont allocate an event
for it to use
Diffstat (limited to 'src/cpu/inorder')
-rw-r--r-- | src/cpu/inorder/resource.cc | 20 | ||||
-rw-r--r-- | src/cpu/inorder/resources/use_def.cc | 6 |
2 files changed, 21 insertions, 5 deletions
diff --git a/src/cpu/inorder/resource.cc b/src/cpu/inorder/resource.cc index 076084d16..c371f8244 100644 --- a/src/cpu/inorder/resource.cc +++ b/src/cpu/inorder/resource.cc @@ -49,7 +49,10 @@ Resource::Resource(string res_name, int res_id, int res_width, Resource::~Resource() { - delete [] resourceEvent; + if (resourceEvent) { + delete [] resourceEvent; + } + delete deniedReq; } @@ -57,8 +60,14 @@ Resource::~Resource() void Resource::init() { - // Set Up Resource Events to Appropriate Resource BandWidth - resourceEvent = new ResourceEvent[width]; + // If the resource has a zero-cycle (no latency) + // function, then no reason to have events + // that will process them for the right tick + if (latency > 0) { + resourceEvent = new ResourceEvent[width]; + } else { + resourceEvent = NULL; + } for (int i = 0; i < width; i++) { reqs[i] = new ResourceRequest(this); @@ -73,7 +82,10 @@ Resource::initSlots() // Add available slot numbers for resource for (int slot_idx = 0; slot_idx < width; slot_idx++) { availSlots.push_back(slot_idx); - resourceEvent[slot_idx].init(this, slot_idx); + + if (resourceEvent) { + resourceEvent[slot_idx].init(this, slot_idx); + } } } diff --git a/src/cpu/inorder/resources/use_def.cc b/src/cpu/inorder/resources/use_def.cc index 85bf14500..19246a30b 100644 --- a/src/cpu/inorder/resources/use_def.cc +++ b/src/cpu/inorder/resources/use_def.cc @@ -92,7 +92,11 @@ void UseDefUnit::init() { // Set Up Resource Events to Appropriate Resource BandWidth - resourceEvent = new ResourceEvent[width]; + if (latency > 0) { + resourceEvent = new ResourceEvent[width]; + } else { + resourceEvent = NULL; + } for (int i = 0; i < width; i++) { reqs[i] = new UseDefRequest(this); |