101 lines
No EOL
3.1 KiB
C++
Executable file
101 lines
No EOL
3.1 KiB
C++
Executable file
/*******************************************************************************
|
|
* 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.h"
|
|
#include "tlm.h"
|
|
|
|
#include "utils/GlobalResourcesCS.h"
|
|
#include "ratatoskrUtils/utils/Report.h"
|
|
#include "ratatoskrUtils/utils/Structures.h"
|
|
#include "ratatoskrUtils/traffic/TrafficPool.h"
|
|
|
|
#include "networkInterface/NetworkInterfaceTlm.h"
|
|
#include "noc/noc.h"
|
|
|
|
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);
|
|
|
|
private:
|
|
GlobalResourcesCS& globalResources = GlobalResourcesCS::getInstance();
|
|
Report& rep = Report::getInstance();
|
|
int dbid;
|
|
std::vector<std::unique_ptr<sc_clock>> clocks;
|
|
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;
|
|
uint8_t max_pos[3];
|
|
|
|
/**
|
|
* Create clocks for Ratatoskr PEs
|
|
*/
|
|
void createClocks();
|
|
|
|
/**
|
|
* Create the traffic pool with the tasks for PEs
|
|
*/
|
|
void createTrafficPool();
|
|
|
|
/**
|
|
* Create Network Participants (creates PE and NI, and
|
|
* connects them)
|
|
*/
|
|
void createNetworkParticipants();
|
|
|
|
/**
|
|
* Connects Network Interface to Routers in NoC
|
|
*/
|
|
void createLinks();
|
|
|
|
/**
|
|
* Connects all unbounded sockets in Network Interface
|
|
*/
|
|
void connectUnboundedNi();
|
|
|
|
/**
|
|
* Initialize routers and starts traffic pool
|
|
*/
|
|
void runNoC();
|
|
|
|
/** Log info
|
|
* @param msg log message
|
|
*/
|
|
void log_info(string msg);
|
|
}; |