Skip to content

Commit

Permalink
Compiling DRAMSim3 and DMA memory libraries with the x86 simulator
Browse files Browse the repository at this point in the history
  • Loading branch information
sripathi-muralitharan committed Apr 30, 2021
1 parent 8af25eb commit f2cc40d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion libraries/platforms/dromajo-vcs/compilation.mk
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ NC=\033[0m
# This file REQUIRES several variables to be set. They are typically
# set by the Makefile that includes this makefile..
#
DEFINES += -UVCS -D_DRAMFS
DEFINES += -D_DRAMFS
INCLUDES += -I$(LIBRARIES_PATH)
INCLUDES += -I$(BSG_PLATFORM_PATH)/software/include
INCLUDES += -I$(BSG_PLATFORM_PATH)
Expand Down
15 changes: 13 additions & 2 deletions libraries/platforms/dromajo-vcs/library.mk
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,17 @@ $(DROMAJO_OBJECTS): CXXFLAGS := -std=c++11 -fPIC -Wall -Wno-parentheses -MMD -D_
$(DROMAJO_OBJECTS): LDFLAGS := -fPIC
$(DROMAJO_OBJECTS): RV_CXX = $(CXX)

include $(LIBRARIES_PATH)/features/dma/simulation/dramsim3.mk
include $(LIBRARIES_PATH)/features/dma/simulation/libdmamem.mk

$(LIBRARIES_PATH)/features/dma/simulation/libdmamem.so: CXXFLAGS := $(filter-out -march=%,$(CXXFLAGS))
$(LIBRARIES_PATH)/features/dma/simulation/libdmamem.so: CXXFLAGS := $(filter-out -mabi=%,$(CXXFLAGS))
$(LIBRARIES_PATH)/features/dma/simulation/libdmamem.so: CXXFLAGS := $(filter-out -mcmodel=%,$(CXXFLAGS))
$(LIBRARIES_PATH)/features/dma/simulation/libdmamem.so: CXXFLAGS := $(filter-out -D_DRAMFS,$(CXXFLAGS))
$(LIBRARIES_PATH)/features/dma/simulation/libdmamem.so: INCLUDES :=

$(LIBRARIES_PATH)/features/dma/simulation/libdramsim3.so: INCLUDES :=

PLATFORM_CXXSOURCES += $(BSG_PLATFORM_PATH)/bsg_manycore_simulator.cpp

PLATFORM_OBJECTS += $(patsubst %cpp,%o,$(PLATFORM_CXXSOURCES))
Expand All @@ -114,8 +125,8 @@ $(PLATFORM_OBJECTS): INCLUDES += -I$(VCS_HOME)/linux64/lib/
$(PLATFORM_OBJECTS): INCLUDES += -I$(BSG_MANYCORE_DIR)/testbenches/dpi/
$(PLATFORM_OBJECTS): INCLUDES += -I$(BASEJUMP_STL_DIR)/bsg_test/
$(PLATFORM_OBJECTS): INCLUDES += -I$(BLACKPARROT_DIR)/sdk/dromajo/include
$(PLATFORM_OBJECTS): CFLAGS := -std=c11 -fPIC -DVCS -D_GNU_SOURCE -DVERILATOR -D_BSD_SOURCE -D_XOPEN_SOURCE=500 $(INCLUDES)
$(PLATFORM_OBJECTS): CXXFLAGS := -std=c++11 -fPIC -DVCS -D_GNU_SOURCE -DVERILATOR -D_BSD_SOURCE -D_XOPEN_SOURCE=500 $(INCLUDES)
$(PLATFORM_OBJECTS): CFLAGS := -std=c11 -fPIC -DVCS -D_GNU_SOURCE -DVERILATOR -D_BSD_SOURCE -D_XOPEN_SOURCE=500
$(PLATFORM_OBJECTS): CXXFLAGS := -std=c++11 -fPIC -DVCS -D_GNU_SOURCE -DVERILATOR -D_BSD_SOURCE -D_XOPEN_SOURCE=500
$(PLATFORM_OBJECTS): LDFLAGS := -fPIC
$(PLATFORM_OBJECTS): RV_CXX = $(CXX)

Expand Down
8 changes: 7 additions & 1 deletion libraries/platforms/dromajo-vcs/link.mk
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,12 @@ $(BSG_PLATFORM_PATH)/test.riscv:
$(BSG_PLATFORM_PATH)/libbsg_manycore_platform.so.1.0: $(DROMAJO_OBJECTS)
$(BSG_PLATFORM_PATH)/libbsg_manycore_platform.so.1.0: $(PLATFORM_OBJECTS)
$(BSG_PLATFORM_PATH)/libbsg_manycore_platform.so.1.0: LDFLAGS := -fPIC
$(BSG_PLATFORM_PATH)/libbsg_manycore_platform.so.1.0: LDFLAGS += -L$(LIBRARIES_PATH)/features/dma/simulation -Wl,-rpath=$(LIBRARIES_PATH)/features/dma/simulation -ldmamem
$(BSG_PLATFORM_PATH)/libbsg_manycore_platform.so.1.0: $(LIBRARIES_PATH)/features/dma/simulation/libdmamem.so
$(BSG_PLATFORM_PATH)/libbsg_manycore_platform.so.1.0: LDFLAGS += -L$(LIBRARIES_PATH)/features/dma/simulation -Wl,-rpath=$(LIBRARIES_PATH)/features/dma/simulation -ldramsim3
$(BSG_PLATFORM_PATH)/libbsg_manycore_platform.so.1.0: $(LIBRARIES_PATH)/features/dma/simulation/libdramsim3.so
$(BSG_PLATFORM_PATH)/libbsg_manycore_platform.so.1.0:
$(CXX) -shared -Wl,-soname,$(basename $(notdir $@)) -o $@ $^ $(LDFLAGS)
$(CXX) -shared -Wl,-soname,$(basename $(notdir $@)) -o $@ $(DROMAJO_OBJECTS) $(PLATFORM_OBJECTS) $(LDFLAGS)

$(BSG_PLATFORM_PATH)/libbsg_manycore_platform.so.1: %: %.0
ln -sf $@.0 $@
Expand Down Expand Up @@ -176,6 +180,8 @@ platform.link.clean:
rm -rf *.vcs.log
rm -rf vc_hdrs.h
rm -rf *.debug *.profile *.saifgen *.exec
rm -rf *.elf
rm -rf $(BSG_PLATFORM_PATH)/*.riscv

link.clean: platform.link.clean ;

0 comments on commit f2cc40d

Please sign in to comment.