Skip to content

Commit

Permalink
Improve resource copy code
Browse files Browse the repository at this point in the history
  • Loading branch information
erlingrj committed Jan 20, 2024
1 parent 6d281f8 commit 3331bce
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
16 changes: 14 additions & 2 deletions src/main/resources/script/VerilatorMakefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,28 @@ ifeq ($(TRACE),true)
CC_OPTIONS := -CFLAGS "-DTRACE"
endif

includeMakefile := include.mk

ifdef includeMakefile
ifneq ("$(wildcard $(includeMakefile))","")
include $(includeMakefile)
else
$(error $(includeMakefile) not found)
endif
else
$(error includeMakefile variable not defined)
endif

PLATFORM := TesterWrapper
SRCS=main.cpp platform-verilatedtester.cpp

lib: $(SRCS)
verilator --cc $(PLATFORM).v $(VERILATOR_OPTIONS) $(CC_OPTIONS) --exe --build $^
verilator --cc $(PLATFORM).v $(VERILATOR_OPTIONS) -CFLAGS $(CC_OPTIONS) -LDFLAGS $(CC_LDFLAGS) --exe --build $^
@rm $(VER_BUILD_DIR)/main.o
ar -rcs $(TARGET_LIB) $(VER_BUILD_DIR)/*.o

$(EMULATOR_BIN): main.cpp platform-verilatedtester.cpp
@verilator --cc $(PLATFORM).v $(VERILATOR_OPTIONS) $(CC_OPTIONS) --exe --build main.cpp platform-verilatedtester.cpp
@verilator --cc $(PLATFORM).v $(VERILATOR_OPTIONS) -CFLAGS $(CC_OPTIONS) -LDFLAGS $(CC_LDFLAGS) --exe --build main.cpp platform-verilatedtester.cpp
@cp obj_dir/V$(PLATFORM) $(EMULATOR_BIN)

build: $(EMULATOR_BIN)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ class ZedBoardWrapper(instFxn: PlatformWrapperParams => GenericAccelerator, targ
//val resRoot = getClass.getResource("").getPath
resourceCopyBulk("/cpp/platform-wrapper-regdriver/", targetDir, platformDriverFiles)
println(s"=======> Driver files copied to ${targetDir}")

}

val verilogBlackBoxFiles = Seq("Q_srl.v", "DualPortBRAM.v")
resourceCopyBulk("/verilog/", targetDir, verilogBlackBoxFiles)

}

class ZedBoardLinuxWrapper(instFxn: PlatformWrapperParams => GenericAccelerator, targetDir: String)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,10 @@ class VerilatedTesterWrapper(instFxn: PlatformWrapperParams => GenericAccelerato
"platform.h", "verilatedtesterdriver.hpp")
val resRoot = Paths.get("src/main/resources").toAbsolutePath
// copy blackbox verilog, scripts, driver and SW support files
resourceCopyBulk("verilog", targetDir, verilogBlackBoxFiles)
resourceCopyBulk("cpp/platform-wrapper-regdriver", targetDir,
resourceCopyBulk("/verilog", targetDir, verilogBlackBoxFiles)
resourceCopyBulk("/cpp/platform-wrapper-regdriver", targetDir,
driverFiles)
resourceCopy("script/VerilatorMakefile", s"$targetDir/Makefile")
resourceCopy("/script/VerilatorMakefile", s"$targetDir/Makefile")

}

0 comments on commit 3331bce

Please sign in to comment.