functional version, changing functionallity ay a bit
This commit is contained in:
parent
304e5be196
commit
cf70543834
23 changed files with 1401 additions and 347 deletions
55
config/simple_2_layer_test/config.xml
Executable file
55
config/simple_2_layer_test/config.xml
Executable 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/simple_2_layer_test/data.xml</dataFile>
|
||||
<mapFile>config/simple_2_layer_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>
|
109
config/simple_2_layer_test/data.xml
Normal file
109
config/simple_2_layer_test/data.xml
Normal file
|
@ -0,0 +1,109 @@
|
|||
<?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="Init_Stream"/>
|
||||
</dataType>
|
||||
<dataType id="3">
|
||||
<name value="End_Stream"/>
|
||||
</dataType>
|
||||
<dataType id="4">
|
||||
<name value="Ack"/>
|
||||
</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"/>
|
||||
</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>
|
||||
<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="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"/>
|
||||
<task value="3"/>
|
||||
</destination>
|
||||
</destinations>
|
||||
</possibility>
|
||||
</generates>
|
||||
</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="1"/>
|
||||
<source value="0"/>
|
||||
<count max="1" min="1"/>
|
||||
</requirement>
|
||||
</requires>
|
||||
</task>
|
||||
|
||||
</tasks>
|
||||
</data>
|
19
config/simple_2_layer_test/map.xml
Normal file
19
config/simple_2_layer_test/map.xml
Normal 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="2"/>
|
||||
</bind>
|
||||
<bind>
|
||||
<task value="2"/>
|
||||
<node value="0"/>
|
||||
</bind>
|
||||
<bind>
|
||||
<task value="3"/>
|
||||
<node value="2"/>
|
||||
</bind>
|
||||
</map>
|
879
config/simple_2_layer_test/net.xml
Normal file
879
config/simple_2_layer_test/net.xml
Normal file
|
@ -0,0 +1,879 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<network-on-chip xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="layer.xsd">
|
||||
<bufferDepthType value="single" /> <!-- single, perVC-->
|
||||
<nodeTypes>
|
||||
<nodeType id="0">
|
||||
<model value="Router"/>
|
||||
<routing value="XYZ"/>
|
||||
<clockDelay value="1"/>
|
||||
</nodeType>
|
||||
<nodeType id="1">
|
||||
<model value="ProcessingElement"/>
|
||||
<clockDelay value="1"/>
|
||||
</nodeType>
|
||||
</nodeTypes>
|
||||
|
||||
|
||||
<nodes>
|
||||
<node id="0">
|
||||
<xPos value="0.000"/>
|
||||
<yPos value="0.000"/>
|
||||
<zPos value="0.000"/>
|
||||
<nodeType value="0"/>
|
||||
<idType value="0"/>
|
||||
<layerType value="0"/>
|
||||
</node>
|
||||
<node id="1">
|
||||
<xPos value="0.000"/>
|
||||
<yPos value="0.333"/>
|
||||
<zPos value="0.000"/>
|
||||
<nodeType value="0"/>
|
||||
<idType value="1"/>
|
||||
<layerType value="0"/>
|
||||
</node>
|
||||
<node id="2">
|
||||
<xPos value="0.000"/>
|
||||
<yPos value="0.667"/>
|
||||
<zPos value="0.000"/>
|
||||
<nodeType value="0"/>
|
||||
<idType value="2"/>
|
||||
<layerType value="0"/>
|
||||
</node>
|
||||
<node id="3">
|
||||
<xPos value="0.000"/>
|
||||
<yPos value="1.000"/>
|
||||
<zPos value="0.000"/>
|
||||
<nodeType value="0"/>
|
||||
<idType value="3"/>
|
||||
<layerType value="0"/>
|
||||
</node>
|
||||
<node id="4">
|
||||
<xPos value="0.333"/>
|
||||
<yPos value="0.000"/>
|
||||
<zPos value="0.000"/>
|
||||
<nodeType value="0"/>
|
||||
<idType value="4"/>
|
||||
<layerType value="0"/>
|
||||
</node>
|
||||
<node id="5">
|
||||
<xPos value="0.333"/>
|
||||
<yPos value="0.333"/>
|
||||
<zPos value="0.000"/>
|
||||
<nodeType value="0"/>
|
||||
<idType value="5"/>
|
||||
<layerType value="0"/>
|
||||
</node>
|
||||
<node id="6">
|
||||
<xPos value="0.333"/>
|
||||
<yPos value="0.667"/>
|
||||
<zPos value="0.000"/>
|
||||
<nodeType value="0"/>
|
||||
<idType value="6"/>
|
||||
<layerType value="0"/>
|
||||
</node>
|
||||
<node id="7">
|
||||
<xPos value="0.333"/>
|
||||
<yPos value="1.000"/>
|
||||
<zPos value="0.000"/>
|
||||
<nodeType value="0"/>
|
||||
<idType value="7"/>
|
||||
<layerType value="0"/>
|
||||
</node>
|
||||
<node id="8">
|
||||
<xPos value="0.667"/>
|
||||
<yPos value="0.000"/>
|
||||
<zPos value="0.000"/>
|
||||
<nodeType value="0"/>
|
||||
<idType value="8"/>
|
||||
<layerType value="0"/>
|
||||
</node>
|
||||
<node id="9">
|
||||
<xPos value="0.667"/>
|
||||
<yPos value="0.333"/>
|
||||
<zPos value="0.000"/>
|
||||
<nodeType value="0"/>
|
||||
<idType value="9"/>
|
||||
<layerType value="0"/>
|
||||
</node>
|
||||
<node id="10">
|
||||
<xPos value="0.667"/>
|
||||
<yPos value="0.667"/>
|
||||
<zPos value="0.000"/>
|
||||
<nodeType value="0"/>
|
||||
<idType value="10"/>
|
||||
<layerType value="0"/>
|
||||
</node>
|
||||
<node id="11">
|
||||
<xPos value="0.667"/>
|
||||
<yPos value="1.000"/>
|
||||
<zPos value="0.000"/>
|
||||
<nodeType value="0"/>
|
||||
<idType value="11"/>
|
||||
<layerType value="0"/>
|
||||
</node>
|
||||
<node id="12">
|
||||
<xPos value="1.000"/>
|
||||
<yPos value="0.000"/>
|
||||
<zPos value="0.000"/>
|
||||
<nodeType value="0"/>
|
||||
<idType value="12"/>
|
||||
<layerType value="0"/>
|
||||
</node>
|
||||
<node id="13">
|
||||
<xPos value="1.000"/>
|
||||
<yPos value="0.333"/>
|
||||
<zPos value="0.000"/>
|
||||
<nodeType value="0"/>
|
||||
<idType value="13"/>
|
||||
<layerType value="0"/>
|
||||
</node>
|
||||
<node id="14">
|
||||
<xPos value="1.000"/>
|
||||
<yPos value="0.667"/>
|
||||
<zPos value="0.000"/>
|
||||
<nodeType value="0"/>
|
||||
<idType value="14"/>
|
||||
<layerType value="0"/>
|
||||
</node>
|
||||
<node id="15">
|
||||
<xPos value="1.000"/>
|
||||
<yPos value="1.000"/>
|
||||
<zPos value="0.000"/>
|
||||
<nodeType value="0"/>
|
||||
<idType value="15"/>
|
||||
<layerType value="0"/>
|
||||
</node>
|
||||
<node id="16">
|
||||
<xPos value="0.000"/>
|
||||
<yPos value="0.000"/>
|
||||
<zPos value="0.000"/>
|
||||
<nodeType value="1"/>
|
||||
<idType value="0"/>
|
||||
<layerType value="0"/>
|
||||
</node>
|
||||
<node id="17">
|
||||
<xPos value="0.000"/>
|
||||
<yPos value="0.333"/>
|
||||
<zPos value="0.000"/>
|
||||
<nodeType value="1"/>
|
||||
<idType value="1"/>
|
||||
<layerType value="0"/>
|
||||
</node>
|
||||
<node id="18">
|
||||
<xPos value="0.000"/>
|
||||
<yPos value="0.667"/>
|
||||
<zPos value="0.000"/>
|
||||
<nodeType value="1"/>
|
||||
<idType value="2"/>
|
||||
<layerType value="0"/>
|
||||
</node>
|
||||
<node id="19">
|
||||
<xPos value="0.000"/>
|
||||
<yPos value="1.000"/>
|
||||
<zPos value="0.000"/>
|
||||
<nodeType value="1"/>
|
||||
<idType value="3"/>
|
||||
<layerType value="0"/>
|
||||
</node>
|
||||
<node id="20">
|
||||
<xPos value="0.333"/>
|
||||
<yPos value="0.000"/>
|
||||
<zPos value="0.000"/>
|
||||
<nodeType value="1"/>
|
||||
<idType value="4"/>
|
||||
<layerType value="0"/>
|
||||
</node>
|
||||
<node id="21">
|
||||
<xPos value="0.333"/>
|
||||
<yPos value="0.333"/>
|
||||
<zPos value="0.000"/>
|
||||
<nodeType value="1"/>
|
||||
<idType value="5"/>
|
||||
<layerType value="0"/>
|
||||
</node>
|
||||
<node id="22">
|
||||
<xPos value="0.333"/>
|
||||
<yPos value="0.667"/>
|
||||
<zPos value="0.000"/>
|
||||
<nodeType value="1"/>
|
||||
<idType value="6"/>
|
||||
<layerType value="0"/>
|
||||
</node>
|
||||
<node id="23">
|
||||
<xPos value="0.333"/>
|
||||
<yPos value="1.000"/>
|
||||
<zPos value="0.000"/>
|
||||
<nodeType value="1"/>
|
||||
<idType value="7"/>
|
||||
<layerType value="0"/>
|
||||
</node>
|
||||
<node id="24">
|
||||
<xPos value="0.667"/>
|
||||
<yPos value="0.000"/>
|
||||
<zPos value="0.000"/>
|
||||
<nodeType value="1"/>
|
||||
<idType value="8"/>
|
||||
<layerType value="0"/>
|
||||
</node>
|
||||
<node id="25">
|
||||
<xPos value="0.667"/>
|
||||
<yPos value="0.333"/>
|
||||
<zPos value="0.000"/>
|
||||
<nodeType value="1"/>
|
||||
<idType value="9"/>
|
||||
<layerType value="0"/>
|
||||
</node>
|
||||
<node id="26">
|
||||
<xPos value="0.667"/>
|
||||
<yPos value="0.667"/>
|
||||
<zPos value="0.000"/>
|
||||
<nodeType value="1"/>
|
||||
<idType value="10"/>
|
||||
<layerType value="0"/>
|
||||
</node>
|
||||
<node id="27">
|
||||
<xPos value="0.667"/>
|
||||
<yPos value="1.000"/>
|
||||
<zPos value="0.000"/>
|
||||
<nodeType value="1"/>
|
||||
<idType value="11"/>
|
||||
<layerType value="0"/>
|
||||
</node>
|
||||
<node id="28">
|
||||
<xPos value="1.000"/>
|
||||
<yPos value="0.000"/>
|
||||
<zPos value="0.000"/>
|
||||
<nodeType value="1"/>
|
||||
<idType value="12"/>
|
||||
<layerType value="0"/>
|
||||
</node>
|
||||
<node id="29">
|
||||
<xPos value="1.000"/>
|
||||
<yPos value="0.333"/>
|
||||
<zPos value="0.000"/>
|
||||
<nodeType value="1"/>
|
||||
<idType value="13"/>
|
||||
<layerType value="0"/>
|
||||
</node>
|
||||
<node id="30">
|
||||
<xPos value="1.000"/>
|
||||
<yPos value="0.667"/>
|
||||
<zPos value="0.000"/>
|
||||
<nodeType value="1"/>
|
||||
<idType value="14"/>
|
||||
<layerType value="0"/>
|
||||
</node>
|
||||
<node id="31">
|
||||
<xPos value="1.000"/>
|
||||
<yPos value="1.000"/>
|
||||
<zPos value="0.000"/>
|
||||
<nodeType value="1"/>
|
||||
<idType value="15"/>
|
||||
<layerType value="0"/>
|
||||
</node>
|
||||
</nodes>
|
||||
|
||||
|
||||
<connections>
|
||||
<con id="0">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="0"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="16"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="1">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="0"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="1"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="2">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="0"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="4"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="3">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="1"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="17"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="4">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="1"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="2"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="5">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="1"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="5"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="6">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="2"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="18"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="7">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="2"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="3"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="8">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="2"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="6"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="9">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="3"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="19"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="10">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="3"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="7"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="11">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="4"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="20"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="12">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="4"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="5"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="13">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="4"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="8"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="14">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="5"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="21"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="15">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="5"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="6"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="16">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="5"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="9"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="17">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="6"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="22"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="18">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="6"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="7"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="19">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="6"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="10"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="20">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="7"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="23"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="21">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="7"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="11"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="22">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="8"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="24"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="23">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="8"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="9"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="24">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="8"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="12"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="25">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="9"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="25"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="26">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="9"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="10"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="27">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="9"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="13"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="28">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="10"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="26"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="29">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="10"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="11"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="30">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="10"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="14"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="31">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="11"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="27"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="32">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="11"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="15"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="33">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="12"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="28"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="34">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="12"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="13"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="35">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="13"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="29"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="36">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="13"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="14"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="37">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="14"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="30"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="38">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="14"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="15"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
<con id="39">
|
||||
<interface value="0"/>
|
||||
<ports>
|
||||
<port id ="0">
|
||||
<node value="15"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
<port id ="1">
|
||||
<node value="31"/>
|
||||
<bufferDepth value="8"/>
|
||||
<vcCount value="8"/>
|
||||
</port>
|
||||
</ports>
|
||||
</con>
|
||||
</connections>
|
||||
</network-on-chip>
|
|
@ -3,7 +3,7 @@
|
|||
<bufferDepthType value="single" /> <!-- single, perVC-->
|
||||
<nodeTypes>
|
||||
<nodeType id="0">
|
||||
<model value="RouterVC"/>
|
||||
<model value="Router"/>
|
||||
<routing value="XYZ"/>
|
||||
<clockDelay value="1"/>
|
||||
</nodeType>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<bufferDepthType value="single" /> <!-- single, perVC-->
|
||||
<nodeTypes>
|
||||
<nodeType id="0">
|
||||
<model value="RouterVC"/>
|
||||
<model value="Router"/>
|
||||
<routing value="XYZ"/>
|
||||
<clockDelay value="1"/>
|
||||
</nodeType>
|
||||
|
|
|
@ -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="1"/>
|
||||
</destination>
|
||||
</destinations>
|
||||
|
@ -34,7 +34,7 @@
|
|||
<repeat max="1" min="1"/>
|
||||
<requires>
|
||||
<requirement id="0">
|
||||
<type value="1"/>
|
||||
<type value="0"/>
|
||||
<source value="0"/>
|
||||
<count max="1" min="1"/>
|
||||
</requirement>
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
<delay min = "0" max = "0" />
|
||||
<interval min = "1000" max = "1000"/>
|
||||
<count min = "1" max = "1" />
|
||||
<type value = "1" />
|
||||
<type value = "0" />
|
||||
<task value = "1" />
|
||||
</destination>
|
||||
<destination id = "1">
|
||||
|
@ -49,7 +49,7 @@
|
|||
<delay min = "0" max = "100" />
|
||||
<interval min = "1000" max = "1000"/>
|
||||
<count min = "1" max = "1" />
|
||||
<type value = "1" />
|
||||
<type value = "0" />
|
||||
<task value = "3" />
|
||||
</destination>
|
||||
</destinations>
|
||||
|
@ -64,7 +64,7 @@
|
|||
|
||||
<requires>
|
||||
<requirement id = "0">
|
||||
<type value = "1"/>
|
||||
<type value = "0"/>
|
||||
<source value = "0"/>
|
||||
<count min = "1" max = "1" />
|
||||
</requirement>
|
||||
|
@ -78,7 +78,7 @@
|
|||
<delay min = "0" max = "100" />
|
||||
<interval min = "1000" max = "1000"/>
|
||||
<count min = "1" max = "1" />
|
||||
<type value = "1" />
|
||||
<type value = "0" />
|
||||
<task value = "3" />
|
||||
</destination>
|
||||
</destinations>
|
||||
|
@ -107,7 +107,7 @@
|
|||
<delay min = "0" max = "100" />
|
||||
<interval min = "1000" max = "1000"/>
|
||||
<count min = "1" max = "1" />
|
||||
<type value = "1" />
|
||||
<type value = "0" />
|
||||
<task value = "3" />
|
||||
</destination>
|
||||
</destinations>
|
||||
|
@ -122,7 +122,7 @@
|
|||
|
||||
<requires>
|
||||
<requirement id = "0">
|
||||
<type value = "1"/>
|
||||
<type value = "0"/>
|
||||
<count min = "1" max = "1" />
|
||||
</requirement>
|
||||
</requires>
|
|
@ -8,21 +8,21 @@
|
|||
</layers>
|
||||
<nodeTypes>
|
||||
<nodeType id="0">
|
||||
<model value="RouterVC"/>
|
||||
<model value="Router"/>
|
||||
<routing value="ZXYZ"/>
|
||||
<selection value="1stFreeVC"/>
|
||||
<clockDelay value="1"/>
|
||||
<arbiterType value="fair"/>
|
||||
</nodeType>
|
||||
<nodeType id="1">
|
||||
<model value="RouterVC"/>
|
||||
<model value="Router"/>
|
||||
<routing value="ZXYZ"/>
|
||||
<selection value="1stFreeVC"/>
|
||||
<clockDelay value="1"/>
|
||||
<arbiterType value="fair"/>
|
||||
</nodeType>
|
||||
<nodeType id="2">
|
||||
<model value="RouterVC"/>
|
||||
<model value="Router"/>
|
||||
<routing value="XYZ"/>
|
||||
<selection value="1stFreeVC"/>
|
||||
<clockDelay value="1"/>
|
|
@ -31,8 +31,6 @@ using namespace std;
|
|||
NetworkInterfaceTlm::NetworkInterfaceTlm(sc_module_name nm, Node& node,
|
||||
uint8_t max_pos[3]) : NetworkInterface(nm, node),
|
||||
credit_counter(NUM_CREDITS), ni_name(nm),
|
||||
initiator((string(nm)+"_initiator").c_str()),
|
||||
target((string(nm)+"_target").c_str()),
|
||||
init_peq(this, &NetworkInterfaceTlm::init_peq_cb),
|
||||
target_peq(this, &NetworkInterfaceTlm::target_peq_cb),
|
||||
curr_req(0), resp_in_progress(false),
|
||||
|
@ -55,15 +53,17 @@ NetworkInterfaceTlm::NetworkInterfaceTlm(sc_module_name nm, Node& node,
|
|||
SC_METHOD(receivePacketFromPE);
|
||||
sensitive << packetPortContainer->portValidIn.pos();
|
||||
|
||||
initiator.register_nb_transport_bw(this,
|
||||
&NetworkInterfaceTlm::nb_transport_bw_cb, 0);
|
||||
target.register_nb_transport_fw(this,
|
||||
&NetworkInterfaceTlm::nb_transport_fw_cb, 0);
|
||||
for(uint 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,
|
||||
&NetworkInterfaceTlm::nb_transport_bw_cb, 0);
|
||||
|
||||
initiator_cs.register_nb_transport_bw(this,
|
||||
&NetworkInterfaceTlm::nb_transport_bw_cb, 0);
|
||||
target_cs.register_nb_transport_fw(this,
|
||||
&NetworkInterfaceTlm::nb_transport_fw_cb, 0);
|
||||
target[lay] = new ni_targ_socket((string(nm)+"_"+
|
||||
to_string(lay)+"targ").c_str());
|
||||
target[lay]->register_nb_transport_fw(this,
|
||||
&NetworkInterfaceTlm::nb_transport_fw_cb, 0);
|
||||
}
|
||||
}
|
||||
|
||||
NetworkInterfaceTlm::~NetworkInterfaceTlm() {
|
||||
|
@ -134,6 +134,7 @@ 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;
|
||||
trans->set_extension(ext);
|
||||
|
||||
trans->set_command(tlm::TLM_WRITE_COMMAND);
|
||||
|
@ -161,12 +162,10 @@ void NetworkInterfaceTlm::send_flit(Packet* p, Flit* f){
|
|||
sc_time delay = sc_time(REQ_INIT_DELAY, UNITS_DELAY);
|
||||
tlm::tlm_phase send_phase = tlm::BEGIN_REQ;
|
||||
|
||||
if(p->dataType == TYPE_STREAM){
|
||||
initiator_cs->nb_transport_fw(*trans, send_phase, delay);
|
||||
}
|
||||
else{
|
||||
initiator->nb_transport_fw(*trans, send_phase, delay);
|
||||
}
|
||||
int lay = p->dataType == TYPE_STREAM ? 1:0;
|
||||
log_info("Sending flit of type "+to_string(p->dataType)+
|
||||
" to layer "+to_string(lay));
|
||||
(*initiator[lay])->nb_transport_fw(*trans, send_phase, delay);
|
||||
}
|
||||
|
||||
|
||||
|
@ -176,6 +175,12 @@ 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);
|
||||
|
@ -198,12 +203,13 @@ void NetworkInterfaceTlm::send_cs_rout_conf_msg(tlm_gp& trans){
|
|||
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);
|
||||
new_trans->set_extension(ext);
|
||||
|
||||
// send transaction in socket
|
||||
tlm_phase phase = BEGIN_REQ;
|
||||
sc_time delay = sc_time(REQ_INIT_DELAY, UNITS_DELAY);
|
||||
initiator_cs->nb_transport_fw(*new_trans, phase, delay);
|
||||
(*initiator[1])->nb_transport_fw(*new_trans, phase, delay);
|
||||
}
|
||||
|
||||
void NetworkInterfaceTlm::send_data_to_noc(){
|
||||
|
@ -289,7 +295,7 @@ void NetworkInterfaceTlm::init_peq_cb(tlm_gp& trans, const tlm::tlm_phase& phase
|
|||
// Send final phase transition to target
|
||||
tlm::tlm_phase fw_phase = tlm::END_RESP;
|
||||
sc_time delay = sc_time(RESP_END_DELAY, UNITS_DELAY);
|
||||
initiator->nb_transport_fw(trans, fw_phase, delay);
|
||||
(*initiator[0])->nb_transport_fw(trans, fw_phase, delay);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -336,49 +342,61 @@ 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);
|
||||
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 configuration message to cs_router
|
||||
if(check_cs_needed(trans)){
|
||||
send_cs_rout_conf_msg(trans);
|
||||
}
|
||||
|
||||
// send response if not type stream
|
||||
if(p->dataType != TYPE_STREAM){
|
||||
if(is_config_msg){
|
||||
if(check_cs_needed(trans)){
|
||||
log_info("Send router configuration message");
|
||||
send_cs_rout_conf_msg(trans);
|
||||
}
|
||||
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); }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -422,7 +440,7 @@ tlm::tlm_sync_enum NetworkInterfaceTlm::send_end_req(tlm_gp& trans){
|
|||
tlm::tlm_phase bw_phase = tlm::END_REQ;
|
||||
sc_time delay = sc_time(REQ_END_DELAY, UNITS_DELAY); // Accept delay
|
||||
|
||||
tlm::tlm_sync_enum status = target->nb_transport_bw(trans,
|
||||
tlm::tlm_sync_enum status = (*target[0])->nb_transport_bw(trans,
|
||||
bw_phase, delay);
|
||||
if (status == tlm::TLM_COMPLETED) {
|
||||
trans.release();
|
||||
|
@ -445,7 +463,7 @@ void NetworkInterfaceTlm::send_response(tlm_gp& trans){
|
|||
sc_time delay = SC_ZERO_TIME;
|
||||
tlm::tlm_phase bw_phase = tlm::BEGIN_RESP;
|
||||
|
||||
tlm::tlm_sync_enum status = target->nb_transport_bw(
|
||||
tlm::tlm_sync_enum status = (*target[0])->nb_transport_bw(
|
||||
trans, bw_phase, delay);
|
||||
credit_counter--;
|
||||
|
||||
|
|
|
@ -56,23 +56,23 @@ public:
|
|||
sc_in<bool> clk;
|
||||
PacketPortContainer* packetPortContainer;
|
||||
// To NoC
|
||||
ni_init_socket initiator;
|
||||
ni_targ_socket target;
|
||||
ni_init_socket* initiator[NUM_ACC_LAYERS];
|
||||
ni_targ_socket* target[NUM_ACC_LAYERS];
|
||||
tlm_utils::peq_with_cb_and_phase<NetworkInterfaceTlm> init_peq;
|
||||
tlm_utils::peq_with_cb_and_phase<NetworkInterfaceTlm> target_peq;
|
||||
tlm_gp* curr_req;
|
||||
tlm_gp* end_req_pend;
|
||||
tlm_gp* nxt_resp_pend;
|
||||
tlm_gp* nxt_send_data_pend;
|
||||
|
||||
bool resp_in_progress;
|
||||
bool send_data_in_progress;
|
||||
int credit_counter;
|
||||
Dir send_data_in_prog_dest;
|
||||
MemoryManager m_mm;
|
||||
uint8_t max_pos[3];
|
||||
// To Circuit Switching NoC
|
||||
ni_init_socket initiator_cs;
|
||||
ni_targ_socket target_cs;
|
||||
bool valid_socket[NUM_ACC_LAYERS] = {false};
|
||||
|
||||
|
||||
sc_event_or_list ev_msg_arrv;
|
||||
|
||||
|
@ -132,6 +132,13 @@ 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
|
||||
|
|
|
@ -34,6 +34,7 @@ NetworkManager::NetworkManager(sc_module_name nm, std::string configFolder){
|
|||
createClocks();
|
||||
createNetworkParticipants();
|
||||
createLinks();
|
||||
connectUnboundedNi();
|
||||
runNoC();
|
||||
}
|
||||
|
||||
|
@ -76,6 +77,7 @@ void NetworkManager::createNetworkParticipants() {
|
|||
ni_name.c_str(), n, max_pos);
|
||||
ni->clk(*clocks.at(n.type->id));
|
||||
networkParticipants.at(n.id) = dynamic_cast<NetworkParticipant *>(ni);
|
||||
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());
|
||||
|
@ -106,23 +108,51 @@ void NetworkManager::createLinks() {
|
|||
Node &node2 = globalResources.nodes.at(c.nodes.at(1));
|
||||
bool is_node1_pe = node1.type->model == "ProcessingElement";
|
||||
bool is_node2_pe = node2.type->model == "ProcessingElement";
|
||||
|
||||
if (is_node1_pe || is_node2_pe){
|
||||
int ni_id = is_node1_pe ? node1.id : node2.id;
|
||||
int rout_id = is_node1_pe ? node2.id : node1.id;
|
||||
std::string rout_type = is_node1_pe ?
|
||||
node2.type->model : node1.type->model;
|
||||
uint8_t lay = rout_type=="Router" ? 0 : 1;
|
||||
|
||||
NetworkInterfaceTlm* ni =
|
||||
dynamic_cast<NetworkInterfaceTlm *>(
|
||||
networkParticipants.at(ni_id));
|
||||
TlmRouter* router = tlmNoc->getRouterNodeId(rout_id);
|
||||
ni->initiator.bind(*router->target_socket[DIR::Local]);
|
||||
router->init_socket[DIR::Local]->bind(ni->target);
|
||||
ni->initiator[lay]->bind(*router->target_socket[DIR::Local]);
|
||||
router->init_socket[DIR::Local]->bind(*ni->target[lay]);
|
||||
ni->valid_socket[lay] = true;
|
||||
link_id += 2;
|
||||
}
|
||||
link_id += 2;
|
||||
} else {
|
||||
LOG(true,"Unsupported number of endpoints in connection "+to_string(c.id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkManager::connectUnboundedNi(){
|
||||
// connecting unbounded network interfaces
|
||||
for (uint8_t i=0; i < idNis.size(); i++){
|
||||
for (uint8_t lay=0; lay < NUM_ACC_LAYERS; lay++){
|
||||
NetworkInterfaceTlm* ni = dynamic_cast<NetworkInterfaceTlm*>(
|
||||
networkParticipants.at(idNis[i]));
|
||||
if (!ni->valid_socket[lay]){
|
||||
ni_init_socket* unbound_init = new ni_init_socket(
|
||||
("unb_ni_init_"+to_string(idNis[i])+"_"+to_string(lay)).c_str());
|
||||
unbound_init->bind(*ni->target[lay]);
|
||||
unbounded_initiators.push_back(unbound_init);
|
||||
|
||||
ni_targ_socket* unbound_targ = new ni_targ_socket(
|
||||
("unb_ni_targ_"+to_string(idNis[i])+"_"+to_string(lay)).c_str());
|
||||
ni->initiator[lay]->bind(*unbound_targ);
|
||||
unbounded_targets.push_back(unbound_targ);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void NetworkManager::runNoC() {
|
||||
for (auto &r : networkParticipants) {
|
||||
if (r) {
|
||||
|
|
|
@ -38,8 +38,12 @@
|
|||
|
||||
using namespace tlm;
|
||||
|
||||
typedef simple_initiator_socket_tagged<NetworkInterfaceTlm> ni_init_socket;
|
||||
typedef simple_target_socket_tagged<NetworkInterfaceTlm> ni_targ_socket;
|
||||
|
||||
class NetworkManager : public sc_module{
|
||||
public:
|
||||
|
||||
SC_HAS_PROCESS(NetworkManager);
|
||||
|
||||
explicit NetworkManager(sc_module_name, std::string);
|
||||
|
@ -52,8 +56,12 @@ private:
|
|||
std::unique_ptr<TrafficPool> tp;
|
||||
TlmNoc* tlmNoc;
|
||||
std::vector<NetworkParticipant*> networkParticipants;
|
||||
std::vector<int> idNis;
|
||||
std::vector<std::unique_ptr<PacketSignalContainer>> packetSignalContainers;
|
||||
|
||||
std::vector<ni_init_socket*> unbounded_initiators;
|
||||
std::vector<ni_targ_socket*> unbounded_targets;
|
||||
|
||||
/**
|
||||
* Create clocks for Ratatoskr PEs
|
||||
*/
|
||||
|
@ -75,6 +83,11 @@ private:
|
|||
*/
|
||||
void createLinks();
|
||||
|
||||
/**
|
||||
* Connects all unbounded sockets in Network Interface
|
||||
*/
|
||||
void connectUnboundedNi();
|
||||
|
||||
/**
|
||||
* Initialize routers and starts traffic pool
|
||||
*/
|
||||
|
|
|
@ -60,7 +60,6 @@ void TlmNoc::initializeGlobalResources(string config_folder) {
|
|||
void TlmNoc::initNoc() {
|
||||
uint8_t max_pos[3];
|
||||
get_max_pos(max_pos);
|
||||
|
||||
for (Node &n : globalResources.nodes) {
|
||||
if (n.type->model == "Router" || n.type->model == "RouterCS"){
|
||||
float float_rout_pos[3] = {n.pos.x, n.pos.y, n.pos.z};
|
||||
|
@ -70,31 +69,27 @@ void TlmNoc::initNoc() {
|
|||
string msg = " initialized in position " +
|
||||
to_string(rout_pos[0]) + "," + to_string(rout_pos[1])+
|
||||
"," + to_string(rout_pos[2]);
|
||||
TlmRouter *r;
|
||||
string rout_name;
|
||||
if (n.type->model == "Router") {
|
||||
rout_name = "router_" + to_string(n.id);
|
||||
r = new TlmRouter(rout_name.c_str(), rout_pos, max_pos);
|
||||
}
|
||||
else {
|
||||
rout_name = "router_cs_" + to_string(n.id);
|
||||
r = new TlmRouterCS(rout_name.c_str(), rout_pos, max_pos);
|
||||
}
|
||||
log_info(rout_name + msg);
|
||||
string rout_name = "router_" + to_string(n.id);
|
||||
TlmRouter* r = new TlmRouter(rout_name.c_str(), rout_pos, max_pos);
|
||||
routers.push_back(r);
|
||||
int id = routers.size()-1;
|
||||
mapNodeRouter.insert(
|
||||
pair<int,int>(n.id, int(routers.size())-1));
|
||||
log_info(rout_name + msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TlmNoc::connectRouters(Node node1, Node node2, int link){
|
||||
bool is_n1_router = node1.type->model=="Router";
|
||||
bool is_n1_router_cs = node1.type->model=="RouterCS";
|
||||
bool is_n2_router = node2.type->model=="Router";
|
||||
bool is_n2_router_cs = node2.type->model=="RouterCS";
|
||||
|
||||
int n1_id = mapNodeRouter[node1.id];
|
||||
int n2_id = mapNodeRouter[node2.id];
|
||||
if((node1.type->model=="Router" || node1.type->model=="RouterCS") &&
|
||||
(node2.type->model=="Router" || node1.type->model=="RouterCS")){
|
||||
|
||||
if((is_n1_router||is_n1_router_cs) && (is_n2_router||is_n2_router_cs)){
|
||||
int connDir = node1.getDirOfCon(link);
|
||||
int opposDir = DIR::getOppositeDir(connDir);
|
||||
|
||||
|
@ -104,22 +99,22 @@ void TlmNoc::connectRouters(Node node1, Node node2, int link){
|
|||
*routers[n1_id]->target_socket[connDir]);
|
||||
routers[n1_id]->valid_links[connDir] = true;
|
||||
routers[n2_id]->valid_links[opposDir] = true;
|
||||
log_conn(routers[n1_id]->router_name,routers[n2_id]->router_name,
|
||||
log_conn(routers[n1_id]->router_name,
|
||||
routers[n2_id]->router_name,
|
||||
DIR::toString(connDir), DIR::toString(opposDir));
|
||||
}
|
||||
else{
|
||||
int r_id = (node1.type->model == "Router" ||
|
||||
node1.type->model == "RouterCS") ? n1_id:n2_id;
|
||||
int r_id = (is_n1_router || is_n1_router_cs) ? n1_id:n2_id;
|
||||
api_initiators.push_back(routers[r_id]->init_socket[DIR::Local]);
|
||||
api_targets.push_back(routers[r_id]->target_socket[DIR::Local]);
|
||||
routers[r_id]->valid_links[DIR::Local] = true;
|
||||
log_conn(routers[r_id]->router_name, "noc interface",
|
||||
DIR::toString(DIR::Local), "external");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void TlmNoc::connectUnbounded(){
|
||||
// connecting unbounded routers
|
||||
for (uint8_t id=0; id < routers.size(); id++){
|
||||
|
@ -141,7 +136,6 @@ void TlmNoc::connectUnbounded(){
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -63,6 +63,28 @@ void TlmRouter::initialize(){
|
|||
}
|
||||
|
||||
/******************* COMMON FUNCTIONS ********************/
|
||||
tlm_gp* TlmRouter::build_transaction(tlm_gp& trans, int dest_link){
|
||||
tlm::tlm_generic_payload* new_trans = m_mm.allocate();
|
||||
new_trans->acquire();
|
||||
new_trans->set_command(tlm::TLM_WRITE_COMMAND);
|
||||
new_trans->set_address(trans.get_address());
|
||||
new_trans->set_data_ptr(trans.get_data_ptr());
|
||||
new_trans->set_data_length(trans.get_data_length());
|
||||
new_trans->set_streaming_width(trans.get_streaming_width());
|
||||
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 = 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;
|
||||
}
|
||||
|
||||
void TlmRouter::send_begin_req(int link, tlm_gp& trans, int dest_link){
|
||||
tlm_gp* new_trans = build_transaction(trans, dest_link);
|
||||
|
||||
|
@ -95,6 +117,7 @@ bool TlmRouter::send_data(int link, int dest_link, tlm_gp& trans){
|
|||
if (credit_counter[dest_link] > 0 && !curr_req[dest_link]){
|
||||
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;
|
||||
|
@ -108,8 +131,51 @@ bool TlmRouter::send_data(int link, int dest_link, tlm_gp& trans){
|
|||
}
|
||||
}
|
||||
|
||||
void TlmRouter::check_transaction(int link, tlm_gp& trans) {
|
||||
if(trans.is_response_error()) {
|
||||
char txt[100];
|
||||
sprintf(txt, "Transaction returned with error, response status = %s",
|
||||
trans.get_response_string().c_str());
|
||||
log_error(link, txt);
|
||||
}
|
||||
|
||||
// Log completed routing
|
||||
tlm_command cmd = trans.get_command();
|
||||
sc_dt::uint64 adr = trans.get_address();
|
||||
int* ptr = reinterpret_cast<int*>(trans.get_data_ptr());
|
||||
std::stringstream stream;
|
||||
stream << hex << adr << " check, cmd=" << (cmd ? 'W' : 'R')
|
||||
<< ", data=" << hex << *ptr;
|
||||
log_info(link, stream.str());
|
||||
// Allow the memory manager to free the transaction object
|
||||
trans.release();
|
||||
}
|
||||
|
||||
int TlmRouter::get_link_from_extension(tlm_gp& trans){
|
||||
link_extension* extension;
|
||||
trans.get_extension<link_extension>(extension);
|
||||
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);
|
||||
|
@ -130,6 +196,7 @@ void TlmRouter::send_cs_rout_conf_msg(int link, int destination, tlm_gp& trans){
|
|||
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
|
||||
|
@ -373,3 +440,25 @@ Dir TlmRouter::routing(int link, tlm_gp& trans){
|
|||
uint8_t dest[3] = {dest_x, dest_y, dest_z};
|
||||
return xyz_routing(link, dest);
|
||||
}
|
||||
|
||||
|
||||
/******************* LOG FUNCTIONS ********************/
|
||||
void TlmRouter::log_info(uint8_t link, string msg){
|
||||
string str_link = DIR::toString(link);
|
||||
SC_REPORT_INFO(R_LOG, (router_name+":"+str_link+":"+msg).c_str());
|
||||
}
|
||||
|
||||
void TlmRouter::log_warn(uint8_t link, string msg){
|
||||
string str_link = DIR::toString(link);
|
||||
SC_REPORT_WARNING(R_LOG, (router_name+":"+str_link+":"+msg).c_str());
|
||||
}
|
||||
|
||||
void TlmRouter::log_error(uint8_t link, string msg){
|
||||
string str_link = DIR::toString(link);
|
||||
SC_REPORT_ERROR(R_LOG, (router_name+":"+str_link+":"+msg).c_str());
|
||||
}
|
||||
|
||||
void TlmRouter::log_fatal(uint8_t link, string msg){
|
||||
string str_link = DIR::toString(link);
|
||||
SC_REPORT_FATAL(R_LOG, (router_name+":"+str_link+":"+msg).c_str());
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include "tlm_utils/simple_target_socket.h"
|
||||
#include "tlm_utils/peq_with_cb_and_phase.h"
|
||||
|
||||
#include "router/router_utils.h"
|
||||
#include "utils/memory_manager.h"
|
||||
#include "utils/configuration.h"
|
||||
#include "utils/utils.h"
|
||||
|
@ -46,17 +45,21 @@ using namespace tlm_utils;
|
|||
|
||||
#define NUM_LINKS Direction::num_dirs
|
||||
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -95,6 +98,16 @@ class TlmRouter : public sc_module{
|
|||
*/
|
||||
void initialize();
|
||||
|
||||
/**
|
||||
* Build the transaction tp send. Called by send flit
|
||||
*
|
||||
* @param trans TLM generic payload object
|
||||
* @param dest_link destination link to send the data to
|
||||
*
|
||||
* @return created transaction
|
||||
*/
|
||||
tlm_gp* build_transaction(tlm_gp& trans, int dest_link);
|
||||
|
||||
/**
|
||||
* Send data
|
||||
*
|
||||
|
@ -104,6 +117,26 @@ class TlmRouter : public sc_module{
|
|||
*/
|
||||
bool send_data(int link, int dest_link, tlm_gp& trans);
|
||||
|
||||
/**
|
||||
* Checks transaction for errors, if no error found, log
|
||||
* transaction and release transaction object. Called when
|
||||
* transaction is completed
|
||||
*
|
||||
* @param link active link
|
||||
* @param trans TLM generic payload object
|
||||
*/
|
||||
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
|
||||
*
|
||||
|
@ -121,7 +154,7 @@ class TlmRouter : public sc_module{
|
|||
* @param phase TLM current phase
|
||||
* @param delay TLM expected delay
|
||||
*/
|
||||
tlm_sync_enum nb_transport_bw_cb(int id, tlm_gp& trans,
|
||||
virtual tlm_sync_enum nb_transport_bw_cb(int id, tlm_gp& trans,
|
||||
tlm_phase& phase, sc_time& delay);
|
||||
|
||||
/**
|
||||
|
@ -217,4 +250,50 @@ class TlmRouter : public sc_module{
|
|||
* @param trans TLM generic payload object
|
||||
*/
|
||||
Dir routing(int link, tlm_gp& trans);
|
||||
|
||||
|
||||
/**
|
||||
* Get link from extension
|
||||
*
|
||||
* @param trans TLM generic payload object
|
||||
*/
|
||||
int get_link_from_extension(tlm_gp& trans);
|
||||
|
||||
/**
|
||||
* Get type from extension
|
||||
*
|
||||
* @param trans TLM generic payload object
|
||||
*/
|
||||
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);
|
||||
|
||||
/** Log info
|
||||
* @param link active link
|
||||
* @param msg log message
|
||||
*/
|
||||
void log_info(uint8_t link, string msg);
|
||||
|
||||
/** Log warning
|
||||
* @param link active link
|
||||
* @param msg log message
|
||||
*/
|
||||
void log_warn(uint8_t link, string msg);
|
||||
|
||||
/** Log error
|
||||
* @param link active link
|
||||
* @param msg log message
|
||||
*/
|
||||
void log_error(uint8_t link, string msg);
|
||||
|
||||
/** Log fatal
|
||||
* @param link active link
|
||||
* @param msg log message
|
||||
*/
|
||||
void log_fatal(uint8_t link, string msg);
|
||||
};
|
|
@ -22,9 +22,6 @@
|
|||
#include "router_cs.h"
|
||||
#include "ratatoskrUtils/utils/Structures.h"
|
||||
|
||||
typedef simple_initiator_socket_tagged<TlmRouter> rout_init_socket;
|
||||
typedef simple_target_socket_tagged<TlmRouter> rout_targ_socket;
|
||||
|
||||
TlmRouterCS::TlmRouterCS(sc_module_name name, uint8_t rout_pos[3],
|
||||
uint8_t max_pos[3]):
|
||||
TlmRouter(name, rout_pos, max_pos) {
|
||||
|
@ -34,23 +31,9 @@ TlmRouterCS::~TlmRouterCS(){
|
|||
}
|
||||
|
||||
void TlmRouterCS::initialize(){
|
||||
TlmRouter::initialize();
|
||||
cout<<"Inherited function called";
|
||||
for(int link=0; link<NUM_LINKS; link++){
|
||||
init_socket_cs[link] = new routcs_init_socket(("csnoc_"+router_name+
|
||||
"_"+to_string(link)+"_init").c_str());
|
||||
(*init_socket_cs[link]).register_nb_transport_bw(this,
|
||||
&TlmRouterCS::nb_transport_bw_cb, link);
|
||||
|
||||
target_socket_cs[link] = new routcs_targ_socket(("csnoc_"+router_name+
|
||||
"_"+to_string(link)+"_targ").c_str());
|
||||
(*target_socket_cs[link]).register_nb_transport_fw(this,
|
||||
&TlmRouterCS::nb_transport_fw_cb, link);
|
||||
|
||||
valid_links[link] = false;
|
||||
//resp_in_progress[link] = false;
|
||||
//nxt_resp_pend[link] = 0;
|
||||
nxt_send_data_pend[link] = 0;
|
||||
curr_req[link] = 0;
|
||||
//send_data_in_prog_dest[link] = Direction::invalid;
|
||||
credit_counter[link] = NUM_CREDITS_CS;
|
||||
auto_rout_map[link] = Direction::invalid;
|
||||
}
|
||||
|
@ -76,7 +59,7 @@ void TlmRouterCS::send_begin_req(int link, tlm_gp& trans, int dest_link){
|
|||
sc_time delay = sc_time(REQ_INIT_DELAY, UNITS_DELAY);
|
||||
|
||||
tlm_sync_enum status;
|
||||
status = (*init_socket_cs[dest_link])->nb_transport_fw(
|
||||
status = (*init_socket[dest_link])->nb_transport_fw(
|
||||
*new_trans, phase, delay);
|
||||
curr_req[dest_link] = new_trans;
|
||||
credit_counter[dest_link]--;
|
||||
|
@ -137,7 +120,7 @@ tlm_sync_enum TlmRouterCS::send_end_req(int link, tlm_gp& trans){
|
|||
// 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_cs[link])->nb_transport_bw(
|
||||
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");
|
||||
|
|
|
@ -43,18 +43,11 @@ DECLARE_EXTENDED_PHASE(CONF_ROUT_PHASE);
|
|||
|
||||
class TlmRouterCS : public TlmRouter{
|
||||
public:
|
||||
typedef simple_initiator_socket_tagged<TlmRouterCS> routcs_init_socket;
|
||||
typedef simple_target_socket_tagged<TlmRouterCS> routcs_targ_socket;
|
||||
|
||||
SC_HAS_PROCESS(TlmRouterCS);
|
||||
TlmRouterCS(sc_module_name name, uint8_t rout_pos[3],
|
||||
uint8_t max_pos[3]);
|
||||
~TlmRouterCS();
|
||||
|
||||
routcs_init_socket* init_socket_cs[NUM_LINKS];
|
||||
routcs_targ_socket* target_socket_cs[NUM_LINKS];
|
||||
|
||||
|
||||
/** Setter for auto_rout_map variable
|
||||
* @param link auto_router_map index
|
||||
* @param dir direction to route to
|
||||
|
@ -120,7 +113,7 @@ class TlmRouterCS : public TlmRouter{
|
|||
* @param delay TLM expected delay
|
||||
*/
|
||||
tlm_sync_enum nb_transport_bw_cb(int id, tlm_gp& trans,
|
||||
tlm_phase& phase, sc_time& delay);
|
||||
tlm_phase& phase, sc_time& delay) override;
|
||||
|
||||
/**
|
||||
* Callback target Payload Event Queue (PEQ)
|
||||
|
|
|
@ -1,86 +0,0 @@
|
|||
#include "router_utils.h"
|
||||
|
||||
namespace RouterUtils{
|
||||
tlm_gp* build_transaction(tlm_gp& trans, int dest_link){
|
||||
tlm::tlm_generic_payload* new_trans = m_mm.allocate();
|
||||
new_trans->acquire();
|
||||
new_trans->set_command(tlm::TLM_WRITE_COMMAND);
|
||||
new_trans->set_address(trans.get_address());
|
||||
new_trans->set_data_ptr(trans.get_data_ptr());
|
||||
new_trans->set_data_length(trans.get_data_length());
|
||||
new_trans->set_streaming_width(trans.get_streaming_width());
|
||||
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 = dest_link; // set direction of connected router
|
||||
ext->data_type = get_type_from_extension(trans);
|
||||
new_trans->set_extension(ext);
|
||||
|
||||
return new_trans;
|
||||
}
|
||||
|
||||
|
||||
void check_transaction(int link, tlm_gp& trans) {
|
||||
if(trans.is_response_error()) {
|
||||
char txt[100];
|
||||
sprintf(txt, "Transaction returned with error, response status = %s",
|
||||
trans.get_response_string().c_str());
|
||||
log_error(link, txt);
|
||||
}
|
||||
|
||||
// Log completed routing
|
||||
tlm_command cmd = trans.get_command();
|
||||
sc_dt::uint64 adr = trans.get_address();
|
||||
int* ptr = reinterpret_cast<int*>(trans.get_data_ptr());
|
||||
std::stringstream stream;
|
||||
stream << hex << adr << " check, cmd=" << (cmd ? 'W' : 'R')
|
||||
<< ", data=" << hex << *ptr;
|
||||
log_info(link, stream.str());
|
||||
// Allow the memory manager to free the transaction object
|
||||
trans.release();
|
||||
}
|
||||
|
||||
|
||||
int get_link_from_extension(tlm_gp& trans){
|
||||
link_extension* extension;
|
||||
trans.get_extension<link_extension>(extension);
|
||||
return extension->link;
|
||||
}
|
||||
|
||||
int get_type_from_extension(tlm_gp& trans){
|
||||
link_extension* extension;
|
||||
trans.get_extension<link_extension>(extension);
|
||||
return extension->data_type;
|
||||
}
|
||||
|
||||
bool 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);
|
||||
}
|
||||
|
||||
/******************* LOG FUNCTIONS ********************/
|
||||
void log_info(uint8_t link, string msg){
|
||||
string str_link = DIR::toString(link);
|
||||
SC_REPORT_INFO(R_LOG, (router_name+":"+str_link+":"+msg).c_str());
|
||||
}
|
||||
|
||||
void log_warn(uint8_t link, string msg){
|
||||
string str_link = DIR::toString(link);
|
||||
SC_REPORT_WARNING(R_LOG, (router_name+":"+str_link+":"+msg).c_str());
|
||||
}
|
||||
|
||||
void log_error(uint8_t link, string msg){
|
||||
string str_link = DIR::toString(link);
|
||||
SC_REPORT_ERROR(R_LOG, (router_name+":"+str_link+":"+msg).c_str());
|
||||
}
|
||||
|
||||
void log_fatal(uint8_t link, string msg){
|
||||
string str_link = DIR::toString(link);
|
||||
SC_REPORT_FATAL(R_LOG, (router_name+":"+str_link+":"+msg).c_str());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,132 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (C) 2024 Juan Neyra
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
******************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#ifndef SC_INCLUDE_DYNAMIC_PROCESSES
|
||||
#define SC_INCLUDE_DYNAMIC_PROCESSES
|
||||
#endif
|
||||
|
||||
#include <systemc>
|
||||
#include <string>
|
||||
#include "tlm.h"
|
||||
|
||||
#include "utils/memory_manager.h"
|
||||
#include "utils/configuration.h"
|
||||
#include "utils/utils.h"
|
||||
#include "utils/noc_logger.h"
|
||||
|
||||
using namespace sc_core;
|
||||
using namespace sc_dt;
|
||||
using namespace std;
|
||||
using namespace tlm;
|
||||
using namespace tlm_utils;
|
||||
|
||||
#define NUM_LINKS Direction::num_dirs
|
||||
|
||||
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;
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
||||
namespace RouterUtils{
|
||||
/**
|
||||
* Build the transaction tp send. Called by send flit
|
||||
*
|
||||
* @param trans TLM generic payload object
|
||||
* @param dest_link destination link to send the data to
|
||||
*
|
||||
* @return created transaction
|
||||
*/
|
||||
tlm_gp* build_transaction(tlm_gp& trans, int dest_link);
|
||||
|
||||
|
||||
/**
|
||||
* Checks transaction for errors, if no error found, log
|
||||
* transaction and release transaction object. Called when
|
||||
* transaction is completed
|
||||
*
|
||||
* @param link active link
|
||||
* @param trans TLM generic payload object
|
||||
*/
|
||||
void check_transaction(int link, tlm_gp& trans);
|
||||
|
||||
|
||||
/**
|
||||
* Get link from extension
|
||||
*
|
||||
* @param trans TLM generic payload object
|
||||
*/
|
||||
int get_link_from_extension(tlm_gp& trans);
|
||||
|
||||
/**
|
||||
* Get type from extension
|
||||
*
|
||||
* @param trans TLM generic payload object
|
||||
*/
|
||||
int get_type_from_extension(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);
|
||||
|
||||
/** Log info
|
||||
* @param link active link
|
||||
* @param msg log message
|
||||
*/
|
||||
void log_info(uint8_t link, string msg);
|
||||
|
||||
/** Log warning
|
||||
* @param link active link
|
||||
* @param msg log message
|
||||
*/
|
||||
void log_warn(uint8_t link, string msg);
|
||||
|
||||
/** Log error
|
||||
* @param link active link
|
||||
* @param msg log message
|
||||
*/
|
||||
void log_error(uint8_t link, string msg);
|
||||
|
||||
/** Log fatal
|
||||
* @param link active link
|
||||
* @param msg log message
|
||||
*/
|
||||
void log_fatal(uint8_t link, string msg);
|
||||
}
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include <systemc>
|
||||
#include "tlm.h"
|
||||
#include "string.h"
|
||||
|
||||
using namespace sc_dt;
|
||||
|
||||
|
@ -43,8 +44,11 @@ using namespace sc_dt;
|
|||
typedef tlm::tlm_generic_payload tlm_gp;
|
||||
|
||||
// for circuit switching noc
|
||||
#define NUM_ACC_LAYERS 2
|
||||
#define NUM_CREDITS_CS 1
|
||||
#define TYPE_PACKET 0
|
||||
#define TYPE_STREAM 1
|
||||
#define TYPE_INIT_STREAM 2
|
||||
#define TYPE_END_STREAM 3
|
||||
#define TYPE_ROUT_CONFIG 2
|
||||
|
||||
const std::string STR_TYPES[5] = {"packet", "stream", "init stream",
|
||||
"end stream", "acknowledge"};
|
||||
|
|
Loading…
Reference in a new issue