Compare commits

..

2 commits

Author SHA1 Message Date
11666fb586 fix: lack of throttle count in routers fixed 2024-11-14 03:18:30 -05:00
a632f28c36 fix: logs added and bugs fixed 2024-11-13 09:48:55 -05:00
20 changed files with 1835 additions and 496 deletions

View file

@ -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
)

View file

@ -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)
* [Ratatoskr NoC simulator](https://github.com/jmjos/ratatoskr)
### TODO
- Check why there is no throttled messages for router

File diff suppressed because it is too large Load diff

View file

@ -5,7 +5,7 @@
<name value="Packet"/>
</dataType>
<dataType id="1">
<name value="Streaming"/>
<name value="Stream"/>
</dataType>
</dataTypes>
<tasks>
@ -18,8 +18,8 @@
<probability value="1"/>
<destinations>
<destination id="0">
<delay min="0" max="100"/>
<interval min="100" max="100"/>
<delay min="0" max="10"/>
<interval min="5" max="5"/>
<count min="1" max="1"/>
<type value="0"/>
<task value="2"/>
@ -38,8 +38,8 @@
<probability value="1"/>
<destinations>
<destination id="0">
<delay min="0" max="100"/>
<interval min="100" max="100"/>
<delay min="0" max="10"/>
<interval min="5" max="5"/>
<count min="1" max="1"/>
<type value="0"/>
<task value="2"/>
@ -57,12 +57,7 @@
<requirement id="0">
<type value="0"/>
<source value="0"/>
<count max="1" min="1"/>
</requirement>
<requirement id="1">
<type value="0"/>
<source value="24"/>
<count max="1" min="1"/>
<count max="2" min="2"/>
</requirement>
</requires>
</task>

View file

@ -5,7 +5,7 @@
<outputToFile value="true">report</outputToFile>
</general>
<noc>
<nocFile>config/simple_test/net.xml</nocFile>
<nocFile>config/simple_2_point_test/net.xml</nocFile>
<flitsPerPacket value="1"/>
<bitWidth value="32"/>
<Vdd value="5"/>

55
config/throttle_test/config.xml Executable file
View file

@ -0,0 +1,55 @@
<?xml version="1.0" ?>
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<general>
<simulationTime value="1500"/>
<outputToFile value="true">report</outputToFile>
</general>
<noc>
<nocFile>config/throttle_test/net.xml</nocFile>
<flitsPerPacket value="1"/>
<bitWidth value="32"/>
<Vdd value="5"/>
</noc>
<application>
<benchmark>task</benchmark>
<dataFile>config/throttle_test/data.xml</dataFile>
<mapFile>config/throttle_test/map.xml</mapFile>
</application>
<verbose>
<processingElements>
<function_calls value="false"/>
<send_flit value="false"/>
<send_head_flit value="true"/>
<receive_flit value="false"/>
<receive_tail_flit value="true"/>
<throttle value="false"/>
<reset value="false"/>
</processingElements>
<router>
<function_calls value="false"/>
<send_flit value="false"/>
<send_head_flit value="false"/>
<receive_flit value="false"/>
<receive_tail_flit value="false"/>
<throttle value="false"/>
<reset value="false"/>
<assign_channel value="false"/>
<buffer_overflow value="true"/>
</router>
<netrace>
<inject value="true"/>
<eject value="true"/>
<router_receive value="true"/>
</netrace>
<tasks>
<function_calls value="true"/>
<xml_parse value="false"/>
<data_receive value="true"/>
<data_send value="true"/>
<source_execute value="false"/>
</tasks>
</verbose>
<report>
<bufferReportRouters>5 6 9 10</bufferReportRouters>
</report>
</configuration>

245
config/throttle_test/data.xml Executable file
View file

@ -0,0 +1,245 @@
<?xml version="1.0" ?>
<data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<dataTypes>
<dataType id="0">
<name value="Packet"/>
</dataType>
<dataType id="1">
<name value="Stream"/>
</dataType>
</dataTypes>
<tasks>
<task id="0">
<start min="0" max="0"/>
<duration min="-1" max="-1"/>
<repeat min="1" max="1"/>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay min="0" max="10"/>
<interval min="5" max="5"/>
<count min="10" max="10"/>
<type value="0"/>
<task value="11"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="1">
<start min="0" max="0"/>
<duration min="-1" max="-1"/>
<repeat min="1" max="1"/>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay min="0" max="10"/>
<interval min="5" max="5"/>
<count min="10" max="10"/>
<type value="0"/>
<task value="11"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="2">
<start min="0" max="0"/>
<duration min="-1" max="-1"/>
<repeat min="1" max="1"/>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay min="0" max="10"/>
<interval min="5" max="5"/>
<count min="10" max="10"/>
<type value="0"/>
<task value="11"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="3">
<start min="0" max="0"/>
<duration min="-1" max="-1"/>
<repeat min="1" max="1"/>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay min="0" max="10"/>
<interval min="5" max="5"/>
<count min="10" max="10"/>
<type value="0"/>
<task value="11"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="4">
<start min="0" max="0"/>
<duration min="-1" max="-1"/>
<repeat min="1" max="1"/>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay min="0" max="10"/>
<interval min="5" max="5"/>
<count min="10" max="10"/>
<type value="0"/>
<task value="11"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="5">
<start min="0" max="0"/>
<duration min="-1" max="-1"/>
<repeat min="1" max="1"/>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay min="0" max="10"/>
<interval min="5" max="5"/>
<count min="10" max="10"/>
<type value="0"/>
<task value="11"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="6">
<start min="0" max="0"/>
<duration min="-1" max="-1"/>
<repeat min="1" max="1"/>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay min="0" max="10"/>
<interval min="5" max="5"/>
<count min="10" max="10"/>
<type value="0"/>
<task value="11"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="7">
<start min="0" max="0"/>
<duration min="-1" max="-1"/>
<repeat min="1" max="1"/>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay min="0" max="10"/>
<interval min="5" max="5"/>
<count min="10" max="10"/>
<type value="0"/>
<task value="11"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="8">
<start min="0" max="0"/>
<duration min="-1" max="-1"/>
<repeat min="1" max="1"/>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay min="0" max="10"/>
<interval min="5" max="5"/>
<count min="10" max="10"/>
<type value="0"/>
<task value="11"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="9">
<start min="0" max="0"/>
<duration min="-1" max="-1"/>
<repeat min="1" max="1"/>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay min="0" max="10"/>
<interval min="5" max="5"/>
<count min="10" max="10"/>
<type value="0"/>
<task value="11"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="10">
<start min="0" max="0"/>
<duration min="-1" max="-1"/>
<repeat min="1" max="1"/>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay min="0" max="10"/>
<interval min="5" max="5"/>
<count min="10" max="10"/>
<type value="0"/>
<task value="11"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="11">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<requires>
<requirement id="0">
<type value="0"/>
<source value="0"/>
<count max="100" min="100"/>
</requirement>
</requires>
</task>
</tasks>
</data>

51
config/throttle_test/map.xml Executable file
View file

@ -0,0 +1,51 @@
<?xml version="1.0" ?>
<map xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<bind>
<task value="0"/>
<node value="0"/>
</bind>
<bind>
<task value="1"/>
<node value="8"/>
</bind>
<bind>
<task value="2"/>
<node value="4"/>
</bind>
<bind>
<task value="3"/>
<node value="10"/>
</bind>
<bind>
<task value="4"/>
<node value="12"/>
</bind>
<bind>
<task value="5"/>
<node value="13"/>
</bind>
<bind>
<task value="6"/>
<node value="14"/>
</bind>
<bind>
<task value="7"/>
<node value="11"/>
</bind>
<bind>
<task value="8"/>
<node value="8"/>
</bind>
<bind>
<task value="9"/>
<node value="9"/>
</bind>
<bind>
<task value="10"/>
<node value="7"/>
</bind>
<bind>
<task value="11"/>
<node value="15"/>
</bind>
</map>

879
config/throttle_test/net.xml Executable file
View file

@ -0,0 +1,879 @@
<?xml version="1.0" encoding="UTF-8"?>
<network-on-chip xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="layer.xsd">
<bufferDepthType value="single" /> <!-- single, perVC-->
<nodeTypes>
<nodeType id="0">
<model value="Router"/>
<routing value="XYZ"/>
<clockDelay value="1"/>
</nodeType>
<nodeType id="1">
<model value="ProcessingElement"/>
<clockDelay value="1"/>
</nodeType>
</nodeTypes>
<nodes>
<node id="0">
<xPos value="0.000"/>
<yPos value="0.000"/>
<zPos value="0.000"/>
<nodeType value="0"/>
<idType value="0"/>
<layerType value="0"/>
</node>
<node id="1">
<xPos value="0.000"/>
<yPos value="0.333"/>
<zPos value="0.000"/>
<nodeType value="0"/>
<idType value="1"/>
<layerType value="0"/>
</node>
<node id="2">
<xPos value="0.000"/>
<yPos value="0.667"/>
<zPos value="0.000"/>
<nodeType value="0"/>
<idType value="2"/>
<layerType value="0"/>
</node>
<node id="3">
<xPos value="0.000"/>
<yPos value="1.000"/>
<zPos value="0.000"/>
<nodeType value="0"/>
<idType value="3"/>
<layerType value="0"/>
</node>
<node id="4">
<xPos value="0.333"/>
<yPos value="0.000"/>
<zPos value="0.000"/>
<nodeType value="0"/>
<idType value="4"/>
<layerType value="0"/>
</node>
<node id="5">
<xPos value="0.333"/>
<yPos value="0.333"/>
<zPos value="0.000"/>
<nodeType value="0"/>
<idType value="5"/>
<layerType value="0"/>
</node>
<node id="6">
<xPos value="0.333"/>
<yPos value="0.667"/>
<zPos value="0.000"/>
<nodeType value="0"/>
<idType value="6"/>
<layerType value="0"/>
</node>
<node id="7">
<xPos value="0.333"/>
<yPos value="1.000"/>
<zPos value="0.000"/>
<nodeType value="0"/>
<idType value="7"/>
<layerType value="0"/>
</node>
<node id="8">
<xPos value="0.667"/>
<yPos value="0.000"/>
<zPos value="0.000"/>
<nodeType value="0"/>
<idType value="8"/>
<layerType value="0"/>
</node>
<node id="9">
<xPos value="0.667"/>
<yPos value="0.333"/>
<zPos value="0.000"/>
<nodeType value="0"/>
<idType value="9"/>
<layerType value="0"/>
</node>
<node id="10">
<xPos value="0.667"/>
<yPos value="0.667"/>
<zPos value="0.000"/>
<nodeType value="0"/>
<idType value="10"/>
<layerType value="0"/>
</node>
<node id="11">
<xPos value="0.667"/>
<yPos value="1.000"/>
<zPos value="0.000"/>
<nodeType value="0"/>
<idType value="11"/>
<layerType value="0"/>
</node>
<node id="12">
<xPos value="1.000"/>
<yPos value="0.000"/>
<zPos value="0.000"/>
<nodeType value="0"/>
<idType value="12"/>
<layerType value="0"/>
</node>
<node id="13">
<xPos value="1.000"/>
<yPos value="0.333"/>
<zPos value="0.000"/>
<nodeType value="0"/>
<idType value="13"/>
<layerType value="0"/>
</node>
<node id="14">
<xPos value="1.000"/>
<yPos value="0.667"/>
<zPos value="0.000"/>
<nodeType value="0"/>
<idType value="14"/>
<layerType value="0"/>
</node>
<node id="15">
<xPos value="1.000"/>
<yPos value="1.000"/>
<zPos value="0.000"/>
<nodeType value="0"/>
<idType value="15"/>
<layerType value="0"/>
</node>
<node id="16">
<xPos value="0.000"/>
<yPos value="0.000"/>
<zPos value="0.000"/>
<nodeType value="1"/>
<idType value="0"/>
<layerType value="0"/>
</node>
<node id="17">
<xPos value="0.000"/>
<yPos value="0.333"/>
<zPos value="0.000"/>
<nodeType value="1"/>
<idType value="1"/>
<layerType value="0"/>
</node>
<node id="18">
<xPos value="0.000"/>
<yPos value="0.667"/>
<zPos value="0.000"/>
<nodeType value="1"/>
<idType value="2"/>
<layerType value="0"/>
</node>
<node id="19">
<xPos value="0.000"/>
<yPos value="1.000"/>
<zPos value="0.000"/>
<nodeType value="1"/>
<idType value="3"/>
<layerType value="0"/>
</node>
<node id="20">
<xPos value="0.333"/>
<yPos value="0.000"/>
<zPos value="0.000"/>
<nodeType value="1"/>
<idType value="4"/>
<layerType value="0"/>
</node>
<node id="21">
<xPos value="0.333"/>
<yPos value="0.333"/>
<zPos value="0.000"/>
<nodeType value="1"/>
<idType value="5"/>
<layerType value="0"/>
</node>
<node id="22">
<xPos value="0.333"/>
<yPos value="0.667"/>
<zPos value="0.000"/>
<nodeType value="1"/>
<idType value="6"/>
<layerType value="0"/>
</node>
<node id="23">
<xPos value="0.333"/>
<yPos value="1.000"/>
<zPos value="0.000"/>
<nodeType value="1"/>
<idType value="7"/>
<layerType value="0"/>
</node>
<node id="24">
<xPos value="0.667"/>
<yPos value="0.000"/>
<zPos value="0.000"/>
<nodeType value="1"/>
<idType value="8"/>
<layerType value="0"/>
</node>
<node id="25">
<xPos value="0.667"/>
<yPos value="0.333"/>
<zPos value="0.000"/>
<nodeType value="1"/>
<idType value="9"/>
<layerType value="0"/>
</node>
<node id="26">
<xPos value="0.667"/>
<yPos value="0.667"/>
<zPos value="0.000"/>
<nodeType value="1"/>
<idType value="10"/>
<layerType value="0"/>
</node>
<node id="27">
<xPos value="0.667"/>
<yPos value="1.000"/>
<zPos value="0.000"/>
<nodeType value="1"/>
<idType value="11"/>
<layerType value="0"/>
</node>
<node id="28">
<xPos value="1.000"/>
<yPos value="0.000"/>
<zPos value="0.000"/>
<nodeType value="1"/>
<idType value="12"/>
<layerType value="0"/>
</node>
<node id="29">
<xPos value="1.000"/>
<yPos value="0.333"/>
<zPos value="0.000"/>
<nodeType value="1"/>
<idType value="13"/>
<layerType value="0"/>
</node>
<node id="30">
<xPos value="1.000"/>
<yPos value="0.667"/>
<zPos value="0.000"/>
<nodeType value="1"/>
<idType value="14"/>
<layerType value="0"/>
</node>
<node id="31">
<xPos value="1.000"/>
<yPos value="1.000"/>
<zPos value="0.000"/>
<nodeType value="1"/>
<idType value="15"/>
<layerType value="0"/>
</node>
</nodes>
<connections>
<con id="0">
<interface value="0"/>
<ports>
<port id ="0">
<node value="0"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="16"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="1">
<interface value="0"/>
<ports>
<port id ="0">
<node value="0"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="1"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="2">
<interface value="0"/>
<ports>
<port id ="0">
<node value="0"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="4"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="3">
<interface value="0"/>
<ports>
<port id ="0">
<node value="1"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="17"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="4">
<interface value="0"/>
<ports>
<port id ="0">
<node value="1"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="2"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="5">
<interface value="0"/>
<ports>
<port id ="0">
<node value="1"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="5"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="6">
<interface value="0"/>
<ports>
<port id ="0">
<node value="2"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="18"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="7">
<interface value="0"/>
<ports>
<port id ="0">
<node value="2"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="3"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="8">
<interface value="0"/>
<ports>
<port id ="0">
<node value="2"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="6"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="9">
<interface value="0"/>
<ports>
<port id ="0">
<node value="3"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="19"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="10">
<interface value="0"/>
<ports>
<port id ="0">
<node value="3"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="7"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="11">
<interface value="0"/>
<ports>
<port id ="0">
<node value="4"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="20"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="12">
<interface value="0"/>
<ports>
<port id ="0">
<node value="4"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="5"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="13">
<interface value="0"/>
<ports>
<port id ="0">
<node value="4"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="8"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="14">
<interface value="0"/>
<ports>
<port id ="0">
<node value="5"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="21"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="15">
<interface value="0"/>
<ports>
<port id ="0">
<node value="5"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="6"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="16">
<interface value="0"/>
<ports>
<port id ="0">
<node value="5"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="9"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="17">
<interface value="0"/>
<ports>
<port id ="0">
<node value="6"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="22"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="18">
<interface value="0"/>
<ports>
<port id ="0">
<node value="6"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="7"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="19">
<interface value="0"/>
<ports>
<port id ="0">
<node value="6"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="10"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="20">
<interface value="0"/>
<ports>
<port id ="0">
<node value="7"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="23"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="21">
<interface value="0"/>
<ports>
<port id ="0">
<node value="7"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="11"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="22">
<interface value="0"/>
<ports>
<port id ="0">
<node value="8"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="24"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="23">
<interface value="0"/>
<ports>
<port id ="0">
<node value="8"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="9"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="24">
<interface value="0"/>
<ports>
<port id ="0">
<node value="8"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="12"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="25">
<interface value="0"/>
<ports>
<port id ="0">
<node value="9"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="25"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="26">
<interface value="0"/>
<ports>
<port id ="0">
<node value="9"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="10"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="27">
<interface value="0"/>
<ports>
<port id ="0">
<node value="9"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="13"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="28">
<interface value="0"/>
<ports>
<port id ="0">
<node value="10"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="26"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="29">
<interface value="0"/>
<ports>
<port id ="0">
<node value="10"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="11"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="30">
<interface value="0"/>
<ports>
<port id ="0">
<node value="10"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="14"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="31">
<interface value="0"/>
<ports>
<port id ="0">
<node value="11"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="27"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="32">
<interface value="0"/>
<ports>
<port id ="0">
<node value="11"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="15"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="33">
<interface value="0"/>
<ports>
<port id ="0">
<node value="12"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="28"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="34">
<interface value="0"/>
<ports>
<port id ="0">
<node value="12"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="13"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="35">
<interface value="0"/>
<ports>
<port id ="0">
<node value="13"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="29"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="36">
<interface value="0"/>
<ports>
<port id ="0">
<node value="13"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="14"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="37">
<interface value="0"/>
<ports>
<port id ="0">
<node value="14"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="30"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="38">
<interface value="0"/>
<ports>
<port id ="0">
<node value="14"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="15"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="39">
<interface value="0"/>
<ports>
<port id ="0">
<node value="15"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="31"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
</connections>
</network-on-chip>

View file

@ -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;
}

View file

@ -54,12 +54,12 @@ NetworkInterfaceTlm::NetworkInterfaceTlm(sc_module_name nm, Node& node,
sensitive << packetPortContainer->portValidIn.pos();
for(uint8_t lay=0; lay<NUM_ACC_LAYERS; lay++){
initiator[lay] = new ni_init_socket((string(nm)+"_"+
initiator[lay] = new ni_init_socket((ni_name+"_"+
to_string(lay)+"_init").c_str());
initiator[lay]->register_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());
}

View file

@ -54,7 +54,6 @@ public:
std::queue<PacketCS*> packet_send_queue;
std::queue<PacketCS*> packet_recv_queue;
string ni_name;
// To PE
sc_in<bool> 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;

View file

@ -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<TaskPoolCS>();
} else if (globalResources.benchmark == "synthetic") {
@ -63,7 +62,6 @@ void NetworkManager::createTrafficPool() {
} else {
FATAL("Please specify correct benchmark type");
}
#endif
tp->processingElements.resize(numOfPEs);
}

View file

@ -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<Direction::num_dirs; dir++){
// check pending link valid and send data
if(send_data_in_prog_dest[dir] == rel_link){
pending_link = Direction(dir);
bool data_sent = send_data(pending_link, rel_link,
*nxt_send_data_pend[pending_link]);
if (!data_sent){
log_error(pending_link, trans,
"Credit counter was freed, but data can't be sent");
if( !nxt_send_data_pend[dir].empty() ){
// check pending link valid and send data
Direction rel_dest = send_data_in_prog_dest[dir].front();
if(rel_dest == rel_link){
tlm_gp* nxt_trans = nxt_send_data_pend[dir].front();
bool data_sent = send_data(dir, rel_link, *nxt_trans);
if (!data_sent){
log_error(dir, trans, "Credit counter was freed, but data can't be sent");
}
send_data_in_prog_dest[dir].pop();
nxt_send_data_pend[dir].pop();
break;
}
nxt_send_data_pend[pending_link] = 0;
send_data_in_prog_dest[dir] = Direction::invalid;
break;
}
}
}
@ -254,14 +262,15 @@ void TlmRouter::target_peq_cb(tlm_gp& trans, const tlm_phase& phase){
case END_RESP:
if (!resp_in_progress[link]){
log_warn(link,trans,
"Illegal transaction phase END_RESP received by target");
"Illegal transaction phase END_RESP received by target");
}
trans.release();
check_transaction(link, trans);
// Target itself is now clear to issue the next BEGIN_RESP
resp_in_progress[link] = false;
if (nxt_resp_pend[link]){
send_begin_response(link, *nxt_resp_pend[link]);
nxt_resp_pend[link] = 0;
if ( !nxt_resp_pend[link].empty() ){
log_info(link, trans, "Issuing next response");
send_begin_response(link, *nxt_resp_pend[link].front());
nxt_resp_pend[link].pop();
}
break;
case END_REQ:
@ -269,6 +278,7 @@ void TlmRouter::target_peq_cb(tlm_gp& trans, const tlm_phase& phase){
log_error(link,trans,"Illegal transaction phase received by target");
break;
default:
report.update_packet_count(router_name);
if(phase == INTERNAL_PROC_PHASE){
switching(link, trans);
}
@ -330,23 +340,9 @@ void TlmRouter::switching(int link, tlm_gp& trans){
}
// validate pending data sent
if (!data_sent) {
if(nxt_send_data_pend[link]) {
log_error(link,trans,
"Attempt to have two pending data send in same destination");
}
nxt_send_data_pend[link] = &trans;
send_data_in_prog_dest[link] = destination;
nxt_send_data_pend[link].push(&trans);
send_data_in_prog_dest[link].push(destination);
}
// validate pending response
if(resp_in_progress[link]) {
//TODO: Make sure that there is always only one transaction per link
if(nxt_resp_pend[link]){
log_error(link,trans,
"Attempt to have two pending responses in target");
}
nxt_resp_pend[link] = &trans;
}
else{ send_begin_response(link, trans); }
}

View file

@ -27,6 +27,7 @@
#include <systemc>
#include <string>
#include <queue>
#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<TlmRouter> init_peq;
peq_with_cb_and_phase<TlmRouter> 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<tlm_gp*> nxt_resp_pend[NUM_LINKS];
queue<tlm_gp*> nxt_send_data_pend[NUM_LINKS];
queue<Dir> 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]);

View file

@ -35,7 +35,7 @@ void TlmRouterCS::initialize(){
TlmRouter::initialize();
cout<<"Inherited function called";
for(int link=0; link<NUM_LINKS; link++){
credit_counter[link] = NUM_CREDITS_CS;
//credit_counter[link] = NUM_CREDITS_CS;
auto_rout_map[link] = Direction::invalid;
}
}
@ -63,17 +63,17 @@ void TlmRouterCS::send_begin_req(int link, tlm_gp& trans, int dest_link){
status = (*init_socket[dest_link])->nb_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);
}

View file

@ -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

View file

@ -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 <iostream>
#include <fstream>
#include <sstream>
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();
}

View file

@ -22,17 +22,42 @@
#pragma once
#include <map>
#include <systemc>
//#include <systemc>
#define PACKET_COUNT_FILE "out/packet_count.csv"
#define THROTTLED_COUNT_FILE "out/throttled_count.csv"
using namespace std;
using namespace sc_core;
//using namespace sc_core;
class Report {
class TlmReport {
public:
TlmReport();
static TlmReport &getInstance();
/**
* Increases the packet count by one for the given router
*
* @param np_name network participant's name
*/
void update_packet_count(string np_name);
/**
* Increases the throttled count by one for the given router
*
* @param np_name network participant's name
*/
void update_throttled_count(string np_name);
/**
* Writes report as csv
*/
void write_report();
private:
std::map<string, int> packet_count;
std::map<string, int> throttled_count;
std::map<int, sc_time> task_start_time;
std::map<int, sc_time> task_completed_time;
Report();
//std::map<int, sc_time> task_start_time;
//std::map<int, sc_time> task_completed_time;
};

View file

@ -51,12 +51,15 @@ void get_max_pos(uint8_t max_pos[3]){
vector<float> gr_pos[3];
get_pos_distances(dists, gr_pos);
max_pos[0] = 1+round(max_element(gr_pos[0].begin(),
gr_pos[0].end())[0]/dists[0]);
max_pos[1] = 1+round(max_element(gr_pos[1].begin(),
gr_pos[1].end())[0]/dists[1]);
max_pos[2] = 1+round(max_element(gr_pos[2].begin(),
gr_pos[2].end())[0]/dists[2]);
max_pos[0] = dists[0] != 0 ?
1+round(max_element(gr_pos[0].begin(), gr_pos[0].end())[0]/dists[0])
: 1;
max_pos[1] = dists[1] != 0 ?
1+round(max_element(gr_pos[1].begin(),gr_pos[1].end())[0]/dists[1])
: 1;
max_pos[2] = dists[2] != 0 ?
1+round(max_element(gr_pos[2].begin(), gr_pos[2].end())[0]/dists[2])
: 1;
}
string get_type_name(dataTypeID_t id){