summaryrefslogtreecommitdiff
path: root/src/mem/ruby
diff options
context:
space:
mode:
authorDaniel R. Carvalho <odanrc@yahoo.com.br>2020-01-07 23:49:52 +0100
committerDaniel Carvalho <odanrc@yahoo.com.br>2020-01-14 07:04:57 +0000
commitaa5140e26ef30e0c66397e73b20196d7d855875c (patch)
tree7170d96a19618b05893d084a26b0579955abfc83 /src/mem/ruby
parent80c5add40b096e29fa45d266104af54733f925f0 (diff)
downloadgem5-aa5140e26ef30e0c66397e73b20196d7d855875c.tar.xz
mem-garnet: Use smart pointers for CrossbarSwitch's members
Use smart pointers for the pointers managed by CrossbarSwitch. Change-Id: I71958c72cde5981d730aa3f68bba0ffbe4c2506f Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24244 Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu> Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu> Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'src/mem/ruby')
-rw-r--r--src/mem/ruby/network/garnet2.0/CrossbarSwitch.cc13
-rw-r--r--src/mem/ruby/network/garnet2.0/CrossbarSwitch.hh8
2 files changed, 8 insertions, 13 deletions
diff --git a/src/mem/ruby/network/garnet2.0/CrossbarSwitch.cc b/src/mem/ruby/network/garnet2.0/CrossbarSwitch.cc
index fbaf25b7d..e3a5665be 100644
--- a/src/mem/ruby/network/garnet2.0/CrossbarSwitch.cc
+++ b/src/mem/ruby/network/garnet2.0/CrossbarSwitch.cc
@@ -1,6 +1,7 @@
/*
- * Copyright (c) 2008 Princeton University
+ * Copyright (c) 2020 Inria
* Copyright (c) 2016 Georgia Institute of Technology
+ * Copyright (c) 2008 Princeton University
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -33,13 +34,10 @@
#include "mem/ruby/network/garnet2.0/CrossbarSwitch.hh"
-#include "base/stl_helpers.hh"
#include "debug/RubyNetwork.hh"
#include "mem/ruby/network/garnet2.0/OutputUnit.hh"
#include "mem/ruby/network/garnet2.0/Router.hh"
-using m5::stl_helpers::deletePointers;
-
CrossbarSwitch::CrossbarSwitch(Router *router)
: Consumer(router)
{
@@ -48,11 +46,6 @@ CrossbarSwitch::CrossbarSwitch(Router *router)
m_crossbar_activity = 0;
}
-CrossbarSwitch::~CrossbarSwitch()
-{
- deletePointers(m_switch_buffer);
-}
-
void
CrossbarSwitch::init()
{
@@ -61,7 +54,7 @@ CrossbarSwitch::init()
m_num_inports = m_router->get_num_inports();
m_switch_buffer.resize(m_num_inports);
for (int i = 0; i < m_num_inports; i++) {
- m_switch_buffer[i] = new flitBuffer();
+ m_switch_buffer[i].reset(new flitBuffer());
}
}
diff --git a/src/mem/ruby/network/garnet2.0/CrossbarSwitch.hh b/src/mem/ruby/network/garnet2.0/CrossbarSwitch.hh
index 9d4fee5a7..40d2f6b69 100644
--- a/src/mem/ruby/network/garnet2.0/CrossbarSwitch.hh
+++ b/src/mem/ruby/network/garnet2.0/CrossbarSwitch.hh
@@ -1,6 +1,7 @@
/*
- * Copyright (c) 2008 Princeton University
+ * Copyright (c) 2020 Inria
* Copyright (c) 2016 Georgia Institute of Technology
+ * Copyright (c) 2008 Princeton University
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,6 +36,7 @@
#define __MEM_RUBY_NETWORK_GARNET2_0_CROSSBARSWITCH_HH__
#include <iostream>
+#include <memory>
#include <vector>
#include "mem/ruby/common/Consumer.hh"
@@ -48,7 +50,7 @@ class CrossbarSwitch : public Consumer
{
public:
CrossbarSwitch(Router *router);
- ~CrossbarSwitch();
+ ~CrossbarSwitch() = default;
void wakeup();
void init();
void print(std::ostream& out) const {};
@@ -66,7 +68,7 @@ class CrossbarSwitch : public Consumer
int m_num_inports;
double m_crossbar_activity;
Router *m_router;
- std::vector<flitBuffer *> m_switch_buffer;
+ std::vector<std::unique_ptr<flitBuffer>> m_switch_buffer;
std::vector<OutputUnit *> m_output_unit;
};