37#include "debug/RubyNetwork.hh"
38#include "params/GarnetIntLink.hh"
61 if (
mType == enums::LINK_OBJECT) {
64 }
else if (
mType == enums::OBJECT_LINK) {
69 panic(
"CDC type must be set");
76 DPRINTF(RubyNetwork,
"VcsPerVnet VC: %d\n", consumerVcs);
101 Cycles totLatency = latency;
111 sendTime = std::max(nextAvailTick, sendTime);
132 if (
mType == enums::OBJECT_LINK) {
137 DPRINTF(RubyNetwork,
"Target width: %d Current: %d\n",
138 target_width, cur_width);
139 assert(target_width != cur_width);
141 int vc = t_flit->
get_vc();
143 if (target_width > cur_width) {
148 int flitPossible = 0;
162 flitPossible = ceil((
float)sizeAvail/(
float)target_width);
163 assert (flitPossible < 2);
173 flitPossible = floor((
float)sizeAvail/(
float)target_width);
174 assert (flitPossible < 2);
182 DPRINTF(RubyNetwork,
"Deserialize :%dB -----> %dB "
183 " vc:%d\n", cur_width, target_width, vc);
199 DPRINTF(RubyNetwork,
"Scheduling a flit\n");
207 DPRINTF(RubyNetwork,
"Serializing flit :%d -----> %d "
208 "(vc:%d, Original Message Size: %d)\n",
209 cur_width, target_width, vc, t_flit->
msgSize);
211 int flitPossible = 0;
223 flitPossible = floor((
float)sizeAvail/(
float)target_width);
225 sizeSent[vc] += flitPossible*target_width;
230 flitPossible = ceil((
float)sizeAvail/(
float)target_width);
234 assert(flitPossible > 0);
238 for (
int i = 0;
i < flitPossible;
i++) {
242 DPRINTF(RubyNetwork,
"Serialized to flit[%d of %d parts]:"
243 " %s\n",
i+1, flitPossible, *fl);
265 DPRINTF(RubyNetwork,
"Recieved flit %s\n", *t_flit);
Tick clockEdge(Cycles cycles=Cycles(0)) const
Determine the tick when a cycle begins, by default the current one, but the argument also enables the...
Cycles is a wrapper class for representing cycle counts, i.e.
void scheduleEventAbsolute(Tick timeAbs)
void scheduleEvent(Cycles timeDelta)
ClockedObject * getObject()
void setVcsPerVnet(uint32_t consumerVcs)
NetworkBridge(const Params &p)
std::vector< int > sizeSent
std::vector< std::queue< int > > extraCredit
void scheduleFlit(flit *t_flit, Cycles latency)
void neutralize(int vc, int eCredit)
NetworkBridgeParams Params
void flitisizeAndSend(flit *t_flit)
std::vector< int > lenBuffer
void initBridge(NetworkBridge *coBrid, bool cdc_en, bool serdes_en)
std::vector< int > flitsSent
void setLinkConsumer(Consumer *consumer)
void setSourceQueue(flitBuffer *src_queue, ClockedObject *srcClockObject)
virtual void setVcsPerVnet(uint32_t consumerVcs)
flitBuffer * link_srcQueue
bool isReady(Tick curTime)
virtual flit * serialize(int ser_id, int parts, uint32_t bWidth)
virtual flit * deserialize(int des_id, int num_flits, uint32_t bWidth)
#define panic(...)
This implements a cprintf based panic() function.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Tick curTick()
The universal simulation clock.
uint64_t Tick
Tick count type.