/*
- * 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
#include "mem/ruby/network/garnet2.0/VirtualChannel.hh"
VirtualChannel::VirtualChannel(int id)
- : m_enqueue_time(INFINITE_)
-{
- m_id = id;
- m_input_buffer = new flitBuffer();
- m_vc_state.first = IDLE_;
- m_vc_state.second = Cycles(0);
- m_output_vc = -1;
- m_output_port = -1;
-}
-
-VirtualChannel::~VirtualChannel()
+ : m_id(id), inputBuffer(), m_vc_state(IDLE_, Cycles(0)), m_output_port(-1),
+ m_enqueue_time(INFINITE_), m_output_vc(-1)
{
- delete m_input_buffer;
}
void
bool
VirtualChannel::need_stage(flit_stage stage, Cycles time)
{
- if (m_input_buffer->isReady(time)) {
+ if (inputBuffer.isReady(time)) {
assert(m_vc_state.first == ACTIVE_ && m_vc_state.second <= time);
- flit *t_flit = m_input_buffer->peekTopFlit();
+ flit *t_flit = inputBuffer.peekTopFlit();
return(t_flit->is_stage(stage, time));
}
return false;
uint32_t
VirtualChannel::functionalWrite(Packet *pkt)
{
- return m_input_buffer->functionalWrite(pkt);
+ return inputBuffer.functionalWrite(pkt);
}
/*
- * 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
{
public:
VirtualChannel(int id);
- ~VirtualChannel();
+ ~VirtualChannel() = default;
bool need_stage(flit_stage stage, Cycles time);
void set_idle(Cycles curTime);
inline void set_enqueue_time(Cycles time) { m_enqueue_time = time; }
inline VC_state_type get_state() { return m_vc_state.first; }
- inline bool isReady(Cycles curTime)
+ inline bool
+ isReady(Cycles curTime)
{
- return m_input_buffer->isReady(curTime);
+ return inputBuffer.isReady(curTime);
}
inline void
insertFlit(flit *t_flit)
{
- m_input_buffer->insert(t_flit);
+ inputBuffer.insert(t_flit);
}
inline void
inline flit*
peekTopFlit()
{
- return m_input_buffer->peekTopFlit();
+ return inputBuffer.peekTopFlit();
}
inline flit*
getTopFlit()
{
- return m_input_buffer->getTopFlit();
+ return inputBuffer.getTopFlit();
}
uint32_t functionalWrite(Packet *pkt);
private:
int m_id;
- flitBuffer *m_input_buffer;
+ flitBuffer inputBuffer;
std::pair<VC_state_type, Cycles> m_vc_state;
int m_output_port;
Cycles m_enqueue_time;