Changes in semaphore manager and router
This commit is contained in:
parent
a6b37bd0c1
commit
10d82d8f7c
6 changed files with 775 additions and 740 deletions
|
@ -9,6 +9,7 @@ Corona_NoC_Optical_230924/
|
|||
│ ├── configuration.h
|
||||
│ ├── core.h
|
||||
│ ├── router.h
|
||||
| |__ semaphore_manager.h
|
||||
├── src/
|
||||
│ ├── core.cpp
|
||||
│ ├── router.cpp
|
||||
|
|
|
@ -69,9 +69,9 @@ public:
|
|||
request_queues[semaphore_id].pop();
|
||||
queue_entries[semaphore_id].erase(next_router); // Remove from set when dequeued
|
||||
semaphore_owners[semaphore_id] = next_router;
|
||||
//semaphore_status[semaphore_id] = true; // Mark semaphore as in use
|
||||
semaphore_status[semaphore_id] = true; // Mark semaphore as in use
|
||||
log_info("Token for destination router " + std::to_string(semaphore_id) + " passed to Router " + std::to_string(next_router));
|
||||
request_token(next_router, semaphore_id);
|
||||
//request_token(next_router, semaphore_id);
|
||||
|
||||
} else {
|
||||
semaphore_owners[semaphore_id] = -1;
|
||||
|
@ -91,9 +91,10 @@ public:
|
|||
wait(20, SC_NS);
|
||||
for (int i = 0; i < ROUTER_NO; ++i) {
|
||||
std::lock_guard<sc_mutex> lock(mutex); // Ensure atomic update
|
||||
if (semaphore_owners[i] == -1 && request_queues[i].empty()) {
|
||||
if ((!semaphore_status[i] && (semaphore_owners[i] == -1 || request_queues[i].empty()))) {
|
||||
semaphore_owners[i] = (last_router_owner[i] + 1) % ROUTER_NO;
|
||||
log_info("Updated owner of semaphore " + std::to_string(i) + " to Router " + std::to_string(semaphore_owners[i]));
|
||||
last_router_owner[i] = semaphore_owners[i];
|
||||
|
||||
}
|
||||
}
|
||||
|
|
BIN
obj/router.o
BIN
obj/router.o
Binary file not shown.
Binary file not shown.
1503
out/report.log
1503
out/report.log
File diff suppressed because it is too large
Load diff
|
@ -106,7 +106,7 @@ void router::process_core_fifo() {
|
|||
sem_mgr->release_token(router_id, destination_router_id);
|
||||
|
||||
} else {
|
||||
log_info("Router " + std::string(name()) + ": Destination router's out_fifo full. Retrying with data:" + std::to_string(payload->data));
|
||||
log_info("Router " + std::string(name()) + ": Destination router Router_" + std::to_string(destination_router_id) + "'s out_fifo full. Retrying with data: " + std::to_string(payload->data));
|
||||
other_sems[destination_router_id]->post(); // Release the semaphore
|
||||
sem_mgr->release_token(router_id, destination_router_id); // Release and retry
|
||||
wait(sc_time(5, SC_NS)); // Wait before retrying
|
||||
|
@ -115,7 +115,7 @@ void router::process_core_fifo() {
|
|||
} else {
|
||||
|
||||
|
||||
log_info("Router " + std::string(name()) + ": Semaphore unavailable. Retrying with data:" + std::to_string(payload->data));
|
||||
log_info("Router " + std::string(name()) + ": Semaphore for Router_" + std::to_string(destination_router_id) + " is unavailable. Retrying with data: " + std::to_string(payload->data));
|
||||
wait(sc_time(5, SC_NS)); // Wait before retrying
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue