fix: bugs fixed, minus router cs call to parent

This commit is contained in:
juanmanuel 2024-10-22 04:19:30 -05:00
parent cf70543834
commit 59eb9a23b6
45 changed files with 4213 additions and 2149 deletions

View file

@ -23,7 +23,12 @@ ADD_EXECUTABLE(${PROJECT_NAME}
src/networkManager/NetworkManager.cpp
src/noc/noc.cpp
src/router/router.cpp
src/router/router_cs.cpp
src/router/router_cs.cpp
src/processingElement/ProcessingElementCS.cpp
src/traffic/PacketCS.cpp
src/traffic/task/TaskPoolCS.cpp
src/utils/PacketFactoryCS.cpp
src/utils/GlobalResourcesCS.cpp
src/utils/memory_manager.cpp
src/utils/utils.cpp
src/utils/noc_logger.cpp

View file

@ -1,508 +0,0 @@
<?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="RouterVC"/>
<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>
<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="1"/>
<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="4"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="2">
<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="3">
<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="4">
<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="5">
<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="6">
<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="7">
<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="8">
<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="9">
<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="10">
<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="11">
<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="12">
<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="13">
<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="14">
<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="15">
<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="16">
<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="17">
<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="18">
<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="19">
<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="20">
<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="21">
<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="22">
<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="23">
<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>
</connections>
</network-on-chip>

View file

@ -1,808 +0,0 @@
<?xml version="1.0" ?>
<data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<dataTypes>
<dataType id="0">
<name value="dt_0"/>
</dataType>
<dataType id="1">
<name value="dt_1"/>
</dataType>
<dataType id="2">
<name value="dt_2"/>
</dataType>
<dataType id="3">
<name value="dt_3"/>
</dataType>
</dataTypes>
<tasks>
<task id="0">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<requires>
<requirement id="0">
<type value="3"/>
<source value="24"/>
<count max="1" min="1"/>
</requirement>
</requires>
</task>
<task id="1">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<requires>
<requirement id="0">
<type value="3"/>
<source value="24"/>
<count max="1" min="1"/>
</requirement>
</requires>
</task>
<task id="2">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<requires>
<requirement id="0">
<type value="3"/>
<source value="24"/>
<count max="1" min="1"/>
</requirement>
</requires>
</task>
<task id="3">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<requires>
<requirement id="0">
<type value="3"/>
<source value="24"/>
<count max="1" min="1"/>
</requirement>
</requires>
</task>
<task id="4">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<requires>
<requirement id="0">
<type value="3"/>
<source value="28"/>
<count max="1" min="1"/>
</requirement>
</requires>
</task>
<task id="5">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<requires>
<requirement id="0">
<type value="3"/>
<source value="28"/>
<count max="1" min="1"/>
</requirement>
</requires>
</task>
<task id="6">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<requires>
<requirement id="0">
<type value="3"/>
<source value="28"/>
<count max="1" min="1"/>
</requirement>
</requires>
</task>
<task id="7">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<requires>
<requirement id="0">
<type value="3"/>
<source value="28"/>
<count max="1" min="1"/>
</requirement>
</requires>
</task>
<task id="8">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<requires>
<requirement id="0">
<type value="3"/>
<source value="32"/>
<count max="1" min="1"/>
</requirement>
</requires>
</task>
<task id="9">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<requires>
<requirement id="0">
<type value="3"/>
<source value="32"/>
<count max="1" min="1"/>
</requirement>
</requires>
</task>
<task id="10">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<requires>
<requirement id="0">
<type value="3"/>
<source value="32"/>
<count max="1" min="1"/>
</requirement>
</requires>
</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="3"/>
<source value="32"/>
<count max="1" min="1"/>
</requirement>
</requires>
</task>
<task id="12">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<requires>
<requirement id="0">
<type value="0"/>
<source value="25"/>
<count max="13161" min="13161"/>
</requirement>
</requires>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay max="100" min="0"/>
<interval max="100" min="100"/>
<count max="3716" min="3716"/>
<type value="1"/>
<task value="14"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="13">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<requires>
<requirement id="0">
<type value="0"/>
<source value="27"/>
<count max="13161" min="13161"/>
</requirement>
</requires>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay max="100" min="0"/>
<interval max="100" min="100"/>
<count max="3716" min="3716"/>
<type value="1"/>
<task value="15"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="16">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<requires>
<requirement id="0">
<type value="0"/>
<source value="29"/>
<count max="13161" min="13161"/>
</requirement>
</requires>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay max="100" min="0"/>
<interval max="100" min="100"/>
<count max="3716" min="3716"/>
<type value="1"/>
<task value="18"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="17">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<requires>
<requirement id="0">
<type value="0"/>
<source value="31"/>
<count max="13161" min="13161"/>
</requirement>
</requires>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay max="100" min="0"/>
<interval max="100" min="100"/>
<count max="3716" min="3716"/>
<type value="1"/>
<task value="19"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="20">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<requires>
<requirement id="0">
<type value="0"/>
<source value="33"/>
<count max="13161" min="13161"/>
</requirement>
</requires>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay max="100" min="0"/>
<interval max="100" min="100"/>
<count max="3716" min="3716"/>
<type value="1"/>
<task value="22"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="21">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<requires>
<requirement id="0">
<type value="0"/>
<source value="35"/>
<count max="13161" min="13161"/>
</requirement>
</requires>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay max="100" min="0"/>
<interval max="100" min="100"/>
<count max="3716" min="3716"/>
<type value="1"/>
<task value="23"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="14">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<requires>
<requirement id="0">
<type value="1"/>
<source value="12"/>
<count max="3716" min="3716"/>
</requirement>
</requires>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay max="100" min="0"/>
<interval max="100" min="100"/>
<count max="929" min="929"/>
<type value="2"/>
<task value="24"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="15">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<requires>
<requirement id="0">
<type value="1"/>
<source value="13"/>
<count max="3716" min="3716"/>
</requirement>
</requires>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay max="100" min="0"/>
<interval max="100" min="100"/>
<count max="929" min="929"/>
<type value="2"/>
<task value="24"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="18">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<requires>
<requirement id="0">
<type value="1"/>
<source value="16"/>
<count max="3716" min="3716"/>
</requirement>
</requires>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay max="100" min="0"/>
<interval max="100" min="100"/>
<count max="929" min="929"/>
<type value="2"/>
<task value="28"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="19">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<requires>
<requirement id="0">
<type value="1"/>
<source value="17"/>
<count max="3716" min="3716"/>
</requirement>
</requires>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay max="100" min="0"/>
<interval max="100" min="100"/>
<count max="929" min="929"/>
<type value="2"/>
<task value="28"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="22">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<requires>
<requirement id="0">
<type value="1"/>
<source value="20"/>
<count max="3716" min="3716"/>
</requirement>
</requires>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay max="100" min="0"/>
<interval max="100" min="100"/>
<count max="929" min="929"/>
<type value="2"/>
<task value="32"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="23">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<requires>
<requirement id="0">
<type value="1"/>
<source value="21"/>
<count max="3716" min="3716"/>
</requirement>
</requires>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay max="100" min="0"/>
<interval max="100" min="100"/>
<count max="929" min="929"/>
<type value="2"/>
<task value="32"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="24">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<requires>
<requirement id="0">
<type value="2"/>
<source value="14"/>
<count max="929" min="929"/>
</requirement>
</requires>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay max="100" min="0"/>
<interval max="100" min="100"/>
<count max="1" min="1"/>
<type value="3"/>
<task value="0"/>
</destination>
<destination id="1">
<delay max="100" min="0"/>
<interval max="100" min="100"/>
<count max="1" min="1"/>
<type value="3"/>
<task value="1"/>
</destination>
<destination id="2">
<delay max="100" min="0"/>
<interval max="100" min="100"/>
<count max="1" min="1"/>
<type value="3"/>
<task value="2"/>
</destination>
<destination id="3">
<delay max="100" min="0"/>
<interval max="100" min="100"/>
<count max="1" min="1"/>
<type value="3"/>
<task value="3"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="28">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<requires>
<requirement id="0">
<type value="2"/>
<source value="18"/>
<count max="929" min="929"/>
</requirement>
</requires>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay max="100" min="0"/>
<interval max="100" min="100"/>
<count max="1" min="1"/>
<type value="3"/>
<task value="4"/>
</destination>
<destination id="1">
<delay max="100" min="0"/>
<interval max="100" min="100"/>
<count max="1" min="1"/>
<type value="3"/>
<task value="5"/>
</destination>
<destination id="2">
<delay max="100" min="0"/>
<interval max="100" min="100"/>
<count max="1" min="1"/>
<type value="3"/>
<task value="6"/>
</destination>
<destination id="3">
<delay max="100" min="0"/>
<interval max="100" min="100"/>
<count max="1" min="1"/>
<type value="3"/>
<task value="7"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="32">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<requires>
<requirement id="0">
<type value="2"/>
<source value="22"/>
<count max="929" min="929"/>
</requirement>
</requires>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay max="100" min="0"/>
<interval max="100" min="100"/>
<count max="1" min="1"/>
<type value="3"/>
<task value="8"/>
</destination>
<destination id="1">
<delay max="100" min="0"/>
<interval max="100" min="100"/>
<count max="1" min="1"/>
<type value="3"/>
<task value="9"/>
</destination>
<destination id="2">
<delay max="100" min="0"/>
<interval max="100" min="100"/>
<count max="1" min="1"/>
<type value="3"/>
<task value="10"/>
</destination>
<destination id="3">
<delay max="100" min="0"/>
<interval max="100" min="100"/>
<count max="1" min="1"/>
<type value="3"/>
<task value="11"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="25">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay max="100" min="0"/>
<interval max="100" min="100"/>
<count max="13161" min="13161"/>
<type value="0"/>
<task value="12"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="26">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay max="100" min="0"/>
<interval max="100" min="100"/>
<count max="6581" min="6581"/>
<type value="0"/>
<task value="13"/>
</destination>
<destination id="1">
<delay max="100" min="0"/>
<interval max="100" min="100"/>
<count max="6581" min="6581"/>
<type value="0"/>
<task value="12"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="27">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay max="100" min="0"/>
<interval max="100" min="100"/>
<count max="13161" min="13161"/>
<type value="0"/>
<task value="13"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="29">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay max="100" min="0"/>
<interval max="100" min="100"/>
<count max="13161" min="13161"/>
<type value="0"/>
<task value="16"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="30">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay max="100" min="0"/>
<interval max="100" min="100"/>
<count max="6581" min="6581"/>
<type value="0"/>
<task value="17"/>
</destination>
<destination id="1">
<delay max="100" min="0"/>
<interval max="100" min="100"/>
<count max="6581" min="6581"/>
<type value="0"/>
<task value="16"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="31">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay max="100" min="0"/>
<interval max="100" min="100"/>
<count max="13161" min="13161"/>
<type value="0"/>
<task value="17"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="33">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay max="100" min="0"/>
<interval max="100" min="100"/>
<count max="13161" min="13161"/>
<type value="0"/>
<task value="20"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="34">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay max="100" min="0"/>
<interval max="100" min="100"/>
<count max="6581" min="6581"/>
<type value="0"/>
<task value="21"/>
</destination>
<destination id="1">
<delay max="100" min="0"/>
<interval max="100" min="100"/>
<count max="6581" min="6581"/>
<type value="0"/>
<task value="20"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="35">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay max="100" min="0"/>
<interval max="100" min="100"/>
<count max="13161" min="13161"/>
<type value="0"/>
<task value="21"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
</tasks>
</data>

View file

@ -1,147 +0,0 @@
<?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="1"/>
</bind>
<bind>
<task value="2"/>
<node value="2"/>
</bind>
<bind>
<task value="3"/>
<node value="3"/>
</bind>
<bind>
<task value="4"/>
<node value="4"/>
</bind>
<bind>
<task value="5"/>
<node value="5"/>
</bind>
<bind>
<task value="6"/>
<node value="6"/>
</bind>
<bind>
<task value="7"/>
<node value="7"/>
</bind>
<bind>
<task value="8"/>
<node value="8"/>
</bind>
<bind>
<task value="9"/>
<node value="9"/>
</bind>
<bind>
<task value="10"/>
<node value="10"/>
</bind>
<bind>
<task value="11"/>
<node value="11"/>
</bind>
<bind>
<task value="12"/>
<node value="20"/>
</bind>
<bind>
<task value="13"/>
<node value="21"/>
</bind>
<bind>
<task value="14"/>
<node value="22"/>
</bind>
<bind>
<task value="15"/>
<node value="23"/>
</bind>
<bind>
<task value="16"/>
<node value="24"/>
</bind>
<bind>
<task value="17"/>
<node value="25"/>
</bind>
<bind>
<task value="18"/>
<node value="26"/>
</bind>
<bind>
<task value="19"/>
<node value="27"/>
</bind>
<bind>
<task value="20"/>
<node value="28"/>
</bind>
<bind>
<task value="21"/>
<node value="29"/>
</bind>
<bind>
<task value="22"/>
<node value="30"/>
</bind>
<bind>
<task value="23"/>
<node value="31"/>
</bind>
<bind>
<task value="24"/>
<node value="36"/>
</bind>
<bind>
<task value="25"/>
<node value="37"/>
</bind>
<bind>
<task value="26"/>
<node value="38"/>
</bind>
<bind>
<task value="27"/>
<node value="39"/>
</bind>
<bind>
<task value="28"/>
<node value="40"/>
</bind>
<bind>
<task value="29"/>
<node value="41"/>
</bind>
<bind>
<task value="30"/>
<node value="42"/>
</bind>
<bind>
<task value="31"/>
<node value="43"/>
</bind>
<bind>
<task value="32"/>
<node value="44"/>
</bind>
<bind>
<task value="33"/>
<node value="45"/>
</bind>
<bind>
<task value="34"/>
<node value="46"/>
</bind>
<bind>
<task value="35"/>
<node value="47"/>
</bind>
</map>

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/simple_test/net.xml</nocFile>
<flitsPerPacket value="1"/>
<bitWidth value="32"/>
<Vdd value="5"/>
</noc>
<application>
<benchmark>task</benchmark>
<dataFile>config/only_config_msg_test/data.xml</dataFile>
<mapFile>config/only_config_msg_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>

View file

@ -0,0 +1,92 @@
<?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>
<dataType id="2">
<name value="ConfigRouter"/>
</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="100"/>
<interval min="100" max="100"/>
<count min="1" max="1"/>
<type value="2"/>
<task value="1"/>
<config link="0" destination="3"/>
</destination>
<destination id="1">
<delay min="0" max="100"/>
<interval min="100" max="100"/>
<count min="1" max="1"/>
<type value="2"/>
<task value="2"/>
<config link="2" destination="3"/>
</destination>
<destination id="2">
<delay min="0" max="100"/>
<interval min="100" max="100"/>
<count min="1" max="1"/>
<type value="2"/>
<task value="3"/>
<config link="2" destination="0"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="1">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<requires>
<requirement id="0">
<type value="2"/>
<source value="0"/>
<count max="1" min="1"/>
</requirement>
</requires>
</task>
<task id="2">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<requires>
<requirement id="0">
<type value="2"/>
<source value="0"/>
<count max="1" min="1"/>
</requirement>
</requires>
</task>
<task id="3">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<requires>
<requirement id="0">
<type value="2"/>
<source value="0"/>
<count max="1" min="1"/>
</requirement>
</requires>
</task>
</tasks>
</data>

View file

@ -0,0 +1,19 @@
<?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="0"/>
</bind>
<bind>
<task value="2"/>
<node value="1"/>
</bind>
<bind>
<task value="3"/>
<node value="2"/>
</bind>
</map>

File diff suppressed because it is too large Load diff

View file

@ -8,13 +8,7 @@
<name value="Stream"/>
</dataType>
<dataType id="2">
<name value="Init_Stream"/>
</dataType>
<dataType id="3">
<name value="End_Stream"/>
</dataType>
<dataType id="4">
<name value="Ack"/>
<name value="ConfigRouter"/>
</dataType>
</dataTypes>
<tasks>
@ -32,6 +26,23 @@
<count min="1" max="1"/>
<type value="2"/>
<task value="1"/>
<config link="0" destination="3"/>
</destination>
<destination id="1">
<delay min="0" max="100"/>
<interval min="100" max="100"/>
<count min="1" max="1"/>
<type value="2"/>
<task value="2"/>
<config link="2" destination="3"/>
</destination>
<destination id="2">
<delay min="0" max="100"/>
<interval min="100" max="100"/>
<count min="1" max="1"/>
<type value="2"/>
<task value="3"/>
<config link="2" destination="0"/>
</destination>
</destinations>
</possibility>
@ -49,6 +60,19 @@
<count max="1" min="1"/>
</requirement>
</requires>
</task>
<task id="2">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<requires>
<requirement id="0">
<type value="2"/>
<source value="0"/>
<count max="1" min="1"/>
</requirement>
</requires>
<generates>
<possibility id="0">
<probability value="1"/>
@ -57,34 +81,7 @@
<delay min="0" max="100"/>
<interval min="100" max="100"/>
<count min="1" max="1"/>
<type value="4"/>
<task value="2"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="2">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<requires>
<requirement id="0">
<type value="4"/>
<source value="0"/>
<count max="1" min="1"/>
</requirement>
</requires>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay min="0" max="100"/>
<interval min="100" max="100"/>
<count min="1" max="1"/>
<type value="1"/>
<type value="0"/>
<task value="3"/>
</destination>
</destinations>
@ -98,6 +95,45 @@
<repeat max="1" min="1"/>
<requires>
<requirement id="0">
<type value="2"/>
<source value="2"/>
<count max="1" min="1"/>
</requirement>
</requires>
<generates>
<possibility id="0">
<probability value="1"/>
<destinations>
<destination id="0">
<delay min="0" max="100"/>
<interval min="100" max="100"/>
<count min="1" max="1"/>
<type value="1"/>
<task value="4"/>
</destination>
<destination id="1">
<delay min="0" max="100"/>
<interval min="100" max="100"/>
<count min="1" max="1"/>
<type value="1"/>
<task value="4"/>
</destination>
</destinations>
</possibility>
</generates>
</task>
<task id="4">
<start max="0" min="0"/>
<duration max="-1" min="-1"/>
<repeat max="1" min="1"/>
<requires>
<requirement id="0">
<type value="1"/>
<source value="0"/>
<count max="1" min="1"/>
</requirement>
<requirement id="1">
<type value="1"/>
<source value="0"/>
<count max="1" min="1"/>

View file

@ -6,14 +6,18 @@
</bind>
<bind>
<task value="1"/>
<node value="2"/>
<node value="1"/>
</bind>
<bind>
<task value="2"/>
<node value="0"/>
<node value="2"/>
</bind>
<bind>
<task value="3"/>
<node value="0"/>
</bind>
<bind>
<task value="4"/>
<node value="2"/>
</bind>
</map>

View file

@ -11,9 +11,13 @@
<model value="ProcessingElement"/>
<clockDelay value="1"/>
</nodeType>
<nodeType id="2">
<model value="RouterCS"/>
<routing value="XYZ"/>
<clockDelay value="1"/>
</nodeType>
</nodeTypes>
<nodes>
<node id="0">
<xPos value="0.000"/>
@ -271,6 +275,134 @@
<idType value="15"/>
<layerType value="0"/>
</node>
<node id="32">
<xPos value="0.000"/>
<yPos value="0.000"/>
<zPos value="1.000"/>
<nodeType value="2"/>
<idType value="0"/>
<layerType value="0"/>
</node>
<node id="33">
<xPos value="0.000"/>
<yPos value="0.333"/>
<zPos value="1.000"/>
<nodeType value="2"/>
<idType value="1"/>
<layerType value="0"/>
</node>
<node id="34">
<xPos value="0.000"/>
<yPos value="0.667"/>
<zPos value="1.000"/>
<nodeType value="2"/>
<idType value="2"/>
<layerType value="0"/>
</node>
<node id="35">
<xPos value="0.000"/>
<yPos value="1.000"/>
<zPos value="1.000"/>
<nodeType value="2"/>
<idType value="3"/>
<layerType value="0"/>
</node>
<node id="36">
<xPos value="0.333"/>
<yPos value="0.000"/>
<zPos value="1.000"/>
<nodeType value="2"/>
<idType value="4"/>
<layerType value="0"/>
</node>
<node id="37">
<xPos value="0.333"/>
<yPos value="0.333"/>
<zPos value="1.000"/>
<nodeType value="2"/>
<idType value="5"/>
<layerType value="0"/>
</node>
<node id="38">
<xPos value="0.333"/>
<yPos value="0.667"/>
<zPos value="1.000"/>
<nodeType value="2"/>
<idType value="6"/>
<layerType value="0"/>
</node>
<node id="39">
<xPos value="0.333"/>
<yPos value="1.000"/>
<zPos value="1.000"/>
<nodeType value="2"/>
<idType value="7"/>
<layerType value="0"/>
</node>
<node id="40">
<xPos value="0.667"/>
<yPos value="0.000"/>
<zPos value="1.000"/>
<nodeType value="2"/>
<idType value="8"/>
<layerType value="0"/>
</node>
<node id="41">
<xPos value="0.667"/>
<yPos value="0.333"/>
<zPos value="1.000"/>
<nodeType value="2"/>
<idType value="9"/>
<layerType value="0"/>
</node>
<node id="42">
<xPos value="0.667"/>
<yPos value="0.667"/>
<zPos value="1.000"/>
<nodeType value="2"/>
<idType value="10"/>
<layerType value="0"/>
</node>
<node id="43">
<xPos value="0.667"/>
<yPos value="1.000"/>
<zPos value="1.000"/>
<nodeType value="2"/>
<idType value="11"/>
<layerType value="0"/>
</node>
<node id="44">
<xPos value="1.000"/>
<yPos value="0.000"/>
<zPos value="1.000"/>
<nodeType value="2"/>
<idType value="12"/>
<layerType value="0"/>
</node>
<node id="45">
<xPos value="1.000"/>
<yPos value="0.333"/>
<zPos value="1.000"/>
<nodeType value="2"/>
<idType value="13"/>
<layerType value="0"/>
</node>
<node id="46">
<xPos value="1.000"/>
<yPos value="0.667"/>
<zPos value="1.000"/>
<nodeType value="2"/>
<idType value="14"/>
<layerType value="0"/>
</node>
<node id="47">
<xPos value="1.000"/>
<yPos value="1.000"/>
<zPos value="1.000"/>
<nodeType value="2"/>
<idType value="15"/>
<layerType value="0"/>
</node>
</nodes>
@ -875,5 +1007,606 @@
</port>
</ports>
</con>
<con id="40">
<interface value="0"/>
<ports>
<port id ="0">
<node value="32"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="16"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="41">
<interface value="0"/>
<ports>
<port id ="0">
<node value="32"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="33"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="2">
<interface value="0"/>
<ports>
<port id ="0">
<node value="32"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="36"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="3">
<interface value="0"/>
<ports>
<port id ="0">
<node value="33"/>
<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="33"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="34"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="5">
<interface value="0"/>
<ports>
<port id ="0">
<node value="33"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="37"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="6">
<interface value="0"/>
<ports>
<port id ="0">
<node value="34"/>
<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="34"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="35"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="8">
<interface value="0"/>
<ports>
<port id ="0">
<node value="34"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="38"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="9">
<interface value="0"/>
<ports>
<port id ="0">
<node value="35"/>
<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="35"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="39"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="11">
<interface value="0"/>
<ports>
<port id ="0">
<node value="36"/>
<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="36"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="37"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="13">
<interface value="0"/>
<ports>
<port id ="0">
<node value="36"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="40"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="14">
<interface value="0"/>
<ports>
<port id ="0">
<node value="37"/>
<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="37"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="38"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="16">
<interface value="0"/>
<ports>
<port id ="0">
<node value="37"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="41"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="17">
<interface value="0"/>
<ports>
<port id ="0">
<node value="38"/>
<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="38"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="39"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="19">
<interface value="0"/>
<ports>
<port id ="0">
<node value="38"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="42"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="20">
<interface value="0"/>
<ports>
<port id ="0">
<node value="39"/>
<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="39"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="43"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="22">
<interface value="0"/>
<ports>
<port id ="0">
<node value="40"/>
<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="40"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="41"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="24">
<interface value="0"/>
<ports>
<port id ="0">
<node value="40"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="44"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="25">
<interface value="0"/>
<ports>
<port id ="0">
<node value="41"/>
<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="41"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="42"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="27">
<interface value="0"/>
<ports>
<port id ="0">
<node value="41"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="45"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="28">
<interface value="0"/>
<ports>
<port id ="0">
<node value="42"/>
<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="42"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="43"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="30">
<interface value="0"/>
<ports>
<port id ="0">
<node value="42"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="46"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="31">
<interface value="0"/>
<ports>
<port id ="0">
<node value="43"/>
<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="43"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="47"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="33">
<interface value="0"/>
<ports>
<port id ="0">
<node value="44"/>
<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="44"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="45"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="35">
<interface value="0"/>
<ports>
<port id ="0">
<node value="45"/>
<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="45"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="46"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="37">
<interface value="0"/>
<ports>
<port id ="0">
<node value="46"/>
<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="46"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
<port id ="1">
<node value="47"/>
<bufferDepth value="8"/>
<vcCount value="8"/>
</port>
</ports>
</con>
<con id="39">
<interface value="0"/>
<ports>
<port id ="0">
<node value="47"/>
<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

@ -21,7 +21,7 @@
<delay min="0" max="100"/>
<interval min="100" max="100"/>
<count min="1" max="1"/>
<type value="1"/>
<type value="0"/>
<task value="2"/>
</destination>
</destinations>
@ -41,7 +41,7 @@
<delay min="0" max="100"/>
<interval min="100" max="100"/>
<count min="1" max="1"/>
<type value="1"/>
<type value="0"/>
<task value="2"/>
</destination>
</destinations>
@ -55,12 +55,12 @@
<repeat max="1" min="1"/>
<requires>
<requirement id="0">
<type value="1"/>
<type value="0"/>
<source value="0"/>
<count max="1" min="1"/>
</requirement>
<requirement id="1">
<type value="1"/>
<type value="0"/>
<source value="24"/>
<count max="1" min="1"/>
</requirement>

View file

@ -1,360 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<network-on-chip xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="layer.xsd">
<nodeTypes>
<nodeType id="0">
<model value="XYZ"/>
<clockSpeed value="2"/>
</nodeType>
</nodeTypes>
<layerTypes>
<layerType id="0">
<technology value="130"/>
</layerType>
<layerType id="1">
<technology value="130"/>
</layerType>
</layerTypes>
<nodes>
<node id="0">
<xPos value="0"/>
<yPos value="0"/>
<zPos value="0"/>
<nodeType value="0"/>
<layerType value="0"/>
</node>
<node id="1">
<xPos value="1.00"/>
<yPos value="0"/>
<zPos value="0"/>
<nodeType value="0"/>
<layerType value="0"/>
</node>
<node id="2">
<xPos value="0"/>
<yPos value="1.00"/>
<zPos value="0"/>
<nodeType value="0"/>
<layerType value="0"/>
</node>
<node id="3">
<xPos value="1.00"/>
<yPos value="1.00"/>
<zPos value="0"/>
<nodeType value="0"/>
<layerType value="0"/>
</node>
<node id="4">
<xPos value="0"/>
<yPos value="0"/>
<zPos value="1.00"/>
<nodeType value="0"/>
<layerType value="1"/>
</node>
<node id="5">
<xPos value="1.00"/>
<yPos value="0"/>
<zPos value="1.00"/>
<nodeType value="0"/>
<layerType value="1"/>
</node>
<node id="6">
<xPos value="0"/>
<yPos value="1.00"/>
<zPos value="1.00"/>
<nodeType value="0"/>
<layerType value="1"/>
</node>
<node id="7">
<xPos value="1.00"/>
<yPos value="1.00"/>
<zPos value="1.00"/>
<nodeType value="0"/>
<layerType value="1"/>
</node>
</nodes>
<connections>
<con id="0">
<length value="0"/>
<interface value="0"/>
<ports>
<port id="0">
<node value="0"/>
<bufferDepth value="16"/>
<vcCount value="4"/>
</port>
</ports>
</con>
<con id="1">
<length value="900"/>
<interface value="0"/>
<ports>
<port id="0">
<node value="0"/>
<bufferDepth value="16"/>
<vcCount value="4"/>
</port>
<port id="1">
<node value="1"/>
<bufferDepth value="16"/>
<vcCount value="4"/>
</port>
</ports>
</con>
<con id="2">
<length value="900"/>
<interface value="0"/>
<ports>
<port id="0">
<node value="0"/>
<bufferDepth value="16"/>
<vcCount value="4"/>
</port>
<port id="1">
<node value="2"/>
<bufferDepth value="16"/>
<vcCount value="4"/>
</port>
</ports>
</con>
<con id="3">
<length value="900"/>
<interface value="0"/>
<ports>
<port id="0">
<node value="0"/>
<bufferDepth value="16"/>
<vcCount value="4"/>
</port>
<port id="1">
<node value="4"/>
<bufferDepth value="16"/>
<vcCount value="4"/>
</port>
</ports>
</con>
<con id="4">
<length value="0"/>
<interface value="0"/>
<ports>
<port id="0">
<node value="1"/>
<bufferDepth value="16"/>
<vcCount value="4"/>
</port>
</ports>
</con>
<con id="5">
<length value="900"/>
<interface value="0"/>
<ports>
<port id="0">
<node value="1"/>
<bufferDepth value="16"/>
<vcCount value="4"/>
</port>
<port id="1">
<node value="3"/>
<bufferDepth value="16"/>
<vcCount value="4"/>
</port>
</ports>
</con>
<con id="6">
<length value="900"/>
<interface value="0"/>
<ports>
<port id="0">
<node value="1"/>
<bufferDepth value="16"/>
<vcCount value="4"/>
</port>
<port id="1">
<node value="5"/>
<bufferDepth value="16"/>
<vcCount value="4"/>
</port>
</ports>
</con>
<con id="7">
<length value="0"/>
<interface value="0"/>
<ports>
<port id="0">
<node value="2"/>
<bufferDepth value="16"/>
<vcCount value="4"/>
</port>
</ports>
</con>
<con id="8">
<length value="900"/>
<interface value="0"/>
<ports>
<port id="0">
<node value="2"/>
<bufferDepth value="16"/>
<vcCount value="4"/>
</port>
<port id="1">
<node value="3"/>
<bufferDepth value="16"/>
<vcCount value="4"/>
</port>
</ports>
</con>
<con id="9">
<length value="900"/>
<interface value="0"/>
<ports>
<port id="0">
<node value="2"/>
<bufferDepth value="16"/>
<vcCount value="4"/>
</port>
<port id="1">
<node value="6"/>
<bufferDepth value="16"/>
<vcCount value="4"/>
</port>
</ports>
</con>
<con id="10">
<length value="0"/>
<interface value="0"/>
<ports>
<port id="0">
<node value="3"/>
<bufferDepth value="16"/>
<vcCount value="4"/>
</port>
</ports>
</con>
<con id="11">
<length value="900"/>
<interface value="0"/>
<ports>
<port id="0">
<node value="3"/>
<bufferDepth value="16"/>
<vcCount value="4"/>
</port>
<port id="1">
<node value="7"/>
<bufferDepth value="16"/>
<vcCount value="4"/>
</port>
</ports>
</con>
<con id="12">
<length value="0"/>
<interface value="0"/>
<ports>
<port id="0">
<node value="4"/>
<bufferDepth value="16"/>
<vcCount value="4"/>
</port>
</ports>
</con>
<con id="13">
<length value="900"/>
<interface value="0"/>
<ports>
<port id="0">
<node value="4"/>
<bufferDepth value="16"/>
<vcCount value="4"/>
</port>
<port id="1">
<node value="5"/>
<bufferDepth value="16"/>
<vcCount value="4"/>
</port>
</ports>
</con>
<con id="14">
<length value="900"/>
<interface value="0"/>
<ports>
<port id="0">
<node value="4"/>
<bufferDepth value="16"/>
<vcCount value="4"/>
</port>
<port id="1">
<node value="6"/>
<bufferDepth value="16"/>
<vcCount value="4"/>
</port>
</ports>
</con>
<con id="15">
<length value="0"/>
<interface value="0"/>
<ports>
<port id="0">
<node value="5"/>
<bufferDepth value="16"/>
<vcCount value="4"/>
</port>
</ports>
</con>
<con id="16">
<length value="900"/>
<interface value="0"/>
<ports>
<port id="0">
<node value="5"/>
<bufferDepth value="16"/>
<vcCount value="4"/>
</port>
<port id="1">
<node value="7"/>
<bufferDepth value="16"/>
<vcCount value="4"/>
</port>
</ports>
</con>
<con id="17">
<length value="0"/>
<interface value="0"/>
<ports>
<port id="0">
<node value="6"/>
<bufferDepth value="16"/>
<vcCount value="4"/>
</port>
</ports>
</con>
<con id="18">
<length value="900"/>
<interface value="0"/>
<ports>
<port id="0">
<node value="6"/>
<bufferDepth value="16"/>
<vcCount value="4"/>
</port>
<port id="1">
<node value="7"/>
<bufferDepth value="16"/>
<vcCount value="4"/>
</port>
</ports>
</con>
<con id="19">
<length value="0"/>
<interface value="0"/>
<ports>
<port id="0">
<node value="7"/>
<bufferDepth value="16"/>
<vcCount value="4"/>
</port>
</ports>
</con>
</connections>
</network-on-chip>

View file

@ -25,7 +25,7 @@
#include <string>
#include "boost/program_options.hpp"
#include "ratatoskrUtils/utils/GlobalResources.h"
#include "utils/GlobalResourcesCS.h"
#include "networkManager/NetworkManager.h"
namespace po = boost::program_options;
@ -46,9 +46,9 @@ int sc_main(int arg_num, char *arg_vec[])
std::string configFolder = vm["configFolder"].as<std::string>();
// start simulation
GlobalResourcesCS& globalResources = GlobalResourcesCS::getInstance();
std::unique_ptr<NetworkManager> networkManager =
std::make_unique<NetworkManager>("Layer", configFolder);
GlobalResources& globalResources = GlobalResources::getInstance();
cout << "Random seed " << globalResources.rd_seed << endl;
cout << endl
<< "Starting Simulation!" << endl;

View file

@ -53,7 +53,7 @@ NetworkInterfaceTlm::NetworkInterfaceTlm(sc_module_name nm, Node& node,
SC_METHOD(receivePacketFromPE);
sensitive << packetPortContainer->portValidIn.pos();
for(uint lay=0; lay<NUM_ACC_LAYERS; lay++){
for(uint8_t lay=0; lay<NUM_ACC_LAYERS; lay++){
initiator[lay] = new ni_init_socket((string(nm)+"_"+
to_string(lay)+"_init").c_str());
initiator[lay]->register_nb_transport_bw(this,
@ -87,13 +87,14 @@ void NetworkInterfaceTlm::receiveFlitFromRouter(){
void NetworkInterfaceTlm::receivePacketFromPE() {
if (packetPortContainer->portValidIn.posedge()) {
//log_info("receive()");
Packet* p = packetPortContainer->portDataIn.read();
PacketCS* p = dynamic_cast<PacketCS*>(
packetPortContainer->portDataIn.read());
generateFlitsForPacket(p);
packet_send_queue.push(p);
}
}
void NetworkInterfaceTlm::get_start_end_pos_string(Packet* p,
void NetworkInterfaceTlm::get_start_end_pos_string(PacketCS* p,
string pos[2]){
pos[0] = to_string(node.pos.x) + "," +
to_string(node.pos.y) + "," + to_string(node.pos.z);
@ -102,7 +103,11 @@ void NetworkInterfaceTlm::get_start_end_pos_string(Packet* p,
to_string(p->dst.pos.z);
}
void NetworkInterfaceTlm::generateFlitsForPacket(Packet* p) {
void NetworkInterfaceTlm::generateFlitsForPacket(Packet* p){
/* NOT IMPLEMENTED */
}
void NetworkInterfaceTlm::generateFlitsForPacket(PacketCS* p) {
int flitsPerPacket = p->size;
for (int i = 0; i<flitsPerPacket; ++i) {
FlitType flitType;
@ -126,7 +131,7 @@ void NetworkInterfaceTlm::generateFlitsForPacket(Packet* p) {
}
}
tlm_gp* NetworkInterfaceTlm::build_transaction(Packet* p, Flit* f){
tlm_gp* NetworkInterfaceTlm::build_transaction(PacketCS* p, Flit* f){
// allocate tlm object
tlm_gp* trans = m_mm.allocate();
trans->acquire();
@ -134,7 +139,8 @@ tlm_gp* NetworkInterfaceTlm::build_transaction(Packet* p, Flit* f){
link_extension* ext = new link_extension();
ext->link = Direction::local;
ext->data_type = p->dataType;
ext->is_config_msg = false;
ext->packet_id = p->id;
ext->flit_id = f->id;
trans->set_extension(ext);
trans->set_command(tlm::TLM_WRITE_COMMAND);
@ -155,15 +161,16 @@ tlm_gp* NetworkInterfaceTlm::build_transaction(Packet* p, Flit* f){
}
void NetworkInterfaceTlm::send_flit(Packet* p, Flit* f){
void NetworkInterfaceTlm::send_flit(PacketCS* p, Flit* f){
tlm_gp* trans = build_transaction(p, f);
credit_counter--;
log_info("Credit counter updated: "+to_string(credit_counter));
sc_time delay = sc_time(REQ_INIT_DELAY, UNITS_DELAY);
tlm::tlm_phase send_phase = tlm::BEGIN_REQ;
int lay = p->dataType == TYPE_STREAM ? 1:0;
log_info("Sending flit of type "+to_string(p->dataType)+
log_info("Sending flit of type "+STR_TYPES[p->dataType]+
" to layer "+to_string(lay));
(*initiator[lay])->nb_transport_fw(*trans, send_phase, delay);
}
@ -175,20 +182,15 @@ int NetworkInterfaceTlm::get_type_from_extension(tlm_gp& trans){
return extension->data_type;
}
bool NetworkInterfaceTlm::get_is_cfg_from_extension(tlm_gp& trans){
link_extension* extension;
trans.get_extension<link_extension>(extension);
return extension->is_config_msg;
}
bool NetworkInterfaceTlm::check_cs_needed(tlm_gp& trans){
int type = get_type_from_extension(trans);
return type == TYPE_INIT_STREAM || type == TYPE_END_STREAM;
return type == TYPE_ROUT_CONFIG;
};
void NetworkInterfaceTlm::send_cs_rout_conf_msg(tlm_gp& trans){
tlm::tlm_generic_payload* new_trans = m_mm.allocate();
tlm_gp* new_trans = m_mm.allocate();
// TODO: maybe use deep_copy_from function
new_trans->acquire();
new_trans->set_command(tlm::TLM_WRITE_COMMAND);
new_trans->set_address(trans.get_address());
@ -198,12 +200,13 @@ void NetworkInterfaceTlm::send_cs_rout_conf_msg(tlm_gp& trans){
new_trans->set_byte_enable_ptr(trans.get_byte_enable_ptr());
new_trans->set_dmi_allowed(false);
new_trans->set_response_status(tlm::TLM_INCOMPLETE_RESPONSE);
// add id to new_transaction
link_extension* ext = new link_extension();
ext->link = Dir::local; // set direction of connected router
ext->data_type = get_type_from_extension(trans);
ext->is_config_msg = get_is_cfg_from_extension(trans);
ext->packet_id = -1;
ext->flit_id = -1;
new_trans->set_extension(ext);
// send transaction in socket
@ -214,7 +217,7 @@ void NetworkInterfaceTlm::send_cs_rout_conf_msg(tlm_gp& trans){
void NetworkInterfaceTlm::send_data_to_noc(){
// if no flits to transmit, generate them
Packet* p = packet_send_queue.front();
PacketCS* p = packet_send_queue.front();
if (p->toTransmit.empty()){
generateFlitsForPacket(p);
}
@ -237,7 +240,7 @@ void NetworkInterfaceTlm::send_data_to_noc(){
string start_end_pos[2];
get_start_end_pos_string(p, start_end_pos);
log_info("Flit send to "+start_end_pos[1]+" from "+start_end_pos[0]);
log_info("Flit sent to "+start_end_pos[1]+" from "+start_end_pos[0]);
globalReport.issueNoCInputDataAmount(sc_time_stamp(),globalResources.bitWidth);
}
@ -256,7 +259,7 @@ void NetworkInterfaceTlm::thread() {
}
if (!packet_recv_queue.empty()) {
if (packetPortContainer->portFlowControlIn.read()) {
Packet* p = packet_recv_queue.front();
PacketCS* p = packet_recv_queue.front();
packet_recv_queue.pop();
packetPortContainer->portValidOut.write(true);
packetPortContainer->portDataOut.write(p);
@ -286,6 +289,7 @@ tlm::tlm_sync_enum NetworkInterfaceTlm::nb_transport_bw_cb(int id,
void NetworkInterfaceTlm::init_peq_cb(tlm_gp& trans, const tlm::tlm_phase& phase){
if (phase == tlm::END_REQ) {
credit_counter++;
log_info("Credit counter updated: "+to_string(credit_counter));
}
else if (phase == tlm::BEGIN_REQ || phase == tlm::END_RESP)
log_fatal("Illegal transaction phase received by initiator");
@ -342,61 +346,50 @@ tlm::tlm_sync_enum NetworkInterfaceTlm::nb_transport_fw_cb(int id,
void NetworkInterfaceTlm::receive_and_process_flit(tlm_gp& trans){
trans.set_response_status(tlm::TLM_OK_RESPONSE);
bool is_config_msg = get_is_cfg_from_extension(trans);
unsigned char* data_ptr = trans.get_data_ptr();
Flit* received_flit = reinterpret_cast<Flit*>(data_ptr);
PacketCS* p = dynamic_cast<PacketCS*>(received_flit->packet);
double time = sc_time_stamp().to_double();
auto position = find(p->inTransmit.begin(), p->inTransmit.end(), received_flit->id);
if (position!=p->inTransmit.end())
p->inTransmit.erase(position);
p->transmitted.push_back(received_flit->id);
if(is_config_msg){
// log arrived flit
if (received_flit->type==TAIL || received_flit->type==SINGLE){
stringstream ss;
string flit_type = received_flit->type==SINGLE ? "Single":"Tail";
ss << "Receive Flit " << flit_type << *received_flit;
log_info(ss.str());
}
if (!p->toTransmit.empty() || !p->inTransmit.empty()) {
stringstream ss;
ss << "Received Tail Flit, but still missing flits! "
<< *received_flit;
log_info(ss.str());
}
//globalReport.issueNoCOutputDataAmount(sc_time_stamp(),globalResources.bitWidth);
if (p->toTransmit.empty() && p->inTransmit.empty()){
packet_recv_queue.push(p);
// send config message when all flits of packet arrive
if(check_cs_needed(trans)){
log_info("Send router configuration message");
send_cs_rout_conf_msg(trans);
}
}
credit_counter++;
log_info("Credit counter updated: "+to_string(credit_counter));
// send response if not type stream
if(p->dataType != TYPE_STREAM){
if(resp_in_progress) {
if(nxt_resp_pend){
log_fatal("Attempt to have two pending responses in target");
nxt_resp_pend = &trans;
log_fatal("Attempt to have two pending responses in target");
nxt_resp_pend = &trans;
}
}
else{ send_response(trans); }
}
else{
Flit* received_flit = reinterpret_cast<Flit*>(data_ptr);
Packet* p = received_flit->packet;
double time = sc_time_stamp().to_double();
auto position = find(p->inTransmit.begin(), p->inTransmit.end(), received_flit->id);
if (position!=p->inTransmit.end())
p->inTransmit.erase(position);
p->transmitted.push_back(received_flit->id);
// log arrived flit
if (received_flit->type==TAIL || received_flit->type==SINGLE){
stringstream ss;
string flit_type = received_flit->type==SINGLE ? "Single":"Tail";
ss << "Receive Flit " << flit_type << *received_flit;
log_info(ss.str());
}
if (!p->toTransmit.empty() || !p->inTransmit.empty()) {
stringstream ss;
ss << "Received Tail Flit, but still missing flits! "
<< *received_flit;
log_info(ss.str());
}
//globalReport.issueNoCOutputDataAmount(sc_time_stamp(),globalResources.bitWidth);
if (p->toTransmit.empty() && p->inTransmit.empty())
packet_recv_queue.push(p);
credit_counter++;
// send response if not type stream
if(p->dataType != TYPE_STREAM){
if(resp_in_progress) {
if(nxt_resp_pend){
log_fatal("Attempt to have two pending responses in target");
nxt_resp_pend = &trans;
}
}
else{ send_response(trans); }
}
}
}
@ -414,6 +407,7 @@ void NetworkInterfaceTlm::target_peq_cb(tlm_gp& trans, const tlm::tlm_phase& pha
}
trans.release();
credit_counter++;
log_info("Credit counter updated: "+to_string(credit_counter));
// Target itself is now clear to issue the next BEGIN_RESP
resp_in_progress = false;
if (nxt_resp_pend){
@ -466,6 +460,7 @@ void NetworkInterfaceTlm::send_response(tlm_gp& trans){
tlm::tlm_sync_enum status = (*target[0])->nb_transport_bw(
trans, bw_phase, delay);
credit_counter--;
log_info("Credit counter updated: "+to_string(credit_counter));
if (status == tlm::TLM_UPDATED){
target_peq.notify(trans, bw_phase, delay);
@ -475,6 +470,7 @@ void NetworkInterfaceTlm::send_response(tlm_gp& trans){
trans.release();
resp_in_progress = false;
credit_counter++;
log_info("Credit counter updated: "+to_string(credit_counter));
}
}

View file

@ -37,9 +37,10 @@
#include "ratatoskrUtils/networkInterface/NetworkInterface.h"
#include "noc/noc.h"
#include "traffic/PacketCS.h"
#include "utils/memory_manager.h"
#include "utils/noc_logger.h"
#include "utils/GlobalResourcesCS.h"
using namespace tlm_utils;
@ -48,8 +49,10 @@ public:
typedef simple_initiator_socket_tagged<NetworkInterfaceTlm> ni_init_socket;
typedef simple_target_socket_tagged<NetworkInterfaceTlm> ni_targ_socket;
std::queue<Packet*> packet_send_queue;
std::queue<Packet*> packet_recv_queue;
GlobalResourcesCS& globalResources = GlobalResourcesCS::getInstance();
std::queue<PacketCS*> packet_send_queue;
std::queue<PacketCS*> packet_recv_queue;
string ni_name;
// To PE
@ -113,7 +116,7 @@ public:
* @param p parent packet of the flit to send
* @param f flit to send
*/
void send_flit(Packet* p, Flit* f);
void send_flit(PacketCS* p, Flit* f);
/**
* Build the transaction tp send. Called by send flit
@ -123,7 +126,7 @@ public:
*
* @return created transaction
*/
tlm_gp* build_transaction(Packet* p, Flit* f);
tlm_gp* build_transaction(PacketCS* p, Flit* f);
/**
* Get type from extension
@ -132,13 +135,6 @@ public:
*/
int get_type_from_extension(tlm_gp& trans);
/**
* Get variable is_cfg_msg from extension
*
* @param trans TLM generic payload object
*/
bool get_is_cfg_from_extension(tlm_gp& trans);
/**
* If message is init streaming, a router_cs needs to be
* configured
@ -164,14 +160,21 @@ public:
* Not implemented. TLM's target nb_transport_fw_cb callback
* used instead
*/
void receiveFlitFromRouter();
void receiveFlitFromRouter() override;
/**
* Used inside receivePacketFromPE to generate flits
*
* @param p packet from which to generate flits
*/
void generateFlitsForPacket(Packet *p);
void generateFlitsForPacket(Packet *p) override;
/**
* Used inside receivePacketFromPE to generate flits
*
* @param p packet from which to generate flits
*/
void generateFlitsForPacket(PacketCS *p);
/**
* Gets the node position and the destination of packet
@ -180,7 +183,7 @@ public:
* @param p packet from which to extract destination
* @param pos stores the start (0) and end position (1)
*/
void get_start_end_pos_string(Packet* p, string pos[2]);
void get_start_end_pos_string(PacketCS* p, string pos[2]);
/**
* Checks transaction for errors, if no error found, log

View file

@ -21,11 +21,14 @@
******************************************************************************/
#include "NetworkManager.h"
#include "ratatoskrUtils/traffic/synthetic/SyntheticPool.h"
#include "ratatoskrUtils/traffic/task/TaskPool.h"
#include "ratatoskrUtils/traffic/netrace/NetracePool.h"
#include "processingElement/ProcessingElementCS.h"
#include "traffic/task/TaskPoolCS.h"
#include "utils/noc_logger.h"
NetworkManager::NetworkManager(sc_module_name nm, std::string configFolder){
setup_logger();
dbid = rep.registerElement("NetworkManager", 0);
tlmNoc = new TlmNoc("TlmNoc", configFolder);
@ -49,18 +52,17 @@ void NetworkManager::createClocks() {
void NetworkManager::createTrafficPool() {
unsigned long numOfPEs = globalResources.nodes.size() / 2;
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<TaskPool>();
tp = std::make_unique<TaskPoolCS>();
} else if (globalResources.benchmark == "synthetic") {
tp = std::make_unique<SyntheticPool>();
} else {
FATAL("Please specify correct benchmark type");
}
#endif
#ifdef ENABLE_NETRACE
tp = std::make_unique<NetracePool>("NetracePool");
#endif
tp->processingElements.resize(numOfPEs);
}
@ -71,8 +73,6 @@ void NetworkManager::createNetworkParticipants() {
if (n.type->model == "ProcessingElement") {
// Creating an network interface
std::string ni_name = "ni_" + std::to_string(n.id % numOfPEs);
uint8_t max_pos[3];
get_max_pos(max_pos);
NetworkInterfaceTlm *ni = new NetworkInterfaceTlm(
ni_name.c_str(), n, max_pos);
ni->clk(*clocks.at(n.type->id));
@ -80,7 +80,7 @@ void NetworkManager::createNetworkParticipants() {
idNis.push_back(n.id);
std::string pe_name = "pe_" + std::to_string(n.id % numOfPEs);
ProcessingElementVC *pe = new ProcessingElementVC(pe_name.c_str(), n, tp.get());
ProcessingElementCS *pe = new ProcessingElementCS(pe_name.c_str(), n, tp.get());
std::unique_ptr<PacketSignalContainer> sig1 =
std::make_unique<PacketSignalContainer>(
("packetSigCon1_" + std::to_string(n.id)).c_str());
@ -93,6 +93,14 @@ void NetworkManager::createNetworkParticipants() {
packetSignalContainers.push_back(move(sig1));
packetSignalContainers.push_back(move(sig2));
tp->processingElements.at(n.id % numOfPEs) = pe;
float float_rout_pos[3] = {n.pos.x, n.pos.y, n.pos.z};
uint8_t rout_pos[3];
convert_pos_to_int(float_rout_pos, rout_pos);
string msg = " initialized in position " +
to_string(rout_pos[0]) + "," + to_string(rout_pos[1])+
"," + to_string(rout_pos[2]);
log_info("NI "+ni_name+msg);
}
}
}
@ -160,4 +168,10 @@ void NetworkManager::runNoC() {
}
}
tp->start();
}
}
/******************* LOG FUNCTIONS ********************/
void NetworkManager::log_info(string msg){
SC_REPORT_INFO(NM_LOG, (msg).c_str());
}

View file

@ -28,7 +28,7 @@
#include "systemc.h"
#include "tlm.h"
#include "ratatoskrUtils/utils/GlobalResources.h"
#include "utils/GlobalResourcesCS.h"
#include "ratatoskrUtils/utils/Report.h"
#include "ratatoskrUtils/utils/Structures.h"
#include "ratatoskrUtils/traffic/TrafficPool.h"
@ -49,7 +49,7 @@ public:
explicit NetworkManager(sc_module_name, std::string);
private:
GlobalResources& globalResources = GlobalResources::getInstance();
GlobalResourcesCS& globalResources = GlobalResourcesCS::getInstance();
Report& rep = Report::getInstance();
int dbid;
std::vector<std::unique_ptr<sc_clock>> clocks;
@ -61,7 +61,8 @@ private:
std::vector<ni_init_socket*> unbounded_initiators;
std::vector<ni_targ_socket*> unbounded_targets;
uint8_t max_pos[3];
/**
* Create clocks for Ratatoskr PEs
*/
@ -92,4 +93,9 @@ private:
* Initialize routers and starts traffic pool
*/
void runNoC();
/** Log info
* @param msg log message
*/
void log_info(string msg);
};

View file

@ -38,23 +38,27 @@ TlmNoc::~TlmNoc() {
void TlmNoc::initializeGlobalResources(string config_folder) {
// initialize global resources and rep
globalResources = GlobalResources::getInstance();
GlobalReport &globalReport = GlobalReport::getInstance();
Report &rep = Report::getInstance();
sleep(1);
string config_path = "config/"+config_folder+"/config.xml";//"config/config.xml";
globalResources.readConfigFile(config_path);
globalResources_legacy.readConfigFile(config_path);
globalReport.readConfigFile(config_path);
string network_path = "config/"+config_folder+"/net.xml";
//globalResources.noc_file;
globalResources.readNoCLayout(network_path);
globalResources_legacy.readNoCLayout(network_path);
globalResources.readTaskAndMapFiles(globalResources.data_file, globalResources.map_file);
globalResources_legacy.readTaskAndMapFiles(globalResources.data_file, globalResources.map_file);
globalReport.resizeMatrices();
globalResources.activateFlitTracing = false;
globalResources_legacy.activateFlitTracing = false;
globalResources.outputDirectory = "out";
globalResources_legacy.outputDirectory = "out";
}
void TlmNoc::initNoc() {
@ -69,7 +73,9 @@ void TlmNoc::initNoc() {
string msg = " initialized in position " +
to_string(rout_pos[0]) + "," + to_string(rout_pos[1])+
"," + to_string(rout_pos[2]);
string rout_name = "router_" + to_string(n.id);
string rout_name = n.type->model == "Router" ?
"router_" : "router_cs_";
rout_name += to_string(n.id);
TlmRouter* r = new TlmRouter(rout_name.c_str(), rout_pos, max_pos);
routers.push_back(r);
mapNodeRouter.insert(
@ -161,8 +167,7 @@ TlmRouter* TlmNoc::getRouter(int id){
}
TlmRouter* TlmNoc::getRouterNodeId(int node_id){
int rout_id = mapNodeRouter.find(node_id)->first;
return routers.at(rout_id);
return routers.at(mapNodeRouter[node_id]);
}

View file

@ -34,7 +34,7 @@
#include "tlm.h"
#include "ratatoskrUtils/utils/Structures.h"
#include "ratatoskrUtils/utils/GlobalResources.h"
#include "utils/GlobalResourcesCS.h"
#include "ratatoskrUtils/utils/GlobalReport.h"
#include "router/router.h"
@ -68,7 +68,8 @@ private:
std::vector<tlm_init_socket*> unbounded_initiators;
std::vector<tlm_targ_socket*> unbounded_targets;
GlobalResources& globalResources = GlobalResources::getInstance();
GlobalResourcesCS& globalResources = GlobalResourcesCS::getInstance();
GlobalResources& globalResources_legacy = GlobalResources::getInstance();
/**
* Initialize global resources

View file

@ -0,0 +1,267 @@
#include "ProcessingElementCS.h"
#include "traffic/PacketCS.h"
void ProcessingElementCS::thread(){
while(true) {
int timeStamp = static_cast<int>(sc_time_stamp().value()/1000);
std::vector<DataDestinationCS> removeList;
// EXPLAIN: check if time of the task has already been passed. If it has passed remove it.
for (auto const& tw : destWait) {
DataDestinationCS dest = tw.first;
TaskCS task = destToTask.at(dest);
if (taskTerminationTime.count(task) && taskTerminationTime.at(task)<timeStamp) {
removeList.push_back(dest);
}
}
// EXPLAIN: removing task
for (auto& dest : removeList) {
TaskCS task = destToTask.at(dest);
destToTask.erase(dest);
taskToDest.erase(task);
taskRepeatLeft.erase(task);
taskStartTime.erase(task);
taskTerminationTime.erase(task);
countLeft.erase(dest);
destWait.erase(dest);
}
// EXPLAIN: loop through all destination that are waiting
for (auto const& pair : destWait) {
DataDestinationCS dest = pair.first;
// EXPLAIN: check if the current time is smaller or equal to the time of the destination if yes generate packet
if (pair.second<=timeStamp) {
TaskCS task = globalResources.tasks.at(dest.destinationTask);
Node dstNode = globalResources.nodes.at(task.nodeID);
PacketCS* p = packetFactoryCS.createPacket(this->node,
dstNode, globalResources.flitsPerPacket,
sc_time_stamp().to_double(), dest.dataType, dest.msg);
double time = sc_time_stamp().to_double();
// EXPLAIN: create packet and send it
if ((float) globalResources.synthetic_start_measurement_time<=(time/1000))
globalReport.undeliveredPackages++;
packetPortContainer->portValidOut = true;
packetPortContainer->portDataOut = p;
// EXPLAIN: decrement number of packets left to be sent
countLeft.at(dest)--;
// EXPLAIN: if there are no more packet to this destination remove destination from list of destinations
if (!countLeft.at(dest)) {
countLeft.erase(dest);
destWait.erase(dest);
TaskCS task = destToTask.at(dest);
destToTask.erase(dest);
taskToDest.at(task).erase(dest);
// EXPLAIN: There are no more destinations to the task, all packets of the task has been send
if (taskToDest.at(task).empty()) {
taskToDest.erase(task);
execute(task);
}
}
// EXPLAIN: is there are more packets to the destination schedule the next packet
else {
destWait.at(dest) =
globalResources.getRandomIntBetween(dest.minInterval, dest.maxInterval)+timeStamp;
}
break;
}
}
wait(SC_ZERO_TIME);
packetPortContainer->portValidOut = false;
int nextCall = -1;
for (auto const& dw : destWait) {
if (nextCall>dw.second || nextCall==-1) {
if (globalResources.benchmark=="synthetic") {
TaskCS task = this->destToTask.at(dw.first);
int minInterval = dw.first.minInterval;
if (timeStamp<task.minStart) {
nextCall = task.minStart+globalResources.getRandomIntBetween(0, minInterval-1);
}
else {
int numIntervalsPassed = (timeStamp-task.minStart)/minInterval;
int intervalBeginning = task.minStart+(numIntervalsPassed*minInterval);
nextCall = intervalBeginning+minInterval+globalResources.getRandomIntBetween(0, minInterval-1);
}
}
else { // if not synthetic, then execute the original behavior
nextCall = dw.second;
}
}
}
if (nextCall==0) { // limit packet rate
nextCall = 1;
}
if (nextCall!=-1) {
event.notify(nextCall-timeStamp, SC_NS);
}
wait(event);
}
}
void ProcessingElementCS::execute(TaskCS& task)
{
// EXPLAIN: if there are no repetitions of the task left, create a new number of repetitions (probably used only in the first call for init)
if (!taskRepeatLeft.count(task)) {
taskRepeatLeft[task] = globalResources.getRandomIntBetween(task.minRepeat, task.maxRepeat);
}
else {
// EXPLAIN: decrement the number of repetitions left by 1 and if they reach 0 after that remove the task from list (task is done).
if (taskRepeatLeft.at(task)>0) {
taskRepeatLeft.at(task)--;
}
if (!taskRepeatLeft.at(task)) {
taskRepeatLeft.erase(task);
return;
}
}
// EXPLAIN: if there is no start time init one
if (!taskStartTime.count(task)) {
taskStartTime[task] = globalResources.getRandomIntBetween(task.minStart, task.maxStart);
}
// EXPLAIN: if there is no termination time init one
if (!taskTerminationTime.count(task) && task.minDuration!=-1) {
taskTerminationTime[task] =
taskStartTime[task]+globalResources.getRandomIntBetween(task.minDuration, task.maxDuration);
}
// EXPLAIN: if there are no requirements left start sending
if (task.requirements.empty()) {
startSending(task);
}
else {
// EXPLAIN: go through all requirements and add them to lists
for (DataRequirement& r : task.requirements) {
neededFor[r.dataType].insert(task);
neededAmount[std::make_pair(task, r.dataType)] = globalResources.getRandomIntBetween(r.minCount,
r.maxCount);
needs[task].insert(r.dataType);
}
}
}
void ProcessingElementCS::receive()
{
LOG(globalReport.verbose_pe_function_calls,
"PE" << this->id << "(Node" << node.id << ")\t- receive_data_process()");
// EXPLAIN: checks for positive edge of the validIn signal. This is the trigger
if (packetPortContainer->portValidIn.posedge()) {
// EXPLAIN: read packet from port
Packet* received_packet = packetPortContainer->portDataIn.read();
if (received_packet) {
dataTypeID_t type = received_packet->dataType;
// EXPLAIN: check if receivedData already has a counter for the packet type of the received packet. If yes increment if, if no create one
if (receivedData.count(type)) {
++receivedData.at(type);
}
else {
receivedData[type] = 1;
}
// EXPLAIN: check if now all required data has arrived and if yes start sending data
checkNeed();
// EXPLAIN: delete packet
packetFactoryCS.deletePacket(received_packet);
}
}
}
// EXPLAIN: select possible destinations and set all timings and packet numbers for these destinations they are saved in destWait
void ProcessingElementCS::startSending(TaskCS& task)
{
// EXPLAIN: There are multiple possibilities where to send the data. Select one based on probability
float rn = globalResources.getRandomFloatBetween(0, 1);
int numOfPoss = task.possibilities.size();
for (unsigned int i = 0; i<numOfPoss; ++i) {
if (task.possibilities.at(i).probability>rn) {
// EXPLAIN: A possibility is chosen. Set the destinations of this possibility as the dest of the task
std::vector<DataDestinationCS> destVec = task.possibilities.at(i).dataDestinations;
for (DataDestinationCS& dest : destVec) {
destToTask[dest] = task;
taskToDest[task].insert(dest);
// EXPLAIN: get random packet count per dest
countLeft[dest] = globalResources.getRandomIntBetween(dest.minCount, dest.maxCount);
// EXPLAIN: random delay time to start sending data to dest
int delayTime =
static_cast<int>((sc_time_stamp().value()/1000)
+globalResources.getRandomIntBetween(dest.minDelay, dest.maxDelay));
if (taskStartTime.count(task) && taskStartTime.at(task)>delayTime) {
destWait[dest] = taskStartTime.at(task);
}
else {
destWait[dest] = delayTime;
}
// EXPLAIN: schedule event in systemC
event.notify(SC_ZERO_TIME);
}
break;
}
else {
rn -= task.possibilities.at(i).probability;
}
}
}
void ProcessingElementCS::checkNeed()
{
// EXPLAIN: iterate through received data
for (auto const& data : receivedData) {
dataTypeID_t type = data.first;
std::vector<std::pair<TaskCS, dataTypeID_t>> removeList;
// EXPLAIN: check if there are task that need this data
if (neededFor.count(type)) {
// EXPLAIN: iterate over tasks needing the data
for (const TaskCS& t : neededFor.at(type)) {
std::pair<TaskCS, dataTypeID_t> pair = std::make_pair(t, type);
neededAmount.at(pair) -= receivedData.at(type);
/* This line was commented out because if a task requires several packets from several data types,
it says that the task is finished receiving the required packets while in fact, it still needs some packets.
receivedData.at(type) = 0;
*/
// EXPLAIN: check if the needed amount (datatype for specific task) is reached. If yes remove the pair
if (neededAmount.at(pair)<=0) {
removeList.push_back(pair);
// This line is also commented out for the same reason mentioned above.
// receivedData.at(type) = -neededAmount.at(pair);
}
}
}
// EXPLAIN: remove data from lists
for (auto& p : removeList) {
neededFor.erase(p.second);
neededAmount.erase(p);
needs.at(p.first).erase(p.second);
// EXPLAIN: check if all data requirements of the task are satisfied. If yes start sending
if (needs.at(p.first).empty()) {
startSending(p.first);
}
}
}
}

View file

@ -0,0 +1,37 @@
#pragma once
#include "ratatoskrUtils/processingElement/ProcessingElementVC.h"
#include "utils/PacketFactoryCS.h"
#include "utils/GlobalResourcesCS.h"
class ProcessingElementCS : public ProcessingElementVC {
public:
std::map<dataTypeID_t, std::set<TaskCS>> neededFor;
std::map<std::pair<TaskCS, dataTypeID_t>, int> neededAmount;
std::map<TaskCS, std::set<dataTypeID_t>> needs;
std::map<dataTypeID_t, int> receivedData;
std::map<DataDestinationCS, TaskCS> destToTask;
std::map<TaskCS, std::set<DataDestinationCS>> taskToDest;
std::map<TaskCS, int> taskRepeatLeft;
std::map<TaskCS, int> taskStartTime;
std::map<TaskCS, int> taskTerminationTime;
std::map<DataDestinationCS, int> countLeft;
std::map<DataDestinationCS, int> destWait;
GlobalResourcesCS& globalResources = GlobalResourcesCS::getInstance();
PacketFactoryCS& packetFactoryCS = PacketFactoryCS::getInstance();
ProcessingElementCS(sc_module_name mn, Node& node, TrafficPool* tp):
ProcessingElementVC(mn, node, tp) {};
void thread() override;
void execute(TaskCS&);
void receive() override;
void startSending(TaskCS&);
void checkNeed();
};

View file

@ -25,6 +25,7 @@
#include <queue>
#include <algorithm>
#include "ratatoskrUtils/model/NetworkParticipant.h"
#include "utils/structures_cs.h"
class TrafficPool;
@ -43,6 +44,8 @@ public:
virtual void execute(Task&) = 0;
virtual void execute(TaskCS&) = 0;
virtual void thread() = 0;
};

View file

@ -226,6 +226,7 @@ void ProcessingElementVC::thread()
void ProcessingElementVC::execute(Task& task)
{
cout<<"hmm"<<endl;
// EXPLAIN: if there are no repetitions of the task left, create a new number of repetitions (probably used only in the first call for init)
if (!taskRepeatLeft.count(task)) {
taskRepeatLeft[task] = globalResources.getRandomIntBetween(task.minRepeat, task.maxRepeat);

View file

@ -52,5 +52,5 @@ struct Packet {
friend ostream & operator <<(ostream & os, const Packet& p);
~Packet();
virtual ~Packet();
};

View file

@ -649,7 +649,6 @@ void GlobalResources::readTaskFile(const std::string &taskFilePath, const std::m
for (pugi::xml_node task_node : data_node.child("tasks").children("task"))
{
taskID_t taskID = task_node.attribute("id").as_int();
std::cout<<taskID;
Task task = Task{taskID, bindings.at(taskID)};
readAttributeIfExists(task_node, "start", "min", task.minStart);
readAttributeIfExists(task_node, "start", "max", task.maxStart);

View file

@ -344,7 +344,8 @@ struct DataDestination {
bool operator<(const DataDestination& dt) const;
};
struct DataSendPossibility {
class DataSendPossibility {
public:
possID_t id;
float probability;
std::vector<DataDestination> dataDestinations;
@ -352,7 +353,8 @@ struct DataSendPossibility {
DataSendPossibility(possID_t id, float probability, const std::vector<DataDestination>& dataDestinations);
};
struct Task {
class Task {
public:
taskID_t id;
nodeID_t nodeID;
std::vector<DataRequirement> requirements;

View file

@ -75,11 +75,12 @@ tlm_gp* TlmRouter::build_transaction(tlm_gp& trans, int dest_link){
new_trans->set_dmi_allowed(false);
new_trans->set_response_status(tlm::TLM_INCOMPLETE_RESPONSE);
// add id to new_transaction
// construct new link extension from old one
link_extension* ext = new link_extension();
link_extension* copy_ext;
trans.get_extension<link_extension>(copy_ext);
ext->copy_from(*copy_ext);
ext->link = dest_link; // set direction of connected router
ext->data_type = get_type_from_extension(trans);
ext->is_config_msg = false;
new_trans->set_extension(ext);
return new_trans;
@ -97,36 +98,33 @@ 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[link]));
// react to result
if(status == TLM_UPDATED) {
init_peq.notify(*new_trans, phase, delay);
}
else if(status == TLM_COMPLETED) {
log_error(link, "Request completed prematurely");
log_warn(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[link]));
new_trans->release();
}
}
bool TlmRouter::send_data(int link, int dest_link, tlm_gp& trans){
log_info(link,"Send data to link:"+DIR::toString(dest_link));
log_info(link,trans,"Send data to link:"+DIR::toString(dest_link));
// check credits or that previous message is complete
if (credit_counter[dest_link] > 0 && !curr_req[dest_link]){
if (credit_counter[dest_link] > 0){
send_begin_req(link, trans, dest_link);
if(check_cs_needed(link, dest_link, trans)){
log_info(link,"Send configuration message");
send_cs_rout_conf_msg(link, dest_link, trans);
}
return true;
}
else {
if(credit_counter[dest_link] > 0){
log_error(link,"Waiting for downstream Router!");
}
else{ log_error(link,"Waiting for END REQUEST"); }
log_warn(link,trans, "Waiting for downstream Router!");
return false;
}
}
@ -136,7 +134,7 @@ void TlmRouter::check_transaction(int link, tlm_gp& trans) {
char txt[100];
sprintf(txt, "Transaction returned with error, response status = %s",
trans.get_response_string().c_str());
log_error(link, txt);
log_warn(link,trans,txt);
}
// Log completed routing
@ -146,7 +144,7 @@ void TlmRouter::check_transaction(int link, tlm_gp& trans) {
std::stringstream stream;
stream << hex << adr << " check, cmd=" << (cmd ? 'W' : 'R')
<< ", data=" << hex << *ptr;
log_info(link, stream.str());
log_info(link,trans, stream.str());
// Allow the memory manager to free the transaction object
trans.release();
}
@ -157,90 +155,37 @@ int TlmRouter::get_link_from_extension(tlm_gp& trans){
return extension->link;
}
int TlmRouter::get_type_from_extension(tlm_gp& trans){
link_extension* extension;
trans.get_extension<link_extension>(extension);
return extension->data_type;
}
bool TlmRouter::get_is_cfg_from_extension(tlm_gp& trans){
link_extension* extension;
trans.get_extension<link_extension>(extension);
return extension->is_config_msg;
}
/******************* CS CONFIG FUNCTIONS **********************/
bool TlmRouter::check_cs_needed(int link, int destination, tlm_gp& trans){
int type = get_type_from_extension(trans);
return (link != Dir::local && destination != Dir::local) &&
(type == TYPE_INIT_STREAM || type == TYPE_END_STREAM);
};
void TlmRouter::send_cs_rout_conf_msg(int link, int destination, tlm_gp& trans){
int dest_link = Dir::local;
unsigned char* data = new unsigned char(link | destination<<2);
tlm::tlm_generic_payload* conf_trans = m_mm.allocate();
conf_trans->acquire();
conf_trans->set_command(tlm::TLM_WRITE_COMMAND);
conf_trans->set_address(rout_pos[0] + rout_pos[1]*max_pos[0] +
rout_pos[2]*max_pos[0]*max_pos[1]);
conf_trans->set_data_ptr(data);
conf_trans->set_data_length(1);
conf_trans->set_streaming_width(4);
conf_trans->set_byte_enable_ptr(0);
conf_trans->set_dmi_allowed(false);
conf_trans->set_response_status(tlm::TLM_INCOMPLETE_RESPONSE);
// add id to transaction
link_extension* ext = new link_extension();
ext->link = dest_link; // set direction of connected router
ext->data_type = get_type_from_extension(trans);
ext->is_config_msg = true;
conf_trans->set_extension(ext);
// send transaction in socket
tlm_phase phase = BEGIN_REQ;
sc_time delay = sc_time(REQ_INIT_DELAY, UNITS_DELAY);
tlm_sync_enum status;
status = (*init_socket[dest_link])->nb_transport_fw(
*conf_trans, phase, delay);
curr_req[dest_link] = conf_trans;
credit_counter[dest_link]--;
// react to result
if(status == TLM_UPDATED) {
init_peq.notify(*conf_trans, phase, delay);
}
else if(status == TLM_COMPLETED) {
log_error(link, "Request completed prematurely");
curr_req[dest_link] = 0;
check_transaction(link, *conf_trans);
credit_counter[dest_link]++;
conf_trans->release();
}
string TlmRouter::get_id_string_from_extension(tlm_gp& trans){
link_extension* ext;
trans.get_extension<link_extension>(ext);
string str_pck_id = ext->packet_id > 0 ? to_string(ext->packet_id):"none";
string str_flt_id = ext->flit_id > 0 ? to_string(ext->flit_id):"none";
return "packet " + to_string(ext->packet_id) +
":flit " + to_string(ext->flit_id);
}
/******************* INIT SOCKET FUNCTIONS ********************/
tlm_sync_enum TlmRouter::nb_transport_bw_cb(int id, tlm_gp& trans,
tlm_phase& phase, sc_time& delay) {
log_info(id, "Backward transport callback start");
log_info(id, trans, "Backward transport callback start");
init_peq.notify(trans, phase, delay);
return TLM_ACCEPTED;
}
void TlmRouter::init_peq_cb(tlm_gp& trans, const tlm_phase& phase){
int link = get_link_from_extension(trans);
log_info(link, "Initiator PEQ callback start");
log_info(link, "Phase "+string(phase.get_name())+" received");
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)){
curr_req[link] = 0;
credit_counter[link]++;
start_pend_req(link);
log_info(link, trans,
"credits value updated: " + to_string(credit_counter[link]));
start_pend_req(link, trans);
}
else if (phase == BEGIN_REQ || phase == END_RESP){
log_error(link,"Illegal transaction phase received by initiator");
log_error(link,trans,"Illegal transaction phase received by initiator");
}
if (phase == BEGIN_RESP) {
@ -250,7 +195,7 @@ void TlmRouter::init_peq_cb(tlm_gp& trans, const tlm_phase& phase){
}
void TlmRouter::start_pend_req(int rel_link){
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++){
@ -260,7 +205,7 @@ void TlmRouter::start_pend_req(int rel_link){
bool data_sent = send_data(pending_link, rel_link,
*nxt_send_data_pend[pending_link]);
if (!data_sent){
log_error(pending_link,
log_error(pending_link, trans,
"Credit counter was freed, but data can't be sent");
}
nxt_send_data_pend[pending_link] = 0;
@ -271,7 +216,7 @@ void TlmRouter::start_pend_req(int rel_link){
}
void TlmRouter::send_end_response(int link, tlm_gp& trans){
log_info(link, "Send end response start");
log_info(link,trans, "Send end response start");
tlm_phase fw_phase = END_RESP;
sc_time delay = sc_time(RESP_END_DELAY, UNITS_DELAY);
(*init_socket[link])->nb_transport_fw(trans, fw_phase, delay);
@ -281,7 +226,7 @@ void TlmRouter::send_end_response(int link, tlm_gp& trans){
/******************* TARGET SOCKET FUNCTIONS ********************/
tlm_sync_enum TlmRouter::nb_transport_fw_cb(int id,
tlm_gp& trans, tlm_phase& phase, sc_time& delay){
log_info(id, "Forward transport callback start");
log_info(id, trans, "Forward transport callback start");
unsigned int len = trans.get_data_length();
unsigned char* byt = trans.get_byte_enable_ptr();
unsigned int wid = trans.get_streaming_width();
@ -299,8 +244,8 @@ tlm_sync_enum TlmRouter::nb_transport_fw_cb(int id,
void TlmRouter::target_peq_cb(tlm_gp& trans, const tlm_phase& phase){
int link = DIR::getOppositeDir(get_link_from_extension(trans));
log_info(link, "Target PEQ callback start");
log_info(link, "Phase "+string(phase.get_name())+" received");
log_info(link,trans, "Target PEQ callback start");
log_info(link,trans, "Phase "+string(phase.get_name())+" received");
switch (phase) {
case BEGIN_REQ:
trans.acquire();
@ -308,7 +253,7 @@ void TlmRouter::target_peq_cb(tlm_gp& trans, const tlm_phase& phase){
break;
case END_RESP:
if (!resp_in_progress[link]){
log_error(link,
log_warn(link,trans,
"Illegal transaction phase END_RESP received by target");
}
trans.release();
@ -321,7 +266,7 @@ void TlmRouter::target_peq_cb(tlm_gp& trans, const tlm_phase& phase){
break;
case END_REQ:
case BEGIN_RESP:
log_error(link,"Illegal transaction phase received by target");
log_error(link,trans,"Illegal transaction phase received by target");
break;
default:
if(phase == INTERNAL_PROC_PHASE){
@ -332,14 +277,14 @@ void TlmRouter::target_peq_cb(tlm_gp& trans, const tlm_phase& phase){
}
tlm_sync_enum TlmRouter::send_end_req(int link, tlm_gp& trans){
log_info(link, "Send end request start");
log_info(link, trans, "Send end request start");
// Queue the acceptance and the response with the appropriate latency
sc_time delay = sc_time(REQ_END_DELAY, UNITS_DELAY);
tlm_phase phase = END_REQ;
tlm_sync_enum status = (*target_socket[link])->nb_transport_bw(
trans, phase, delay);
if (status == TLM_COMPLETED) {
log_warn(link,"Request completed, no response to be send");
log_warn(link,trans,"Request completed, no response to be send");
trans.release();
return status;
}
@ -352,7 +297,7 @@ tlm_sync_enum TlmRouter::send_end_req(int link, tlm_gp& trans){
}
void TlmRouter::send_begin_response(int link, tlm_gp& trans){
log_info(link, "Send begin response start");
log_info(link,trans, "Send begin response start");
resp_in_progress[link] = true;
tlm_phase phase = BEGIN_RESP;
sc_time zero_delay = SC_ZERO_TIME;
@ -363,13 +308,13 @@ void TlmRouter::send_begin_response(int link, tlm_gp& trans){
target_peq.notify(trans, phase, zero_delay);
}
else if (status == TLM_COMPLETED) {
log_warn(link,"Request completed, no response to be send");
log_warn(link,trans,"Request completed, no response to be send");
trans.release();
}
}
void TlmRouter::switching(int link, tlm_gp& trans){
log_info(link, "Switching start");
log_info(link,trans, "Switching start");
trans.set_response_status(TLM_OK_RESPONSE);
// arbitration and send message to next router
Dir destination = routing(link, trans);
@ -378,7 +323,7 @@ void TlmRouter::switching(int link, tlm_gp& trans){
data_sent = true;
check_transaction(link, trans);
// change to fatal?
log_warn(link, "Routing failed. Message couldn't be delivered");
log_warn(link,trans, "Routing failed. Message couldn't be delivered");
}
else{
data_sent = send_data(link, destination, trans);
@ -386,7 +331,7 @@ void TlmRouter::switching(int link, tlm_gp& trans){
// validate pending data sent
if (!data_sent) {
if(nxt_send_data_pend[link]) {
log_error(link,
log_error(link,trans,
"Attempt to have two pending data send in same destination");
}
nxt_send_data_pend[link] = &trans;
@ -395,7 +340,7 @@ void TlmRouter::switching(int link, tlm_gp& trans){
// validate pending response
if(resp_in_progress[link]) {
if(nxt_resp_pend[link]){
log_error(link,
log_error(link,trans,
"Attempt to have two pending responses in target");
}
nxt_resp_pend[link] = &trans;
@ -443,22 +388,26 @@ Dir TlmRouter::routing(int link, tlm_gp& trans){
/******************* LOG FUNCTIONS ********************/
void TlmRouter::log_info(uint8_t link, string msg){
void TlmRouter::log_info(uint8_t link, tlm_gp& trans, string msg){
string str_link = DIR::toString(link);
SC_REPORT_INFO(R_LOG, (router_name+":"+str_link+":"+msg).c_str());
string id = get_id_string_from_extension(trans);
SC_REPORT_INFO(R_LOG, (router_name+":"+str_link+":"+id+":"+msg).c_str());
}
void TlmRouter::log_warn(uint8_t link, string msg){
void TlmRouter::log_warn(uint8_t link, tlm_gp& trans, string msg){
string str_link = DIR::toString(link);
SC_REPORT_WARNING(R_LOG, (router_name+":"+str_link+":"+msg).c_str());
string id = get_id_string_from_extension(trans);
SC_REPORT_WARNING(R_LOG, (router_name+":"+str_link+":"+id+":"+msg).c_str());
}
void TlmRouter::log_error(uint8_t link, string msg){
void TlmRouter::log_error(uint8_t link, tlm_gp& trans, string msg){
string str_link = DIR::toString(link);
SC_REPORT_ERROR(R_LOG, (router_name+":"+str_link+":"+msg).c_str());
string id = get_id_string_from_extension(trans);
SC_REPORT_ERROR(R_LOG, (router_name+":"+str_link+":"+id+":"+msg).c_str());
}
void TlmRouter::log_fatal(uint8_t link, string msg){
void TlmRouter::log_fatal(uint8_t link, tlm_gp& trans, string msg){
string str_link = DIR::toString(link);
SC_REPORT_FATAL(R_LOG, (router_name+":"+str_link+":"+msg).c_str());
string id = get_id_string_from_extension(trans);
SC_REPORT_FATAL(R_LOG, (router_name+":"+str_link+":"+id+":"+msg).c_str());
}

View file

@ -47,22 +47,6 @@ using namespace tlm_utils;
DECLARE_EXTENDED_PHASE(INTERNAL_PROC_PHASE);
// Define an extension for the transactions
// link always point to initiator link of transaction
struct link_extension : tlm_extension<link_extension> {
int link;
int data_type;
bool is_config_msg;
virtual tlm_extension_base* clone() const {
return new link_extension(*this);
}
virtual void copy_from(const tlm_extension_base& ext) {
link = static_cast<const link_extension&>(ext).link;
data_type = static_cast<const link_extension&>(ext).data_type;
is_config_msg = static_cast<const link_extension&>(ext).is_config_msg;
}
};
class TlmRouter : public sc_module{
public:
// TLM
@ -114,6 +98,7 @@ class TlmRouter : public sc_module{
* @param link active link
* @param dest_link destination link to send the data to
* @param trans TLM generic payload object
* @return true if data was sent, otherwise, false
*/
bool send_data(int link, int dest_link, tlm_gp& trans);
@ -127,25 +112,6 @@ class TlmRouter : public sc_module{
*/
void check_transaction(int link, tlm_gp& trans);
/**
* If message is init streaming, a router_cs needs to be
* configured
*
* @param link active link
* @param destination destination link to transmit transaction
* @param trans TLM generic payload object
*/
bool check_cs_needed(int link, int destination, tlm_gp& trans);
/**
* Sends router_cs configuration message to local link
*
* @param link active link
* @param destination destination link to transmit transaction
* @param trans TLM generic payload object
*/
void send_cs_rout_conf_msg(int link, int destination, tlm_gp& trans);
/**
* Callback function for non blocking transport backward
*
@ -153,6 +119,7 @@ class TlmRouter : public sc_module{
* @param trans TLM generic payload object
* @param phase TLM current phase
* @param delay TLM expected delay
* @return transaction status
*/
virtual tlm_sync_enum nb_transport_bw_cb(int id, tlm_gp& trans,
tlm_phase& phase, sc_time& delay);
@ -164,6 +131,7 @@ class TlmRouter : public sc_module{
* @param trans TLM generic payload object
* @param phase TLM current phase
* @param delay TLM expected delay
* @return transaction status
*/
tlm_sync_enum nb_transport_fw_cb(int id, tlm_gp& trans,
tlm_phase& phase, sc_time& delay);
@ -182,7 +150,7 @@ class TlmRouter : public sc_module{
* @param trans TLM generic payload object
* @param phase TLM current phase
*/
void target_peq_cb(tlm_gp& trans, const tlm_phase& phase);
virtual void target_peq_cb(tlm_gp& trans, const tlm_phase& phase);
/**
* Begin request
@ -198,6 +166,7 @@ class TlmRouter : public sc_module{
*
* @param link active link
* @param trans TLM generic payload object
* @return request status
*/
tlm::tlm_sync_enum send_end_req(int link, tlm_gp& trans);
@ -215,8 +184,9 @@ class TlmRouter : public sc_module{
* Executed when request ends
*
* @param rel_link link that is now free/released to receive data
* @param trans TLM generic payload object
*/
void start_pend_req(int rel_link);
void start_pend_req(int rel_link, tlm_gp& trans);
/**
@ -240,6 +210,7 @@ class TlmRouter : public sc_module{
*
* @param link active link
* @param dest destination
* @return direction to route to
*/
Dir xyz_routing(int link, uint8_t dest[3]);
@ -248,6 +219,7 @@ class TlmRouter : public sc_module{
*
* @param link active link
* @param trans TLM generic payload object
* @return direction to route to
*/
Dir routing(int link, tlm_gp& trans);
@ -256,44 +228,39 @@ class TlmRouter : public sc_module{
* Get link from extension
*
* @param trans TLM generic payload object
* @return link
*/
int get_link_from_extension(tlm_gp& trans);
/**
* Get type from extension
* Get id from extension as a string (id packet + "_" + id flit)
*
* @param trans TLM generic payload object
* @return id of packet as string
*/
int get_type_from_extension(tlm_gp& trans);
/**
* Get variable is_cfg_msg from extension
*
* @param trans TLM generic payload object
*/
bool get_is_cfg_from_extension(tlm_gp& trans);
string get_id_string_from_extension(tlm_gp& trans);
/** Log info
* @param link active link
* @param msg log message
*/
void log_info(uint8_t link, string msg);
void log_info(uint8_t link, tlm_gp& trans, string msg);
/** Log warning
* @param link active link
* @param msg log message
*/
void log_warn(uint8_t link, string msg);
void log_warn(uint8_t link, tlm_gp& trans, string msg);
/** Log error
* @param link active link
* @param msg log message
*/
void log_error(uint8_t link, string msg);
void log_error(uint8_t link, tlm_gp& trans, string msg);
/** Log fatal
* @param link active link
* @param msg log message
*/
void log_fatal(uint8_t link, string msg);
void log_fatal(uint8_t link, tlm_gp& trans, string msg);
};

View file

@ -21,6 +21,7 @@
******************************************************************************/
#include "router_cs.h"
#include "ratatoskrUtils/utils/Structures.h"
#include "traffic/PacketCS.h"
TlmRouterCS::TlmRouterCS(sc_module_name name, uint8_t rout_pos[3],
uint8_t max_pos[3]):
@ -65,7 +66,7 @@ void TlmRouterCS::send_begin_req(int link, tlm_gp& trans, int dest_link){
credit_counter[dest_link]--;
// react to result
if(status == TLM_COMPLETED) {
log_error(link, "Request completed prematurely");
log_error(link, trans, "Request completed prematurely");
curr_req[dest_link] = 0;
check_transaction(link, *new_trans);
credit_counter[dest_link]++;
@ -74,27 +75,30 @@ void TlmRouterCS::send_begin_req(int link, tlm_gp& trans, int dest_link){
}
void TlmRouterCS::configure_router(tlm_gp& trans){
void TlmRouterCS::configure_router(int link, tlm_gp& trans){
log_info(link, trans, "Configure router");
// get link and destination
unsigned char* data = trans.get_data_ptr();
int link = *data && 3;
int destination = *data >> 2;
unsigned char* data_ptr = trans.get_data_ptr();
Flit* rec_flit = reinterpret_cast<Flit*>(data_ptr);
PacketCS* rec_packet = reinterpret_cast<PacketCS*>(rec_flit->packet);
int config_link = rec_packet->msg.config_link;
int destination = rec_packet->msg.dest_link;
// set auto router map
set_auto_router_map(link, Dir(destination));
set_auto_router_map(config_link, Dir(destination));
}
/******************* INIT SOCKET FUNCTIONS ********************/
tlm_sync_enum TlmRouterCS::nb_transport_bw_cb(int id, tlm_gp& trans,
tlm_phase& phase, sc_time& delay) {
log_info(id, "Backward transport callback start");
log_info(id, trans, "Backward transport callback start CS");
return TLM_ACCEPTED;
}
/******************* TARGET SOCKET FUNCTIONS ********************/
void TlmRouterCS::target_peq_cb(tlm_gp& trans, const tlm_phase& phase){
int link = DIR::getOppositeDir(get_link_from_extension(trans));
log_info(link, "Target PEQ callback start");
log_info(link, "Phase "+string(phase.get_name())+" received");
log_info(link, trans, "Target PEQ callback start CS");
log_info(link, trans, "Phase "+string(phase.get_name())+" received");
switch (phase) {
case BEGIN_REQ:
trans.acquire();
@ -105,10 +109,10 @@ void TlmRouterCS::target_peq_cb(tlm_gp& trans, const tlm_phase& phase){
switching(link, trans);
}
else if(phase == CONF_ROUT_PHASE){
configure_router(trans);
configure_router(link, trans);
}
else{
log_error(link,
log_error(link, trans,
"Illegal transaction phase received by target");
}
break;
@ -116,14 +120,14 @@ void TlmRouterCS::target_peq_cb(tlm_gp& trans, const tlm_phase& phase){
}
tlm_sync_enum TlmRouterCS::send_end_req(int link, tlm_gp& trans){
log_info(link, "Send end request start");
log_info(link, trans, "Send end request start");
// Queue the acceptance and the response with the appropriate latency
sc_time delay = sc_time(REQ_END_DELAY, UNITS_DELAY);
tlm_phase phase = END_REQ;
tlm_sync_enum status = (*target_socket[link])->nb_transport_bw(
trans, phase, delay);
if (status == TLM_COMPLETED) {
log_warn(link,"Request completed, no response to be send");
log_warn(link, trans, "Request completed, no response to be send");
trans.release();
return status;
}
@ -132,13 +136,14 @@ tlm_sync_enum TlmRouterCS::send_end_req(int link, tlm_gp& trans){
int type = get_type_from_extension(trans);
phase = (type == TYPE_STREAM) ? INTERNAL_PROC_PHASE :
CONF_ROUT_PHASE;
log_info(link, trans, "Type of processed message: "+STR_TYPES[type]);
target_peq.notify(trans, phase, delay);
return status;
}
void TlmRouterCS::switching(int link, tlm_gp& trans){
log_info(link, "Switching start");
log_info(link, trans, "Switching start");
trans.set_response_status(TLM_OK_RESPONSE);
// arbitration and send message to next router
Dir destination = routing(link, trans);
@ -147,13 +152,21 @@ void TlmRouterCS::switching(int link, tlm_gp& trans){
data_sent = true;
check_transaction(link, trans);
// change to fatal?
log_warn(link, "Routing failed. Message couldn't be delivered");
log_warn(link, trans, "Routing failed. Message couldn't be delivered");
}
else{
data_sent = send_data(link, destination, trans);
}
// validate pending data sent
if (!data_sent) {
log_error(link,"Attempt to have pending data in same destination");
log_error(link, trans,
"Attempt to have pending data in same destination");
}
}
int TlmRouterCS::get_type_from_extension(tlm_gp& trans){
link_extension* extension;
trans.get_extension<link_extension>(extension);
return extension->data_type;
}

View file

@ -73,9 +73,10 @@ class TlmRouterCS : public TlmRouter{
* Called during configure phase. Sets a new direction
* of routing for a given link
*
* @param link active link
* @param trans TLM generic payload object
*/
void configure_router(tlm_gp& trans);
void configure_router(int link, tlm_gp& trans);
/**
@ -121,7 +122,7 @@ class TlmRouterCS : public TlmRouter{
* @param trans TLM generic payload object
* @param phase TLM current phase
*/
void target_peq_cb(tlm_gp& trans, const tlm_phase& phase);
void target_peq_cb(tlm_gp& trans, const tlm_phase& phase) override;
/**
* Send end request
@ -130,5 +131,13 @@ class TlmRouterCS : public TlmRouter{
* @param trans TLM generic payload object
*/
tlm::tlm_sync_enum send_end_req(int link, tlm_gp& trans);
/**
* Get type from extension
*
* @param trans TLM generic payload object
*/
int get_type_from_extension(tlm_gp& trans);
};

7
src/traffic/PacketCS.cpp Executable file
View file

@ -0,0 +1,7 @@
#include "PacketCS.h"
PacketCS::PacketCS(Node& src, Node& dst, int size, double generationTime,
dataTypeID_t dataType, Message msg)
: Packet(src, dst, size, generationTime, dataType) {
this->msg = msg;
}

11
src/traffic/PacketCS.h Executable file
View file

@ -0,0 +1,11 @@
# pragma once
#include "ratatoskrUtils/traffic/Packet.h"
#include "utils/structures_cs.h"
struct PacketCS:Packet {
Message msg;
PacketCS(Node& src, Node& dst, int size, double generationTime,
dataTypeID_t dataType, Message msg);
};

View file

@ -0,0 +1,9 @@
#include "TaskPoolCS.h"
void TaskPoolCS::start()
{
int numOfPEs = processingElements.size();
for (auto& task: globalResources.tasks) {
processingElements.at(task.nodeID%numOfPEs)->execute(task);
}
}

View file

@ -0,0 +1,20 @@
#pragma once
#include "systemc.h"
#include "utils/GlobalResourcesCS.h"
#include "utils/structures_cs.h"
#include "ratatoskrUtils/utils/Structures.h"
#include "ratatoskrUtils/traffic/task/TaskPool.h"
class TaskPoolCS : public TaskPool {
public:
GlobalResourcesCS& globalResources = GlobalResourcesCS::getInstance();
TaskPoolCS(): TaskPool() {};
TaskPoolCS(int numOfElements): TaskPool(numOfElements) {};
void start() override;
};

View file

@ -0,0 +1,722 @@
/*******************************************************************************
* Copyright (C) 2018 Jan Moritz Joseph
*
* 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 "GlobalResourcesCS.h"
#include <iostream>
#include <iomanip>
GlobalResourcesCS::GlobalResourcesCS()
: simulation_time(0),
outputToFile(false),
activateFlitTracing(false),
routingVerticalThreshold(1.0),
Vdd(1.0),
isUniform(false),
numberOfTrafficTypes(0),
synthetic_start_measurement_time(-1)
{
rand = new std::mt19937_64();
auto seed = std::random_device{}();
rand->seed(seed);
rd_seed = seed;
}
GlobalResourcesCS &GlobalResourcesCS::getInstance()
{
static GlobalResourcesCS instance;
return instance;
}
int GlobalResourcesCS::getRandomIntBetween(int min, int max)
{
std::uniform_int_distribution<int> dis(min, max);
return dis(*rand);
}
float GlobalResourcesCS::getRandomFloatBetween(float min, float max)
{
std::uniform_real_distribution<float> dis(min, max);
return dis(*rand);
}
void GlobalResourcesCS::readAttributeIfExists(pugi::xml_node node, const char *child, const char *attribute, int &var)
{
readAttributeIfExists(node.child(child), attribute, var);
}
void GlobalResourcesCS::readAttributeIfExists(pugi::xml_node node, const char *attribute, int &var)
{
if (!node.attribute(attribute).empty())
{
var = node.attribute(attribute).as_int();
}
}
int GlobalResourcesCS::readRequiredIntAttribute(pugi::xml_node node, const char *child, const char *attribute)
{
return readRequiredIntAttribute(node.child(child), attribute);
}
int GlobalResourcesCS::readRequiredIntAttribute(pugi::xml_node node, const char *attribute)
{
if (node.attribute(attribute).empty())
{
FATAL("Can not read node:" << node.path() << " " << attribute);
}
return node.attribute(attribute).as_int();
}
float GlobalResourcesCS::readRequiredFloatAttribute(pugi::xml_node node, const char *child, const char *attribute)
{
return readRequiredFloatAttribute(node.child(child), attribute);
}
float GlobalResourcesCS::readRequiredFloatAttribute(pugi::xml_node node, const char *attribute)
{
if (node.attribute(attribute).empty())
{
FATAL("Can not read node:" << node.path() << " " << attribute);
}
return node.attribute(attribute).as_float();
}
std::string
GlobalResourcesCS::readRequiredStringAttribute(pugi::xml_node node, const char *child, const char *attribute)
{
return readRequiredStringAttribute(node.child(child), attribute);
}
std::string GlobalResourcesCS::readRequiredStringAttribute(pugi::xml_node node, const char *attribute)
{
if (node.attribute(attribute).empty())
{
FATAL("Can not read node:" << node.path() << " " << attribute);
}
return node.attribute(attribute).as_string();
}
std::vector<std::string> GlobalResourcesCS::string_split(const std::string &str, const std::string &delim)
{
std::vector<std::string> strings;
auto start = 0U;
auto end = str.find(delim);
while (end != std::string::npos)
{
strings.push_back(str.substr(start, end - start));
start = static_cast<unsigned int>(end + 1);
end = str.find(delim, start);
}
strings.push_back(str.substr(start, end));
return strings;
}
std::vector<int> GlobalResourcesCS::strs_to_ints(const std::vector<std::string> &strings)
{
std::vector<int> ints{};
for (auto &str : strings)
{
ints.push_back(std::stoi(str));
}
return ints;
}
void GlobalResourcesCS::createRoutingTable()
{
std::string filename;
filename = RoutingTable_file;
std::ifstream infile(filename);
std::string line;
int cpt_line = 0;
while (std::getline(infile, line))
{
std::istringstream iss(line);
std::string word;
int DIR;
std::vector<int> v;
while (iss >> word)
{
DIR = std::stoi(word);
v.push_back(DIR);
}
RoutingTable.push_back(v);
cpt_line += 1;
}
std::cout << "Routing Table :" << std::endl;
for (auto vec : RoutingTable)
{
for (auto x : vec)
std::cout << x << " , ";
std::cout << std::endl;
}
}
void GlobalResourcesCS::readConfigFile(const std::string &configPath)
{
pugi::xml_document doc;
std::cout << "Reading simulator config: " << configPath << endl;
struct stat buffer;
if (!stat(configPath.c_str(), &buffer) == 0)
cout << endl
<< "ERROR: Config file not found, program will exit with exception" << endl
<< endl;
pugi::xml_parse_result result = doc.load_file(configPath.c_str());
assert(result && "Failed to read simulator config file!");
//GENERAL
pugi::xml_node gen_node = doc.child("configuration").child("general");
simulation_time = gen_node.child("simulationTime").attribute("value").as_int();
outputToFile = gen_node.child("outputToFile").attribute("value").as_bool();
outputFileName = gen_node.child("outputToFile").child_value();
activateFlitTracing = gen_node.child("flitTracing").attribute("value").as_bool();
//ROUTING TABLE
pugi::xml_node Routing_node = doc.child("configuration").child("noc").child("routingTable");
if (Routing_node.child("routingTable_mode") != NULL)
{
RoutingTable_mode = Routing_node.child("routingTable_mode").attribute("value").as_bool();
}
else
{
RoutingTable_mode = 0;
}
std::cout << "Routing table mode: " << RoutingTable_mode << std::endl;
if (RoutingTable_mode == 1)
{
pugi::xml_node RTFile_node = Routing_node.child("routingTable_path");
RoutingTable_file = readRequiredStringAttribute(RTFile_node, "value");
createRoutingTable();
// DIRECTION MATRIX
pugi::xml_node DMFile_node = Routing_node.child("directionMatrix_path");
DirectionMat_file = readRequiredStringAttribute(DMFile_node, "value");
}
//NOC
pugi::xml_node noc_node = doc.child("configuration").child("noc");
noc_file = noc_node.child_value("nocFile");
flitsPerPacket = noc_node.child("flitsPerPacket").attribute("value").as_int();
bitWidth = noc_node.child("bitWidth").attribute("value").as_int();
routingVerticalThreshold = noc_node.child("routingVerticalThreshold").attribute("value").as_float();
Vdd = noc_node.child("Vdd").attribute("value").as_float();
//APPLICATION
pugi::xml_node app_node = doc.child("configuration").child("application");
benchmark = app_node.child_value("benchmark");
data_file = app_node.child_value("dataFile");
map_file = app_node.child_value("mapFile");
simulation_file = app_node.child_value("simulationFile");
mapping_file = app_node.child_value("mappingFile");
netraceFile = app_node.child_value("netraceFile");
netraceStartRegion = app_node.child("netraceStartRegion").attribute("value").as_int();
isUniform = app_node.child("isUniform").attribute("value").as_bool();
numberOfTrafficTypes = app_node.child("numberOfTrafficTypes").attribute("value").as_int();
synthID_t syntheticPhaseID = 0;
for (pugi::xml_node phase_node : app_node.child("synthetic").children("phase"))
{
std::string name = readRequiredStringAttribute(phase_node, "name");
std::string distribution = readRequiredStringAttribute(phase_node, "distribution", "value");
float injectionRate = readRequiredFloatAttribute(phase_node, "injectionRate", "value");
SyntheticPhase sp = SyntheticPhase(syntheticPhaseID, name, distribution, injectionRate);
++syntheticPhaseID;
readAttributeIfExists(phase_node, "start", "min", sp.minStart);
readAttributeIfExists(phase_node, "start", "max", sp.maxStart);
readAttributeIfExists(phase_node, "duration", "min", sp.minDuration);
readAttributeIfExists(phase_node, "duration", "max", sp.maxDuration);
readAttributeIfExists(phase_node, "repeat", "min", sp.minRepeat);
readAttributeIfExists(phase_node, "repeat", "max", sp.maxRepeat);
readAttributeIfExists(phase_node, "count", "min", sp.minCount);
readAttributeIfExists(phase_node, "count", "max", sp.maxCount);
readAttributeIfExists(phase_node, "delay", "min", sp.minDelay);
readAttributeIfExists(phase_node, "delay", "max", sp.maxDelay);
readAttributeIfExists(phase_node, "hotspot", "value", sp.hotspot);
//set first start time after warmup to start of measurement
if (benchmark == "synthetic" && name != "warmup" &&
synthetic_start_measurement_time == -1)
{
synthetic_start_measurement_time = sp.minStart;
}
syntheticPhases.push_back(sp);
}
}
void GlobalResourcesCS::readNoCLayout(const std::string &nocPath)
{
std::cout << "Reading NoC layout: " << nocPath << endl;
assert(access(nocPath.c_str(), F_OK) != -1);
pugi::xml_document doc;
pugi::xml_parse_result result = doc.load_file(nocPath.c_str());
assert(result && "Failed to read NoC file!");
pugi::xml_node noc_node = doc.child("network-on-chip");
bufferDepthType = noc_node.child("bufferDepthType").attribute("value").as_string();
if (!bufferDepthType.empty() && (bufferDepthType != "single" && bufferDepthType != "perVC"))
{
FATAL("The value of bufferDepthType in your network file should be either 'single' or 'perVC'!");
}
// topology
topology = noc_node.child_value("topology");
routingCircular = std::set<std::string>({std::string("torus"), std::string("ring")}).count(topology);
readNodeTypes(noc_node);
readNodes(noc_node);
readConnections(noc_node);
if (!RoutingTable_mode)
{
fillDirInfoOfNodeConn();
}
else
{
fillDirInfoOfNodeConn_DM();
}
#ifdef ENABLE_NETRACE
int temp_z = noc_node.child("abstract").child("z").attribute("value").as_int();
std::vector<int> temp_xs;
std::vector<int> temp_ys;
int temp;
std::stringstream iss;
iss = std::stringstream(noc_node.child("abstract").child("y").attribute("value").as_string());
while (iss >> temp)
temp_xs.push_back(temp);
iss = std::stringstream(noc_node.child("abstract").child("x").attribute("value").as_string());
while (iss >> temp)
temp_ys.push_back(temp);
int node_count = 0;
for(int i = 0; i < temp_z; i++)
node_count += (temp_xs[i] * temp_ys[i]);
// make sure node_count always larger equal than 64, because netrace simulates 64 nodes
// this line is to make it compatible for old simulation (old network.xml do not have xs, ys & z values.)
node_count = (node_count > 64)? node_count : 64;
for (int i = 0; i < node_count; ++i)
{
netraceNodeToTask.insert(std::pair<nodeID_t, int>(i + node_count, i));
netraceTaskToNode.insert(std::pair<nodeID_t, int>(i, i + node_count));
}
#endif
}
void GlobalResourcesCS::readNodeTypes(const pugi::xml_node &noc_node)
{
for (pugi::xml_node node : noc_node.child("nodeTypes").children("nodeType"))
{
dataTypeID_t typeID = node.attribute("id").as_int();
std::string model = node.child("model").attribute("value").as_string();
if (model.empty())
cout << "Model not set properly for nodeType with id " << typeID << endl;
std::string routing = node.child("routing").attribute("value").as_string();
std::string selection = node.child("selection").attribute("value").as_string();
int clkDelay = node.child("clockDelay").attribute("value").as_int();
std::string arbiterType = node.child("arbiterType").attribute("value").as_string();
auto nodeType = std::make_shared<NodeType>(typeID, model, routing, selection, clkDelay, arbiterType);
nodeTypes.emplace_back(nodeType);
}
}
void GlobalResourcesCS::readNodes(const pugi::xml_node &noc_node)
{
for (pugi::xml_node xmlnode : noc_node.child("nodes").children("node"))
{
nodeID_t nodeID = xmlnode.attribute("id").as_int();
std::string name = "node_" + std::to_string(nodeID);
float x = xmlnode.child("xPos").attribute("value").as_float();
float y = xmlnode.child("yPos").attribute("value").as_float();
float z = xmlnode.child("zPos").attribute("value").as_float();
xPositions.push_back(x);
yPositions.push_back(y);
zPositions.push_back(z);
nodeTypeID_t nodeTypeID = xmlnode.child("nodeType").attribute("value").as_int();
std::shared_ptr<NodeType> nodeType = nodeTypes.at(nodeTypeID);
int layer = xmlnode.child("layer").attribute("value").as_int();
nodes.emplace_back(nodeID, Vec3D<float>(x, y, z), nodeType, layer);
}
sortNodesPositions();
}
void GlobalResourcesCS::sortNodesPositions()
{
sort(xPositions.begin(), xPositions.end());
xPositions.erase(unique(xPositions.begin(), xPositions.end()), xPositions.end());
sort(yPositions.begin(), yPositions.end());
yPositions.erase(unique(yPositions.begin(), yPositions.end()), yPositions.end());
sort(zPositions.begin(), zPositions.end());
zPositions.erase(unique(zPositions.begin(), zPositions.end()), zPositions.end());
}
void GlobalResourcesCS::fillDirInfoOfNodeConn()
{
for (Node &node : nodes)
{
//check for common directions
Vec3D<float> distance{};
for (int connectedNodeID : node.connectedNodes)
{
Node connectedNode = nodes.at(connectedNodeID);
distance = node.pos - connectedNode.pos;
connID_t matching_conn = node.getConnWithNode(connectedNode);
DIR::TYPE dir{};
if (distance.isZero())
{ //no axis differs
dir = DIR::Local;
}
else
{ //one axis differs
if (routingCircular && xPositions.size() > 2 && (node.pos.x == 0. && connectedNode.pos.x == 1. && node.pos.y == connectedNode.pos.y))
{
dir = DIR::West;
}
else if (routingCircular && xPositions.size() > 2 && (node.pos.x == 1. && connectedNode.pos.x == 0. && node.pos.y == connectedNode.pos.y))
{
dir = DIR::East;
}
else if (routingCircular && yPositions.size() > 2 && (node.pos.y == 0. && connectedNode.pos.y == 1. && node.pos.x == connectedNode.pos.x))
{
dir = DIR::South;
}
else if (routingCircular && yPositions.size() > 2 && (node.pos.y == 1. && connectedNode.pos.y == 0. && node.pos.x == connectedNode.pos.x))
{
dir = DIR::North;
}
else if (distance.x > 0)
{
dir = DIR::West;
}
else if (distance.x < 0)
{
dir = DIR::East;
}
else if (distance.y < 0)
{
dir = DIR::North;
}
else if (distance.y > 0)
{
dir = DIR::South;
}
else if (distance.z < 0)
{
dir = DIR::Up;
}
else if (distance.z > 0)
{
dir = DIR::Down;
}
}
node.setConPosOfDir(dir, matching_conn);
node.setDirOfConn(matching_conn, dir);
}
}
}
// My fillDirInfoOfNodeConn() function. Rely on Direction_Mat.txt file
void GlobalResourcesCS::fillDirInfoOfNodeConn_DM()
{
std::cout << "Start filling direction of nodes \n";
std::vector<std::vector<int>> directions_mat;
std::ifstream infile(DirectionMat_file);
std::string line;
int cpt_line = 0;
while (std::getline(infile, line))
{
std::istringstream iss(line);
std::string word;
int DIR;
std::vector<int> v;
while (iss >> word)
{
DIR = std::stoi(word);
v.push_back(DIR);
}
directions_mat.push_back(v);
cpt_line += 1;
}
std::cout << "Direction Matrix :" << std::endl;
for (auto vec : directions_mat)
{
for (auto x : vec)
std::cout << x << " , ";
std::cout << std::endl;
}
for (Node &node : nodes)
{
for (int connectedNodeID : node.connectedNodes)
{
Node connectedNode = nodes.at(connectedNodeID);
Vec3D<float> distance{};
distance = node.pos - connectedNode.pos;
connID_t matching_conn = node.getConnWithNode(connectedNode);
DIR::TYPE dir{};
int d;
if (distance.isZero())
{ //no axis differs
dir = DIR::Local;
}
else
{
d = directions_mat[node.id][connectedNode.id];
if (d == -1)
{
std::cout << "error, no direction found \n";
}
else
{
if (d == 1)
{
dir = DIR::East;
}
else
{
if (d == 2)
{
dir = DIR::West;
}
else
{
if (d == 3)
{
dir = DIR::North;
}
else
{
if (d == 4)
{
dir = DIR::South;
}
else
{
if (d == 5)
{
dir = DIR::Up;
}
else
{
if (d == 6)
{
dir = DIR::Down;
}
}
}
}
}
}
}
}
node.setConPosOfDir(dir, matching_conn);
node.setDirOfConn(matching_conn, dir);
}
}
}
void GlobalResourcesCS::readConnections(const pugi::xml_node &noc_node)
{
for (pugi::xml_node xml_con : noc_node.child("connections").children("con"))
{
connID_t connID = xml_con.attribute("id").as_int();
std::vector<nodeID_t> nodesOfConnection{};
std::vector<int> vcsCount{};
std::vector<int> buffersDepth{};
std::vector<std::vector<int>> buffersDepths{};
for (pugi::xml_node xml_port : xml_con.child("ports").children("port"))
{
nodeID_t connectedNodeID = xml_port.child("node").attribute("value").as_int();
nodesOfConnection.push_back(connectedNodeID);
int vcCount = xml_port.child("vcCount").attribute("value").as_int();
vcsCount.push_back(vcCount);
buffersDepth.push_back(xml_port.child("bufferDepth").attribute("value").as_int());
if (bufferDepthType == "perVC")
{
std::string str_vec = xml_port.child("buffersDepths").attribute("value").as_string();
std::vector<std::string> strings = string_split(str_vec, ",");
if (strings.size() != vcCount)
{
FATAL("The buffersDepths size is not equal to vcCount!");
}
std::vector<int> bd = strs_to_ints(strings);
buffersDepths.push_back(bd);
}
}
assert(nodesOfConnection.size() == 2); // make sure each connection only consists 2 nodes
float length = xml_con.child("length").attribute("value").as_float();
int depth = xml_con.child("depth").attribute("value").as_int();
int width = xml_con.child("width").attribute("value").as_int();
Connection con = Connection(connID, nodesOfConnection, vcsCount, buffersDepth, buffersDepths, length, width,
depth);
int nodesSize = nodesOfConnection.size();
con.bufferUtilization.resize(nodesSize);
for (nodeID_t nID : con.nodes)
{
// Now that we know the nodes of each connection, we should reflect this info to the nodes themselves.
for (nodeID_t dstNodeID : con.nodes)
{
if (nID != dstNodeID)
nodes.at(nID).connectedNodes.push_back(dstNodeID);
}
nodes.at(nID).connections.push_back(con.id);
}
connections.push_back(con);
}
}
void GlobalResourcesCS::readTaskAndMapFiles(const std::string &taskFilePath, const std::string &mappingFilePath)
{
std::map<taskID_t, nodeID_t> bindings = readMappingFile(mappingFilePath);
readTaskFile(taskFilePath, bindings);
}
std::map<taskID_t, nodeID_t> GlobalResourcesCS::readMappingFile(const std::string &mappingFilePath)
{
std::cout << "Reading Mapping config: " << mappingFilePath << endl;
pugi::xml_document doc;
pugi::xml_parse_result result = doc.load_file(mappingFilePath.c_str());
assert(result && "Failed to read Mapping file!");
pugi::xml_node map_node = doc.child("map");
std::map<taskID_t, nodeID_t> bindings;
for (pugi::xml_node bind_node : map_node.children("bind"))
{
int taskID = readRequiredIntAttribute(bind_node, "task", "value");
int nodeID = readRequiredIntAttribute(bind_node, "node", "value");
bindings.emplace(taskID, nodeID);
}
return bindings;
}
void GlobalResourcesCS::readTaskFile(const std::string &taskFilePath, const std::map<int, int> &bindings)
{
//TODO the bindings vector was used to get the destination node and not task, of a current task.. keep it?
std::cout << "Reading Data config: " << taskFilePath << endl;
pugi::xml_document doc;
pugi::xml_parse_result result = doc.load_file(taskFilePath.c_str());
assert(result && "Failed to read Data file!");
pugi::xml_node data_node = doc.child("data");
// Read Data Types
numberOfTrafficTypes = static_cast<int>(data_node.child("dataTypes").select_nodes("dataType").size());
for (pugi::xml_node type_node : data_node.child("dataTypes").children("dataType"))
{
dataTypeID_t dataTypeID = readRequiredIntAttribute(type_node, "id");
std::string name = readRequiredStringAttribute(type_node, "name", "value");
dataTypes.emplace_back(dataTypeID, name);
}
// Read Tasks
for (pugi::xml_node task_node : data_node.child("tasks").children("task"))
{
taskID_t taskID = task_node.attribute("id").as_int();
TaskCS task = TaskCS{taskID, bindings.at(taskID)};
readAttributeIfExists(task_node, "start", "min", task.minStart);
readAttributeIfExists(task_node, "start", "max", task.maxStart);
readAttributeIfExists(task_node, "duration", "min", task.minDuration);
readAttributeIfExists(task_node, "duration", "max", task.maxDuration);
readAttributeIfExists(task_node, "repeat", "min", task.minRepeat);
readAttributeIfExists(task_node, "repeat", "max", task.maxRepeat);
// Read Requirements
std::vector<DataRequirement> requirements{};
for (pugi::xml_node requirement_node : task_node.child("requires").children("requirement"))
{
dataReqID_t reqID = readRequiredIntAttribute(requirement_node, "id");
dataTypeID_t typeID = readRequiredIntAttribute(requirement_node, "type", "value");
DataRequirement req = DataRequirement{reqID, typeID};
readAttributeIfExists(requirement_node, "count", "min", req.minCount);
readAttributeIfExists(requirement_node, "count", "max", req.maxCount);
readAttributeIfExists(requirement_node, "count", "max", req.maxCount);
requirements.push_back(req);
}
task.requirements = requirements;
// Read Destinations
std::vector<DataSendPossibilityCS> possibilities{};
for (pugi::xml_node generate_node : task_node.child("generates").children("possibility"))
{
possID_t possID = readRequiredIntAttribute(generate_node, "id");
float probability = readRequiredFloatAttribute(generate_node, "probability", "value");
std::vector<DataDestinationCS> destinations{};
for (pugi::xml_node destination_node : generate_node.child("destinations").children("destination"))
{
dataDestID_t dataDestID = readRequiredIntAttribute(destination_node, "id");
dataTypeID_t typeID = readRequiredIntAttribute(destination_node, "type", "value");
taskID_t destTaskID = readRequiredIntAttribute(destination_node, "task", "value");
int minInterval = readRequiredIntAttribute(destination_node, "interval", "min");
int maxInterval = readRequiredIntAttribute(destination_node, "interval", "max");
DataDestinationCS dataDestination = DataDestinationCS{dataDestID, typeID, destTaskID, minInterval,
maxInterval};
readAttributeIfExists(destination_node, "count", "min", dataDestination.minCount);
readAttributeIfExists(destination_node, "count", "max", dataDestination.maxCount);
readAttributeIfExists(destination_node, "delay", "min", dataDestination.minDelay);
readAttributeIfExists(destination_node, "delay", "max", dataDestination.maxDelay);
readAttributeIfExists(destination_node, "config", "link", dataDestination.msg.config_link);
readAttributeIfExists(destination_node, "config", "destination", dataDestination.msg.dest_link);
destinations.push_back(dataDestination);
}
possibilities.emplace_back(possID, probability, destinations);
}
task.possibilities = possibilities;
tasks.push_back(task);
}
}
std::vector<Node *> GlobalResourcesCS::getNodesByPos(const Vec3D<float> &pos)
{
std::vector<Node *> matching_nodes{};
for (auto &node : nodes)
if (node.getNodeByPos(pos))
{
matching_nodes.push_back(&node);
}
return matching_nodes;
}
GlobalResourcesCS::~GlobalResourcesCS()
{
delete rand;
}

View file

@ -0,0 +1,148 @@
/*******************************************************************************
* Copyright (C) 2018 Jan Moritz Joseph
*
* 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.
******************************************************************************/
#pragma once
#include <string>
#include <vector>
#include <set>
#include <map>
#include <unistd.h>
#include <random>
#include <sys/stat.h>
#include "structures_cs.h"
#include "pugixml.hpp"
// my includes
#include <cmath>
#include <list>
#include <fstream>
#include <sstream>
#include <iostream>
class GlobalResourcesCS
{
public:
std::vector<float> xPositions;
std::vector<float> yPositions;
std::vector<float> zPositions;
//General
int simulation_time;
bool outputToFile;
bool activateFlitTracing;
std::string outputFileName;
std::string outputDirectory;
std::string noc_file;
int flitsPerPacket = 0;
int bitWidth = 32;
float routingVerticalThreshold = 1.0f;
float Vdd = 1.0f;
std::string bufferDepthType;
std::string RoutingTable_file;
bool RoutingTable_mode;
std::vector<std::vector<int>> RoutingTable;
std::string DirectionMat_file;
//Application
std::string benchmark;
std::string data_file;
std::string map_file;
std::string simulation_file;
std::string mapping_file;
std::string netraceFile;
int netraceStartRegion;
bool isUniform;
int numberOfTrafficTypes;
int synthetic_start_measurement_time;
// General NoC data
std::vector<std::shared_ptr<NodeType>> nodeTypes;
std::vector<Node> nodes;
std::vector<Connection> connections;
std::vector<TaskCS> tasks;
std::vector<DataType> dataTypes;
std::vector<SyntheticPhase> syntheticPhases;
std::string topology; // store the topology of the network (mesh, torus, ring)
bool routingCircular = false; // decide whether the routing algorithm is routed in a circular way (for torus and ring)
long long rd_seed;
std::mt19937_64 *rand;
//debug
bool routingDebugMode = false;
static GlobalResourcesCS &getInstance();
int getRandomIntBetween(int, int);
float getRandomFloatBetween(float, float);
void readConfigFile(const std::string &configPath);
void readNoCLayout(const std::string &nocPath);
void readTaskAndMapFiles(const std::string &taskFilePath, const std::string &mappingFilePath);
std::vector<Node *> getNodesByPos(const Vec3D<float> &pos);
private:
GlobalResourcesCS();
~GlobalResourcesCS();
std::vector<std::string> string_split(const std::string &str, const std::string &delim);
std::vector<int> strs_to_ints(const std::vector<std::string> &strings);
void readNodeTypes(const pugi::xml_node &noc_node);
void readNodes(const pugi::xml_node &noc_node);
void sortNodesPositions();
void fillDirInfoOfNodeConn();
void fillDirInfoOfNodeConn_DM();
void readConnections(const pugi::xml_node &noc_node);
void readAttributeIfExists(pugi::xml_node, const char *, const char *, int &);
void readAttributeIfExists(pugi::xml_node, const char *, int &);
void readTaskFile(const std::string &taskFilePath, const std::map<int, int> &bindings);
std::map<int, int> readMappingFile(const std::string &mappingFilePath);
std::string readRequiredStringAttribute(pugi::xml_node, const char *, const char *);
std::string readRequiredStringAttribute(pugi::xml_node, const char *);
int readRequiredIntAttribute(pugi::xml_node, const char *, const char *);
int readRequiredIntAttribute(pugi::xml_node, const char *);
float readRequiredFloatAttribute(pugi::xml_node, const char *, const char *);
float readRequiredFloatAttribute(pugi::xml_node, const char *);
void createRoutingTable();
};

View file

@ -0,0 +1,24 @@
#pragma once
#include "systemc.h"
#include <set>
#include <utils/PacketFactoryCS.h>
#include "ratatoskrUtils/utils/GlobalResources.h"
#include "ratatoskrUtils/utils/GlobalReport.h"
#include "ratatoskrUtils/utils/Report.h"
#include "ratatoskrUtils/container/Container.h"
class NetworkParticipantCS {
public:
GlobalResources& globalResources = GlobalResources::getInstance();
GlobalReport& globalReport = GlobalReport::getInstance();
Report& rep = Report::getInstance();
PacketFactoryCS& packetFactory = PacketFactoryCS::getInstance();
virtual void initialize() = 0;
virtual void bind(Connection*, SignalContainer*, SignalContainer*) = 0;
~NetworkParticipantCS() = default;
};

27
src/utils/PacketFactoryCS.cpp Executable file
View file

@ -0,0 +1,27 @@
#include "PacketFactoryCS.h"
PacketFactoryCS& PacketFactoryCS::getInstance()
{
static PacketFactoryCS instance;
return instance;
}
PacketCS* PacketFactoryCS::createPacket(Node& src, Node& dst, int size, double generationTime, dataTypeID_t dataType, Message msg)
{
auto p = new PacketCS(src, dst, size, sc_time_stamp().to_double(), dataType, msg);
packets.push_back(p);
//cout<<"Create packet: "<<p->id<<endl;
return p;
}
void PacketFactoryCS::deletePacket(Packet* p)
{
auto it = std::find(packets.begin(), packets.end(), p);
//cout<<"Delete packet: "<<p->id<<endl;
if (it != packets.end()) {
delete (*it);
packets.erase(it);
} else {
cerr << "payload not in packet vector" << endl;
}
}

18
src/utils/PacketFactoryCS.h Executable file
View file

@ -0,0 +1,18 @@
#pragma once
#include <vector>
#include "traffic/PacketCS.h"
#include "utils/structures_cs.h"
class PacketFactoryCS {
public:
std::vector<PacketCS*> packets;
static PacketFactoryCS& getInstance();
PacketCS* createPacket(Node& src, Node& dst, int size, double generationTime, dataTypeID_t dataType, Message msg);
void deletePacket(Packet* p);
PacketFactoryCS(PacketFactoryCS const&) = delete;
void operator=(PacketFactoryCS const&) = delete;
private:
PacketFactoryCS() {}
};

View file

@ -50,5 +50,24 @@ typedef tlm::tlm_generic_payload tlm_gp;
#define TYPE_STREAM 1
#define TYPE_ROUT_CONFIG 2
const std::string STR_TYPES[5] = {"packet", "stream", "init stream",
"end stream", "acknowledge"};
const std::string STR_TYPES[3] = {"packet", "stream", "configRouter"};
/********************** EXTENSIONS ****************************/
// Define an extension for the transactions
// link always point to initiator link of transaction
struct link_extension : tlm::tlm_extension<link_extension> {
int packet_id;
int flit_id;
int link;
int data_type;
virtual tlm_extension_base* clone() const {
return new link_extension(*this);
}
virtual void copy_from(const tlm_extension_base& ext) {
packet_id = static_cast<const link_extension&>(ext).packet_id;
flit_id = static_cast<const link_extension&>(ext).flit_id;
link = static_cast<const link_extension&>(ext).link;
data_type = static_cast<const link_extension&>(ext).data_type;
}
};

View file

@ -54,6 +54,9 @@ void report_handler(const sc_report& report, const sc_actions& actions){
else if(string(report.get_msg_type()) == NI_LOG){
log_filename = NI_LOGFILENAME;
}
else if(string(report.get_msg_type()) == NM_LOG){
log_filename = NM_LOGFILENAME;
}
ofstream log_file;
log_file.open(log_filename, std::ios_base::app);
@ -72,6 +75,8 @@ void setup_logger(){
log_file.close();
log_file.open(NI_LOGFILENAME);
log_file.close();
log_file.open(NM_LOGFILENAME);
log_file.close();
log_file.open(DEF_LOGFILENAME);
log_file.close();

View file

@ -36,6 +36,9 @@
#define NI_LOGFILENAME "./out/ni.log"
#define NI_LOG "TLM_NI"
#define NM_LOGFILENAME "./out/nm_conn.log"
#define NM_LOG "NetworkManager"
#define ASCII_RED "31"
#define ASCII_GREEN "32"
#define ASCII_YELLOW "33"

46
src/utils/structures_cs.h Normal file
View file

@ -0,0 +1,46 @@
#pragma once
#include "ratatoskrUtils/utils/Structures.h"
struct Message {
int config_link = 0;
int dest_link = 0;
};
struct DataDestinationCS: DataDestination {
Message msg;
DataDestinationCS() : DataDestination() {};
DataDestinationCS(dataDestID_t id, dataTypeID_t dataType,
nodeID_t destinationNode, int minInterval, int maxInterval):
DataDestination(id, dataType, destinationNode,
minInterval, maxInterval){};
};
struct DataSendPossibilityCS {
possID_t id;
float probability;
std::vector<DataDestinationCS> dataDestinations;
DataSendPossibilityCS(possID_t id, float probability,
const std::vector<DataDestinationCS>& dataDestinations):
id(id),
probability(probability),
dataDestinations(dataDestinations) {};
};
class TaskCS: public Task{
public:
std::vector<DataSendPossibilityCS> possibilities;
TaskCS() : Task() {};
TaskCS(taskID_t id, nodeID_t nodeID) : Task(id, nodeID) {};
TaskCS(taskID_t id, nodeID_t nodeID, const std::vector<DataRequirement>& requirements,
const std::vector<DataSendPossibilityCS>& possibilities) :
Task(id, nodeID, requirements,
std::vector<DataSendPossibility>()),
possibilities(possibilities) {};
};

View file

@ -1,12 +1,12 @@
#include "utils.h"
#include "configuration.h"
#include "ratatoskrUtils/utils/GlobalResources.h"
#include "utils/GlobalResourcesCS.h"
#include <fstream>
using namespace std;
void get_pos_distances(float distances[3], vector<float> gr_pos[3]){
GlobalResources& globalResources = GlobalResources::getInstance();
GlobalResourcesCS& globalResources = GlobalResourcesCS::getInstance();
gr_pos[0] = globalResources.xPositions;
gr_pos[1] = globalResources.yPositions;
gr_pos[2] = globalResources.zPositions;