Skip to content

Commit

Permalink
Fixed bug on multiple channel
Browse files Browse the repository at this point in the history
  • Loading branch information
davidepatti committed Feb 14, 2020
1 parent 179e380 commit 3e0f7ca
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/Hub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ void Hub::txRadioProcessTokenPacket(int channel)
}
else
{
if (!transmission_in_progress[channel])
if (!transmission_in_progress.at(channel))
{
LOG << "*** [Ch"<<channel<<"] Buffer_tx empty and no trasmission in progress, releasing token" << endl;
flag[channel]->write(RELEASE_CHANNEL);
Expand Down Expand Up @@ -676,7 +676,7 @@ int Hub::selectChannel(int src_hub, int dst_hub) const
{
k = (start_channel+i)%intersection.size();

if (!transmission_in_progress[intersection[k]])
if (!transmission_in_progress.at(intersection[k]))
{
cout << "Found free channel " << intersection[k] << " on (src,dest) (" << src_hub << "," << dst_hub << ") " << endl;
return intersection[k];
Expand Down
6 changes: 3 additions & 3 deletions src/Hub.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ SC_MODULE(Hub)
map<int, sc_in<int>* > current_token_holder;
map<int, sc_in<int>* > current_token_expiration;
map<int, sc_inout<int>* > flag;
bool * transmission_in_progress;
map<int, bool> transmission_in_progress;

map<int, Initiator*> init;
map<int, Target*> target;
Expand Down Expand Up @@ -137,7 +137,7 @@ SC_MODULE(Hub)
buffer_to_tile = new BufferBank[num_ports];

start_from_vc = new int[num_ports];
transmission_in_progress = new bool[num_ports];


current_level_rx = new bool[num_ports];
current_level_tx = new bool[num_ports];
Expand All @@ -146,7 +146,6 @@ SC_MODULE(Hub)

for(int i = 0; i < num_ports; i++)
{
transmission_in_progress[i] = false;
for (int vc = 0;vc<GlobalParams::n_virtual_channels; vc++)
{
buffer_from_tile[i][vc].SetMaxBufferSize(GlobalParams::hub_configuration[local_id].fromTileBufferSize);
Expand All @@ -168,6 +167,7 @@ SC_MODULE(Hub)
current_token_expiration[ch] = new sc_in<int>();
flag[ch] = new sc_inout<int>();
token_ring->attachHub(ch,local_id, current_token_holder[ch],current_token_expiration[ch],flag[ch]);
transmission_in_progress[ch] = false;
// power manager currently assumes TOKEN_PACKET mac policy
if (GlobalParams::use_powermanager)
assert(token_ring->getPolicy(ch).first==TOKEN_PACKET);
Expand Down
5 changes: 2 additions & 3 deletions src/Initiator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,13 @@ void Initiator::thread_process()
hub->power.antennaBufferPop();

if (flit_payload.flit_type == FLIT_TYPE_HEAD)
hub->transmission_in_progress[_channel_id] = true;
hub->transmission_in_progress.at(_channel_id) = true;

if (flit_payload.flit_type == FLIT_TYPE_TAIL)
{
LOG << "*** [Ch"<< _channel_id <<"] tail flit sent " << flit_payload << ", releasing token" << endl;
hub->flag[_channel_id]->write(RELEASE_CHANNEL);
// TODO: vector for multiple channel
hub->transmission_in_progress[_channel_id] = false;
hub->transmission_in_progress.at(_channel_id) = false;
}
}
else
Expand Down

0 comments on commit 3e0f7ca

Please sign in to comment.