SPACX_NoC_Architecture/Makefile
2025-01-02 16:42:56 +01:00

81 lines
2.2 KiB
Makefile

# 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