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>
This commit is contained in:
committed by
Daniel Carvalho
parent
80c5add40b
commit
aa5140e26e
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user