commit 0a4bc1f94ec9c5a146d6187c0c5fb20e3c1613a0 Author: HelenClaraGeorge Date: Thu Jan 2 16:42:56 2025 +0100 The commit with initial architectural setup for SPACX diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e70fbfa --- /dev/null +++ b/Makefile @@ -0,0 +1,81 @@ +# Compiler and flags +CXX = g++ +CXXFLAGS = -std=c++17 -g -I/usr/local/systemc/include -I./src/GB -I./src/Interposer -I./utils +LDFLAGS = -L$(SYSTEMC_HOME)/lib-linux64 -lsystemc + +# Directories +SRC_DIR = src +GB_DIR = $(SRC_DIR)/GB +INTERPOSER_DIR = $(SRC_DIR)/Interposer +CHIPLET_DIR = $(SRC_DIR)/Chiplet +OEC_DIR = $(SRC_DIR)/Optical_Electrical +PE_DIR = $(SRC_DIR)/PE +UTILS_DIR = $(SRC_DIR)/utils +OBJ_DIR = obj +OUT_DIR = out +SCRIPTS_DIR = scripts + +# Source files +GB_SRC = $(GB_DIR)/Global_Buffer.cpp +INTERPOSER_SRC = $(INTERPOSER_DIR)/Interposer_Interface.cpp +CHIPLET_SRC = $(CHIPLET_DIR)/Chiplet_Interface.cpp +OEC_SRC = $(OEC_DIR)/O_E_converter.cpp +PE_SRC = $(PE_DIR)/Processing_Element.cpp +UTILS_SRC = $(UTILS_DIR)/noc_logger.cpp + +# Object files +OBJS = $(OBJ_DIR)/Global_Buffer.o $(OBJ_DIR)/Interposer_Interface.o $(OBJ_DIR)/Chiplet_Interface.o $(OBJ_DIR)/O_E_converter.o $(OBJ_DIR)/Processing_Element.o $(OBJ_DIR)/noc_logger.o $(OBJ_DIR)/main.o + +# Executable name +EXEC = $(OUT_DIR)/simulation + +# Default target +all: directories $(EXEC) + +# Create directories for object files and output if they do not exist +directories: + mkdir -p $(OBJ_DIR) $(OUT_DIR) + +# Rule to link the executable +$(EXEC): $(OBJS) + $(CXX) -o $@ $^ $(LDFLAGS) + +# Rule to compile Global_Buffer.cpp +$(OBJ_DIR)/Global_Buffer.o: $(GB_SRC) + $(CXX) $(CXXFLAGS) -c $< -o $@ + +# Rule to compile Interposer_Interface.cpp +$(OBJ_DIR)/Interposer_Interface.o: $(INTERPOSER_SRC) + $(CXX) $(CXXFLAGS) -c $< -o $@ + +# Rule to compile Chiplet_Interface.cpp +$(OBJ_DIR)/Chiplet_Interface.o: $(CHIPLET_SRC) + $(CXX) $(CXXFLAGS) -c $< -o $@ + +# Rule to compile O_E_Converter.cpp +$(OBJ_DIR)/O_E_converter.o: $(OEC_SRC) + $(CXX) $(CXXFLAGS) -c $< -o $@ + +# Rule to compile Processing_Element.cpp +$(OBJ_DIR)/Processing_Element.o: $(PE_SRC) + $(CXX) $(CXXFLAGS) -c $< -o $@ + +# Rule to compile noc_logger.cpp +$(OBJ_DIR)/noc_logger.o: $(UTILS_SRC) + $(CXX) $(CXXFLAGS) -c $< -o $@ + +# Rule to compile main.cpp +$(OBJ_DIR)/main.o: main.cpp + $(CXX) $(CXXFLAGS) -c $< -o $@ + +# Clean up object files and the executable +clean: + rm -rf $(OBJ_DIR) $(OUT_DIR) + +# Run the Python scripts to generate matrices before running the simulation +run: all + python3 $(SCRIPTS_DIR)/input_feature.py + python3 $(SCRIPTS_DIR)/weight_kernal.py + ./$(EXEC) + +.PHONY: all clean run directories diff --git a/README.md b/README.md new file mode 100644 index 0000000..d57b13d --- /dev/null +++ b/README.md @@ -0,0 +1,130 @@ +# SPACX hybrid Network on Chip (NoC) Simulation + +This project simulates the Optical plus Electrical Network on Chip (NoC) architecture SPACX using SystemC TLM 2.0 + +## Prerequisites + +- SystemC (version 2.3.3 or later) +- C++ compiler supporting C++17 or later (e.g., GCC 7+ or Clang 5+) +- Make + +## Setup + +1. Install SystemC on your system. +2. Set the `SYSTEMC_HOME` environment variable to point to your SystemC installation directory: + + ```bash + export SYSTEMC_HOME=/path/to/your/systemc/installation + +## Compilation +make + +## Output + ./out/simulation + + or + + make run + + +## Project directory structure + +SPACX +- src + - GB + - Global_Buffer.h + - Global_Buffer.cpp + - Interposer + - Interposer_Interface.h + - Interposer_Interface.cpp + - Chiplet + - Chiplet_Interface.h + - Chiplet_Interface.cpp + - Optical_Electrical + - O_E_converter.h + - O_E_converter.cpp + - PE + - Processing_Element.h + - Processing_Element.cpp +- Utils + - configuration.h + - noc_logger.h + - noc_logger.cpp + - token_manager.h +- scripts + - input_feature.py + - weight_kernal.py +- out +- obj +- main.cpp +- Makefile +- README.md + +# Log files + +The log files are in +- out/report.log : general communication like token transfer +- out/gb_comm.log : communication to and from global buffer +- out/interposer_comm.log : communication to and from interposer interface +- out/chiplet_comm.log : communication to and from chiplet interface +- out/oec_comm.log : communication to and from OEC +- out/pe_comm.log : communication to and from PE + +# SPACX initial implementation + +- The Global Buffer is initializing all the transactions +- In the beggining GB generates weights and input features as matrices and convert them to payloads +- The GB is connected to interposer interface to accept the payload through TLM blocking communication +- The address is the wavelegth, which is encoded into the payload and transmitted +- The interposer interface simply diverts the payload to chiplet interface again as TLM blocking communication +- The chiplet interface is connected to all PEs in a chiplet through the optical to electrical converter +- The chiplet interface copies the data to the curresponding OEC based on the address that is the wavelength +- Once the data is in the OEC, they are simply forwarding them to the PEs using the TLM blocking communication +- In PEs the data is stored into 2 fifos, the weight buffer and the buffer for input features +- The PE then multiplies it and gets the Psum stored into the accumulation buffer +- once the psum is ready, PE weights for the token, and then gives the data to the OEC +- OEC then transfers the data to the chiplet interface, and then to interposer interface in backward +- This way the Psums are back at global buffer through multiple TLM blocking transport + +# SPACX architecture and its operation + +1. SPACX Overview: +SPACX leverages photonic interconnects for efficient data communication in chiplet-based architectures, focusing on the needs of DNN inference, such as broadcast communication. It uses a hierarchical design: +• Global waveguide: Connects all chiplets. +• Local waveguide: Exists within each chiplet for intra-chiplet communication. +2. Key Components: +Chiplets and Processing Elements (PEs): +• Each chiplet has multiple PEs (e.g., 8 per chiplet in the example). +• PEs perform computations like Multiply-and-Accumulate (MAC) for DNN workloads. +• Each PE has: + o Two receivers for incoming broadcast data (local and global). + o One transmitter for sending computed results back to the global buffer (GB). +Wavelengths and Waveguides: +• Data transmission uses wavelength-division multiplexing (WDM). +• Wavelength allocation: + o Global (cross-chiplet) wavelengths: Used for broadcasting the same data to corresponding PEs across all chiplets. + o Local (single-chiplet) wavelengths: Used for intra-chiplet broadcasts and communication between chiplet PEs and the GB. +Optical Splitters and Filters: +• Optical splitters: Split light (data) across multiple destinations by controlling the split ratio. Used for broadcasts. +• Optical filters: Select or forward specific wavelengths for targeted communication. +3. Communication Mechanisms: +A. Cross-Chiplet Broadcast (Global Waveguide): +• Example: Data for PE0 across all chiplets is sent using wavelength λ0. +• Process: + o The GB modulates data onto λ0. + o Splitters in the global waveguide distribute power to each chiplet's local waveguide. + o Local waveguides deliver the data to PE0 on each chiplet. +B. Single-Chiplet Broadcast (Local Waveguide): +• Example: Data for all PEs within a single chiplet (e.g., Chiplet0) is sent using wavelength λ8. +• Process: + o The GB modulates data onto λ8. + o Optical filters direct all power of λ8 from the global waveguide to the local waveguide. + o Splitters on the local waveguide evenly distribute data to all PEs within Chiplet0. +C. PE-to-GB Communication: +• Each chiplet's PEs share a single wavelength for sending computed results back to the GB (e.g. λ8 for Chiplet0). +• Token-based arbitration ensures orderly transmission: + o A token is passed sequentially among PEs, granting transmission access to one PE at a time. + + + + diff --git a/input_features.txt b/input_features.txt new file mode 100644 index 0000000..5c73817 --- /dev/null +++ b/input_features.txt @@ -0,0 +1,29 @@ +55 37 +74 45 + +67 74 +90 52 + +12 12 +7 55 + +27 98 +70 39 + +38 24 +29 11 + +12 44 +36 70 + +65 39 +29 35 + +67 27 +42 81 + +24 91 +69 52 + +63 74 +77 24 diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..1287aaf --- /dev/null +++ b/main.cpp @@ -0,0 +1,90 @@ +#include +#include "src/GB/Global_Buffer.h" +#include "src/Interposer/Interposer_Interface.h" +#include "src/Chiplet/Chiplet_Interface.h" +#include "src/Optical_Electrical/O_E_converter.h" +#include "src/PE/Processing_Element.h" +#include "src/utils/configuration.h" // Make sure this file includes definitions for CHIPLET_NO +#include "src/utils/token_manager.h" +#include "src/utils/noc_logger.h" + +int sc_main(int argc, char* argv[]) { + // Define the number of chiplets and processing elements + const int num_chiplets = CHIPLET_NO; + const int num_pes = PE_PER_CHIPLET; + const int total_pes = PE_NO; + setup_logger(); + // Create the Global Buffer instance + GlobalBuffer gb("GlobalBuffer", num_chiplets, num_pes); + //gb.configure(CHIPLET_NO); + //std::cout << "Creating global buffer instances" << std::endl; + // Create an array of Interposer Interface instances + InterposerInterface* interposers[num_chiplets]; + ChipletInterface* chiplets[num_chiplets]; + O_E_converter* oec[num_chiplets][total_pes]; + ProcessingElement* pe[num_chiplets][total_pes]; + TokenManager* tokens[num_chiplets]; + + for (int i = 0; i < num_chiplets; ++i) { + //Dynamically Create each Interposer Interface instance + std::string name = "InterposerInterface_" + std::to_string(i); + interposers[i] = new InterposerInterface(name.c_str()); + //std::cout << "Creating interposer instances" << std::endl; + interposers[i] -> interposer_id = i; + //std::cout << "Before Connecting sockets" << std::endl; + // Bind the sockets of Global Buffer to those of the Interposer Interface + gb.features_from_GB_sockets[i].bind(interposers[i]->gb_features_receive_socket); + gb.weight_from_GB_sockets[i].bind(interposers[i]->gb_weight_receive_socket); + interposers[i]->gb_send_socket.bind(gb.receive_to_GB_sockets[i]); + //std::cout << "After Connecting sockets" << std::endl; + + std::string chip_name = "ChipletInterface_" + std::to_string(i); + chiplets[i] = new ChipletInterface(chip_name.c_str(), num_pes); + chiplets[i] -> chiplet_id = i; + // Bind chiplet sockets + interposers[i]->chiplet_features_send_socket.bind(chiplets[i]->interposer_features_receive_socket); + interposers[i]->chiplet_weight_send_socket.bind(chiplets[i]->interposer_weight_receive_socket); + chiplets[i]->interposer_send_socket.bind(interposers[i]->chiplet_receive_socket); + std::string token_name = "TokenManager_" + std::to_string(i); + tokens[i] = new TokenManager(token_name.c_str()); // Create a token for each chiplet + + for (int j = 0; j < num_pes; ++j) { + std::string oe_name = "O_E_converter_" + std::to_string(i) + "_" + std::to_string(j); + oec[i][j] = new O_E_converter(oe_name.c_str()); + oec[i][j] -> O_E_converter_id = j; + chiplets[i]->oec_features_send_sockets[j].bind(oec[i][j]->ci_features_receive_socket); + chiplets[i]->oec_weight_send_sockets[j].bind(oec[i][j]->ci_weight_receive_socket); + oec[i][j]->ci_send_socket.bind(chiplets[i]->oec_receive_sockets[j]); + + std::string pe_name = "ProcessingElement_" + std::to_string(i) + "_" + std::to_string(j); + pe[i][j] = new ProcessingElement(pe_name.c_str(), *tokens[i]); + oec[i][j]->pe_features_send_socket.bind(pe[i][j] ->oec_features_receive_socket); + oec[i][j]->pe_weight_send_socket.bind(pe[i][j] ->oec_weight_receive_socket); + pe[i][j] ->oec_send_socket.bind(oec[i][j] ->pe_receive_socket); + pe[i][j] ->pe_id = j; + pe[i][j] ->pe_chiplet_id = i; + //pe[i][j]->set_token_manager[i](&tok_mgr); + //std::cout << "Created modules and binded sockets" << std::endl; + } + } + + + + // Start the simulation + sc_core::sc_start(1500, SC_NS); + + // Clean up dynamically allocated Interposer Interfaces + for (int i = 0; i < num_chiplets; ++i) { + delete interposers[i]; + delete chiplets[i]; + delete tokens[i]; + for (int j = 0; j < num_pes; ++j) { + delete oec[i][j]; + delete pe[i][j]; + } + + } + + + return 0; +} \ No newline at end of file diff --git a/obj/Chiplet_Interface.o b/obj/Chiplet_Interface.o new file mode 100644 index 0000000..701bcc8 Binary files /dev/null and b/obj/Chiplet_Interface.o differ diff --git a/obj/Global_Buffer.o b/obj/Global_Buffer.o new file mode 100644 index 0000000..f93cfbc Binary files /dev/null and b/obj/Global_Buffer.o differ diff --git a/obj/Interposer_Interface.o b/obj/Interposer_Interface.o new file mode 100644 index 0000000..327cab1 Binary files /dev/null and b/obj/Interposer_Interface.o differ diff --git a/obj/O_E_converter.o b/obj/O_E_converter.o new file mode 100644 index 0000000..a5f9ea7 Binary files /dev/null and b/obj/O_E_converter.o differ diff --git a/obj/Processing_Element.o b/obj/Processing_Element.o new file mode 100644 index 0000000..65c8a0e Binary files /dev/null and b/obj/Processing_Element.o differ diff --git a/obj/main.o b/obj/main.o new file mode 100644 index 0000000..5e667ed Binary files /dev/null and b/obj/main.o differ diff --git a/obj/noc_logger.o b/obj/noc_logger.o new file mode 100644 index 0000000..bca82d1 Binary files /dev/null and b/obj/noc_logger.o differ diff --git a/out/chiplet_comm.log b/out/chiplet_comm.log new file mode 100644 index 0000000..a467176 --- /dev/null +++ b/out/chiplet_comm.log @@ -0,0 +1,120 @@ +0 s: INFO: ChipletInterface: 0 Received input feature: 3 with Wavelength: 4 +0 s: INFO: ChipletInterface: 0 Forwarding input features: 3 with Wavelength: 4 to Optical to Electrical Converter: 0 +0 s: INFO: ChipletInterface: 0 Forwarding input features: 3 with Wavelength: 4 to Optical to Electrical Converter: 1 +0 s: INFO: ChipletInterface: 0 Forwarding input features: 3 with Wavelength: 4 to Optical to Electrical Converter: 2 +0 s: INFO: ChipletInterface: 0 Forwarding input features: 3 with Wavelength: 4 to Optical to Electrical Converter: 3 +0 s: INFO: ChipletInterface: 0 Transaction of input feature 3 completed successfully from Chiplet Interface: 0 to OEC +0 s: INFO: ChipletInterface: 0 Received Weight Kernal: 3 with Wavelength: 0 +0 s: INFO: ChipletInterface: 0 Forwarding Weight Kernal: 3 with Wavelength: 0 to Optical to Electrical Converter +0 s: INFO: ChipletInterface: 0 Transaction of weight kernal3 completed successfully from Chiplet Interface: 0 to OEC +0 s: INFO: ChipletInterface: 1 Received Weight Kernal: 3 with Wavelength: 0 +0 s: INFO: ChipletInterface: 1 Forwarding Weight Kernal: 3 with Wavelength: 0 to Optical to Electrical Converter +0 s: INFO: ChipletInterface: 1 Transaction of weight kernal3 completed successfully from Chiplet Interface: 1 to OEC +0 s: INFO: ChipletInterface: 2 Received Weight Kernal: 3 with Wavelength: 0 +0 s: INFO: ChipletInterface: 2 Forwarding Weight Kernal: 3 with Wavelength: 0 to Optical to Electrical Converter +0 s: INFO: ChipletInterface: 2 Transaction of weight kernal3 completed successfully from Chiplet Interface: 2 to OEC +0 s: INFO: ChipletInterface: 3 Received Weight Kernal: 3 with Wavelength: 0 +0 s: INFO: ChipletInterface: 3 Forwarding Weight Kernal: 3 with Wavelength: 0 to Optical to Electrical Converter +0 s: INFO: ChipletInterface: 3 Transaction of weight kernal3 completed successfully from Chiplet Interface: 3 to OEC +0 s: INFO: ChipletInterface: 0 Chiplet Interface received PSUM from PE: 0 through OEC with data: 9 +0 s: INFO: ChipletInterface: 0 Forwarding the PSUM 9 from PE: 0 to Interposer interface: 0 +0 s: INFO: ChipletInterface: 0 PSUM Transaction: 9 completed successfully from Chiplet Interface: 0 to Interposer Interface +10 ns: INFO: ChipletInterface: 1 Received input feature: 72 with Wavelength: 5 +10 ns: INFO: ChipletInterface: 1 Forwarding input features: 72 with Wavelength: 5 to Optical to Electrical Converter: 0 +10 ns: INFO: ChipletInterface: 1 Forwarding input features: 72 with Wavelength: 5 to Optical to Electrical Converter: 1 +10 ns: INFO: ChipletInterface: 1 Forwarding input features: 72 with Wavelength: 5 to Optical to Electrical Converter: 2 +10 ns: INFO: ChipletInterface: 1 Forwarding input features: 72 with Wavelength: 5 to Optical to Electrical Converter: 3 +10 ns: INFO: ChipletInterface: 1 Transaction of input feature 72 completed successfully from Chiplet Interface: 1 to OEC +10 ns: INFO: ChipletInterface: 1 Chiplet Interface received PSUM from PE: 0 through OEC with data: 216 +10 ns: INFO: ChipletInterface: 1 Forwarding the PSUM 216 from PE: 0 to Interposer interface: 1 +10 ns: INFO: ChipletInterface: 1 PSUM Transaction: 216 completed successfully from Chiplet Interface: 1 to Interposer Interface +15 ns: INFO: ChipletInterface: 0 Received Weight Kernal: 90 with Wavelength: 1 +15 ns: INFO: ChipletInterface: 0 Forwarding Weight Kernal: 90 with Wavelength: 1 to Optical to Electrical Converter +15 ns: INFO: ChipletInterface: 0 Transaction of weight kernal90 completed successfully from Chiplet Interface: 0 to OEC +15 ns: INFO: ChipletInterface: 1 Received Weight Kernal: 90 with Wavelength: 1 +15 ns: INFO: ChipletInterface: 1 Forwarding Weight Kernal: 90 with Wavelength: 1 to Optical to Electrical Converter +15 ns: INFO: ChipletInterface: 1 Transaction of weight kernal90 completed successfully from Chiplet Interface: 1 to OEC +15 ns: INFO: ChipletInterface: 2 Received Weight Kernal: 90 with Wavelength: 1 +15 ns: INFO: ChipletInterface: 2 Forwarding Weight Kernal: 90 with Wavelength: 1 to Optical to Electrical Converter +15 ns: INFO: ChipletInterface: 2 Transaction of weight kernal90 completed successfully from Chiplet Interface: 2 to OEC +15 ns: INFO: ChipletInterface: 3 Received Weight Kernal: 90 with Wavelength: 1 +15 ns: INFO: ChipletInterface: 3 Forwarding Weight Kernal: 90 with Wavelength: 1 to Optical to Electrical Converter +15 ns: INFO: ChipletInterface: 3 Transaction of weight kernal90 completed successfully from Chiplet Interface: 3 to OEC +15 ns: INFO: ChipletInterface: 1 Chiplet Interface received PSUM from PE: 1 through OEC with data: 6480 +15 ns: INFO: ChipletInterface: 1 Forwarding the PSUM 6480 from PE: 1 to Interposer interface: 1 +15 ns: INFO: ChipletInterface: 1 PSUM Transaction: 6480 completed successfully from Chiplet Interface: 1 to Interposer Interface +15 ns: INFO: ChipletInterface: 0 Chiplet Interface received PSUM from PE: 1 through OEC with data: 270 +15 ns: INFO: ChipletInterface: 0 Forwarding the PSUM 270 from PE: 1 to Interposer interface: 0 +15 ns: INFO: ChipletInterface: 0 PSUM Transaction: 270 completed successfully from Chiplet Interface: 0 to Interposer Interface +20 ns: INFO: ChipletInterface: 2 Received input feature: 52 with Wavelength: 6 +20 ns: INFO: ChipletInterface: 2 Forwarding input features: 52 with Wavelength: 6 to Optical to Electrical Converter: 0 +20 ns: INFO: ChipletInterface: 2 Forwarding input features: 52 with Wavelength: 6 to Optical to Electrical Converter: 1 +20 ns: INFO: ChipletInterface: 2 Forwarding input features: 52 with Wavelength: 6 to Optical to Electrical Converter: 2 +20 ns: INFO: ChipletInterface: 2 Forwarding input features: 52 with Wavelength: 6 to Optical to Electrical Converter: 3 +20 ns: INFO: ChipletInterface: 2 Transaction of input feature 52 completed successfully from Chiplet Interface: 2 to OEC +20 ns: INFO: ChipletInterface: 2 Chiplet Interface received PSUM from PE: 0 through OEC with data: 156 +20 ns: INFO: ChipletInterface: 2 Forwarding the PSUM 156 from PE: 0 to Interposer interface: 2 +20 ns: INFO: ChipletInterface: 2 PSUM Transaction: 156 completed successfully from Chiplet Interface: 2 to Interposer Interface +20 ns: INFO: ChipletInterface: 2 Chiplet Interface received PSUM from PE: 1 through OEC with data: 4680 +20 ns: INFO: ChipletInterface: 2 Forwarding the PSUM 4680 from PE: 1 to Interposer interface: 2 +20 ns: INFO: ChipletInterface: 2 PSUM Transaction: 4680 completed successfully from Chiplet Interface: 2 to Interposer Interface +30 ns: INFO: ChipletInterface: 0 Received Weight Kernal: 35 with Wavelength: 2 +30 ns: INFO: ChipletInterface: 0 Forwarding Weight Kernal: 35 with Wavelength: 2 to Optical to Electrical Converter +30 ns: INFO: ChipletInterface: 0 Transaction of weight kernal35 completed successfully from Chiplet Interface: 0 to OEC +30 ns: INFO: ChipletInterface: 1 Received Weight Kernal: 35 with Wavelength: 2 +30 ns: INFO: ChipletInterface: 1 Forwarding Weight Kernal: 35 with Wavelength: 2 to Optical to Electrical Converter +30 ns: INFO: ChipletInterface: 1 Transaction of weight kernal35 completed successfully from Chiplet Interface: 1 to OEC +30 ns: INFO: ChipletInterface: 2 Received Weight Kernal: 35 with Wavelength: 2 +30 ns: INFO: ChipletInterface: 2 Forwarding Weight Kernal: 35 with Wavelength: 2 to Optical to Electrical Converter +30 ns: INFO: ChipletInterface: 2 Transaction of weight kernal35 completed successfully from Chiplet Interface: 2 to OEC +30 ns: INFO: ChipletInterface: 3 Received Weight Kernal: 35 with Wavelength: 2 +30 ns: INFO: ChipletInterface: 3 Forwarding Weight Kernal: 35 with Wavelength: 2 to Optical to Electrical Converter +30 ns: INFO: ChipletInterface: 3 Transaction of weight kernal35 completed successfully from Chiplet Interface: 3 to OEC +30 ns: INFO: ChipletInterface: 3 Received input feature: 13 with Wavelength: 7 +30 ns: INFO: ChipletInterface: 3 Forwarding input features: 13 with Wavelength: 7 to Optical to Electrical Converter: 0 +30 ns: INFO: ChipletInterface: 3 Forwarding input features: 13 with Wavelength: 7 to Optical to Electrical Converter: 1 +30 ns: INFO: ChipletInterface: 3 Forwarding input features: 13 with Wavelength: 7 to Optical to Electrical Converter: 2 +30 ns: INFO: ChipletInterface: 3 Forwarding input features: 13 with Wavelength: 7 to Optical to Electrical Converter: 3 +30 ns: INFO: ChipletInterface: 3 Transaction of input feature 13 completed successfully from Chiplet Interface: 3 to OEC +30 ns: INFO: ChipletInterface: 3 Chiplet Interface received PSUM from PE: 0 through OEC with data: 39 +30 ns: INFO: ChipletInterface: 3 Forwarding the PSUM 39 from PE: 0 to Interposer interface: 3 +30 ns: INFO: ChipletInterface: 3 PSUM Transaction: 39 completed successfully from Chiplet Interface: 3 to Interposer Interface +30 ns: INFO: ChipletInterface: 2 Chiplet Interface received PSUM from PE: 2 through OEC with data: 1820 +30 ns: INFO: ChipletInterface: 2 Forwarding the PSUM 1820 from PE: 2 to Interposer interface: 2 +30 ns: INFO: ChipletInterface: 2 PSUM Transaction: 1820 completed successfully from Chiplet Interface: 2 to Interposer Interface +30 ns: INFO: ChipletInterface: 1 Chiplet Interface received PSUM from PE: 2 through OEC with data: 2520 +30 ns: INFO: ChipletInterface: 1 Forwarding the PSUM 2520 from PE: 2 to Interposer interface: 1 +30 ns: INFO: ChipletInterface: 1 PSUM Transaction: 2520 completed successfully from Chiplet Interface: 1 to Interposer Interface +30 ns: INFO: ChipletInterface: 0 Chiplet Interface received PSUM from PE: 2 through OEC with data: 105 +30 ns: INFO: ChipletInterface: 0 Forwarding the PSUM 105 from PE: 2 to Interposer interface: 0 +30 ns: INFO: ChipletInterface: 0 PSUM Transaction: 105 completed successfully from Chiplet Interface: 0 to Interposer Interface +30 ns: INFO: ChipletInterface: 3 Chiplet Interface received PSUM from PE: 1 through OEC with data: 1170 +30 ns: INFO: ChipletInterface: 3 Forwarding the PSUM 1170 from PE: 1 to Interposer interface: 3 +30 ns: INFO: ChipletInterface: 3 PSUM Transaction: 1170 completed successfully from Chiplet Interface: 3 to Interposer Interface +30 ns: INFO: ChipletInterface: 3 Chiplet Interface received PSUM from PE: 2 through OEC with data: 455 +30 ns: INFO: ChipletInterface: 3 Forwarding the PSUM 455 from PE: 2 to Interposer interface: 3 +30 ns: INFO: ChipletInterface: 3 PSUM Transaction: 455 completed successfully from Chiplet Interface: 3 to Interposer Interface +45 ns: INFO: ChipletInterface: 0 Received Weight Kernal: 24 with Wavelength: 3 +45 ns: INFO: ChipletInterface: 0 Forwarding Weight Kernal: 24 with Wavelength: 3 to Optical to Electrical Converter +45 ns: INFO: ChipletInterface: 0 Transaction of weight kernal24 completed successfully from Chiplet Interface: 0 to OEC +45 ns: INFO: ChipletInterface: 1 Received Weight Kernal: 24 with Wavelength: 3 +45 ns: INFO: ChipletInterface: 1 Forwarding Weight Kernal: 24 with Wavelength: 3 to Optical to Electrical Converter +45 ns: INFO: ChipletInterface: 1 Transaction of weight kernal24 completed successfully from Chiplet Interface: 1 to OEC +45 ns: INFO: ChipletInterface: 2 Received Weight Kernal: 24 with Wavelength: 3 +45 ns: INFO: ChipletInterface: 2 Forwarding Weight Kernal: 24 with Wavelength: 3 to Optical to Electrical Converter +45 ns: INFO: ChipletInterface: 2 Transaction of weight kernal24 completed successfully from Chiplet Interface: 2 to OEC +45 ns: INFO: ChipletInterface: 3 Received Weight Kernal: 24 with Wavelength: 3 +45 ns: INFO: ChipletInterface: 3 Forwarding Weight Kernal: 24 with Wavelength: 3 to Optical to Electrical Converter +45 ns: INFO: ChipletInterface: 3 Transaction of weight kernal24 completed successfully from Chiplet Interface: 3 to OEC +45 ns: INFO: ChipletInterface: 3 Chiplet Interface received PSUM from PE: 3 through OEC with data: 312 +45 ns: INFO: ChipletInterface: 3 Forwarding the PSUM 312 from PE: 3 to Interposer interface: 3 +45 ns: INFO: ChipletInterface: 3 PSUM Transaction: 312 completed successfully from Chiplet Interface: 3 to Interposer Interface +45 ns: INFO: ChipletInterface: 2 Chiplet Interface received PSUM from PE: 3 through OEC with data: 1248 +45 ns: INFO: ChipletInterface: 2 Forwarding the PSUM 1248 from PE: 3 to Interposer interface: 2 +45 ns: INFO: ChipletInterface: 2 PSUM Transaction: 1248 completed successfully from Chiplet Interface: 2 to Interposer Interface +45 ns: INFO: ChipletInterface: 1 Chiplet Interface received PSUM from PE: 3 through OEC with data: 1728 +45 ns: INFO: ChipletInterface: 1 Forwarding the PSUM 1728 from PE: 3 to Interposer interface: 1 +45 ns: INFO: ChipletInterface: 1 PSUM Transaction: 1728 completed successfully from Chiplet Interface: 1 to Interposer Interface +45 ns: INFO: ChipletInterface: 0 Chiplet Interface received PSUM from PE: 3 through OEC with data: 72 +45 ns: INFO: ChipletInterface: 0 Forwarding the PSUM 72 from PE: 3 to Interposer interface: 0 +45 ns: INFO: ChipletInterface: 0 PSUM Transaction: 72 completed successfully from Chiplet Interface: 0 to Interposer Interface diff --git a/out/gb_comm.log b/out/gb_comm.log new file mode 100644 index 0000000..389c26a --- /dev/null +++ b/out/gb_comm.log @@ -0,0 +1,88 @@ +0 s: INFO: GlobalBuffer: Generated input feature: 3 +0 s: INFO: GlobalBuffer: Transmitting Input Features: 3 +0 s: INFO: GlobalBuffer: Transaction of input feature 3 completed successfully from Global Buffer to Interpoaser Interface +0 s: INFO: GlobalBuffer: Generated Weight kernal: 3 +0 s: INFO: GlobalBuffer: Transmitting weight kernals: 3 to interposer Interface 0 +0 s: INFO: GlobalBuffer: Transaction of Weight Kernal 3 completed successfully from Global Buffer: to Interpoaser Interface +0 s: INFO: GlobalBuffer: Transmitting weight kernals: 3 to interposer Interface 1 +0 s: INFO: GlobalBuffer: Transaction of Weight Kernal 3 completed successfully from Global Buffer: to Interpoaser Interface +0 s: INFO: GlobalBuffer: Transmitting weight kernals: 3 to interposer Interface 2 +0 s: INFO: GlobalBuffer: Transaction of Weight Kernal 3 completed successfully from Global Buffer: to Interpoaser Interface +0 s: INFO: GlobalBuffer: Transmitting weight kernals: 3 to interposer Interface 3 +0 s: INFO: GlobalBuffer: Transaction of Weight Kernal 3 completed successfully from Global Buffer: to Interpoaser Interface +0 s: INFO: GlobalBuffer: Received transaction from PE: 0 from chiplet: 0 through Interposer Interface with PSUM: 9 +0 s: INFO: GlobalBuffer: Updated credit_matrix[0][0] = 1 +10 ns: INFO: GlobalBuffer: Generated input feature: 72 +10 ns: INFO: GlobalBuffer: Transmitting Input Features: 72 +10 ns: INFO: GlobalBuffer: Transaction of input feature 72 completed successfully from Global Buffer to Interpoaser Interface +10 ns: INFO: GlobalBuffer: Received transaction from PE: 0 from chiplet: 1 through Interposer Interface with PSUM: 216 +10 ns: INFO: GlobalBuffer: Updated credit_matrix[1][0] = 1 +15 ns: INFO: GlobalBuffer: Generated Weight kernal: 90 +15 ns: INFO: GlobalBuffer: Transmitting weight kernals: 90 to interposer Interface 0 +15 ns: INFO: GlobalBuffer: Transaction of Weight Kernal 90 completed successfully from Global Buffer: to Interpoaser Interface +15 ns: INFO: GlobalBuffer: Transmitting weight kernals: 90 to interposer Interface 1 +15 ns: INFO: GlobalBuffer: Transaction of Weight Kernal 90 completed successfully from Global Buffer: to Interpoaser Interface +15 ns: INFO: GlobalBuffer: Transmitting weight kernals: 90 to interposer Interface 2 +15 ns: INFO: GlobalBuffer: Transaction of Weight Kernal 90 completed successfully from Global Buffer: to Interpoaser Interface +15 ns: INFO: GlobalBuffer: Transmitting weight kernals: 90 to interposer Interface 3 +15 ns: INFO: GlobalBuffer: Transaction of Weight Kernal 90 completed successfully from Global Buffer: to Interpoaser Interface +15 ns: INFO: GlobalBuffer: Received transaction from PE: 1 from chiplet: 1 through Interposer Interface with PSUM: 6480 +15 ns: INFO: GlobalBuffer: Updated credit_matrix[1][1] = 1 +15 ns: INFO: GlobalBuffer: Received transaction from PE: 1 from chiplet: 0 through Interposer Interface with PSUM: 270 +15 ns: INFO: GlobalBuffer: Updated credit_matrix[0][1] = 1 +20 ns: INFO: GlobalBuffer: Generated input feature: 52 +20 ns: INFO: GlobalBuffer: Transmitting Input Features: 52 +20 ns: INFO: GlobalBuffer: Transaction of input feature 52 completed successfully from Global Buffer to Interpoaser Interface +20 ns: INFO: GlobalBuffer: Received transaction from PE: 0 from chiplet: 2 through Interposer Interface with PSUM: 156 +20 ns: INFO: GlobalBuffer: Updated credit_matrix[2][0] = 1 +20 ns: INFO: GlobalBuffer: Received transaction from PE: 1 from chiplet: 2 through Interposer Interface with PSUM: 4680 +20 ns: INFO: GlobalBuffer: Updated credit_matrix[2][1] = 1 +30 ns: INFO: GlobalBuffer: Generated Weight kernal: 35 +30 ns: INFO: GlobalBuffer: Transmitting weight kernals: 35 to interposer Interface 0 +30 ns: INFO: GlobalBuffer: Transaction of Weight Kernal 35 completed successfully from Global Buffer: to Interpoaser Interface +30 ns: INFO: GlobalBuffer: Transmitting weight kernals: 35 to interposer Interface 1 +30 ns: INFO: GlobalBuffer: Transaction of Weight Kernal 35 completed successfully from Global Buffer: to Interpoaser Interface +30 ns: INFO: GlobalBuffer: Transmitting weight kernals: 35 to interposer Interface 2 +30 ns: INFO: GlobalBuffer: Transaction of Weight Kernal 35 completed successfully from Global Buffer: to Interpoaser Interface +30 ns: INFO: GlobalBuffer: Transmitting weight kernals: 35 to interposer Interface 3 +30 ns: INFO: GlobalBuffer: Transaction of Weight Kernal 35 completed successfully from Global Buffer: to Interpoaser Interface +30 ns: INFO: GlobalBuffer: Generated input feature: 13 +30 ns: INFO: GlobalBuffer: Transmitting Input Features: 13 +30 ns: INFO: GlobalBuffer: Transaction of input feature 13 completed successfully from Global Buffer to Interpoaser Interface +30 ns: INFO: GlobalBuffer: Received transaction from PE: 0 from chiplet: 3 through Interposer Interface with PSUM: 39 +30 ns: INFO: GlobalBuffer: Updated credit_matrix[3][0] = 1 +30 ns: INFO: GlobalBuffer: Incremented weight_counter[0] = 17 +30 ns: INFO: GlobalBuffer: Received transaction from PE: 2 from chiplet: 2 through Interposer Interface with PSUM: 1820 +30 ns: INFO: GlobalBuffer: Updated credit_matrix[2][2] = 1 +30 ns: INFO: GlobalBuffer: Received transaction from PE: 2 from chiplet: 1 through Interposer Interface with PSUM: 2520 +30 ns: INFO: GlobalBuffer: Updated credit_matrix[1][2] = 1 +30 ns: INFO: GlobalBuffer: Received transaction from PE: 2 from chiplet: 0 through Interposer Interface with PSUM: 105 +30 ns: INFO: GlobalBuffer: Updated credit_matrix[0][2] = 1 +30 ns: INFO: GlobalBuffer: Received transaction from PE: 1 from chiplet: 3 through Interposer Interface with PSUM: 1170 +30 ns: INFO: GlobalBuffer: Updated credit_matrix[3][1] = 1 +30 ns: INFO: GlobalBuffer: Incremented weight_counter[1] = 17 +30 ns: INFO: GlobalBuffer: Received transaction from PE: 2 from chiplet: 3 through Interposer Interface with PSUM: 455 +30 ns: INFO: GlobalBuffer: Updated credit_matrix[3][2] = 1 +30 ns: INFO: GlobalBuffer: Incremented weight_counter[2] = 17 +45 ns: INFO: GlobalBuffer: Generated Weight kernal: 24 +45 ns: INFO: GlobalBuffer: Transmitting weight kernals: 24 to interposer Interface 0 +45 ns: INFO: GlobalBuffer: Transaction of Weight Kernal 24 completed successfully from Global Buffer: to Interpoaser Interface +45 ns: INFO: GlobalBuffer: Transmitting weight kernals: 24 to interposer Interface 1 +45 ns: INFO: GlobalBuffer: Transaction of Weight Kernal 24 completed successfully from Global Buffer: to Interpoaser Interface +45 ns: INFO: GlobalBuffer: Transmitting weight kernals: 24 to interposer Interface 2 +45 ns: INFO: GlobalBuffer: Transaction of Weight Kernal 24 completed successfully from Global Buffer: to Interpoaser Interface +45 ns: INFO: GlobalBuffer: Transmitting weight kernals: 24 to interposer Interface 3 +45 ns: INFO: GlobalBuffer: Transaction of Weight Kernal 24 completed successfully from Global Buffer: to Interpoaser Interface +45 ns: INFO: GlobalBuffer: Received transaction from PE: 3 from chiplet: 3 through Interposer Interface with PSUM: 312 +45 ns: INFO: GlobalBuffer: Updated credit_matrix[3][3] = 1 +45 ns: INFO: GlobalBuffer: Incremented feature_counter[3] = 20 +45 ns: INFO: GlobalBuffer: Received transaction from PE: 3 from chiplet: 2 through Interposer Interface with PSUM: 1248 +45 ns: INFO: GlobalBuffer: Updated credit_matrix[2][3] = 1 +45 ns: INFO: GlobalBuffer: Incremented feature_counter[2] = 20 +45 ns: INFO: GlobalBuffer: Received transaction from PE: 3 from chiplet: 1 through Interposer Interface with PSUM: 1728 +45 ns: INFO: GlobalBuffer: Updated credit_matrix[1][3] = 1 +45 ns: INFO: GlobalBuffer: Incremented feature_counter[1] = 20 +45 ns: INFO: GlobalBuffer: Received transaction from PE: 3 from chiplet: 0 through Interposer Interface with PSUM: 72 +45 ns: INFO: GlobalBuffer: Updated credit_matrix[0][3] = 1 +45 ns: INFO: GlobalBuffer: Incremented weight_counter[3] = 17 +45 ns: INFO: GlobalBuffer: Incremented feature_counter[0] = 20 diff --git a/out/interposer_comm.log b/out/interposer_comm.log new file mode 100644 index 0000000..bda24b9 --- /dev/null +++ b/out/interposer_comm.log @@ -0,0 +1,124 @@ +0 s: INFO: InterposerInterface: 0 Received input feature: 3 with Wavelength: 4 +0 s: INFO: InterposerInterface: 0 Forwarding input features: 3 with Wavelength: 4 to chiplet interface +0 s: INFO: InterposerInterface: 0 Transaction of input feature 3 completed successfully from Interposer Interface: 0 to Chiplet Interface +0 s: INFO: InterposerInterface: 0 Received cross-chiplet data: 3 with Wavelength: 0 +0 s: INFO: InterposerInterface: 0 Splitting data for PE: 0 to chiplet:0 +0 s: INFO: InterposerInterface: 0 Forwarding weight kernals: 3 with Wavelength: 0 to chiplet interface +0 s: INFO: InterposerInterface: 0 Transaction of weight kernal 3 completed successfully from Interposer Interface: 0 to Chiplet Interface +0 s: INFO: InterposerInterface: 1 Received cross-chiplet data: 3 with Wavelength: 0 +0 s: INFO: InterposerInterface: 1 Splitting data for PE: 0 to chiplet:1 +0 s: INFO: InterposerInterface: 1 Forwarding weight kernals: 3 with Wavelength: 0 to chiplet interface +0 s: INFO: InterposerInterface: 1 Transaction of weight kernal 3 completed successfully from Interposer Interface: 1 to Chiplet Interface +0 s: INFO: InterposerInterface: 2 Received cross-chiplet data: 3 with Wavelength: 0 +0 s: INFO: InterposerInterface: 2 Splitting data for PE: 0 to chiplet:2 +0 s: INFO: InterposerInterface: 2 Forwarding weight kernals: 3 with Wavelength: 0 to chiplet interface +0 s: INFO: InterposerInterface: 2 Transaction of weight kernal 3 completed successfully from Interposer Interface: 2 to Chiplet Interface +0 s: INFO: InterposerInterface: 3 Received cross-chiplet data: 3 with Wavelength: 0 +0 s: INFO: InterposerInterface: 3 Splitting data for PE: 0 to chiplet:3 +0 s: INFO: InterposerInterface: 3 Forwarding weight kernals: 3 with Wavelength: 0 to chiplet interface +0 s: INFO: InterposerInterface: 3 Transaction of weight kernal 3 completed successfully from Interposer Interface: 3 to Chiplet Interface +0 s: INFO: InterposerInterface: 0 received PSUM from PE: 0 through OEC with data: 9 +0 s: INFO: InterposerInterface: 0 Forwarding the PSUMs from PE: 0 to Global Buffer +0 s: INFO: InterposerInterface: 0 Transaction of PSUM 9 completed successfully from Interposer Interface: 0 to Global Buffer +10 ns: INFO: InterposerInterface: 1 Received input feature: 72 with Wavelength: 5 +10 ns: INFO: InterposerInterface: 1 Forwarding input features: 72 with Wavelength: 5 to chiplet interface +10 ns: INFO: InterposerInterface: 1 Transaction of input feature 72 completed successfully from Interposer Interface: 1 to Chiplet Interface +10 ns: INFO: InterposerInterface: 1 received PSUM from PE: 0 through OEC with data: 216 +10 ns: INFO: InterposerInterface: 1 Forwarding the PSUMs from PE: 0 to Global Buffer +10 ns: INFO: InterposerInterface: 1 Transaction of PSUM 216 completed successfully from Interposer Interface: 1 to Global Buffer +15 ns: INFO: InterposerInterface: 0 Received cross-chiplet data: 90 with Wavelength: 1 +15 ns: INFO: InterposerInterface: 0 Splitting data for PE: 1 to chiplet:0 +15 ns: INFO: InterposerInterface: 0 Forwarding weight kernals: 90 with Wavelength: 1 to chiplet interface +15 ns: INFO: InterposerInterface: 0 Transaction of weight kernal 90 completed successfully from Interposer Interface: 0 to Chiplet Interface +15 ns: INFO: InterposerInterface: 1 Received cross-chiplet data: 90 with Wavelength: 1 +15 ns: INFO: InterposerInterface: 1 Splitting data for PE: 1 to chiplet:1 +15 ns: INFO: InterposerInterface: 1 Forwarding weight kernals: 90 with Wavelength: 1 to chiplet interface +15 ns: INFO: InterposerInterface: 1 Transaction of weight kernal 90 completed successfully from Interposer Interface: 1 to Chiplet Interface +15 ns: INFO: InterposerInterface: 2 Received cross-chiplet data: 90 with Wavelength: 1 +15 ns: INFO: InterposerInterface: 2 Splitting data for PE: 1 to chiplet:2 +15 ns: INFO: InterposerInterface: 2 Forwarding weight kernals: 90 with Wavelength: 1 to chiplet interface +15 ns: INFO: InterposerInterface: 2 Transaction of weight kernal 90 completed successfully from Interposer Interface: 2 to Chiplet Interface +15 ns: INFO: InterposerInterface: 3 Received cross-chiplet data: 90 with Wavelength: 1 +15 ns: INFO: InterposerInterface: 3 Splitting data for PE: 1 to chiplet:3 +15 ns: INFO: InterposerInterface: 3 Forwarding weight kernals: 90 with Wavelength: 1 to chiplet interface +15 ns: INFO: InterposerInterface: 3 Transaction of weight kernal 90 completed successfully from Interposer Interface: 3 to Chiplet Interface +15 ns: INFO: InterposerInterface: 1 received PSUM from PE: 1 through OEC with data: 6480 +15 ns: INFO: InterposerInterface: 1 Forwarding the PSUMs from PE: 1 to Global Buffer +15 ns: INFO: InterposerInterface: 1 Transaction of PSUM 6480 completed successfully from Interposer Interface: 1 to Global Buffer +15 ns: INFO: InterposerInterface: 0 received PSUM from PE: 1 through OEC with data: 270 +15 ns: INFO: InterposerInterface: 0 Forwarding the PSUMs from PE: 1 to Global Buffer +15 ns: INFO: InterposerInterface: 0 Transaction of PSUM 270 completed successfully from Interposer Interface: 0 to Global Buffer +20 ns: INFO: InterposerInterface: 2 Received input feature: 52 with Wavelength: 6 +20 ns: INFO: InterposerInterface: 2 Forwarding input features: 52 with Wavelength: 6 to chiplet interface +20 ns: INFO: InterposerInterface: 2 Transaction of input feature 52 completed successfully from Interposer Interface: 2 to Chiplet Interface +20 ns: INFO: InterposerInterface: 2 received PSUM from PE: 0 through OEC with data: 156 +20 ns: INFO: InterposerInterface: 2 Forwarding the PSUMs from PE: 0 to Global Buffer +20 ns: INFO: InterposerInterface: 2 Transaction of PSUM 156 completed successfully from Interposer Interface: 2 to Global Buffer +20 ns: INFO: InterposerInterface: 2 received PSUM from PE: 1 through OEC with data: 4680 +20 ns: INFO: InterposerInterface: 2 Forwarding the PSUMs from PE: 1 to Global Buffer +20 ns: INFO: InterposerInterface: 2 Transaction of PSUM 4680 completed successfully from Interposer Interface: 2 to Global Buffer +30 ns: INFO: InterposerInterface: 0 Received cross-chiplet data: 35 with Wavelength: 2 +30 ns: INFO: InterposerInterface: 0 Splitting data for PE: 2 to chiplet:0 +30 ns: INFO: InterposerInterface: 0 Forwarding weight kernals: 35 with Wavelength: 2 to chiplet interface +30 ns: INFO: InterposerInterface: 0 Transaction of weight kernal 35 completed successfully from Interposer Interface: 0 to Chiplet Interface +30 ns: INFO: InterposerInterface: 1 Received cross-chiplet data: 35 with Wavelength: 2 +30 ns: INFO: InterposerInterface: 1 Splitting data for PE: 2 to chiplet:1 +30 ns: INFO: InterposerInterface: 1 Forwarding weight kernals: 35 with Wavelength: 2 to chiplet interface +30 ns: INFO: InterposerInterface: 1 Transaction of weight kernal 35 completed successfully from Interposer Interface: 1 to Chiplet Interface +30 ns: INFO: InterposerInterface: 2 Received cross-chiplet data: 35 with Wavelength: 2 +30 ns: INFO: InterposerInterface: 2 Splitting data for PE: 2 to chiplet:2 +30 ns: INFO: InterposerInterface: 2 Forwarding weight kernals: 35 with Wavelength: 2 to chiplet interface +30 ns: INFO: InterposerInterface: 2 Transaction of weight kernal 35 completed successfully from Interposer Interface: 2 to Chiplet Interface +30 ns: INFO: InterposerInterface: 3 Received cross-chiplet data: 35 with Wavelength: 2 +30 ns: INFO: InterposerInterface: 3 Splitting data for PE: 2 to chiplet:3 +30 ns: INFO: InterposerInterface: 3 Forwarding weight kernals: 35 with Wavelength: 2 to chiplet interface +30 ns: INFO: InterposerInterface: 3 Transaction of weight kernal 35 completed successfully from Interposer Interface: 3 to Chiplet Interface +30 ns: INFO: InterposerInterface: 3 Received input feature: 13 with Wavelength: 7 +30 ns: INFO: InterposerInterface: 3 Forwarding input features: 13 with Wavelength: 7 to chiplet interface +30 ns: INFO: InterposerInterface: 3 Transaction of input feature 13 completed successfully from Interposer Interface: 3 to Chiplet Interface +30 ns: INFO: InterposerInterface: 3 received PSUM from PE: 0 through OEC with data: 39 +30 ns: INFO: InterposerInterface: 3 Forwarding the PSUMs from PE: 0 to Global Buffer +30 ns: INFO: InterposerInterface: 3 Transaction of PSUM 39 completed successfully from Interposer Interface: 3 to Global Buffer +30 ns: INFO: InterposerInterface: 2 received PSUM from PE: 2 through OEC with data: 1820 +30 ns: INFO: InterposerInterface: 2 Forwarding the PSUMs from PE: 2 to Global Buffer +30 ns: INFO: InterposerInterface: 2 Transaction of PSUM 1820 completed successfully from Interposer Interface: 2 to Global Buffer +30 ns: INFO: InterposerInterface: 1 received PSUM from PE: 2 through OEC with data: 2520 +30 ns: INFO: InterposerInterface: 1 Forwarding the PSUMs from PE: 2 to Global Buffer +30 ns: INFO: InterposerInterface: 1 Transaction of PSUM 2520 completed successfully from Interposer Interface: 1 to Global Buffer +30 ns: INFO: InterposerInterface: 0 received PSUM from PE: 2 through OEC with data: 105 +30 ns: INFO: InterposerInterface: 0 Forwarding the PSUMs from PE: 2 to Global Buffer +30 ns: INFO: InterposerInterface: 0 Transaction of PSUM 105 completed successfully from Interposer Interface: 0 to Global Buffer +30 ns: INFO: InterposerInterface: 3 received PSUM from PE: 1 through OEC with data: 1170 +30 ns: INFO: InterposerInterface: 3 Forwarding the PSUMs from PE: 1 to Global Buffer +30 ns: INFO: InterposerInterface: 3 Transaction of PSUM 1170 completed successfully from Interposer Interface: 3 to Global Buffer +30 ns: INFO: InterposerInterface: 3 received PSUM from PE: 2 through OEC with data: 455 +30 ns: INFO: InterposerInterface: 3 Forwarding the PSUMs from PE: 2 to Global Buffer +30 ns: INFO: InterposerInterface: 3 Transaction of PSUM 455 completed successfully from Interposer Interface: 3 to Global Buffer +45 ns: INFO: InterposerInterface: 0 Received cross-chiplet data: 24 with Wavelength: 3 +45 ns: INFO: InterposerInterface: 0 Splitting data for PE: 3 to chiplet:0 +45 ns: INFO: InterposerInterface: 0 Forwarding weight kernals: 24 with Wavelength: 3 to chiplet interface +45 ns: INFO: InterposerInterface: 0 Transaction of weight kernal 24 completed successfully from Interposer Interface: 0 to Chiplet Interface +45 ns: INFO: InterposerInterface: 1 Received cross-chiplet data: 24 with Wavelength: 3 +45 ns: INFO: InterposerInterface: 1 Splitting data for PE: 3 to chiplet:1 +45 ns: INFO: InterposerInterface: 1 Forwarding weight kernals: 24 with Wavelength: 3 to chiplet interface +45 ns: INFO: InterposerInterface: 1 Transaction of weight kernal 24 completed successfully from Interposer Interface: 1 to Chiplet Interface +45 ns: INFO: InterposerInterface: 2 Received cross-chiplet data: 24 with Wavelength: 3 +45 ns: INFO: InterposerInterface: 2 Splitting data for PE: 3 to chiplet:2 +45 ns: INFO: InterposerInterface: 2 Forwarding weight kernals: 24 with Wavelength: 3 to chiplet interface +45 ns: INFO: InterposerInterface: 2 Transaction of weight kernal 24 completed successfully from Interposer Interface: 2 to Chiplet Interface +45 ns: INFO: InterposerInterface: 3 Received cross-chiplet data: 24 with Wavelength: 3 +45 ns: INFO: InterposerInterface: 3 Splitting data for PE: 3 to chiplet:3 +45 ns: INFO: InterposerInterface: 3 Forwarding weight kernals: 24 with Wavelength: 3 to chiplet interface +45 ns: INFO: InterposerInterface: 3 Transaction of weight kernal 24 completed successfully from Interposer Interface: 3 to Chiplet Interface +45 ns: INFO: InterposerInterface: 3 received PSUM from PE: 3 through OEC with data: 312 +45 ns: INFO: InterposerInterface: 3 Forwarding the PSUMs from PE: 3 to Global Buffer +45 ns: INFO: InterposerInterface: 3 Transaction of PSUM 312 completed successfully from Interposer Interface: 3 to Global Buffer +45 ns: INFO: InterposerInterface: 2 received PSUM from PE: 3 through OEC with data: 1248 +45 ns: INFO: InterposerInterface: 2 Forwarding the PSUMs from PE: 3 to Global Buffer +45 ns: INFO: InterposerInterface: 2 Transaction of PSUM 1248 completed successfully from Interposer Interface: 2 to Global Buffer +45 ns: INFO: InterposerInterface: 1 received PSUM from PE: 3 through OEC with data: 1728 +45 ns: INFO: InterposerInterface: 1 Forwarding the PSUMs from PE: 3 to Global Buffer +45 ns: INFO: InterposerInterface: 1 Transaction of PSUM 1728 completed successfully from Interposer Interface: 1 to Global Buffer +45 ns: INFO: InterposerInterface: 0 received PSUM from PE: 3 through OEC with data: 72 +45 ns: INFO: InterposerInterface: 0 Forwarding the PSUMs from PE: 3 to Global Buffer +45 ns: INFO: InterposerInterface: 0 Transaction of PSUM 72 completed successfully from Interposer Interface: 0 to Global Buffer diff --git a/out/oec_comm.log b/out/oec_comm.log new file mode 100644 index 0000000..5c498dd --- /dev/null +++ b/out/oec_comm.log @@ -0,0 +1,144 @@ +0 s: INFO: OpticalToElectrical: 0 Received input feature: 3 with Wavelength: 4 +0 s: INFO: OpticalToElectrical: 0 Forwarding input features: 3 with Wavelength: 4 to Processing Element +0 s: INFO: OpticalToElectrical: 0 Transaction completed successfully from OEC: 0 to Processing Element +0 s: INFO: OpticalToElectrical: 1 Received input feature: 3 with Wavelength: 4 +0 s: INFO: OpticalToElectrical: 1 Forwarding input features: 3 with Wavelength: 4 to Processing Element +0 s: INFO: OpticalToElectrical: 1 Transaction completed successfully from OEC: 1 to Processing Element +0 s: INFO: OpticalToElectrical: 2 Received input feature: 3 with Wavelength: 4 +0 s: INFO: OpticalToElectrical: 2 Forwarding input features: 3 with Wavelength: 4 to Processing Element +0 s: INFO: OpticalToElectrical: 2 Transaction completed successfully from OEC: 2 to Processing Element +0 s: INFO: OpticalToElectrical: 3 Received input feature: 3 with Wavelength: 4 +0 s: INFO: OpticalToElectrical: 3 Forwarding input features: 3 with Wavelength: 4 to Processing Element +0 s: INFO: OpticalToElectrical: 3 Transaction completed successfully from OEC: 3 to Processing Element +0 s: INFO: OpticalToElectrical: 0 Received cross-chiplet data: 3 with Wavelength: 0 +0 s: INFO: OpticalToElectrical: 0 Forwarding weight kernals: 3 with Wavelength: 0 to Processing Element +0 s: INFO: OpticalToElectrical: 0 Transaction completed successfully from OEC: 0 to Processing Element +0 s: INFO: OpticalToElectrical: 0 Received cross-chiplet data: 3 with Wavelength: 0 +0 s: INFO: OpticalToElectrical: 0 Forwarding weight kernals: 3 with Wavelength: 0 to Processing Element +0 s: INFO: OpticalToElectrical: 0 Transaction completed successfully from OEC: 0 to Processing Element +0 s: INFO: OpticalToElectrical: 0 Received cross-chiplet data: 3 with Wavelength: 0 +0 s: INFO: OpticalToElectrical: 0 Forwarding weight kernals: 3 with Wavelength: 0 to Processing Element +0 s: INFO: OpticalToElectrical: 0 Transaction completed successfully from OEC: 0 to Processing Element +0 s: INFO: OpticalToElectrical: 0 Received cross-chiplet data: 3 with Wavelength: 0 +0 s: INFO: OpticalToElectrical: 0 Forwarding weight kernals: 3 with Wavelength: 0 to Processing Element +0 s: INFO: OpticalToElectrical: 0 Transaction completed successfully from OEC: 0 to Processing Element +0 s: INFO: OpticalToElectrical: 0 Optical to Electrical converter received PSUM from PE: 0 with data: 9 +0 s: INFO: OpticalToElectrical: 0 Forwarding the PSUMs from PE: 0 to chiplet interface: 0 +0 s: INFO: OpticalToElectrical: 0 PSUM Transaction completed successfully from OEC: 0 to Chiplet Interface +10 ns: INFO: OpticalToElectrical: 0 Received input feature: 72 with Wavelength: 5 +10 ns: INFO: OpticalToElectrical: 0 Forwarding input features: 72 with Wavelength: 5 to Processing Element +10 ns: INFO: OpticalToElectrical: 0 Transaction completed successfully from OEC: 0 to Processing Element +10 ns: INFO: OpticalToElectrical: 1 Received input feature: 72 with Wavelength: 5 +10 ns: INFO: OpticalToElectrical: 1 Forwarding input features: 72 with Wavelength: 5 to Processing Element +10 ns: INFO: OpticalToElectrical: 1 Transaction completed successfully from OEC: 1 to Processing Element +10 ns: INFO: OpticalToElectrical: 2 Received input feature: 72 with Wavelength: 5 +10 ns: INFO: OpticalToElectrical: 2 Forwarding input features: 72 with Wavelength: 5 to Processing Element +10 ns: INFO: OpticalToElectrical: 2 Transaction completed successfully from OEC: 2 to Processing Element +10 ns: INFO: OpticalToElectrical: 3 Received input feature: 72 with Wavelength: 5 +10 ns: INFO: OpticalToElectrical: 3 Forwarding input features: 72 with Wavelength: 5 to Processing Element +10 ns: INFO: OpticalToElectrical: 3 Transaction completed successfully from OEC: 3 to Processing Element +10 ns: INFO: OpticalToElectrical: 0 Optical to Electrical converter received PSUM from PE: 0 with data: 216 +10 ns: INFO: OpticalToElectrical: 0 Forwarding the PSUMs from PE: 0 to chiplet interface: 1 +10 ns: INFO: OpticalToElectrical: 0 PSUM Transaction completed successfully from OEC: 0 to Chiplet Interface +15 ns: INFO: OpticalToElectrical: 1 Received cross-chiplet data: 90 with Wavelength: 1 +15 ns: INFO: OpticalToElectrical: 1 Forwarding weight kernals: 90 with Wavelength: 1 to Processing Element +15 ns: INFO: OpticalToElectrical: 1 Transaction completed successfully from OEC: 1 to Processing Element +15 ns: INFO: OpticalToElectrical: 1 Received cross-chiplet data: 90 with Wavelength: 1 +15 ns: INFO: OpticalToElectrical: 1 Forwarding weight kernals: 90 with Wavelength: 1 to Processing Element +15 ns: INFO: OpticalToElectrical: 1 Transaction completed successfully from OEC: 1 to Processing Element +15 ns: INFO: OpticalToElectrical: 1 Received cross-chiplet data: 90 with Wavelength: 1 +15 ns: INFO: OpticalToElectrical: 1 Forwarding weight kernals: 90 with Wavelength: 1 to Processing Element +15 ns: INFO: OpticalToElectrical: 1 Transaction completed successfully from OEC: 1 to Processing Element +15 ns: INFO: OpticalToElectrical: 1 Received cross-chiplet data: 90 with Wavelength: 1 +15 ns: INFO: OpticalToElectrical: 1 Forwarding weight kernals: 90 with Wavelength: 1 to Processing Element +15 ns: INFO: OpticalToElectrical: 1 Transaction completed successfully from OEC: 1 to Processing Element +15 ns: INFO: OpticalToElectrical: 1 Optical to Electrical converter received PSUM from PE: 1 with data: 6480 +15 ns: INFO: OpticalToElectrical: 1 Forwarding the PSUMs from PE: 1 to chiplet interface: 1 +15 ns: INFO: OpticalToElectrical: 1 PSUM Transaction completed successfully from OEC: 1 to Chiplet Interface +15 ns: INFO: OpticalToElectrical: 1 Optical to Electrical converter received PSUM from PE: 1 with data: 270 +15 ns: INFO: OpticalToElectrical: 1 Forwarding the PSUMs from PE: 1 to chiplet interface: 0 +15 ns: INFO: OpticalToElectrical: 1 PSUM Transaction completed successfully from OEC: 1 to Chiplet Interface +20 ns: INFO: OpticalToElectrical: 0 Received input feature: 52 with Wavelength: 6 +20 ns: INFO: OpticalToElectrical: 0 Forwarding input features: 52 with Wavelength: 6 to Processing Element +20 ns: INFO: OpticalToElectrical: 0 Transaction completed successfully from OEC: 0 to Processing Element +20 ns: INFO: OpticalToElectrical: 1 Received input feature: 52 with Wavelength: 6 +20 ns: INFO: OpticalToElectrical: 1 Forwarding input features: 52 with Wavelength: 6 to Processing Element +20 ns: INFO: OpticalToElectrical: 1 Transaction completed successfully from OEC: 1 to Processing Element +20 ns: INFO: OpticalToElectrical: 2 Received input feature: 52 with Wavelength: 6 +20 ns: INFO: OpticalToElectrical: 2 Forwarding input features: 52 with Wavelength: 6 to Processing Element +20 ns: INFO: OpticalToElectrical: 2 Transaction completed successfully from OEC: 2 to Processing Element +20 ns: INFO: OpticalToElectrical: 3 Received input feature: 52 with Wavelength: 6 +20 ns: INFO: OpticalToElectrical: 3 Forwarding input features: 52 with Wavelength: 6 to Processing Element +20 ns: INFO: OpticalToElectrical: 3 Transaction completed successfully from OEC: 3 to Processing Element +20 ns: INFO: OpticalToElectrical: 0 Optical to Electrical converter received PSUM from PE: 0 with data: 156 +20 ns: INFO: OpticalToElectrical: 0 Forwarding the PSUMs from PE: 0 to chiplet interface: 2 +20 ns: INFO: OpticalToElectrical: 0 PSUM Transaction completed successfully from OEC: 0 to Chiplet Interface +20 ns: INFO: OpticalToElectrical: 1 Optical to Electrical converter received PSUM from PE: 1 with data: 4680 +20 ns: INFO: OpticalToElectrical: 1 Forwarding the PSUMs from PE: 1 to chiplet interface: 2 +20 ns: INFO: OpticalToElectrical: 1 PSUM Transaction completed successfully from OEC: 1 to Chiplet Interface +30 ns: INFO: OpticalToElectrical: 2 Received cross-chiplet data: 35 with Wavelength: 2 +30 ns: INFO: OpticalToElectrical: 2 Forwarding weight kernals: 35 with Wavelength: 2 to Processing Element +30 ns: INFO: OpticalToElectrical: 2 Transaction completed successfully from OEC: 2 to Processing Element +30 ns: INFO: OpticalToElectrical: 2 Received cross-chiplet data: 35 with Wavelength: 2 +30 ns: INFO: OpticalToElectrical: 2 Forwarding weight kernals: 35 with Wavelength: 2 to Processing Element +30 ns: INFO: OpticalToElectrical: 2 Transaction completed successfully from OEC: 2 to Processing Element +30 ns: INFO: OpticalToElectrical: 2 Received cross-chiplet data: 35 with Wavelength: 2 +30 ns: INFO: OpticalToElectrical: 2 Forwarding weight kernals: 35 with Wavelength: 2 to Processing Element +30 ns: INFO: OpticalToElectrical: 2 Transaction completed successfully from OEC: 2 to Processing Element +30 ns: INFO: OpticalToElectrical: 2 Received cross-chiplet data: 35 with Wavelength: 2 +30 ns: INFO: OpticalToElectrical: 2 Forwarding weight kernals: 35 with Wavelength: 2 to Processing Element +30 ns: INFO: OpticalToElectrical: 2 Transaction completed successfully from OEC: 2 to Processing Element +30 ns: INFO: OpticalToElectrical: 0 Received input feature: 13 with Wavelength: 7 +30 ns: INFO: OpticalToElectrical: 0 Forwarding input features: 13 with Wavelength: 7 to Processing Element +30 ns: INFO: OpticalToElectrical: 0 Transaction completed successfully from OEC: 0 to Processing Element +30 ns: INFO: OpticalToElectrical: 1 Received input feature: 13 with Wavelength: 7 +30 ns: INFO: OpticalToElectrical: 1 Forwarding input features: 13 with Wavelength: 7 to Processing Element +30 ns: INFO: OpticalToElectrical: 1 Transaction completed successfully from OEC: 1 to Processing Element +30 ns: INFO: OpticalToElectrical: 2 Received input feature: 13 with Wavelength: 7 +30 ns: INFO: OpticalToElectrical: 2 Forwarding input features: 13 with Wavelength: 7 to Processing Element +30 ns: INFO: OpticalToElectrical: 2 Transaction completed successfully from OEC: 2 to Processing Element +30 ns: INFO: OpticalToElectrical: 3 Received input feature: 13 with Wavelength: 7 +30 ns: INFO: OpticalToElectrical: 3 Forwarding input features: 13 with Wavelength: 7 to Processing Element +30 ns: INFO: OpticalToElectrical: 3 Transaction completed successfully from OEC: 3 to Processing Element +30 ns: INFO: OpticalToElectrical: 0 Optical to Electrical converter received PSUM from PE: 0 with data: 39 +30 ns: INFO: OpticalToElectrical: 0 Forwarding the PSUMs from PE: 0 to chiplet interface: 3 +30 ns: INFO: OpticalToElectrical: 0 PSUM Transaction completed successfully from OEC: 0 to Chiplet Interface +30 ns: INFO: OpticalToElectrical: 2 Optical to Electrical converter received PSUM from PE: 2 with data: 1820 +30 ns: INFO: OpticalToElectrical: 2 Forwarding the PSUMs from PE: 2 to chiplet interface: 2 +30 ns: INFO: OpticalToElectrical: 2 PSUM Transaction completed successfully from OEC: 2 to Chiplet Interface +30 ns: INFO: OpticalToElectrical: 2 Optical to Electrical converter received PSUM from PE: 2 with data: 2520 +30 ns: INFO: OpticalToElectrical: 2 Forwarding the PSUMs from PE: 2 to chiplet interface: 1 +30 ns: INFO: OpticalToElectrical: 2 PSUM Transaction completed successfully from OEC: 2 to Chiplet Interface +30 ns: INFO: OpticalToElectrical: 2 Optical to Electrical converter received PSUM from PE: 2 with data: 105 +30 ns: INFO: OpticalToElectrical: 2 Forwarding the PSUMs from PE: 2 to chiplet interface: 0 +30 ns: INFO: OpticalToElectrical: 2 PSUM Transaction completed successfully from OEC: 2 to Chiplet Interface +30 ns: INFO: OpticalToElectrical: 1 Optical to Electrical converter received PSUM from PE: 1 with data: 1170 +30 ns: INFO: OpticalToElectrical: 1 Forwarding the PSUMs from PE: 1 to chiplet interface: 3 +30 ns: INFO: OpticalToElectrical: 1 PSUM Transaction completed successfully from OEC: 1 to Chiplet Interface +30 ns: INFO: OpticalToElectrical: 2 Optical to Electrical converter received PSUM from PE: 2 with data: 455 +30 ns: INFO: OpticalToElectrical: 2 Forwarding the PSUMs from PE: 2 to chiplet interface: 3 +30 ns: INFO: OpticalToElectrical: 2 PSUM Transaction completed successfully from OEC: 2 to Chiplet Interface +45 ns: INFO: OpticalToElectrical: 3 Received cross-chiplet data: 24 with Wavelength: 3 +45 ns: INFO: OpticalToElectrical: 3 Forwarding weight kernals: 24 with Wavelength: 3 to Processing Element +45 ns: INFO: OpticalToElectrical: 3 Transaction completed successfully from OEC: 3 to Processing Element +45 ns: INFO: OpticalToElectrical: 3 Received cross-chiplet data: 24 with Wavelength: 3 +45 ns: INFO: OpticalToElectrical: 3 Forwarding weight kernals: 24 with Wavelength: 3 to Processing Element +45 ns: INFO: OpticalToElectrical: 3 Transaction completed successfully from OEC: 3 to Processing Element +45 ns: INFO: OpticalToElectrical: 3 Received cross-chiplet data: 24 with Wavelength: 3 +45 ns: INFO: OpticalToElectrical: 3 Forwarding weight kernals: 24 with Wavelength: 3 to Processing Element +45 ns: INFO: OpticalToElectrical: 3 Transaction completed successfully from OEC: 3 to Processing Element +45 ns: INFO: OpticalToElectrical: 3 Received cross-chiplet data: 24 with Wavelength: 3 +45 ns: INFO: OpticalToElectrical: 3 Forwarding weight kernals: 24 with Wavelength: 3 to Processing Element +45 ns: INFO: OpticalToElectrical: 3 Transaction completed successfully from OEC: 3 to Processing Element +45 ns: INFO: OpticalToElectrical: 3 Optical to Electrical converter received PSUM from PE: 3 with data: 312 +45 ns: INFO: OpticalToElectrical: 3 Forwarding the PSUMs from PE: 3 to chiplet interface: 3 +45 ns: INFO: OpticalToElectrical: 3 PSUM Transaction completed successfully from OEC: 3 to Chiplet Interface +45 ns: INFO: OpticalToElectrical: 3 Optical to Electrical converter received PSUM from PE: 3 with data: 1248 +45 ns: INFO: OpticalToElectrical: 3 Forwarding the PSUMs from PE: 3 to chiplet interface: 2 +45 ns: INFO: OpticalToElectrical: 3 PSUM Transaction completed successfully from OEC: 3 to Chiplet Interface +45 ns: INFO: OpticalToElectrical: 3 Optical to Electrical converter received PSUM from PE: 3 with data: 1728 +45 ns: INFO: OpticalToElectrical: 3 Forwarding the PSUMs from PE: 3 to chiplet interface: 1 +45 ns: INFO: OpticalToElectrical: 3 PSUM Transaction completed successfully from OEC: 3 to Chiplet Interface +45 ns: INFO: OpticalToElectrical: 3 Optical to Electrical converter received PSUM from PE: 3 with data: 72 +45 ns: INFO: OpticalToElectrical: 3 Forwarding the PSUMs from PE: 3 to chiplet interface: 0 +45 ns: INFO: OpticalToElectrical: 3 PSUM Transaction completed successfully from OEC: 3 to Chiplet Interface diff --git a/out/pe_comm.log b/out/pe_comm.log new file mode 100644 index 0000000..749bbf6 --- /dev/null +++ b/out/pe_comm.log @@ -0,0 +1,96 @@ +0 s: INFO: ProcessingElement: 0 Received input feature: 3 with Wavelength: 4 +0 s: INFO: ProcessingElement: 0 writing the input features: 3 with Wavelength: 4 to FiFo +0 s: INFO: ProcessingElement: 1 Received input feature: 3 with Wavelength: 4 +0 s: INFO: ProcessingElement: 1 writing the input features: 3 with Wavelength: 4 to FiFo +0 s: INFO: ProcessingElement: 2 Received input feature: 3 with Wavelength: 4 +0 s: INFO: ProcessingElement: 2 writing the input features: 3 with Wavelength: 4 to FiFo +0 s: INFO: ProcessingElement: 3 Received input feature: 3 with Wavelength: 4 +0 s: INFO: ProcessingElement: 3 writing the input features: 3 with Wavelength: 4 to FiFo +0 s: INFO: ProcessingElement: 0 Received cross-chiplet data: 3 with Wavelength: 0 +0 s: INFO: ProcessingElement: 0 Saving weight kernals: 3 with Wavelength: 0 to Fifo +0 s: INFO: ProcessingElement: 0 Received cross-chiplet data: 3 with Wavelength: 0 +0 s: INFO: ProcessingElement: 0 Saving weight kernals: 3 with Wavelength: 0 to Fifo +0 s: INFO: ProcessingElement: 0 Received cross-chiplet data: 3 with Wavelength: 0 +0 s: INFO: ProcessingElement: 0 Saving weight kernals: 3 with Wavelength: 0 to Fifo +0 s: INFO: ProcessingElement: 0 Received cross-chiplet data: 3 with Wavelength: 0 +0 s: INFO: ProcessingElement: 0 Saving weight kernals: 3 with Wavelength: 0 to Fifo +0 s: INFO: ProcessingElement: 0 Transmitting PSUM: 9 +0 s: INFO: ProcessingElement: 0 Transaction of PSUM completed successfully at time 0 s from PE: 0 to OEC +10 ns: INFO: ProcessingElement: 0 Received input feature: 72 with Wavelength: 5 +10 ns: INFO: ProcessingElement: 0 writing the input features: 72 with Wavelength: 5 to FiFo +10 ns: INFO: ProcessingElement: 1 Received input feature: 72 with Wavelength: 5 +10 ns: INFO: ProcessingElement: 1 writing the input features: 72 with Wavelength: 5 to FiFo +10 ns: INFO: ProcessingElement: 2 Received input feature: 72 with Wavelength: 5 +10 ns: INFO: ProcessingElement: 2 writing the input features: 72 with Wavelength: 5 to FiFo +10 ns: INFO: ProcessingElement: 3 Received input feature: 72 with Wavelength: 5 +10 ns: INFO: ProcessingElement: 3 writing the input features: 72 with Wavelength: 5 to FiFo +10 ns: INFO: ProcessingElement: 0 Transmitting PSUM: 216 +10 ns: INFO: ProcessingElement: 0 Transaction of PSUM completed successfully at time 10 ns from PE: 0 to OEC +15 ns: INFO: ProcessingElement: 1 Received cross-chiplet data: 90 with Wavelength: 1 +15 ns: INFO: ProcessingElement: 1 Saving weight kernals: 90 with Wavelength: 1 to Fifo +15 ns: INFO: ProcessingElement: 1 Received cross-chiplet data: 90 with Wavelength: 1 +15 ns: INFO: ProcessingElement: 1 Saving weight kernals: 90 with Wavelength: 1 to Fifo +15 ns: INFO: ProcessingElement: 1 Received cross-chiplet data: 90 with Wavelength: 1 +15 ns: INFO: ProcessingElement: 1 Saving weight kernals: 90 with Wavelength: 1 to Fifo +15 ns: INFO: ProcessingElement: 1 Received cross-chiplet data: 90 with Wavelength: 1 +15 ns: INFO: ProcessingElement: 1 Saving weight kernals: 90 with Wavelength: 1 to Fifo +15 ns: INFO: ProcessingElement: 1 Transmitting PSUM: 6480 +15 ns: INFO: ProcessingElement: 1 Transaction of PSUM completed successfully at time 15 ns from PE: 1 to OEC +15 ns: INFO: ProcessingElement: 1 Transmitting PSUM: 270 +15 ns: INFO: ProcessingElement: 1 Transaction of PSUM completed successfully at time 15 ns from PE: 1 to OEC +20 ns: INFO: ProcessingElement: 0 Received input feature: 52 with Wavelength: 6 +20 ns: INFO: ProcessingElement: 0 writing the input features: 52 with Wavelength: 6 to FiFo +20 ns: INFO: ProcessingElement: 1 Received input feature: 52 with Wavelength: 6 +20 ns: INFO: ProcessingElement: 1 writing the input features: 52 with Wavelength: 6 to FiFo +20 ns: INFO: ProcessingElement: 2 Received input feature: 52 with Wavelength: 6 +20 ns: INFO: ProcessingElement: 2 writing the input features: 52 with Wavelength: 6 to FiFo +20 ns: INFO: ProcessingElement: 3 Received input feature: 52 with Wavelength: 6 +20 ns: INFO: ProcessingElement: 3 writing the input features: 52 with Wavelength: 6 to FiFo +20 ns: INFO: ProcessingElement: 0 Transmitting PSUM: 156 +20 ns: INFO: ProcessingElement: 0 Transaction of PSUM completed successfully at time 20 ns from PE: 0 to OEC +20 ns: INFO: ProcessingElement: 1 Transmitting PSUM: 4680 +20 ns: INFO: ProcessingElement: 1 Transaction of PSUM completed successfully at time 20 ns from PE: 1 to OEC +30 ns: INFO: ProcessingElement: 2 Received cross-chiplet data: 35 with Wavelength: 2 +30 ns: INFO: ProcessingElement: 2 Saving weight kernals: 35 with Wavelength: 2 to Fifo +30 ns: INFO: ProcessingElement: 2 Received cross-chiplet data: 35 with Wavelength: 2 +30 ns: INFO: ProcessingElement: 2 Saving weight kernals: 35 with Wavelength: 2 to Fifo +30 ns: INFO: ProcessingElement: 2 Received cross-chiplet data: 35 with Wavelength: 2 +30 ns: INFO: ProcessingElement: 2 Saving weight kernals: 35 with Wavelength: 2 to Fifo +30 ns: INFO: ProcessingElement: 2 Received cross-chiplet data: 35 with Wavelength: 2 +30 ns: INFO: ProcessingElement: 2 Saving weight kernals: 35 with Wavelength: 2 to Fifo +30 ns: INFO: ProcessingElement: 0 Received input feature: 13 with Wavelength: 7 +30 ns: INFO: ProcessingElement: 0 writing the input features: 13 with Wavelength: 7 to FiFo +30 ns: INFO: ProcessingElement: 1 Received input feature: 13 with Wavelength: 7 +30 ns: INFO: ProcessingElement: 1 writing the input features: 13 with Wavelength: 7 to FiFo +30 ns: INFO: ProcessingElement: 2 Received input feature: 13 with Wavelength: 7 +30 ns: INFO: ProcessingElement: 2 writing the input features: 13 with Wavelength: 7 to FiFo +30 ns: INFO: ProcessingElement: 3 Received input feature: 13 with Wavelength: 7 +30 ns: INFO: ProcessingElement: 3 writing the input features: 13 with Wavelength: 7 to FiFo +30 ns: INFO: ProcessingElement: 0 Transmitting PSUM: 39 +30 ns: INFO: ProcessingElement: 0 Transaction of PSUM completed successfully at time 30 ns from PE: 0 to OEC +30 ns: INFO: ProcessingElement: 2 Transmitting PSUM: 1820 +30 ns: INFO: ProcessingElement: 2 Transaction of PSUM completed successfully at time 30 ns from PE: 2 to OEC +30 ns: INFO: ProcessingElement: 2 Transmitting PSUM: 2520 +30 ns: INFO: ProcessingElement: 2 Transaction of PSUM completed successfully at time 30 ns from PE: 2 to OEC +30 ns: INFO: ProcessingElement: 2 Transmitting PSUM: 105 +30 ns: INFO: ProcessingElement: 2 Transaction of PSUM completed successfully at time 30 ns from PE: 2 to OEC +30 ns: INFO: ProcessingElement: 1 Transmitting PSUM: 1170 +30 ns: INFO: ProcessingElement: 1 Transaction of PSUM completed successfully at time 30 ns from PE: 1 to OEC +30 ns: INFO: ProcessingElement: 2 Transmitting PSUM: 455 +30 ns: INFO: ProcessingElement: 2 Transaction of PSUM completed successfully at time 30 ns from PE: 2 to OEC +45 ns: INFO: ProcessingElement: 3 Received cross-chiplet data: 24 with Wavelength: 3 +45 ns: INFO: ProcessingElement: 3 Saving weight kernals: 24 with Wavelength: 3 to Fifo +45 ns: INFO: ProcessingElement: 3 Received cross-chiplet data: 24 with Wavelength: 3 +45 ns: INFO: ProcessingElement: 3 Saving weight kernals: 24 with Wavelength: 3 to Fifo +45 ns: INFO: ProcessingElement: 3 Received cross-chiplet data: 24 with Wavelength: 3 +45 ns: INFO: ProcessingElement: 3 Saving weight kernals: 24 with Wavelength: 3 to Fifo +45 ns: INFO: ProcessingElement: 3 Received cross-chiplet data: 24 with Wavelength: 3 +45 ns: INFO: ProcessingElement: 3 Saving weight kernals: 24 with Wavelength: 3 to Fifo +45 ns: INFO: ProcessingElement: 3 Transmitting PSUM: 312 +45 ns: INFO: ProcessingElement: 3 Transaction of PSUM completed successfully at time 45 ns from PE: 3 to OEC +45 ns: INFO: ProcessingElement: 3 Transmitting PSUM: 1248 +45 ns: INFO: ProcessingElement: 3 Transaction of PSUM completed successfully at time 45 ns from PE: 3 to OEC +45 ns: INFO: ProcessingElement: 3 Transmitting PSUM: 1728 +45 ns: INFO: ProcessingElement: 3 Transaction of PSUM completed successfully at time 45 ns from PE: 3 to OEC +45 ns: INFO: ProcessingElement: 3 Transmitting PSUM: 72 +45 ns: INFO: ProcessingElement: 3 Transaction of PSUM completed successfully at time 45 ns from PE: 3 to OEC diff --git a/out/report.log b/out/report.log new file mode 100644 index 0000000..ccb642b --- /dev/null +++ b/out/report.log @@ -0,0 +1,32 @@ +0 s: INFO: MY_LOG: Token for the chiplet 0 granted to PE 0 +0 s: INFO: MY_LOG: PE 0 released token for the chiplet 0 +10 ns: INFO: MY_LOG: Token for the chiplet 1 granted to PE 0 +10 ns: INFO: MY_LOG: PE 0 released token for the chiplet 1 +15 ns: INFO: MY_LOG: Token for the chiplet 1 granted to PE 1 +15 ns: INFO: MY_LOG: PE 1 released token for the chiplet 1 +15 ns: INFO: MY_LOG: Token for the chiplet 0 granted to PE 1 +15 ns: INFO: MY_LOG: PE 1 released token for the chiplet 0 +20 ns: INFO: MY_LOG: Token for the chiplet 2 granted to PE 0 +20 ns: INFO: MY_LOG: PE 0 released token for the chiplet 2 +20 ns: INFO: MY_LOG: Token for the chiplet 2 granted to PE 1 +20 ns: INFO: MY_LOG: PE 1 released token for the chiplet 2 +30 ns: INFO: MY_LOG: Token for the chiplet 3 granted to PE 0 +30 ns: INFO: MY_LOG: PE 0 released token for the chiplet 3 +30 ns: INFO: MY_LOG: Token for the chiplet 2 granted to PE 2 +30 ns: INFO: MY_LOG: PE 2 released token for the chiplet 2 +30 ns: INFO: MY_LOG: Token for the chiplet 1 granted to PE 2 +30 ns: INFO: MY_LOG: PE 2 released token for the chiplet 1 +30 ns: INFO: MY_LOG: Token for the chiplet 0 granted to PE 2 +30 ns: INFO: MY_LOG: PE 2 released token for the chiplet 0 +30 ns: INFO: MY_LOG: Token for the chiplet 3 granted to PE 1 +30 ns: INFO: MY_LOG: PE 1 released token for the chiplet 3 +30 ns: INFO: MY_LOG: Token for the chiplet 3 granted to PE 2 +30 ns: INFO: MY_LOG: PE 2 released token for the chiplet 3 +45 ns: INFO: MY_LOG: Token for the chiplet 3 granted to PE 3 +45 ns: INFO: MY_LOG: PE 3 released token for the chiplet 3 +45 ns: INFO: MY_LOG: Token for the chiplet 2 granted to PE 3 +45 ns: INFO: MY_LOG: PE 3 released token for the chiplet 2 +45 ns: INFO: MY_LOG: Token for the chiplet 1 granted to PE 3 +45 ns: INFO: MY_LOG: PE 3 released token for the chiplet 1 +45 ns: INFO: MY_LOG: Token for the chiplet 0 granted to PE 3 +45 ns: INFO: MY_LOG: PE 3 released token for the chiplet 0 diff --git a/out/simulation b/out/simulation new file mode 100644 index 0000000..ff91f54 Binary files /dev/null and b/out/simulation differ diff --git a/scripts/input_feature.py b/scripts/input_feature.py new file mode 100644 index 0000000..aba8c75 --- /dev/null +++ b/scripts/input_feature.py @@ -0,0 +1,18 @@ +import numpy as np + +# Parameters +num_matrices = 10 +rows = 2 # Number of rows in each matrix +cols = 2 # Number of columns in each matrix + +# Generate and save input feature matrices +with open('input_features.txt', 'w') as f: + for i in range(num_matrices): + input_features = np.random.randint(0, 100, size=(rows, cols)) + np.savetxt(f, input_features, fmt='%d') + + # Add an empty line after each matrix except the last one + if i < num_matrices - 1: + f.write("\n") + +print(f"{num_matrices} random input feature matrices generated and saved to 'input_features.txt'.") \ No newline at end of file diff --git a/scripts/weight_kernal.py b/scripts/weight_kernal.py new file mode 100644 index 0000000..f91ee45 --- /dev/null +++ b/scripts/weight_kernal.py @@ -0,0 +1,18 @@ +import numpy as np + +# Parameters +num_matrices = 10 +rows = 2 # Number of rows in each matrix +cols = 2 # Number of columns in each matrix + +# Generate and save weight kernel matrices +with open('weight_kernels.txt', 'w') as f: + for i in range(num_matrices): + weight_kernels = np.random.randint(0, 100, size=(rows, cols)) + np.savetxt(f, weight_kernels, fmt='%d') + + # Add an empty line after each matrix except the last one + if i < num_matrices - 1: + f.write("\n") + +print(f"{num_matrices} random weight kernel matrices generated and saved to 'weight_kernels.txt'.") \ No newline at end of file diff --git a/src/Chiplet/Chiplet_Interface.cpp b/src/Chiplet/Chiplet_Interface.cpp new file mode 100644 index 0000000..ad4442d --- /dev/null +++ b/src/Chiplet/Chiplet_Interface.cpp @@ -0,0 +1,197 @@ +#include "Chiplet_Interface.h" +#include + +// Constructor implementation +ChipletInterface::ChipletInterface(sc_core::sc_module_name name, int num_pes): sc_module(name), num_pes(num_pes) { + //sc_report_handler::set_log_file_name("out/report.log"); + sc_report_handler::set_actions(C_LOG, SC_INFO, SC_LOG|SC_DISPLAY); + for (int i = 0; i < num_pes; ++i) { + // Register b_transport method for each PE receive socket + oec_receive_sockets[i].register_b_transport(this, &ChipletInterface::oec_b_transport); + } + + //SC_THREAD(send_psum_interposer); + // Register b_transport method for Interposer interface + interposer_features_receive_socket.register_b_transport(this, &ChipletInterface::ii_fetures_receive_b_transport); + interposer_weight_receive_socket.register_b_transport(this, &ChipletInterface::ii_weight_receive_b_transport); +} + +// Handle incoming transactions from the Interposer Interface +void ChipletInterface::ii_fetures_receive_b_transport(tlm_generic_payload& trans, sc_time& delay) { + CustomPayload* orig_trans = dynamic_cast(&trans); + if (!orig_trans) { + wait(5, SC_NS); + log_error(std::to_string(chiplet_id) + " Invalid transaction type (not CustomPayload)." ); + trans.set_response_status(TLM_GENERIC_ERROR_RESPONSE); + return; + } + + CustomPayload* chip_trans1 = new CustomPayload(); + chip_trans1->update_timestamp(sc_time_stamp()); + sc_time current_time = sc_time_stamp(); + //manually copy the transaction payload for future use + // Log the time when the core sent the transaction + sc_time sent_time = orig_trans->timestamp; + chip_trans1->data = orig_trans->data; + chip_trans1->num_rows = orig_trans->num_rows; + chip_trans1->num_cols = orig_trans->num_cols; + chip_trans1->update_timestamp(current_time); + chip_trans1->set_address(orig_trans->get_address()); + chip_trans1->set_command(orig_trans->get_command()); + chip_trans1->set_data_ptr(reinterpret_cast(&chip_trans1->data)); + chip_trans1->set_data_length(orig_trans->get_data_length()); + chip_trans1->set_streaming_width(orig_trans->get_streaming_width()); + chip_trans1->set_byte_enable_ptr(orig_trans->get_byte_enable_ptr()); + chip_trans1->set_dmi_allowed(orig_trans->is_dmi_allowed()); + + int address = chip_trans1->get_address(); // address is used to determine wavelength + if (address >= 0x100 && address < 0x200) { + // Single-chiplet communication + int chiplet_index = address - 0x100; + int chiplet_id = chiplet_index - PE_PER_CHIPLET; + + int single_wavelength = chiplet_index; + + trans.set_response_status(TLM_OK_RESPONSE); // Set response status + //log_info(std::to_string(chiplet_id) + " Single-chiplet communication, wavelength: " + std::to_string(single_wavelength)); + + // Single-chiplet communication (λM) + log_info(std::to_string(chiplet_id) + " Received input feature: " + std::to_string(chip_trans1->data) + " with Wavelength: " + std::to_string(single_wavelength)); + //wait(sc_time(5, SC_NS)); + sc_time delay = SC_ZERO_TIME; + // Forward the transaction + for (int i = 0; i < num_pes; ++i) { + log_info(std::to_string(chiplet_id) + " Forwarding input features: " + std::to_string(chip_trans1->data) + " with Wavelength: " + std::to_string(single_wavelength) + " to Optical to Electrical Converter: " + std::to_string(i)); + oec_features_send_sockets[i] -> b_transport(*chip_trans1, delay); // Send transaction to OEC + } + if(chip_trans1->get_response_status() == TLM_OK_RESPONSE) { + log_info( std::to_string(chiplet_id) + " Transaction of input feature " + std::to_string(chip_trans1->data) + " completed successfully from Chiplet Interface: " + std::to_string(chiplet_id) + " to OEC"); + } else { + log_error(std::to_string(chiplet_id) + " Error in transmitting data: " + std::to_string(chip_trans1->data) + " from Chiplet Interface to OEC"); + } + } else { + log_error(std::to_string(chiplet_id) + " Invalid or unrecognized address: " + std::to_string(address)); + } + + delete chip_trans1; // Clean up dynamically allocated memory + +} + + + +// Handle incoming transactions - weight kernals from the Interposer Interface +void ChipletInterface::ii_weight_receive_b_transport(tlm_generic_payload& trans, sc_time& delay) { + CustomPayload* orig_trans = dynamic_cast(&trans); + if (!orig_trans) { + + log_error( std::to_string(chiplet_id) + " Invalid transaction type (not CustomPayload)." ); + trans.set_response_status(TLM_GENERIC_ERROR_RESPONSE); + return; + } + + CustomPayload* chip_trans2 = new CustomPayload(); + + sc_time current_time = sc_time_stamp(); + //manually copy the transaction payload for future use + // Log the time when the core sent the transaction + sc_time sent_time = orig_trans->timestamp; + chip_trans2->data = orig_trans->data; + chip_trans2->num_rows = orig_trans->num_rows; + chip_trans2->num_cols = orig_trans->num_cols; + chip_trans2->update_timestamp(current_time); + chip_trans2->set_address(orig_trans->get_address()); + chip_trans2->set_command(orig_trans->get_command()); + chip_trans2->set_data_ptr(reinterpret_cast(&chip_trans2->data)); + chip_trans2->set_data_length(orig_trans->get_data_length()); + chip_trans2->set_streaming_width(orig_trans->get_streaming_width()); + chip_trans2->set_byte_enable_ptr(orig_trans->get_byte_enable_ptr()); + chip_trans2->set_dmi_allowed(orig_trans->is_dmi_allowed()); + + int address = chip_trans2->get_address(); // address is used to determine wavelength + if (address >= 0x200) { + int cross_wavelength = address - 0x200; + //log_info(std::to_string(chiplet_id) + " Cross-chiplet communication, wavelength: " + std::to_string(cross_wavelength)); + + log_info(std::to_string(chiplet_id) + " Received Weight Kernal: " + std::to_string(chip_trans2->data) + " with Wavelength: " + std::to_string(cross_wavelength)); + + // Forward the transaction to the chiplet interface + sc_time delay = SC_ZERO_TIME; + oec_weight_send_sockets[cross_wavelength] -> b_transport(*chip_trans2, delay); // Send transaction to OEC + //chiplet_features_send_socket->b_transport(*chip_trans1, delay); // Send transaction to Chiplet Interface + log_info(std::to_string(chiplet_id) + " Forwarding Weight Kernal: " + std::to_string(chip_trans2->data) + " with Wavelength: " + std::to_string(cross_wavelength) + " to Optical to Electrical Converter"); + if(chip_trans2->get_response_status() == TLM_OK_RESPONSE) { + log_info( std::to_string(chiplet_id) + " Transaction of weight kernal" + std::to_string(chip_trans2->data) + " completed successfully from Chiplet Interface: " + std::to_string(chiplet_id) + " to OEC"); + }else{ + log_error(std::to_string(chiplet_id) + " Error in transmitting data: " + std::to_string(chip_trans2->data) + " from Chiplet Interface to OEC"); + } + } else { + log_error(std::to_string(chiplet_id) + " Invalid or unrecognized address: " + std::to_string(address)); + } + + delete chip_trans2; // Clean up dynamically allocated memory + trans.set_response_status(TLM_OK_RESPONSE); // Set response status +} + + + +//Handle incoming transactions from the OEC +void ChipletInterface::oec_b_transport(tlm_generic_payload& trans, sc_time& delay) { + PESendPayload* orig_trans = dynamic_cast(&trans); + if (!orig_trans) { + + log_error(std::to_string(chiplet_id) + " Invalid transaction type (not PESendPayload)."); + trans.set_response_status(TLM_GENERIC_ERROR_RESPONSE); + return; + } + + PESendPayload* rx_trans2 = new PESendPayload(); + + sc_time current_time = sc_time_stamp(); + //manually copy the transaction payload for future use + // Log the time when the core sent the transaction + sc_time sent_time = orig_trans->timestamp; + rx_trans2->psum = orig_trans->psum; + rx_trans2->src_chiplet = orig_trans->src_chiplet; + rx_trans2->src_pe = orig_trans->src_pe; + rx_trans2->num_rows = orig_trans->num_rows; + rx_trans2->num_cols = orig_trans->num_cols; + rx_trans2->update_timestamp(current_time); + rx_trans2->set_address(orig_trans->get_address()); + rx_trans2->set_command(orig_trans->get_command()); + rx_trans2->set_data_ptr(reinterpret_cast(&rx_trans2->psum)); + rx_trans2->set_data_length(orig_trans->get_data_length()); + rx_trans2->set_streaming_width(orig_trans->get_streaming_width()); + rx_trans2->set_byte_enable_ptr(orig_trans->get_byte_enable_ptr()); + rx_trans2->set_dmi_allowed(orig_trans->is_dmi_allowed()); + + int address = rx_trans2->get_address(); // address is used to determine wavelength + + int chiplet_index = address - 0x300; + + int unicast_wavelength = chiplet_index; + + log_info(std::to_string(chiplet_id) + " Chiplet Interface received PSUM from PE: " + std::to_string(rx_trans2->src_pe) + " through OEC with data: " + std::to_string(rx_trans2->psum)); + + // Forward the transaction to the Interposer interface + delay = SC_ZERO_TIME; + interposer_send_socket->b_transport(*rx_trans2, delay); + log_info(std::to_string(chiplet_id) + " Forwarding the PSUM " + std::to_string(rx_trans2->psum) + " from PE: " + std::to_string(rx_trans2->src_pe) + " to Interposer interface: " + std::to_string(rx_trans2->src_chiplet)); + if(rx_trans2->get_response_status() == TLM_OK_RESPONSE) { + log_info(std::to_string(chiplet_id) + " PSUM Transaction: " + std::to_string(rx_trans2->psum) + " completed successfully from Chiplet Interface: " + std::to_string(chiplet_id) + " to Interposer Interface"); + }else{ + log_error( std::to_string(chiplet_id) + " Error in transmitting PSUM: " + std::to_string(rx_trans2->psum) + " from Chiplet Interface to Interposer Interface "); + } + delete rx_trans2; // Clean up dynamically allocated memory + trans.set_response_status(TLM_OK_RESPONSE); // Set response status +} + + + + +void ChipletInterface::log_info(std::string msg){ + SC_REPORT_INFO(C_LOG, msg.c_str()); +} + +void ChipletInterface::log_error(std::string msg){ + SC_REPORT_ERROR(C_LOG, msg.c_str()); +} \ No newline at end of file diff --git a/src/Chiplet/Chiplet_Interface.h b/src/Chiplet/Chiplet_Interface.h new file mode 100644 index 0000000..6b318ca --- /dev/null +++ b/src/Chiplet/Chiplet_Interface.h @@ -0,0 +1,49 @@ +#ifndef CHIPLET_INTERFACE_H +#define CHIPLET_INTERFACE_H + +#include +#include +#include +#include +#include +#include +#include + +using namespace tlm; + +class O_E_converter; // Forward declaration + +class ChipletInterface : public sc_module { +public: + // TLM sockets + tlm_utils::simple_target_socket interposer_features_receive_socket; // Receiving from Interposer Interface + tlm_utils::simple_target_socket interposer_weight_receive_socket; // Receiving from Interposer Interface + tlm_utils::simple_initiator_socket interposer_send_socket; // Sending to Interposer Interface + unsigned int chiplet_id; + + // Sockets for PEs + tlm_utils::simple_target_socket oec_receive_sockets[PE_PER_CHIPLET]; // Receiving from O_E_converters + tlm_utils::simple_initiator_socket oec_features_send_sockets[PE_PER_CHIPLET]; // Sending to O_E_converters + tlm_utils::simple_initiator_socket oec_weight_send_sockets[PE_PER_CHIPLET]; // Sending to O_E_converters + + SC_HAS_PROCESS(ChipletInterface); + + explicit ChipletInterface(sc_module_name name, int num_pes); + +private: + int num_pes; // Number of PEs + + // Handle incoming transactions from the Interposer Interface + void ii_fetures_receive_b_transport(tlm_generic_payload& trans, sc_time& delay); + void ii_weight_receive_b_transport(tlm_generic_payload& trans, sc_time& delay); + void send_psum_interposer(); + // Handle incoming transactions from the OEC + void oec_b_transport(tlm_generic_payload& trans, sc_time& delay); + // Forward transaction to O_E_converters + //void forward_to_O_E_converters(tlm_generic_payload& trans, int wavelength); + + void log_info(std::string msg); + void log_error(std::string msg); +}; + +#endif // CHIPLET_INTERFACE_H \ No newline at end of file diff --git a/src/GB/Global_Buffer.cpp b/src/GB/Global_Buffer.cpp new file mode 100644 index 0000000..88f9db0 --- /dev/null +++ b/src/GB/Global_Buffer.cpp @@ -0,0 +1,251 @@ +#include "Global_Buffer.h" + +// Constructor implementation +GlobalBuffer::GlobalBuffer(sc_module_name name, int num_chiplets, int num_pes) + : sc_module(name), + num_chiplets(num_chiplets), + num_pes(num_pes), + feature_counter(num_chiplets, 20), + weight_counter(num_pes, 20), + credit_matrix(num_chiplets, std::vector(num_pes, 0)) { + //sc_report_handler::set_log_file_name("out/report.log"); + + sc_report_handler::set_actions(GB_LOG, SC_INFO, SC_LOG|SC_DISPLAY); + for (int i = 0; i < num_chiplets; ++i) { + // Register b_transport callback for each target socket + receive_to_GB_sockets[i].register_b_transport(this, &GlobalBuffer::receive_to_gb_b_transport); + } + + + // SC_THREAD for processing features, weights, and PSum reception + SC_THREAD(single_chiplet_communication); + SC_THREAD(cross_chiplet_communication); + +} + +// Generate input features and transmit as single-chiplet communication +void GlobalBuffer::generate_features() { + CustomPayload* trans = nullptr; + // Initialize random seed + static bool seeded1 = false; + if (!seeded1) { + srand(time(0)); // Seed the random number generator + seeded1 = true; + } + sc_time inter_transaction_delay = sc_time(10, SC_NS); // Delay between transactions + sc_time delay = SC_ZERO_TIME; + bool retry = false; // Retry flag + + // Iterate over all chiplets + for (int chiplet_id = 0; chiplet_id < CHIPLET_NO; ++chiplet_id) { + do { // Ensure feature counter > 0 + if (!retry) { + int data = rand() % 101; + unsigned int num_rows = rand() % 101; + unsigned int num_cols = rand() % 101; + log_info("Generated input feature: " + std::to_string(data)); + // Create a new payload for each chiplet + trans = new CustomPayload(num_rows, num_cols, data, sc_time_stamp()); + int chiplet_index = 0x100 + (PE_PER_CHIPLET + chiplet_id); // Address for wavelength λ8 onward + trans->update_timestamp(sc_time_stamp()); // Set the current simulation time + // Set TLM payload fields + trans->set_command(TLM_WRITE_COMMAND); + trans->set_address(chiplet_index); + trans->set_byte_enable_ptr(nullptr); + trans->set_dmi_allowed(false); + } + //std::cout << "Attempt transmitting input features" << std::endl; + // Attempt transaction + if (feature_counter[chiplet_id] > 0) { + //std::cout << "Transmitting input features" << std::endl; + log_info("Transmitting Input Features: " + std::to_string(trans->data)); + //wait(sc_time(5, SC_NS)); + sc_time start_time = sc_time_stamp(); + //std::cout << "delay before send in Global buffer" << start_time << std::endl; + features_from_GB_sockets[chiplet_id]->b_transport(*trans, delay); + sc_time end_time = sc_time_stamp(); + //std::cout << "delay before send in Global buffer" << end_time << std::endl; + if(trans->get_response_status() == TLM_OK_RESPONSE) { + log_info("Transaction of input feature " + std::to_string(trans->data) + " completed successfully from Global Buffer to Interpoaser Interface"); + } else { + log_error ("Error in transmitting data: " + std::to_string(trans->data) + " from Global Buffer to Interposer Interface"); + } + retry = false; // Transaction successful, no retry needed + feature_counter[chiplet_id]--; // Decrement feature counter + delete trans; // Clean up payload + wait(inter_transaction_delay); + break; // Exit retry loop + } else { + retry = true; // FIFO full, retry needed + log_info("GlobalBuffer: FIFO full, retrying..."); + wait(20, SC_NS); // Wait for FIFO space + } + + if (trans != nullptr) { + delete trans; // Clean up if not already deleted + } + } while(retry); + } + + wait(SC_ZERO_TIME); // Synchronize simulation time +} + + +// Process to transmit weight kernels +void GlobalBuffer::generate_weights() { + CustomPayload* trans = nullptr; + static bool seeded = false; + if (!seeded) { + srand(time(0)); // Seed the random number generator + seeded = true; + } + sc_time delay = SC_ZERO_TIME; // Start with zero delay + sc_time inter_transaction_delay = sc_time(15, SC_NS); // Delay between transactions + bool retry = false; // Retry flag + for (int pe_id = 0; pe_id < PE_PER_CHIPLET; ++pe_id) { + do { + if (!retry) { + int data = rand() % 101; + unsigned int num_rows = rand() % 101; + unsigned int num_cols = rand() % 101; + log_info("Generated Weight kernal: " + std::to_string(data)); + // Create a new payload for each chiplet + trans = new CustomPayload(num_rows, num_cols, data, sc_time_stamp()); + int chiplet_index = 0x200 + (pe_id); // Address for wavelength λ8 onward + // Set TLM payload fields + trans->set_command(TLM_WRITE_COMMAND); + trans->set_address(chiplet_index); + + trans->set_byte_enable_ptr(nullptr); + trans->set_dmi_allowed(false); + } + //std::cout << "attempt transmitting weights" << std::endl; + for (int chiplet_id = 0; chiplet_id < num_chiplets; ++chiplet_id) { + //std::cout << "Transmitting weights" << std::endl; + if (weight_counter[pe_id] > 0){ + log_info("Transmitting weight kernals: " + std::to_string(trans->data) + " to interposer Interface " + std::to_string(chiplet_id)); + (weight_from_GB_sockets[chiplet_id])->b_transport(*trans, delay); + if(trans->get_response_status() == TLM_OK_RESPONSE) { + log_info("Transaction of Weight Kernal " + std::to_string(trans->data) + " completed successfully from Global Buffer: " +" to Interpoaser Interface"); + }else{ + log_error ("Error in transmitting weight kernal: " + std::to_string(trans->data) + " from Global Buffer to Interposer Interface"); + } + weight_counter[pe_id]--; + retry = false; + + } else { + retry = true; // FIFO full, retry needed + log_info("Waiting for space in FIFO for weight kernals..."); + wait(20, SC_NS); // Wait before retrying + + } + } wait(inter_transaction_delay); + + } while(retry); + + } + wait(SC_ZERO_TIME); // Synchronize simulation time +} + +// Process to receive PSums from all chiplets +void GlobalBuffer::receive_to_gb_b_transport(tlm_generic_payload& trans, sc_time& delay) { + PESendPayload* orig_trans = dynamic_cast(&trans); + if (!orig_trans) { + log_error(" Invalid transaction type (not PESendPayload)."); + trans.set_response_status(TLM_GENERIC_ERROR_RESPONSE); + return; + } + + PESendPayload* rx_trans4 = new PESendPayload(); + + sc_time current_time = sc_time_stamp(); + //manually copy the transaction payload for future use + // Log the time when the core sent the transaction + sc_time sent_time = orig_trans->timestamp; + rx_trans4->psum = orig_trans->psum; + rx_trans4->src_chiplet = orig_trans->src_chiplet; + unsigned int chiplet_id = rx_trans4->src_chiplet; + rx_trans4->src_pe = orig_trans->src_pe; + unsigned int pe_id = rx_trans4->src_pe; + rx_trans4->num_rows = orig_trans->num_rows; + rx_trans4->num_cols = orig_trans->num_cols; + rx_trans4->update_timestamp(current_time); + rx_trans4->set_address(orig_trans->get_address()); + rx_trans4->set_command(orig_trans->get_command()); + rx_trans4->set_data_ptr(reinterpret_cast(&rx_trans4->psum)); + rx_trans4->set_data_length(orig_trans->get_data_length()); + rx_trans4->set_streaming_width(orig_trans->get_streaming_width()); + rx_trans4->set_byte_enable_ptr(orig_trans->get_byte_enable_ptr()); + rx_trans4->set_dmi_allowed(orig_trans->is_dmi_allowed()); + + int address = rx_trans4->get_address(); // address is used to determine wavelength + + int chiplet_index = address - 0x300; + int unicast_wavelength = chiplet_index; + // wait(4, SC_NS); + log_info(" Received transaction from PE: " + std::to_string(rx_trans4->src_pe) + " from chiplet: " + std::to_string(rx_trans4->src_chiplet) + " through Interposer Interface with PSUM: " + std::to_string(rx_trans4->psum)); + // Increment the credit matrix value + credit_matrix[chiplet_id][pe_id]++; + log_info("Updated credit_matrix[" + std::to_string(chiplet_id) + "][" + std::to_string(pe_id) + "] = " + + std::to_string(credit_matrix[chiplet_id][pe_id]) ); + //log_credits(rx_trans4); + // Check and update weight counter + bool all_pe_in_column_nonzero = true; + for (int i = 0; i < num_chiplets; ++i) { + if (credit_matrix[i][pe_id] == 0) { + all_pe_in_column_nonzero = false; + break; + } + } + if (all_pe_in_column_nonzero) { + weight_counter[pe_id]++; + log_info( "Incremented weight_counter[" + std::to_string( pe_id ) + "] = " +std::to_string( weight_counter[pe_id])); + } + + + // Check and update feature counter + bool all_pe_in_row_nonzero = true; + for (int j = 0; j < num_pes; ++j) { + if (credit_matrix[chiplet_id][j] == 0) { + all_pe_in_row_nonzero = false; + break; + } + } + if (all_pe_in_row_nonzero) { + feature_counter[chiplet_id]++; + log_info("Incremented feature_counter[" + std::to_string(chiplet_id) + "] = " + std::to_string(feature_counter[chiplet_id])); + } + + delete rx_trans4; // Clean up dynamically allocated memory + trans.set_response_status(TLM_OK_RESPONSE); // Set response status +} + +// Single-chiplet communication (λM onwards for input features) +void GlobalBuffer::single_chiplet_communication() { + while(true){ + + generate_features(); + + wait(); + } +} + +// Cross-chiplet communication (λ0 to λ(M-1) for weights) +void GlobalBuffer::cross_chiplet_communication() { + while(true){ + + generate_weights(); + + wait(); + } +} + + + +void GlobalBuffer::log_info(std::string msg){ + SC_REPORT_INFO(GB_LOG, msg.c_str()); +} + +void GlobalBuffer::log_error(std::string msg){ + SC_REPORT_ERROR(GB_LOG, msg.c_str()); +} \ No newline at end of file diff --git a/src/GB/Global_Buffer.h b/src/GB/Global_Buffer.h new file mode 100644 index 0000000..edbfcce --- /dev/null +++ b/src/GB/Global_Buffer.h @@ -0,0 +1,65 @@ +#ifndef GLOBAL_BUFFER_H +#define GLOBAL_BUFFER_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include "src/utils/configuration.h" +#include "src/utils/noc_logger.h" +#include // For rand() +#include // For time() +#include +#include + +using namespace tlm; + +class GlobalBuffer : public sc_module { +public: + // Constructor + SC_HAS_PROCESS(GlobalBuffer); + + + // TLM sockets for communication with interposer interfaces + tlm_utils::simple_initiator_socket features_from_GB_sockets[CHIPLET_NO]; // Sending to chiplets + tlm_utils::simple_initiator_socket weight_from_GB_sockets[CHIPLET_NO]; // Sending to chiplets + tlm_utils::simple_target_socket receive_to_GB_sockets[CHIPLET_NO]; // Receiving PSums from chiplets + + explicit GlobalBuffer(sc_module_name name, int num_chiplets, int num_pes); + +private: + // Data members + + int num_chiplets; // Number of chiplets (interposer interfaces) + int num_pes; // Number of PEs in total + std::vector psums; // Storage for received PSums + std::vector feature_counter; // Counter for input features + std::vector weight_counter; // Counter for weight kernels + std::vector> credit_matrix; // Credit matrix + + // Process declarations + void generate_features(); + void generate_weights(); + + // Function to handle received TLM transactions + void receive_to_gb_b_transport(tlm::tlm_generic_payload& trans, sc_time& delay); + + // TLM Communication methods + void single_chiplet_communication(); + void cross_chiplet_communication(); + //void log_credits(tlm_generic_payload& trans); + + // Function to load multiple matrices from a single file + std::vector>> load_matrices_from_file(const std::string& filename); + bool is_file_empty(const std::string& file_path); + + void log_info(std::string msg); + void log_error(std::string msg); + +}; + +#endif // GLOBAL_BUFFER_H \ No newline at end of file diff --git a/src/Interposer/Interposer_Interface.cpp b/src/Interposer/Interposer_Interface.cpp new file mode 100644 index 0000000..9578adc --- /dev/null +++ b/src/Interposer/Interposer_Interface.cpp @@ -0,0 +1,195 @@ +#include "Interposer_Interface.h" +#include + +// Constructor implementation +InterposerInterface::InterposerInterface(sc_module_name name) + : sc_module(name) + //chiplet_receive_socket("chiplet_receive_socket"), + //chiplet_send_socket("chiplet_send_socket") + { + //sc_report_handler::set_log_file_name("out/report.log"); + sc_report_handler::set_actions(I_LOG, SC_INFO, SC_LOG|SC_DISPLAY); + // Register b_transport methods for GB and Chiplet interfaces + gb_features_receive_socket.register_b_transport(this, &InterposerInterface::gb_features_b_transport); + gb_weight_receive_socket.register_b_transport(this, &InterposerInterface::gb_weight_b_transport); + chiplet_receive_socket.register_b_transport(this, &InterposerInterface::chiplet_b_transport); +} + +// Handle incoming transactions from the Global Buffer +void InterposerInterface::gb_features_b_transport(tlm_generic_payload& trans, sc_time& delay) { + CustomPayload* orig_trans = dynamic_cast(&trans); + if (!orig_trans) { + wait(5, SC_NS); + log_error("Invalid transaction type (not CustomPayload)."); + trans.set_response_status(TLM_GENERIC_ERROR_RESPONSE); + return; + } + + + // Copy payload manually + CustomPayload* my_trans = new CustomPayload(); + sc_time current_time = sc_time_stamp(); + my_trans->update_timestamp(sc_time_stamp()); + // Log the time when the core sent the transaction + sc_time sent_time = orig_trans->timestamp; + my_trans->data = orig_trans->data; + my_trans->num_rows = orig_trans->num_rows; + my_trans->num_cols = orig_trans->num_cols; + my_trans->update_timestamp(current_time); + my_trans->set_address(orig_trans->get_address()); + my_trans->set_command(orig_trans->get_command()); + my_trans->set_data_ptr(reinterpret_cast(&my_trans->data)); + my_trans->set_data_length(orig_trans->get_data_length()); + my_trans->set_streaming_width(orig_trans->get_streaming_width()); + my_trans->set_byte_enable_ptr(orig_trans->get_byte_enable_ptr()); + my_trans->set_dmi_allowed(orig_trans->is_dmi_allowed()); + + int address = my_trans->get_address(); // address is used to determine wavelength + if (address >= 0x100 && address < 0x200) { + // Single-chiplet communication + int chiplet_index = address - 0x100; + int chiplet_id = chiplet_index - PE_PER_CHIPLET; + int single_wavelength = chiplet_index; + trans.set_response_status(TLM_OK_RESPONSE); // Set response status + + log_info(std::to_string(interposer_id) + " Received input feature: " + std::to_string(my_trans->data) + " with Wavelength: " + std::to_string(single_wavelength)); + //wait(sc_time(5, SC_NS)); + sc_time delay = SC_ZERO_TIME; + // Forward the transaction to the chiplet interface + log_info(std::to_string(interposer_id) + " Forwarding input features: " + std::to_string(my_trans->data) + " with Wavelength: " + std::to_string(single_wavelength) + " to chiplet interface"); + chiplet_features_send_socket->b_transport(*my_trans, delay); // Send transaction to Chiplet Interface + + if(my_trans->get_response_status() == tlm::TLM_OK_RESPONSE) { + log_info(std::to_string(interposer_id) + " Transaction of input feature " + std::to_string(my_trans->data) + " completed successfully from Interposer Interface: " + std::to_string(interposer_id) + " to Chiplet Interface"); + }else{ + log_error(std::to_string(interposer_id) + " Error in transmitting data: " + std::to_string(my_trans->data) + " from Interposer Interface to Chiplet Interface"); + } + } else { + log_error(std::to_string(interposer_id) + " Invalid or unrecognized address: " + std::to_string(address)); + } + + delete my_trans; // Clean up dynamically allocated memory + +} + + +// Handle incoming weight kernals from the Global Buffer +void InterposerInterface::gb_weight_b_transport(tlm_generic_payload& trans, sc_time& delay) { + CustomPayload* orig_trans = dynamic_cast(&trans); + if (!orig_trans) { + // wait(4, SC_NS); + std::cerr << std::to_string(interposer_id) + " Invalid transaction type (not CustomPayload)." << std::endl; + trans.set_response_status(TLM_GENERIC_ERROR_RESPONSE); + return; + } + + CustomPayload* new_trans = new CustomPayload(); + sc_time current_time = sc_time_stamp(); + //manually copy the transaction payload for future use + // Log the time when the core sent the transaction + sc_time sent_time = orig_trans->timestamp; + new_trans->data = orig_trans->data; + new_trans->num_rows = orig_trans->num_rows; + new_trans->num_cols = orig_trans->num_cols; + new_trans->update_timestamp(current_time); + new_trans->set_address(orig_trans->get_address()); + new_trans->set_command(orig_trans->get_command()); + new_trans->set_data_ptr(reinterpret_cast(&new_trans->data)); + new_trans->set_data_length(orig_trans->get_data_length()); + new_trans->set_streaming_width(orig_trans->get_streaming_width()); + new_trans->set_byte_enable_ptr(orig_trans->get_byte_enable_ptr()); + new_trans->set_dmi_allowed(orig_trans->is_dmi_allowed()); + + int address = new_trans->get_address(); // address is used to determine wavelength + if (address >= 0x200) { + int cross_wavelength = address - 0x200; + //log_info("Cross-chiplet communication, wavelength : " + std::to_string(cross_wavelength)); + // wait(4, SC_NS); + // Cross-chiplet communication (λ0, λ1, λ2, ...) + log_info(std::to_string(interposer_id) + " Received cross-chiplet data: " + std::to_string(new_trans->data) + " with Wavelength: " + std::to_string(cross_wavelength)); + + + log_info(std::to_string(interposer_id) + " Splitting data for PE: " + std::to_string(cross_wavelength) + " to chiplet:" + std::to_string(interposer_id)); + + // Forward modified data to chiplet interface + sc_time delay = SC_ZERO_TIME; + chiplet_weight_send_socket->b_transport(*new_trans, delay); // Send transaction to Chiplet Interface + log_info(std::to_string(interposer_id) + " Forwarding weight kernals: " + std::to_string(new_trans->data) + " with Wavelength: " + std::to_string(cross_wavelength) + " to chiplet interface"); + if(new_trans->get_response_status() == TLM_OK_RESPONSE) { + log_info(std::to_string(interposer_id) + " Transaction of weight kernal " + std::to_string(new_trans->data) + " completed successfully from Interposer Interface: " + std::to_string(interposer_id) + " to Chiplet Interface"); + }else{ + log_error(std::to_string(interposer_id) + " Error in transmitting data: " + std::to_string(new_trans->data) + " from Interposer Interface to Chiplet Interface"); + } + + + } else { + log_error(std::to_string(interposer_id) + " Invalid or unrecognized address: " + std::to_string(address)); + } + + delete new_trans; // Clean up dynamically allocated memory + // Complete the original transaction + trans.set_response_status(TLM_OK_RESPONSE); +} + + +//Handle incoming transactions from the Chiplet Interface +void InterposerInterface::chiplet_b_transport(tlm_generic_payload& trans, sc_time& delay) { + PESendPayload* orig_trans = dynamic_cast(&trans); + if (!orig_trans) { + log_error(std::to_string(interposer_id) + " Invalid transaction type (not PESendPayload)."); + trans.set_response_status(TLM_GENERIC_ERROR_RESPONSE); + return; + } + + PESendPayload* rx_trans3 = new PESendPayload(); + + sc_time current_time = sc_time_stamp(); + //manually copy the transaction payload for future use + // Log the time when the core sent the transaction + sc_time sent_time = orig_trans->timestamp; + rx_trans3->psum = orig_trans->psum; + rx_trans3->src_chiplet = orig_trans->src_chiplet; + rx_trans3->src_pe = orig_trans->src_pe; + rx_trans3->num_rows = orig_trans->num_rows; + rx_trans3->num_cols = orig_trans->num_cols; + rx_trans3->update_timestamp(current_time); + rx_trans3->set_address(orig_trans->get_address()); + rx_trans3->set_command(orig_trans->get_command()); + rx_trans3->set_data_ptr(reinterpret_cast(&rx_trans3->psum)); + rx_trans3->set_data_length(orig_trans->get_data_length()); + rx_trans3->set_streaming_width(orig_trans->get_streaming_width()); + rx_trans3->set_byte_enable_ptr(orig_trans->get_byte_enable_ptr()); + rx_trans3->set_dmi_allowed(orig_trans->is_dmi_allowed()); + + int address = rx_trans3->get_address(); // address is used to determine wavelength + + int chiplet_index = address - 0x300; + + int unicast_wavelength = chiplet_index; + + // wait(4, SC_NS); + + log_info(std::to_string(interposer_id) + " received PSUM from PE: " + std::to_string(rx_trans3->src_pe) + " through OEC with data: " + std::to_string(rx_trans3->psum)); + + // Forward the transaction to the Global Buffer + delay = SC_ZERO_TIME; + gb_send_socket->b_transport(*rx_trans3, delay); + log_info(std::to_string(interposer_id) + " Forwarding the PSUMs from PE: " + std::to_string(rx_trans3->src_pe) + " to Global Buffer "); + if(rx_trans3->get_response_status() == TLM_OK_RESPONSE) { + log_info( std::to_string(interposer_id) + " Transaction of PSUM " + std::to_string(rx_trans3->psum) + " completed successfully from Interposer Interface: " + std::to_string(interposer_id) + " to Global Buffer"); + }else{ + log_error( std::to_string(interposer_id) + "Error in transmitting PSUM: " + std::to_string(rx_trans3->psum) + " from Interposer Interface to Global Buffer"); + } + delete rx_trans3; // Clean up dynamically allocated memory + trans.set_response_status(TLM_OK_RESPONSE); // Set response status +} + + + +void InterposerInterface::log_info(std::string msg){ + SC_REPORT_INFO(I_LOG, msg.c_str()); +} + +void InterposerInterface::log_error(std::string msg){ + SC_REPORT_ERROR(I_LOG, msg.c_str()); +} \ No newline at end of file diff --git a/src/Interposer/Interposer_Interface.h b/src/Interposer/Interposer_Interface.h new file mode 100644 index 0000000..1206c12 --- /dev/null +++ b/src/Interposer/Interposer_Interface.h @@ -0,0 +1,48 @@ +#ifndef INTERPOSER_INTERFACE_H +#define INTERPOSER_INTERFACE_H + +#include +#include +#include +#include +#include +#include +#include + +using namespace tlm; + +class InterposerInterface : public sc_module { +public: + // TLM sockets + + tlm_utils::simple_target_socket gb_features_receive_socket; // Receiving from Global Buffer + tlm_utils::simple_target_socket gb_weight_receive_socket; // Receiving from Global Buffer + tlm_utils::simple_initiator_socket gb_send_socket; // Sending to Global Buffer + tlm_utils::simple_target_socket chiplet_receive_socket; // Receiving from Chiplet Interface + tlm_utils::simple_initiator_socket chiplet_features_send_socket; // Sending to Chiplet Interface + tlm_utils::simple_initiator_socket chiplet_weight_send_socket; // Sending to Chiplet Interface + + SC_HAS_PROCESS(InterposerInterface); + + InterposerInterface(sc_module_name name); + int interposer_id; + +private: + // Handle incoming transactions from the Global Buffer + void gb_features_b_transport(tlm_generic_payload& trans, sc_time& delay); + void gb_weight_b_transport(tlm_generic_payload& trans, sc_time& delay); + + // Handle incoming transactions from the Chiplet Interface + void chiplet_b_transport(tlm_generic_payload& trans, sc_time& delay); + + // Forward transaction to Chiplet Interface + //// void chiplet_features_send_transaction(tlm_generic_payload& trans); + + // Forward transaction back to Global Buffer + void gb_send_transaction(tlm_generic_payload& trans); + + void log_info(std::string msg); + void log_error(std::string msg); +}; + +#endif // INTERPOSER_INTERFACE_H \ No newline at end of file diff --git a/src/Optical_Electrical/O_E_converter.cpp b/src/Optical_Electrical/O_E_converter.cpp new file mode 100644 index 0000000..dedb622 --- /dev/null +++ b/src/Optical_Electrical/O_E_converter.cpp @@ -0,0 +1,196 @@ +#include "O_E_converter.h" +#include + +// Constructor implementation +O_E_converter::O_E_converter(sc_module_name name) + : sc_module(name) { + //sc_report_handler::set_log_file_name("out/report.log"); + sc_report_handler::set_actions(OEC_LOG, SC_INFO, SC_LOG|SC_DISPLAY); + // Register b_transport methods for GB and Processing Element s + ci_features_receive_socket.register_b_transport(this, &O_E_converter::ci_features_b_transport); + ci_weight_receive_socket.register_b_transport(this, &O_E_converter::ci_weight_b_transport); + //Register b_transport for incoming psums from PE + pe_receive_socket.register_b_transport(this, &O_E_converter::pe_b_transport); + //SC_THREAD(chiplet_send_transaction); +} + +// Handle incoming transactions from the chiplet interface +void O_E_converter::ci_features_b_transport(tlm_generic_payload& trans, sc_time& delay) { + CustomPayload* orig_trans = dynamic_cast(&trans); + if (!orig_trans) { + wait(5, SC_NS); + log_error(std::to_string(O_E_converter_id) + " Invalid transaction type (not CustomPayload)." ); + trans.set_response_status(TLM_GENERIC_ERROR_RESPONSE); + return; + } + + CustomPayload* oec_trans1 = new CustomPayload(); + + sc_time current_time = sc_time_stamp(); + //manually copy the transaction payload for future use + // Log the time when the core sent the transaction + sc_time sent_time = orig_trans->timestamp; + oec_trans1->data = orig_trans->data; + oec_trans1->num_rows = orig_trans->num_rows; + oec_trans1->num_cols = orig_trans->num_cols; + oec_trans1->update_timestamp(current_time); + oec_trans1->set_address(orig_trans->get_address()); + oec_trans1->set_command(orig_trans->get_command()); + oec_trans1->set_data_ptr(reinterpret_cast(&oec_trans1->data)); + oec_trans1->set_data_length(orig_trans->get_data_length()); + oec_trans1->set_streaming_width(orig_trans->get_streaming_width()); + oec_trans1->set_byte_enable_ptr(orig_trans->get_byte_enable_ptr()); + oec_trans1->set_dmi_allowed(orig_trans->is_dmi_allowed()); + + int address = oec_trans1->get_address(); // address is used to determine wavelength + if (address >= 0x100 && address < 0x200) { + // Single-chiplet communication + int chiplet_index = address - 0x100; + int chiplet_id = chiplet_index - PE_PER_CHIPLET; + + int single_wavelength = chiplet_index; + //log_info(std::to_string(O_E_converter_id) + " Single-chiplet communication, wavelength: " + std::to_string(single_wavelength)); + + trans.set_response_status(TLM_OK_RESPONSE); // Set response status + // Single-chiplet communication (λM) + log_info(std::to_string(O_E_converter_id) + " Received input feature: " + std::to_string(oec_trans1->data) + " with Wavelength: " + std::to_string(single_wavelength)); + //wait(sc_time(5, SC_NS)); + // Forward the transaction to the Processing Element + log_info(std::to_string(O_E_converter_id) + " Forwarding input features: " + std::to_string(oec_trans1->data) + " with Wavelength: " + std::to_string(single_wavelength) + " to Processing Element"); + // sc_time delay = SC_ZERO_TIME; + pe_features_send_socket->b_transport(*oec_trans1, delay); // Send transaction to Processing Element + + + if(oec_trans1->get_response_status() == TLM_OK_RESPONSE) { + log_info(std::to_string(O_E_converter_id) + " Transaction completed successfully from OEC: " + std::to_string(O_E_converter_id) + " to Processing Element"); + }else{ + log_error( std::to_string(O_E_converter_id) + " Error in transmitting data: " + std::to_string(oec_trans1->data) + " from OEC to PE "); + } + } else { + log_error(std::to_string(O_E_converter_id) + " Invalid or unrecognized address: " + std::to_string(address)); + } + + delete oec_trans1; // Clean up dynamically allocated memory + +} + + +// Handle incoming weight kernals from the Global Buffer +void O_E_converter::ci_weight_b_transport(tlm_generic_payload& trans, sc_time& delay) { + CustomPayload* orig_trans = dynamic_cast(&trans); + if (!orig_trans) { + + log_error(std::to_string(O_E_converter_id) + " Invalid transaction type (not CustomPayload)."); + trans.set_response_status(TLM_GENERIC_ERROR_RESPONSE); + return; + } + + CustomPayload* oec_trans2 = new CustomPayload(); + sc_time current_time = sc_time_stamp(); + //manually copy the transaction payload for future use + // Log the time when the core sent the transaction + sc_time sent_time = orig_trans->timestamp; + oec_trans2->data = orig_trans->data; + oec_trans2->num_rows = orig_trans->num_rows; + oec_trans2->num_cols = orig_trans->num_cols; + oec_trans2->update_timestamp(current_time); + oec_trans2->set_address(orig_trans->get_address()); + oec_trans2->set_command(orig_trans->get_command()); + oec_trans2->set_data_ptr(reinterpret_cast(&oec_trans2->data)); + oec_trans2->set_data_length(orig_trans->get_data_length()); + oec_trans2->set_streaming_width(orig_trans->get_streaming_width()); + oec_trans2->set_byte_enable_ptr(orig_trans->get_byte_enable_ptr()); + oec_trans2->set_dmi_allowed(orig_trans->is_dmi_allowed()); + + int address = oec_trans2->get_address(); // address is used to determine wavelength + if (address >= 0x200) { + int cross_wavelength = address - 0x200; + //log_info("Cross-chiplet communication, wavelength : " + std::to_string(cross_wavelength)); + + // Cross-chiplet communication (λ0, λ1, λ2, ...) + log_info(std::to_string(O_E_converter_id) + " Received cross-chiplet data: " + std::to_string(oec_trans2->data) + " with Wavelength: " + std::to_string(cross_wavelength)); + + + // Forward modified data to Processing Element + sc_time delay = SC_ZERO_TIME; + pe_weight_send_socket->b_transport(*oec_trans2, delay); // Send transaction to Processing Element + log_info(std::to_string(O_E_converter_id) + " Forwarding weight kernals: " + std::to_string(oec_trans2->data) + " with Wavelength: " + std::to_string(cross_wavelength) + " to Processing Element"); + + if(oec_trans2->get_response_status() == TLM_OK_RESPONSE) { + log_info( std::to_string(O_E_converter_id) + " Transaction completed successfully from OEC: " + std::to_string(O_E_converter_id) + " to Processing Element"); + }else{ + log_error(std::to_string(O_E_converter_id) + " Error in transmitting data: " + std::to_string(oec_trans2->data) + " from OEC to PE "); + } + + } else { + log_error(std::to_string(O_E_converter_id) + " Invalid or unrecognized address: " + std::to_string(address)); + + } + + delete oec_trans2; // Clean up dynamically allocated memory + // Complete the original transaction + trans.set_response_status(TLM_OK_RESPONSE); +} + + +void O_E_converter::pe_b_transport(tlm_generic_payload& trans, sc_time& delay) { + PESendPayload* orig_trans = dynamic_cast(&trans); + if (!orig_trans) { + + log_error(std::to_string(O_E_converter_id) + " Invalid transaction type (not PESendPayload)."); + trans.set_response_status(TLM_GENERIC_ERROR_RESPONSE); + return; + } + + PESendPayload* rx_trans1 = new PESendPayload(); + + sc_time current_time = sc_time_stamp(); + //manually copy the transaction payload for future use + // Log the time when the core sent the transaction + sc_time sent_time = orig_trans->timestamp; + rx_trans1->psum = orig_trans->psum; + rx_trans1->src_chiplet = orig_trans->src_chiplet; + rx_trans1->src_pe = orig_trans->src_pe; + rx_trans1->num_rows = orig_trans->num_rows; + rx_trans1->num_cols = orig_trans->num_cols; + rx_trans1->update_timestamp(current_time); + rx_trans1->set_address(orig_trans->get_address()); + rx_trans1->set_command(orig_trans->get_command()); + rx_trans1->set_data_ptr(reinterpret_cast(&rx_trans1->psum)); + rx_trans1->set_data_length(orig_trans->get_data_length()); + rx_trans1->set_streaming_width(orig_trans->get_streaming_width()); + rx_trans1->set_byte_enable_ptr(orig_trans->get_byte_enable_ptr()); + rx_trans1->set_dmi_allowed(orig_trans->is_dmi_allowed()); + + int address = rx_trans1->get_address(); // address is used to determine wavelength + + int chiplet_index = address - 0x300; + + int unicast_wavelength = chiplet_index; + + log_info(std::to_string(O_E_converter_id) + " Optical to Electrical converter received PSUM from PE: " + std::to_string(rx_trans1->src_pe) + " with data: " + std::to_string(rx_trans1->psum)); + + // Forward the transaction to the Chiplet interface + delay = SC_ZERO_TIME; + ci_send_socket->b_transport(*rx_trans1, delay); + log_info(std::to_string(O_E_converter_id) + " Forwarding the PSUMs from PE: " + std::to_string(rx_trans1->src_pe) + " to chiplet interface: " + std::to_string(rx_trans1->src_chiplet)); + if(rx_trans1->get_response_status() == TLM_OK_RESPONSE) { + log_info( std::to_string(O_E_converter_id) + " PSUM Transaction completed successfully from OEC: " + std::to_string(O_E_converter_id) + " to Chiplet Interface"); + }else{ + log_error( std::to_string(O_E_converter_id) + " Error in transmitting PSUM: " + std::to_string(rx_trans1->psum) + " from OEC to Chiplet Interface "); + } + + + delete rx_trans1; // Clean up dynamically allocated memory + trans.set_response_status(TLM_OK_RESPONSE); // Set response status +} + + + +void O_E_converter::log_info(std::string msg){ + SC_REPORT_INFO(OEC_LOG, msg.c_str()); +} + +void O_E_converter::log_error(std::string msg){ + SC_REPORT_ERROR(OEC_LOG, msg.c_str()); +} \ No newline at end of file diff --git a/src/Optical_Electrical/O_E_converter.h b/src/Optical_Electrical/O_E_converter.h new file mode 100644 index 0000000..5f66229 --- /dev/null +++ b/src/Optical_Electrical/O_E_converter.h @@ -0,0 +1,48 @@ +#ifndef O_E_CONVERTER_H +#define O_E_CONVERTER_H + +#include +#include +#include +#include +#include +#include +#include + +using namespace tlm; + +class O_E_converter : public sc_module { +public: + // TLM sockets + + tlm_utils::simple_target_socket ci_features_receive_socket; // Receiving from Chiplet Interface + tlm_utils::simple_target_socket ci_weight_receive_socket; // Receiving from Chiplet Interface + tlm_utils::simple_initiator_socket ci_send_socket; // Sending to Chiplet Interface + tlm_utils::simple_target_socket pe_receive_socket; // Receiving from PE + tlm_utils::simple_initiator_socket pe_features_send_socket; // Sending to PE + tlm_utils::simple_initiator_socket pe_weight_send_socket; // Sending to PE + + SC_HAS_PROCESS(O_E_converter); + + O_E_converter(sc_module_name name); + + int O_E_converter_id; + +private: + // Handle incoming transactions from the Chiplet Interface + void ci_features_b_transport(tlm_generic_payload& trans, sc_time& delay); + void ci_weight_b_transport(tlm_generic_payload& trans, sc_time& delay); + + // Handle incoming transactions from the processing element + void pe_b_transport(tlm_generic_payload& trans, sc_time& delay); + + // Forward transaction to Chiplet Interface + void chiplet_send_transaction(tlm_generic_payload& trans); + + // Forward transaction back to chiplet + void chiplet_send_transaction(); + void log_info(std::string msg); + void log_error(std::string msg); +}; + +#endif // INTERPOSER_INTERFACE_H \ No newline at end of file diff --git a/src/PE/Processing_Element.cpp b/src/PE/Processing_Element.cpp new file mode 100644 index 0000000..438db94 --- /dev/null +++ b/src/PE/Processing_Element.cpp @@ -0,0 +1,190 @@ +#include "Processing_Element.h" + +// PE module with FIFOs, semaphores, and capacity control for receive FIFO +ProcessingElement::ProcessingElement(sc_module_name name, TokenManager& token_ref) +: sc_module(name), token(token_ref), features_fifo(IFMAP_FIFO_CAPACITY), weight_fifo(WEIGHT_FIFO_CAPACITY), psum_fifo(ACC_FIFO_CAPACITY), pe_id(-1) // default ProcessingElement id +{ + //sc_report_handler::set_log_file_name("out/report.log"); + sc_report_handler::set_actions(PE_LOG, SC_INFO, SC_LOG|SC_DISPLAY); + + oec_features_receive_socket.register_b_transport(this, &ProcessingElement::oec_features_b_transport); //register the b_transport fun to each target socket to receive data from oec + oec_weight_receive_socket.register_b_transport(this, &ProcessingElement::oec_weight_b_transport); + + SC_THREAD(process_convolution); //process to handle data in the input fifo + SC_THREAD(process_psum_send); //process to send the data available in output fifo to destination +} + + + +void ProcessingElement::oec_features_b_transport(tlm_generic_payload& trans, sc_time& delay) { + CustomPayload* orig_trans = dynamic_cast(&trans); + if (!orig_trans) { + // wait(4, SC_NS); + log_error(std::to_string(pe_id) + " Invalid transaction type (not CustomPayload)."); + trans.set_response_status(TLM_GENERIC_ERROR_RESPONSE); + return; + } + + CustomPayload* pe_trans1 = new CustomPayload(); + + sc_time current_time = sc_time_stamp(); + //manually copy the transaction payload for future use + // Log the time when the core sent the transaction + sc_time sent_time = orig_trans->timestamp; + pe_trans1->data = orig_trans->data; + pe_trans1->num_rows = orig_trans->num_rows; + pe_trans1->num_cols = orig_trans->num_cols; + pe_trans1->update_timestamp(current_time); + pe_trans1->set_address(orig_trans->get_address()); + pe_trans1->set_command(orig_trans->get_command()); + pe_trans1->set_data_ptr(reinterpret_cast(&pe_trans1->data)); + pe_trans1->set_data_length(orig_trans->get_data_length()); + pe_trans1->set_streaming_width(orig_trans->get_streaming_width()); + pe_trans1->set_byte_enable_ptr(orig_trans->get_byte_enable_ptr()); + pe_trans1->set_dmi_allowed(orig_trans->is_dmi_allowed()); + + int address = pe_trans1->get_address(); // address is used to determine wavelength + if (address >= 0x100 && address < 0x200) { + // Single-chiplet communication + int chiplet_index = address - 0x100; + int chiplet_id = chiplet_index - PE_PER_CHIPLET; + + int single_wavelength = chiplet_index; + //log_info(std::to_string(pe_id) + " Single-chiplet communication, wavelength: " + std::to_string(single_wavelength)); + // wait(4, SC_NS); + // Single-chiplet communication (λM) + log_info(std::to_string(pe_id) + " Received input feature: " + std::to_string(pe_trans1->data) + " with Wavelength: " + std::to_string(single_wavelength)); + + features_fifo.write(pe_trans1 -> data); //Write input features to fifo + + log_info(std::to_string(pe_id) + " writing the input features: " + std::to_string(pe_trans1->data) + " with Wavelength: " + std::to_string(single_wavelength) + " to FiFo"); + + } else { + + log_error(std::to_string(pe_id) + " Invalid or unrecognized address: " + std::to_string(address)); + + } + + delete pe_trans1; // Clean up dynamically allocated memory + trans.set_response_status(TLM_OK_RESPONSE); // Set response status +} + + +// Handle incoming weight kernals from the Global Buffer +void ProcessingElement::oec_weight_b_transport(tlm_generic_payload& trans, sc_time& delay) { + CustomPayload* orig_trans = dynamic_cast(&trans); + if (!orig_trans) { + // wait(4, SC_NS); + log_error(std::to_string(pe_id) + " Invalid transaction type (not CustomPayload)."); + trans.set_response_status(TLM_GENERIC_ERROR_RESPONSE); + return; + } + + CustomPayload* pe_trans2 = new CustomPayload(); + sc_time current_time = sc_time_stamp(); + //manually copy the transaction payload for future use + // Log the time when the core sent the transaction + sc_time sent_time = orig_trans->timestamp; + pe_trans2->data = orig_trans->data; + pe_trans2->num_rows = orig_trans->num_rows; + pe_trans2->num_cols = orig_trans->num_cols; + pe_trans2->update_timestamp(current_time); + pe_trans2->set_address(orig_trans->get_address()); + pe_trans2->set_command(orig_trans->get_command()); + pe_trans2->set_data_ptr(reinterpret_cast(&pe_trans2->data)); + pe_trans2->set_data_length(orig_trans->get_data_length()); + pe_trans2->set_streaming_width(orig_trans->get_streaming_width()); + pe_trans2->set_byte_enable_ptr(orig_trans->get_byte_enable_ptr()); + pe_trans2->set_dmi_allowed(orig_trans->is_dmi_allowed()); + + int address = pe_trans2->get_address(); // address is used to determine wavelength + if (address >= 0x200) { + int cross_wavelength = address - 0x200; + //log_info("Cross-chiplet communication, wavelength : " + std::to_string(cross_wavelength)); + // wait(4, SC_NS); + // Cross-chiplet communication (λ0, λ1, λ2, ...) + log_info(std::to_string(pe_id) + " Received cross-chiplet data: " + std::to_string(pe_trans2->data) + " with Wavelength: " + std::to_string(cross_wavelength)); + + weight_fifo.write(pe_trans2-> data); //Write weights to fifo + + log_info(std::to_string(pe_id) + " Saving weight kernals: " + std::to_string(pe_trans2->data) + " with Wavelength: " + std::to_string(cross_wavelength) + " to Fifo"); + + } else { + + log_error(std::to_string(pe_id) + " Invalid or unrecognized address: " + std::to_string(address)); + + } + + delete pe_trans2; // Clean up dynamically allocated memory + // Complete the original transaction + trans.set_response_status(TLM_OK_RESPONSE); +} + + + + +// Thread to process input fifo +void ProcessingElement::process_convolution() { + + while (true) { + + // Wait for data in the input FIFO + int features = features_fifo.read(); // Blocking read + int weight = weight_fifo.read(); // Blocking read + int psum = features * weight; + psum_fifo.write(psum); + + } +} + + +// Thread to process ProcessingElement_psum_fifo and forward transactions to gb +void ProcessingElement::process_psum_send() { + PESendPayload* trans = nullptr; + sc_core::sc_time prev_timestamp = sc_time(0.1, SC_NS); + while (true) { + bool success = false; + while (!success) { + int psum = psum_fifo.read(); // Blocking read + if (token.request_token(pe_id, pe_chiplet_id)) { + unsigned int src_chiplet = pe_chiplet_id; + unsigned int src_pe = pe_id; + unsigned int num_rows = rand() % 5; + unsigned int num_cols = rand() % 5; + // Create a new payload for each chiplet + trans = new PESendPayload(src_chiplet, src_pe, num_rows, num_cols, psum, sc_time_stamp()); + int chiplet_index = 0x300 + (pe_chiplet_id); // Address for wavelength λ8 onward + trans->update_timestamp(sc_time_stamp()); // Set the current simulation time + // Set TLM payload fields + trans->set_command(TLM_WRITE_COMMAND); + trans->set_address(chiplet_index); + trans->set_byte_enable_ptr(nullptr); + trans->set_dmi_allowed(false); + sc_time delay = SC_ZERO_TIME; + // wait(4, SC_NS); + // Attempt transaction + log_info(std::to_string(pe_id) + " Transmitting PSUM: " + std::to_string(psum)); + oec_send_socket ->b_transport(*trans, delay); + if(trans->get_response_status() == TLM_OK_RESPONSE) { + log_info( std::to_string(pe_id) + " Transaction of PSUM completed successfully at time " + sc_time_stamp().to_string() + " from PE: " + std::to_string(pe_id) + " to OEC"); + }else{ + log_error(std::to_string(pe_id) + " Error in transmitting PSUM: " + std::to_string(psum) + " from PE to OEC "); + } + token.release_token(pe_id, pe_chiplet_id); + success = true; + } else{ + log_info(std::to_string(pe_id) + ": Token of the Chiplet" + std::to_string(pe_chiplet_id) + " is unavailable. Retrying with data: " + std::to_string(psum)); + wait(sc_time(5, SC_NS)); // Wait before retrying + } + } + } +} + +//print log messages +void ProcessingElement::log_info(std::string msg){ + SC_REPORT_INFO(PE_LOG, msg.c_str()); +} + +void ProcessingElement::log_error(std::string msg){ + SC_REPORT_ERROR(PE_LOG, msg.c_str()); +} \ No newline at end of file diff --git a/src/PE/Processing_Element.h b/src/PE/Processing_Element.h new file mode 100644 index 0000000..e29ec97 --- /dev/null +++ b/src/PE/Processing_Element.h @@ -0,0 +1,71 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // For rand() +#include // For time() + +#include "src/utils/configuration.h" +#include "src/utils/token_manager.h" +#include "src/utils/noc_logger.h" + +using namespace sc_core; +using namespace tlm; + +class ProcessingElement : public sc_module { +public: + // TLM sockets + + tlm_utils::simple_target_socket oec_features_receive_socket; // Receiving from Chiplet Interface + tlm_utils::simple_target_socket oec_weight_receive_socket; // Receiving from Chiplet Interface + tlm_utils::simple_initiator_socket oec_send_socket; // Sending to Chiplet Interface + + sc_core::sc_fifo features_fifo; // FIFO for incoming features transactions from oec + sc_core::sc_fifo weight_fifo; // FIFO for incoming weight transactions from oec + sc_core::sc_fifo psum_fifo; // FIFO for transactions to be processed by the pe + + sc_core::sc_event psum_written_event; + + SC_HAS_PROCESS(ProcessingElement); + + explicit ProcessingElement(sc_module_name name, TokenManager& token_ref); + + int pe_id; + int pe_chiplet_id; + + + // Add a pointer to the semaphore manager + // TokenManager* tok_mgr; + + +private: + TokenManager& token; // Reference to the Token instance + // Handle incoming transactions from the OEC + void oec_features_b_transport(tlm_generic_payload& trans, sc_time& delay); + void oec_weight_b_transport(tlm_generic_payload& trans, sc_time& delay); + + + + // Thread to process ml + void process_convolution(); + + void process_psum_send(); + + void log_info(std::string msg); + void log_error(std::string msg); + + // Method to set the semaphore manager instance after creation + // void set_token_manager(TokenManager* manager) { + // tok_mgr = manager; +// } + +}; + diff --git a/src/utils/configuration.h b/src/utils/configuration.h new file mode 100644 index 0000000..d87e698 --- /dev/null +++ b/src/utils/configuration.h @@ -0,0 +1,125 @@ +/******************************************************************************* + * Copyright (C) 2024 + * + * 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 +#include +#include +#include +// #include "ratatoskrUtils/utils/Structures.h" +// #include +// #include + +using namespace sc_core; // For sc_time + +// Global parameters to generalize the design +#define PE_NO 16 // Number of routers +#define CHIPLET_NO 4 +#define PE_PER_CHIPLET (PE_NO/CHIPLET_NO) // Number of NIs per router +#define IFMAP_FIFO_CAPACITY 20 // Capacity of FIFO in PE +#define WEIGHT_FIFO_CAPACITY 64 // Capacity of FIFO +#define ACC_FIFO_CAPACITY 20 +#define INTERPOSER_INTERFACE 8 // +#define NUM_MATRICES 10 + +#define LOG_NAME "MY_LOG" +#define NI_LOG "TLM_NI" + + +struct CustomPayload : public tlm::tlm_generic_payload { + + unsigned int num_rows; // Number of rows in the matrix + unsigned int num_cols; // Number of columns in the matrix + int data; // Flattened matrix data + sc_core::sc_time timestamp; // Timestamp field + + // Default constructor + CustomPayload() + : num_rows(0), + num_cols(0), + data(0), + timestamp(sc_core::SC_ZERO_TIME) { + set_data_ptr(reinterpret_cast(&data)); + set_data_length(sizeof(data)); + set_streaming_width(sizeof(data)); + } + + // Constructor with random data + CustomPayload(unsigned int num_rows, unsigned int num_cols, int data, sc_core::sc_time time = sc_core::SC_ZERO_TIME) + : num_rows(num_rows), + num_cols(num_cols), + data(data), + timestamp(time) { + + set_data_ptr(reinterpret_cast(&data)); + set_data_length(sizeof(data)); + set_streaming_width(sizeof(data)); + } + + // Function to update the timestamp at any stage + void update_timestamp(sc_core::sc_time new_time) { + timestamp = new_time; + } +}; + +struct PESendPayload : public tlm::tlm_generic_payload { + unsigned int src_chiplet; + unsigned int src_pe; + unsigned int num_rows; // Number of rows in the matrix + unsigned int num_cols; // Number of columns in the matrix + int psum; // Flattened matrix data + sc_core::sc_time timestamp; // Timestamp field + + // Default constructor + PESendPayload() + : src_chiplet(0), + src_pe(0), + num_rows(0), + num_cols(0), + psum(0), + timestamp(sc_core::SC_ZERO_TIME) { + set_data_ptr(reinterpret_cast(&psum)); + set_data_length(sizeof(psum)); + set_streaming_width(sizeof(psum)); + } + + // Constructor with random data + PESendPayload(unsigned int src_chiplet, unsigned int src_pe, unsigned int num_rows, unsigned int num_cols, int psum, sc_core::sc_time time = sc_core::SC_ZERO_TIME) + : src_chiplet(src_chiplet), + src_pe(src_pe), + num_rows(num_rows), + num_cols(num_cols), + psum(psum), + timestamp(time) { + + set_data_ptr(reinterpret_cast(&psum)); + set_data_length(sizeof(psum)); + set_streaming_width(sizeof(psum)); + + } + + // Function to update the timestamp at any stage + void update_timestamp(sc_core::sc_time new_time) { + timestamp = new_time; + } +}; diff --git a/src/utils/memory_manager.cpp b/src/utils/memory_manager.cpp new file mode 100644 index 0000000..0621b99 --- /dev/null +++ b/src/utils/memory_manager.cpp @@ -0,0 +1,40 @@ +#include "memory_manager.h" + +// ************************************************************************************** +// User-defined memory manager, which maintains a pool of transactions +// ************************************************************************************** + + +MemoryManager::gp_t* MemoryManager::allocate() { + gp_t* ptr; + if (free_list) { + ptr = free_list->trans; + empties = free_list; + free_list = free_list->next; + } + else { + ptr = new gp_t(this); + } + return ptr; +} + +void MemoryManager::free(gp_t* trans) +{ + if (!empties) { + empties = new access; + empties->next = free_list; + empties->prev = 0; + if (free_list) + free_list->prev = empties; + } + free_list = empties; + free_list->trans = trans; + empties = free_list->prev; +} + +// Generate a random delay (with power-law distribution) to aid testing and stress the protocol +int rand_ps() { + int n = rand() % 100; + n = n * n * n; + return n / 100; +} diff --git a/src/utils/memory_manager.h b/src/utils/memory_manager.h new file mode 100644 index 0000000..3dc7072 --- /dev/null +++ b/src/utils/memory_manager.h @@ -0,0 +1,32 @@ +#pragma once + +#ifndef SC_INCLUDE_DYNAMIC_PROCESSES +#define SC_INCLUDE_DYNAMIC_PROCESSES +#endif + +#include "tlm.h" +#include "systemc" +using namespace sc_core; +using namespace sc_dt; +using namespace std; + +class MemoryManager: public tlm::tlm_mm_interface { + typedef tlm::tlm_generic_payload gp_t; + +public: + MemoryManager() : free_list(0), empties(0) + {} + + gp_t* allocate(); + void free(gp_t* trans); + +private: + struct access { + gp_t* trans; + access* next; + access* prev; + }; + + access* free_list; + access* empties; +}; diff --git a/src/utils/noc_logger.cpp b/src/utils/noc_logger.cpp new file mode 100644 index 0000000..717bf30 --- /dev/null +++ b/src/utils/noc_logger.cpp @@ -0,0 +1,101 @@ +#include "noc_logger.h" +#include +#include +#include + +#define NOC_LOG "NOC_LOG" + +using namespace sc_core; +using namespace sc_dt; +using namespace std; + +const string severity_str[5] = {"INFO", "WARNING", "ERROR", "FATAL", ""}; + +void report_handler(const sc_report& report, const sc_actions& actions){ + stringstream ss_msg; + ss_msg << report.get_time() << ": " + << severity_str[report.get_severity()] << ": " + << report.get_msg_type() << ": " << report.get_msg() + << std::endl; + + if (actions & SC_DISPLAY) { + string col_code; + switch (report.get_severity()){ + case SC_INFO: + col_code = ASCII_GREEN; + break; + case SC_WARNING: + col_code = ASCII_YELLOW; + break; + case SC_ERROR: + case SC_FATAL: + col_code = ASCII_RED; + break; + default: + col_code = ""; + break; + } + + if (! report.get_severity()==SC_INFO ){ + string formatted_msg = "\033[0;" + col_code + "m" + + ss_msg.str() + "\033[0m"; + cout << formatted_msg; + } + } + + if (actions & SC_LOG) { + string log_filename = DEF_LOGFILENAME; + if(string(report.get_msg_type()) == GB_LOG){ + log_filename = GB_LOGFILENAME; + } + else if(string(report.get_msg_type()) == I_LOG){ + log_filename = I_LOGFILENAME; + } + else if(string(report.get_msg_type()) == C_LOG){ + log_filename = C_LOGFILENAME; + } + else if(string(report.get_msg_type()) == OEC_LOG){ + log_filename = OEC_LOGFILENAME; + } + else if(string(report.get_msg_type()) == PE_LOG){ + log_filename = PE_LOGFILENAME; + } + + ofstream log_file; + log_file.open(log_filename, std::ios_base::app); + log_file << ss_msg.str(); + log_file.close(); + } +} + + +void setup_logger(){ + // empty old log files + ofstream log_file; + log_file.open(GB_LOGFILENAME); + log_file.close(); + log_file.open(I_LOGFILENAME); + log_file.close(); + log_file.open(C_LOGFILENAME); + log_file.close(); + log_file.open(OEC_LOGFILENAME); + log_file.close(); + log_file.open(PE_LOGFILENAME); + log_file.close(); + log_file.open(DEF_LOGFILENAME); + log_file.close(); + + sc_report_handler::set_handler(report_handler); +} + +/*void creds_log_info(string router_name, uint8_t link, uint8_t num_creds, + bool is_ext){ + string msg = is_ext? ": #external credits" : ": #internal credits"; + SC_REPORT_INFO(NOC_LOG, (router_name + msg + ": on link "+ + str_dir[link]+": "+to_string(num_creds)).c_str()); +}*/ + + +void cout_logger(string msg){ + cout << sc_time_stamp() << ": "<< msg < +#include "configuration.h" +#include "utils.h" + +#define DEF_LOGFILENAME "./out/report.log" + +#define GB_LOGFILENAME "./out/gb_comm.log" +#define GB_LOG "GlobalBuffer" + +#define I_LOGFILENAME "./out/interposer_comm.log" +#define I_LOG "InterposerInterface" + +#define C_LOGFILENAME "./out/chiplet_comm.log" +#define C_LOG "ChipletInterface" + +#define OEC_LOGFILENAME "./out/oec_comm.log" +#define OEC_LOG "OpticalToElectrical" + +#define PE_LOGFILENAME "./out/pe_comm.log" +#define PE_LOG "ProcessingElement" + +#define ASCII_RED "31" +#define ASCII_GREEN "32" +#define ASCII_YELLOW "33" + +const std::string str_dir[Direction::num_dirs] = {"local","east","west","north","south","up","down"}; + +/** + * Handles log messages (writes to console and log) + * + * @param report report object with log information + * @param actions valid actions + */ +void report_handler(const sc_report& report, const sc_actions& actions); + +/** + * Configure sc report handler filename and actions + */ +void setup_logger(); + +//void creds_log_info(std::string router_name, uint8_t link, uint8_t num_creds, bool is_ext); + +/** + * Log to cout + */ +void cout_logger(std::string msg); diff --git a/src/utils/token_manager.h b/src/utils/token_manager.h new file mode 100644 index 0000000..d1b61e6 --- /dev/null +++ b/src/utils/token_manager.h @@ -0,0 +1,158 @@ +/******************************************************************************* + * Copyright (C) 2024 + * + * 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. + ******************************************************************************/ +// token_manager.h +#ifndef TOKEN_MANAGER_H +#define TOKEN_MANAGER_H + +#include +#include +#include +#include +#include +#include +#include "configuration.h" + +using namespace sc_core; + +class TokenManager : public sc_module { +public: + SC_HAS_PROCESS(TokenManager); + + TokenManager(sc_module_name name) : sc_module(name) { + token_owner =- 1; // Start with all tokens unowned + request_queues.resize(PE_PER_CHIPLET); // Initialize a queue for each token + queue_entries.resize(PE_PER_CHIPLET); // Set for each token to track queued PEs + token_status = false; // All tokens are initially free + last_pe_owner = -1; // Initialize last owner to -1 + sc_report_handler::set_log_file_name("out/report.log"); + sc_report_handler::set_actions(LOG_NAME, SC_INFO, SC_LOG|SC_DISPLAY); + // Declare the token for access control + //sc_core::sc_semaphore sem; + } + + // Request a token for a specific PE with round-robin priority ordering + bool request_token(int pe_id, int token_id) { + //wait(SC_ZERO_TIME); + std::lock_guard lock(mutex); // Ensure atomic access + if (token_id >= 0 && token_id < CHIPLET_NO) { + wait(SC_ZERO_TIME); + // Give priority as the request follows round-robin order from the last owner + if (token_owner == pe_id || (token_owner == -1 && request_queues[pe_id].empty())) + { + log_info("Token for the chiplet " + std::to_string(token_id) + " granted to PE " + std::to_string(pe_id)); + token_owner = pe_id; + token_status = true; // Mark token as in use + last_pe_owner = pe_id; // Update last owner + return true; + } else { + if (queue_entries[pe_id].find(pe_id) == queue_entries[pe_id].end()) { + request_queues[pe_id].push(pe_id); + queue_entries[pe_id].insert(pe_id); // Track in the set + log_info("PE " + std::to_string(pe_id) + " added to queue for token " + std::to_string(token_id)); + } + } + } + return false; + } + + // Release the token and pass it to the next in round-robin order + bool release_token(int pe_id, int token_id) { + std::lock_guard lock(mutex); // Ensure atomic access + if (token_id >= 0 && token_id < CHIPLET_NO) { + if (token_owner == pe_id) { + log_info("PE " + std::to_string(pe_id) + " released token for the chiplet " + std::to_string(token_id)); + + if (!request_queues[token_id].empty()) { + // Start searching from the next pe in clockwise order + int next_pe = -1; + int start_pe = (pe_id + 1) % CHIPLET_NO; // Start clockwise from the next pe + + // Search for the first pe in queue that is in clockwise order + for (int i = 0; i < CHIPLET_NO; ++i) { + int candidate_pe = (start_pe + i) % CHIPLET_NO; + + // Check if this candidate is in the queue + if (queue_entries[pe_id].find(candidate_pe) != queue_entries[pe_id].end()) { + next_pe = candidate_pe; + break; + } + } + + if (next_pe != -1) { + // Assign the token to the found pe + token_owner = next_pe; + token_status = true; // Mark token as in use + + // Remove next_pe from the queue and queue_entries + std::queue temp_queue; + while (!request_queues[pe_id].empty()) { + int current_pe = request_queues[pe_id].front(); + request_queues[pe_id].pop(); + + if (current_pe != next_pe) { + temp_queue.push(current_pe); // Keep all others in the queue + } + } + request_queues[pe_id] = temp_queue; + queue_entries[pe_id].erase(next_pe); // Remove from set + + log_info("Token of the Chiplet " + std::to_string(token_id) + " passed to PE " + std::to_string(next_pe)); + } + } else { + token_owner= -1; // No one else is waiting, so free the token + token_status = false; // Mark token as free + } + return true; + } + } + return false; +} + +bool peek_token(int pe_id, int token_id) { + if(token_status == false) + { + return true; + } + return false; +} + +private: + int token_owner; // Tracks pe ownership (-1 means no owner) + std::vector> request_queues; // Queue of pending requests per token + bool token_status; // token availability + sc_mutex mutex; // Mutex to ensure atomic operations + std::vector> queue_entries; // Track entries in each queue to prevent duplicates + int last_pe_owner; // to track last owner for round-robin assignment + + //print log messages + void log_info(std::string msg){ + SC_REPORT_INFO(LOG_NAME, msg.c_str()); + } + + void log_error(std::string msg){ + SC_REPORT_ERROR(LOG_NAME, msg.c_str()); + } + +}; + +#endif // TOKEN_MANAGER_H + diff --git a/src/utils/utils.cpp b/src/utils/utils.cpp new file mode 100644 index 0000000..6c453b1 --- /dev/null +++ b/src/utils/utils.cpp @@ -0,0 +1,39 @@ +#include "utils.h" +#include "configuration.h" +#include "ratatoskrUtils/utils/GlobalResources.h" +#include + +using namespace std; + +void get_pos_distances(float distances[3], vector gr_pos[3]){ + GlobalResources& globalResources = GlobalResources::getInstance(); + gr_pos[0] = globalResources.xPositions; + gr_pos[1] = globalResources.yPositions; + gr_pos[2] = globalResources.zPositions; + distances[0] = min_element(gr_pos[0].begin(), gr_pos[0].end())[1]; + distances[1] = min_element(gr_pos[1].begin(), gr_pos[1].end())[1]; + distances[2] = min_element(gr_pos[2].begin(), gr_pos[2].end())[1]; +} + +void convert_pos_to_int(float pos_float[3], uint8_t pos_int[3]){ + float dists[3]; + vector gr_pos[3]; + get_pos_distances(dists, gr_pos); + + pos_int[0] = round(pos_float[0]/dists[0]); + pos_int[1] = round(pos_float[1]/dists[1]); + pos_int[2] = round(pos_float[2]/dists[2]); +} + +void get_max_pos(uint8_t max_pos[3]){ + float dists[3]; + vector gr_pos[3]; + get_pos_distances(dists, gr_pos); + + max_pos[0] = 1+round(max_element(gr_pos[0].begin(), + gr_pos[0].end())[0]/dists[0]); + max_pos[1] = 1+round(max_element(gr_pos[1].begin(), + gr_pos[1].end())[0]/dists[1]); + max_pos[2] = 1+round(max_element(gr_pos[2].begin(), + gr_pos[2].end())[0]/dists[2]); +} \ No newline at end of file diff --git a/src/utils/utils.h b/src/utils/utils.h new file mode 100644 index 0000000..19e8d4e --- /dev/null +++ b/src/utils/utils.h @@ -0,0 +1,64 @@ +/******************************************************************************* + * Copyright (C) 2024 + * + * 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 +#include "configuration.h" + +using namespace sc_core; + +enum Direction{ + local = 0, + east, + west, + north, + south, + up, + down, + num_dirs, + invalid = num_dirs +}; + +typedef Direction Dir; + +/** + * Get the distance between two elements for every axis + * + * @param distances array to store the value of distances + */ +void get_pos_distances(float distances[3]); + +/** + * Transform the position in range 0 to 1 to an integer value + * in range 0 to max position-1 + * + * @param pos_float array with the positions as float + * @param pos_float array to store the value of converted positions + */ +void convert_pos_to_int(float pos_float[3], uint8_t pos_int[3]); + +/** + * Gets the maximum positions of the noc + * + * @param max_pos array to store the value of max positions + */ +void get_max_pos(uint8_t max_pos[3]); diff --git a/weight_kernels.txt b/weight_kernels.txt new file mode 100644 index 0000000..19893fa --- /dev/null +++ b/weight_kernels.txt @@ -0,0 +1,29 @@ +34 44 +87 47 + +78 79 +5 17 + +10 53 +64 99 + +58 27 +9 98 + +36 32 +76 5 + +9 93 +78 98 + +99 57 +21 25 + +56 89 +92 48 + +24 47 +23 97 + +40 35 +54 48