segmentation fault - calling function from if statement
In the following code segment, creating variable flit is the only way I've found to run this code without errors. Removing flit and replacing all occurrences with peekFront(noc[id].channels[LOCAL].buffer causes the error: zsh: segmentation fault modest check 3-receive-send.modest
// Advance flits to respective buffers
process AdvanceFlits(int id){
// If flit needs to stay on this row
// TODO fix for x-y routing
int flit;
{=
flit = peekFront(noc[id].channels[LOCAL].buffer)
=};
if(flit >= getFirstInRow(id) && flit <= getLastInRow(id)){
// Send it west
if(flit < id){
Send(id, LOCAL, WEST)
}
// Or send it east
else{
Send(id, LOCAL, EAST)
}
}
// Else, if flit needs to go north
else if(flit < id){
Send(id, LOCAL, NORTH)
}
// Else, flit needs to go south
else{
Send(id, LOCAL, SOUTH)
}
}
Here is the entire model: 3-receive-send.modest
Edited by Jonah Boe