diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9924173..876fee7 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -32,6 +32,7 @@ ADD_EXECUTABLE(${PROJECT_NAME}
src/utils/memory_manager.cpp
src/utils/utils.cpp
src/utils/noc_logger.cpp
+ src/utils/report.cpp
src/ratatoskrUtils/utils/Report.cpp
src/ratatoskrUtils/utils/GlobalReport.cpp
src/ratatoskrUtils/utils/Structures.cpp
@@ -46,13 +47,7 @@ ADD_EXECUTABLE(${PROJECT_NAME}
src/ratatoskrUtils/traffic/synthetic/SyntheticPool.cpp
src/ratatoskrUtils/traffic/task/TaskPool.cpp
src/ratatoskrUtils/traffic/TrafficPool.cpp
- src/ratatoskrUtils/link/Link.cpp
- src/ratatoskrUtils/traffic/netrace/NetracePool.cpp
- src/ratatoskrUtils/traffic/netrace/NetracePool.h
- src/ratatoskrUtils/traffic/netrace/ntNetrace.h
- src/ratatoskrUtils/traffic/netrace/ntNetrace.cpp
- src/ratatoskrUtils/traffic/netrace/ntQueue.h
- src/ratatoskrUtils/traffic/netrace/ntQueue.cpp
+ src/ratatoskrUtils/link/Link.cpp
src/ratatoskrUtils/utils/TrafficTracer.cpp
)
diff --git a/README.md b/README.md
index dbf0838..7b423ff 100755
--- a/README.md
+++ b/README.md
@@ -47,4 +47,7 @@ This project is licensed under the MIT License - see the LICENSE.md file for det
## Acknowledgments
-* [Ratatoskr NoC simulator](https://github.com/jmjos/ratatoskr)
\ No newline at end of file
+* [Ratatoskr NoC simulator](https://github.com/jmjos/ratatoskr)
+
+### TODO
+- Check why there is no throttled messages for router
\ No newline at end of file
diff --git a/config/ai_test/data.xml b/config/ai_test/data.xml
index 49545fa..e373369 100755
--- a/config/ai_test/data.xml
+++ b/config/ai_test/data.xml
@@ -264,9 +264,9 @@
-
-
-
+
+
+
@@ -284,9 +284,9 @@
-
-
-
+
+
+
@@ -297,7 +297,7 @@
-
+
@@ -310,9 +310,9 @@
-
-
-
+
+
+
@@ -323,7 +323,7 @@
-
+
@@ -336,9 +336,9 @@
-
-
-
+
+
+
@@ -349,7 +349,7 @@
-
+
@@ -362,9 +362,9 @@
-
-
-
+
+
+
@@ -375,7 +375,7 @@
-
+
@@ -388,9 +388,9 @@
-
-
-
+
+
+
@@ -401,7 +401,7 @@
-
+
@@ -414,16 +414,16 @@
-
-
-
+
+
+
-
-
-
+
+
+
@@ -434,7 +434,7 @@
-
+
@@ -447,9 +447,9 @@
-
-
-
+
+
+
@@ -460,7 +460,7 @@
-
+
@@ -473,9 +473,9 @@
-
-
-
+
+
+
@@ -486,7 +486,7 @@
-
+
@@ -499,9 +499,9 @@
-
-
-
+
+
+
@@ -512,7 +512,7 @@
-
+
@@ -525,16 +525,16 @@
-
-
-
+
+
+
-
-
-
+
+
+
@@ -545,12 +545,12 @@
-
+
-
+
@@ -563,9 +563,9 @@
-
-
-
+
+
+
@@ -576,7 +576,7 @@
-
+
@@ -589,9 +589,9 @@
-
-
-
+
+
+
@@ -602,7 +602,7 @@
-
+
@@ -615,9 +615,9 @@
-
-
-
+
+
+
@@ -628,7 +628,7 @@
-
+
@@ -641,9 +641,9 @@
-
-
-
+
+
+
@@ -654,12 +654,12 @@
-
+
-
+
@@ -672,9 +672,9 @@
-
-
-
+
+
+
@@ -685,7 +685,7 @@
-
+
@@ -698,9 +698,9 @@
-
-
-
+
+
+
@@ -711,7 +711,7 @@
-
+
@@ -724,16 +724,16 @@
-
-
-
+
+
+
-
-
-
+
+
+
@@ -744,7 +744,7 @@
-
+
@@ -757,9 +757,9 @@
-
-
-
+
+
+
@@ -770,7 +770,7 @@
-
+
@@ -783,9 +783,9 @@
-
-
-
+
+
+
@@ -796,7 +796,7 @@
-
+
@@ -809,9 +809,9 @@
-
-
-
+
+
+
@@ -822,7 +822,7 @@
-
+
@@ -835,16 +835,16 @@
-
-
-
+
+
+
-
-
-
+
+
+
@@ -855,12 +855,12 @@
-
+
-
+
@@ -873,9 +873,9 @@
-
-
-
+
+
+
@@ -886,7 +886,7 @@
-
+
@@ -899,9 +899,9 @@
-
-
-
+
+
+
@@ -912,7 +912,7 @@
-
+
@@ -925,9 +925,9 @@
-
-
-
+
+
+
@@ -938,7 +938,7 @@
-
+
@@ -951,9 +951,9 @@
-
-
-
+
+
+
@@ -964,12 +964,12 @@
-
+
-
+
@@ -982,9 +982,9 @@
-
-
-
+
+
+
@@ -995,7 +995,7 @@
-
+
@@ -1008,9 +1008,9 @@
-
-
-
+
+
+
@@ -1021,7 +1021,7 @@
-
+
@@ -1034,16 +1034,16 @@
-
-
-
+
+
+
-
-
-
+
+
+
@@ -1054,7 +1054,7 @@
-
+
@@ -1067,9 +1067,9 @@
-
-
-
+
+
+
@@ -1080,7 +1080,7 @@
-
+
@@ -1093,9 +1093,9 @@
-
-
-
+
+
+
@@ -1106,7 +1106,7 @@
-
+
@@ -1119,9 +1119,9 @@
-
-
-
+
+
+
@@ -1132,7 +1132,7 @@
-
+
@@ -1145,16 +1145,16 @@
-
-
-
+
+
+
-
-
-
+
+
+
@@ -1165,12 +1165,12 @@
-
+
-
+
@@ -1183,9 +1183,9 @@
-
-
-
+
+
+
@@ -1196,7 +1196,7 @@
-
+
@@ -1209,9 +1209,9 @@
-
-
-
+
+
+
@@ -1222,7 +1222,7 @@
-
+
@@ -1235,9 +1235,9 @@
-
-
-
+
+
+
@@ -1248,7 +1248,7 @@
-
+
@@ -1261,16 +1261,16 @@
-
-
-
+
+
+
-
-
-
+
+
+
@@ -1281,12 +1281,12 @@
-
+
-
+
@@ -1299,9 +1299,9 @@
-
-
-
+
+
+
@@ -1312,7 +1312,7 @@
-
+
@@ -1325,9 +1325,9 @@
-
-
-
+
+
+
@@ -1338,7 +1338,7 @@
-
+
@@ -1351,9 +1351,9 @@
-
-
-
+
+
+
@@ -1364,7 +1364,7 @@
-
+
@@ -1377,9 +1377,9 @@
-
-
-
+
+
+
@@ -1390,12 +1390,12 @@
-
+
-
+
@@ -1408,9 +1408,9 @@
-
-
-
+
+
+
@@ -1421,7 +1421,7 @@
-
+
@@ -1434,9 +1434,9 @@
-
-
-
+
+
+
@@ -1447,7 +1447,7 @@
-
+
@@ -1460,16 +1460,16 @@
-
-
-
+
+
+
-
-
-
+
+
+
@@ -1480,7 +1480,7 @@
-
+
@@ -1493,9 +1493,9 @@
-
-
-
+
+
+
@@ -1506,7 +1506,7 @@
-
+
@@ -1519,9 +1519,9 @@
-
-
-
+
+
+
@@ -1532,7 +1532,7 @@
-
+
@@ -1545,9 +1545,9 @@
-
-
-
+
+
+
@@ -1558,7 +1558,7 @@
-
+
@@ -1571,16 +1571,16 @@
-
-
-
+
+
+
-
-
-
+
+
+
@@ -1591,12 +1591,12 @@
-
+
-
+
@@ -1609,9 +1609,9 @@
-
-
-
+
+
+
@@ -1622,7 +1622,7 @@
-
+
@@ -1635,9 +1635,9 @@
-
-
-
+
+
+
@@ -1648,7 +1648,7 @@
-
+
@@ -1661,9 +1661,9 @@
-
-
-
+
+
+
@@ -1674,7 +1674,7 @@
-
+
@@ -1687,16 +1687,16 @@
-
-
-
+
+
+
-
-
-
+
+
+
@@ -1707,12 +1707,12 @@
-
+
-
+
@@ -1725,9 +1725,9 @@
-
-
-
+
+
+
@@ -1738,7 +1738,7 @@
-
+
@@ -1751,9 +1751,9 @@
-
-
-
+
+
+
@@ -1764,7 +1764,7 @@
-
+
@@ -1777,9 +1777,9 @@
-
-
-
+
+
+
@@ -1790,7 +1790,7 @@
-
+
@@ -1803,9 +1803,9 @@
-
-
-
+
+
+
@@ -1816,12 +1816,12 @@
-
+
-
+
@@ -1834,9 +1834,9 @@
-
-
-
+
+
+
@@ -1847,7 +1847,7 @@
-
+
@@ -1860,9 +1860,9 @@
-
-
-
+
+
+
@@ -1873,7 +1873,7 @@
-
+
@@ -1886,16 +1886,16 @@
-
-
-
+
+
+
-
-
-
+
+
+
@@ -1906,7 +1906,7 @@
-
+
@@ -1919,9 +1919,9 @@
-
-
-
+
+
+
@@ -1932,7 +1932,7 @@
-
+
@@ -1945,9 +1945,9 @@
-
-
-
+
+
+
@@ -1958,7 +1958,7 @@
-
+
@@ -1971,9 +1971,9 @@
-
-
-
+
+
+
@@ -1984,7 +1984,7 @@
-
+
@@ -1997,16 +1997,16 @@
-
-
-
+
+
+
-
-
-
+
+
+
@@ -2017,12 +2017,12 @@
-
+
-
+
@@ -2035,9 +2035,9 @@
-
-
-
+
+
+
@@ -2048,7 +2048,7 @@
-
+
@@ -2061,9 +2061,9 @@
-
-
-
+
+
+
@@ -2074,7 +2074,7 @@
-
+
@@ -2087,9 +2087,9 @@
-
-
-
+
+
+
@@ -2100,7 +2100,7 @@
-
+
@@ -2113,16 +2113,16 @@
-
-
-
+
+
+
-
-
-
+
+
+
@@ -2133,12 +2133,12 @@
-
+
-
+
@@ -2151,9 +2151,9 @@
-
-
-
+
+
+
@@ -2164,7 +2164,7 @@
-
+
@@ -2177,9 +2177,9 @@
-
-
-
+
+
+
@@ -2190,7 +2190,7 @@
-
+
@@ -2203,9 +2203,9 @@
-
-
-
+
+
+
@@ -2216,7 +2216,7 @@
-
+
@@ -2229,16 +2229,16 @@
-
-
-
+
+
+
-
-
-
+
+
+
@@ -2249,12 +2249,12 @@
-
+
-
+
@@ -2267,9 +2267,9 @@
-
-
-
+
+
+
@@ -2280,7 +2280,7 @@
-
+
@@ -2293,9 +2293,9 @@
-
-
-
+
+
+
@@ -2306,7 +2306,7 @@
-
+
@@ -2319,9 +2319,9 @@
-
-
-
+
+
+
@@ -2332,7 +2332,7 @@
-
+
@@ -2345,9 +2345,9 @@
-
-
-
+
+
+
@@ -2358,12 +2358,12 @@
-
+
-
+
@@ -2376,9 +2376,9 @@
-
-
-
+
+
+
@@ -2389,7 +2389,7 @@
-
+
@@ -2402,9 +2402,9 @@
-
-
-
+
+
+
@@ -2415,7 +2415,7 @@
-
+
@@ -2428,9 +2428,9 @@
-
-
-
+
+
+
@@ -2441,7 +2441,7 @@
-
+
@@ -2454,9 +2454,9 @@
-
-
-
+
+
+
@@ -2467,7 +2467,7 @@
-
+
@@ -2480,9 +2480,9 @@
-
-
-
+
+
+
@@ -2493,7 +2493,7 @@
-
+
@@ -2507,8 +2507,8 @@
-
-
+
+
@@ -2519,7 +2519,7 @@
-
+
@@ -2532,9 +2532,9 @@
-
-
-
+
+
+
@@ -2545,7 +2545,7 @@
-
+
@@ -2558,9 +2558,9 @@
-
-
-
+
+
+
@@ -2571,7 +2571,7 @@
-
+
@@ -2589,7 +2589,7 @@
-
+
diff --git a/config/simple_2_point_test/2pt_data.xml b/config/simple_2_point_test/2pt_data.xml
index c91fdb8..42b28e9 100755
--- a/config/simple_2_point_test/2pt_data.xml
+++ b/config/simple_2_point_test/2pt_data.xml
@@ -5,7 +5,7 @@
-
+
@@ -18,8 +18,8 @@
-
-
+
+
@@ -38,8 +38,8 @@
-
-
+
+
@@ -57,12 +57,7 @@
-
-
-
-
-
-
+
diff --git a/config/simple_2_point_test/config.xml b/config/simple_2_point_test/config.xml
index 4de57e7..bc0faa5 100755
--- a/config/simple_2_point_test/config.xml
+++ b/config/simple_2_point_test/config.xml
@@ -5,7 +5,7 @@
report
- config/simple_test/net.xml
+ config/simple_2_point_test/net.xml
diff --git a/config/throttle_test/config.xml b/config/throttle_test/config.xml
new file mode 100755
index 0000000..8f5501d
--- /dev/null
+++ b/config/throttle_test/config.xml
@@ -0,0 +1,55 @@
+
+
+
+
+ report
+
+
+ config/throttle_test/net.xml
+
+
+
+
+
+ task
+ config/throttle_test/data.xml
+ config/throttle_test/map.xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 5 6 9 10
+
+
diff --git a/config/throttle_test/data.xml b/config/throttle_test/data.xml
new file mode 100755
index 0000000..b79db77
--- /dev/null
+++ b/config/throttle_test/data.xml
@@ -0,0 +1,245 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/config/throttle_test/map.xml b/config/throttle_test/map.xml
new file mode 100755
index 0000000..f165073
--- /dev/null
+++ b/config/throttle_test/map.xml
@@ -0,0 +1,51 @@
+
+
diff --git a/config/throttle_test/net.xml b/config/throttle_test/net.xml
new file mode 100755
index 0000000..7407f52
--- /dev/null
+++ b/config/throttle_test/net.xml
@@ -0,0 +1,879 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main.cpp b/src/main.cpp
index 667cb93..18df502 100755
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -27,6 +27,7 @@
#include "utils/GlobalResourcesCS.h"
#include "networkManager/NetworkManager.h"
+#include "utils/report.h"
namespace po = boost::program_options;
@@ -55,5 +56,8 @@ int sc_main(int arg_num, char *arg_vec[])
sc_start(globalResources.simulation_time, SC_NS);
cout << endl
<< "Simulation completed! Time: "<< sc_time_stamp() << endl;
+
+ TlmReport& report = TlmReport::getInstance();
+ report.write_report();
return 0;
}
diff --git a/src/networkInterface/NetworkInterfaceTlm.cpp b/src/networkInterface/NetworkInterfaceTlm.cpp
index 622e7a2..ec57717 100755
--- a/src/networkInterface/NetworkInterfaceTlm.cpp
+++ b/src/networkInterface/NetworkInterfaceTlm.cpp
@@ -54,12 +54,12 @@ NetworkInterfaceTlm::NetworkInterfaceTlm(sc_module_name nm, Node& node,
sensitive << packetPortContainer->portValidIn.pos();
for(uint8_t lay=0; layregister_nb_transport_bw(this,
&NetworkInterfaceTlm::nb_transport_bw_cb, lay);
- target[lay] = new ni_targ_socket((string(nm)+"_"+
+ target[lay] = new ni_targ_socket((ni_name+"_"+
to_string(lay)+"targ").c_str());
target[lay]->register_nb_transport_fw(this,
&NetworkInterfaceTlm::nb_transport_fw_cb, lay);
@@ -263,6 +263,7 @@ void NetworkInterfaceTlm::thread() {
}
else {
if(log_wait){
+ report.update_throttled_count(ni_name);
if(credit_counter == 0){
log_info("No more credits. Waiting for Router!");
}
@@ -312,7 +313,7 @@ void NetworkInterfaceTlm::init_peq_cb(tlm_gp& trans, const tlm::tlm_phase& phase
log_info("Init PEQ callback start for packet "+to_string(p_id));
log_info("Phase "+string(phase.get_name())+" received");
if (phase == tlm::END_REQ) {
- update_credits(trans, 1);
+ //update_credits(trans, 1);
curr_req = 0;
if(p_id == -1){
// Config msg transaction ended, so packet can be scheduled for deletion
@@ -465,6 +466,7 @@ void NetworkInterfaceTlm::target_peq_cb(tlm_gp& trans, const tlm::tlm_phase& pha
break;
default:
+ report.update_packet_count(ni_name);
if(phase == INTERNAL_PROC_PHASE){
receive_and_process_flit(trans);
}
@@ -505,7 +507,7 @@ void NetworkInterfaceTlm::send_response(tlm_gp& trans){
tlm::tlm_sync_enum status = (*target[0])->nb_transport_bw(
trans, bw_phase, delay);
- update_credits(trans, -1);
+ //update_credits(trans, -1);
if (status == tlm::TLM_UPDATED){
target_peq.notify(trans, bw_phase, delay);
@@ -522,27 +524,28 @@ void NetworkInterfaceTlm::send_response(tlm_gp& trans){
void NetworkInterfaceTlm::update_credits(tlm_gp&trans, int added_creds){
string type_name = get_type_name(get_type_from_extension(trans));
int p_id = get_packet_id_from_extension(trans);
-
- if(type_name == TYPE_PACKET || (type_name == TYPE_ROUT_CONFIG && p_id != -1)){
+ //if(type_name == TYPE_PACKET || (type_name == TYPE_ROUT_CONFIG && p_id != -1)){
+ if (!((type_name == TYPE_ROUT_CONFIG && p_id == -1) ||
+ type_name == TYPE_STREAM)){
credit_counter += added_creds;
log_info("Credit counter updated: "+to_string(credit_counter));
}
}
void NetworkInterfaceTlm::log_info(string msg){
- string log_msg = ni_name + ": (Node" +
+ string log_msg = string(name()) + ": (Node" +
to_string(node.id)+"): "+msg;
SC_REPORT_INFO(NI_LOG, (log_msg).c_str());
}
void NetworkInterfaceTlm::log_error(string msg){
- string log_msg = ni_name + ": (Node" +
+ string log_msg = string(name()) + ": (Node" +
to_string(node.id)+"): "+msg;
SC_REPORT_ERROR(NI_LOG, (log_msg).c_str());
}
void NetworkInterfaceTlm::log_fatal(string msg){
- string log_msg = ni_name + ": (Node" +
+ string log_msg = string(name()) + ": (Node" +
to_string(node.id)+"): "+msg;
SC_REPORT_FATAL(NI_LOG, (log_msg).c_str());
}
diff --git a/src/networkInterface/NetworkInterfaceTlm.h b/src/networkInterface/NetworkInterfaceTlm.h
index acd156b..d5f81b3 100755
--- a/src/networkInterface/NetworkInterfaceTlm.h
+++ b/src/networkInterface/NetworkInterfaceTlm.h
@@ -54,7 +54,6 @@ public:
std::queue packet_send_queue;
std::queue packet_recv_queue;
- string ni_name;
// To PE
sc_in clk;
PacketPortContainer* packetPortContainer;
@@ -66,12 +65,14 @@ public:
tlm_gp* curr_req;
tlm_gp* nxt_resp_pend;
+ string ni_name;
bool resp_in_progress;
int credit_counter;
MemoryManager m_mm;
uint8_t max_pos[3];
bool valid_socket[NUM_ACC_LAYERS] = {false};
+ TlmReport& report = TlmReport::getInstance();
sc_event_or_list ev_msg_arrv;
diff --git a/src/networkManager/NetworkManager.cpp b/src/networkManager/NetworkManager.cpp
index c1fa379..727fb3f 100755
--- a/src/networkManager/NetworkManager.cpp
+++ b/src/networkManager/NetworkManager.cpp
@@ -55,7 +55,6 @@ void NetworkManager::createTrafficPool() {
get_max_pos(max_pos);
// divided by num of layers (assuming equal number of nodes in each layer)
unsigned long numOfPEs = globalResources.nodes.size() / (max_pos[2]+1);
-#ifndef ENABLE_NETRACE
if (globalResources.benchmark == "task") {
tp = std::make_unique();
} else if (globalResources.benchmark == "synthetic") {
@@ -63,7 +62,6 @@ void NetworkManager::createTrafficPool() {
} else {
FATAL("Please specify correct benchmark type");
}
-#endif
tp->processingElements.resize(numOfPEs);
}
diff --git a/src/router/router.cpp b/src/router/router.cpp
index 0b57c79..73b31e9 100755
--- a/src/router/router.cpp
+++ b/src/router/router.cpp
@@ -46,18 +46,18 @@ void TlmRouter::initialize(){
to_string(link)+"_init").c_str());
(*init_socket[link]).register_nb_transport_bw(this,
&TlmRouter::nb_transport_bw_cb, link);
-
+
target_socket[link] = new rout_targ_socket((router_name+"_"+
to_string(link)+"_targ").c_str());
(*target_socket[link]).register_nb_transport_fw(this,
&TlmRouter::nb_transport_fw_cb, link);
-
+
valid_links[link] = false;
resp_in_progress[link] = false;
- nxt_resp_pend[link] = 0;
- nxt_send_data_pend[link] = 0;
+ //nxt_resp_pend[link] = 0;
+ //nxt_send_data_pend[link] = 0;
curr_req[link] = 0;
- send_data_in_prog_dest[link] = Direction::invalid;
+ //send_data_in_prog_dest[link] = Direction::invalid;
credit_counter[link] = NUM_CREDITS;
}
}
@@ -98,8 +98,8 @@ void TlmRouter::send_begin_req(int link, tlm_gp& trans, int dest_link){
*new_trans, phase, delay);
curr_req[dest_link] = new_trans;
credit_counter[dest_link]--;
- log_info(link, trans,
- "credits value updated: " + to_string(credit_counter[dest_link]));
+ log_info(link, trans, "credits value updated on link " + DIR::toString(dest_link) +
+ ": " + to_string(credit_counter[dest_link]));
// react to result
if(status == TLM_UPDATED) {
init_peq.notify(*new_trans, phase, delay);
@@ -109,8 +109,8 @@ void TlmRouter::send_begin_req(int link, tlm_gp& trans, int dest_link){
curr_req[dest_link] = 0;
check_transaction(link, *new_trans);
credit_counter[dest_link]++;
- log_info(link, trans,
- "credits value updated: " + to_string(credit_counter[dest_link]));
+ log_info(link, trans, "credits value updated on link " + DIR::toString(dest_link) +
+ ": " + to_string(credit_counter[dest_link]));
new_trans->release();
}
}
@@ -121,10 +121,17 @@ bool TlmRouter::send_data(int link, int dest_link, tlm_gp& trans){
// check credits or that previous message is complete
if (credit_counter[dest_link] > 0){
send_begin_req(link, trans, dest_link);
+ // send response or add it to queue
+ if(resp_in_progress[link]) {
+ nxt_resp_pend[link].push(&trans);
+ }
+ else{ send_begin_response(link, trans); }
+
return true;
}
else {
log_warn(link,trans, "Waiting for downstream Router!");
+ report.update_throttled_count(router_name);
return false;
}
}
@@ -145,7 +152,6 @@ void TlmRouter::check_transaction(int link, tlm_gp& trans) {
stream << hex << adr << " check, cmd=" << (cmd ? 'W' : 'R')
<< ", data=" << hex << *ptr;
log_info(link,trans, stream.str());
- // Allow the memory manager to free the transaction object
trans.release();
}
@@ -176,12 +182,12 @@ void TlmRouter::init_peq_cb(tlm_gp& trans, const tlm_phase& phase){
int link = get_link_from_extension(trans);
log_info(link,trans, "Initiator PEQ callback start");
log_info(link,trans, "Phase "+string(phase.get_name())+" received");
- if (phase == END_REQ || (&trans == curr_req[link] &&
- phase == BEGIN_RESP)){
+ if (phase == END_REQ || (&trans == curr_req[link] && phase == BEGIN_RESP)){
curr_req[link] = 0;
- credit_counter[link]++;
- log_info(link, trans,
- "credits value updated: " + to_string(credit_counter[link]));
+ /*credit_counter[link]++;
+ log_info(link, trans, "credits value updated on link " + DIR::toString(link) +
+ ": " + to_string(credit_counter[link]));*/
+ log_info(link, trans, "Issuing next request");
start_pend_req(link, trans);
}
else if (phase == BEGIN_REQ || phase == END_RESP){
@@ -189,7 +195,9 @@ void TlmRouter::init_peq_cb(tlm_gp& trans, const tlm_phase& phase){
}
if (phase == BEGIN_RESP) {
- check_transaction(link, trans);
+ credit_counter[link]++;
+ log_info(link, trans, "credits value updated on link " + DIR::toString(link) +
+ ": " + to_string(credit_counter[link]));
send_end_response(link, trans);
}
}
@@ -197,20 +205,20 @@ void TlmRouter::init_peq_cb(tlm_gp& trans, const tlm_phase& phase){
void TlmRouter::start_pend_req(int rel_link, tlm_gp& trans){
// find pending link
- Direction pending_link = Direction::invalid;
for(uint8_t dir=0; dir
#include
+#include
#include "tlm.h"
#include "tlm_utils/simple_initiator_socket.h"
@@ -37,6 +38,7 @@
#include "utils/configuration.h"
#include "utils/utils.h"
#include "utils/noc_logger.h"
+#include "utils/report.h"
using namespace sc_core;
using namespace sc_dt;
@@ -59,12 +61,12 @@ class TlmRouter : public sc_module{
peq_with_cb_and_phase init_peq;
peq_with_cb_and_phase target_peq;
tlm_gp* curr_req[NUM_LINKS];
- tlm_gp* nxt_resp_pend[NUM_LINKS];
- tlm_gp* nxt_send_data_pend[NUM_LINKS];
MemoryManager m_mm;
- bool resp_in_progress[NUM_LINKS];
int credit_counter[NUM_LINKS];
- Dir send_data_in_prog_dest[NUM_LINKS];
+ bool resp_in_progress[NUM_LINKS];
+ queue nxt_resp_pend[NUM_LINKS];
+ queue nxt_send_data_pend[NUM_LINKS];
+ queue send_data_in_prog_dest[NUM_LINKS];
// attributes
string router_name;
@@ -72,6 +74,8 @@ class TlmRouter : public sc_module{
uint8_t max_pos[3];
bool valid_links[NUM_LINKS];
+ TlmReport& report = TlmReport::getInstance();
+
SC_HAS_PROCESS(TlmRouter);
TlmRouter(sc_module_name name, uint8_t rout_pos[3],
uint8_t max_pos[3]);
diff --git a/src/router/router_cs.cpp b/src/router/router_cs.cpp
index d63f360..d310bfe 100755
--- a/src/router/router_cs.cpp
+++ b/src/router/router_cs.cpp
@@ -35,7 +35,7 @@ void TlmRouterCS::initialize(){
TlmRouter::initialize();
cout<<"Inherited function called";
for(int link=0; linknb_transport_fw(
*new_trans, phase, delay);
curr_req[dest_link] = new_trans;
- credit_counter[dest_link]--;
- log_info(link, trans,
- "credits value updated: " + to_string(credit_counter[link]));
+ //credit_counter[dest_link]--;
+ /*log_info(link, trans,
+ "credits value updated: " + to_string(credit_counter[link]));*/
// react to result
if(status == TLM_COMPLETED) {
log_error(link, trans, "Request completed prematurely");
curr_req[dest_link] = 0;
check_transaction(link, *new_trans);
- credit_counter[dest_link]++;
- log_info(link, trans,
- "credits value updated: " + to_string(credit_counter[dest_link]));
+ //credit_counter[dest_link]++;
+ /*log_info(link, trans,
+ "credits value updated: " + to_string(credit_counter[dest_link]));*/
new_trans->release();
}
}
@@ -122,6 +122,7 @@ void TlmRouterCS::target_peq_cb(tlm_gp& trans, const tlm_phase& phase){
send_end_req(link, trans);
break;
default:
+ report.update_packet_count(name());
if(phase == INTERNAL_PROC_PHASE){
switching(link, trans);
}
diff --git a/src/utils/configuration.h b/src/utils/configuration.h
index 5172a1a..064c9a7 100755
--- a/src/utils/configuration.h
+++ b/src/utils/configuration.h
@@ -34,10 +34,10 @@ using namespace sc_dt;
// router paremters
#define NUM_CREDITS 7
// router delays
-#define REQ_INIT_DELAY 20
-#define REQ_END_DELAY 20
-#define INTERN_PROC_DELAY 20
-#define RESP_END_DELAY 20
+#define REQ_INIT_DELAY 10
+#define REQ_END_DELAY 10
+#define INTERN_PROC_DELAY 100
+#define RESP_END_DELAY 10
#define UNITS_DELAY SC_NS
// types
diff --git a/src/utils/report.cpp b/src/utils/report.cpp
index e69de29..2719455 100644
--- a/src/utils/report.cpp
+++ b/src/utils/report.cpp
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (C) 2024 Juan Neyra
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ ******************************************************************************/
+#include "report.h"
+#include
+#include
+#include
+
+TlmReport::TlmReport(){
+}
+
+TlmReport &TlmReport::getInstance()
+{
+ static TlmReport instance;
+ return instance;
+}
+
+void TlmReport::update_packet_count(string np_name){
+ // check if np_name exists in packet_count
+ if(packet_count.count(np_name)){
+ packet_count[np_name] += 1;
+ }
+ else{
+ packet_count.insert(std::make_pair(np_name, 1));
+ }
+}
+
+
+void TlmReport::update_throttled_count(string np_name){
+ if(throttled_count.count(np_name)){
+ throttled_count[np_name] += 1;
+ }
+ else{
+ throttled_count.insert(std::make_pair(np_name, 1));
+ }
+}
+
+
+void TlmReport::write_report(){
+ cout << endl << "Write packet count csv file" << endl;
+ stringstream ss_msg_packet;
+ ss_msg_packet << "router,packet_count" << endl;
+ for(auto& pc_pair: packet_count){
+ ss_msg_packet << string(pc_pair.first) << "," << to_string(pc_pair.second) << endl;
+ }
+
+ ofstream log_file;
+ log_file.open(PACKET_COUNT_FILE);
+ log_file << ss_msg_packet.str();
+ log_file.close();
+
+
+ cout << "Write throttled count csv file" << endl << endl;
+ stringstream ss_msg_throttled;
+ ss_msg_throttled << "router,throttled_count" << endl;
+ for(auto& tc_pair: throttled_count){
+ ss_msg_throttled << tc_pair.first << "," << tc_pair.second << endl;
+ }
+
+ log_file.open(THROTTLED_COUNT_FILE);
+ log_file << ss_msg_throttled.str();
+ log_file.close();
+}
diff --git a/src/utils/report.h b/src/utils/report.h
index 561c03b..8106de6 100644
--- a/src/utils/report.h
+++ b/src/utils/report.h
@@ -22,17 +22,42 @@
#pragma once
#include