From de849deaaf94a33c448fa1377b2300d201202942 Mon Sep 17 00:00:00 2001 From: Georg Rutishauser Date: Fri, 21 May 2021 00:29:02 +0200 Subject: [PATCH 1/4] replace g++ with $(CXX) --- tools/gvsoc/common/dpi-wrapper/Makefile | 6 ++--- tools/gvsoc/common/engine/Makefile | 24 +++++++++---------- tools/gvsoc/common/examples/launcher/Makefile | 6 ++--- tools/gvsoc/common/launcher/Makefile | 8 +++---- tools/gvsoc/common/models/cpu/iss/Makefile.sa | 2 +- tools/gvsoc/common/vp_models.mk | 5 ++-- tools/pulp-debug-bridge/Makefile | 4 ++-- 7 files changed, 28 insertions(+), 27 deletions(-) diff --git a/tools/gvsoc/common/dpi-wrapper/Makefile b/tools/gvsoc/common/dpi-wrapper/Makefile index c589e12d..0c172906 100644 --- a/tools/gvsoc/common/dpi-wrapper/Makefile +++ b/tools/gvsoc/common/dpi-wrapper/Makefile @@ -20,15 +20,15 @@ DPI_OBJS = $(patsubst %.cpp,$(BUILD_DIR)/dpi/%.o,$(patsubst %.c,$(BUILD_DIR)/dpi $(BUILD_DIR)/dpi/%.o: %.cpp @mkdir -p $(basename $@) - g++ $(DPI_CFLAGS) -o $@ -c $< + $(CXX) $(DPI_CFLAGS) -o $@ -c $< $(BUILD_DIR)/dpi/%.o: %.c @mkdir -p $(basename $@) - g++ $(DPI_CFLAGS) -o $@ -c $< + $(CXX) $(DPI_CFLAGS) -o $@ -c $< $(BUILD_DIR)/libgvsocdpi.so: $(DPI_OBJS) @mkdir -p $(basename $@) - g++ -o $@ $^ $(DPI_LDFLAGS) + $(CXX) -o $@ $^ $(DPI_LDFLAGS) clean: rm -rf $(BUILD_DIR) diff --git a/tools/gvsoc/common/engine/Makefile b/tools/gvsoc/common/engine/Makefile index 8350c03b..821e5cb9 100644 --- a/tools/gvsoc/common/engine/Makefile +++ b/tools/gvsoc/common/engine/Makefile @@ -11,7 +11,7 @@ ifndef VERBOSE V = @ endif -CC = g++ +# CC = g++ CFLAGS += -MMD -MP -O2 -g -fpic -Isrc -std=c++11 -Werror -Wall -I$(INSTALL_DIR)/include @@ -53,58 +53,58 @@ endef $(ENGINE_BUILD_DIR)/%.o: src/%.c @echo "CXX $<" @mkdir -p $(basename $@) - $(V)$(CC) $(CFLAGS) -o $@ -c $< + $(V)$(CXX) $(CFLAGS) -o $@ -c $< $(ENGINE_BUILD_DIR)/%.o: src/%.cpp @echo "CXX $<" @mkdir -p $(basename $@) - $(V)$(CC) $(CFLAGS) -o $@ -c $< + $(V)$(CXX) $(CFLAGS) -o $@ -c $< $(ENGINE_BUILD_DIR)/dbg/%.o: src/%.c @echo "CXX DBG $<" @mkdir -p $(basename $@) - $(V)$(CC) $(CFLAGS) $(CFLAGS_DBG) -o $@ -c $< + $(V)$(CXX) $(CFLAGS) $(CFLAGS_DBG) -o $@ -c $< $(ENGINE_BUILD_DIR)/dbg/%.o: src/%.cpp @echo "CXX DBG $<" @mkdir -p $(basename $@) - $(V)$(CC) $(CFLAGS) $(CFLAGS_DBG) -o $@ -c $< + $(V)$(CXX) $(CFLAGS) $(CFLAGS_DBG) -o $@ -c $< $(ENGINE_BUILD_DIR)/sv/%.o: src/%.c @echo "CXX SV $<" @mkdir -p $(basename $@) - $(V)$(CC) $(CFLAGS) $(CFLAGS_SV) -o $@ -c $< + $(V)$(CXX) $(CFLAGS) $(CFLAGS_SV) -o $@ -c $< $(ENGINE_BUILD_DIR)/sv/%.o: src/%.cpp @echo "CXX SV $<" @mkdir -p $(basename $@) - $(V)$(CC) $(CFLAGS) $(CFLAGS_SV) -o $@ -c $< + $(V)$(CXX) $(CFLAGS) $(CFLAGS_SV) -o $@ -c $< $(ENGINE_BUILD_DIR)/libpulpvp.so: $(VP_OBJS) @echo "CXX $<" @mkdir -p $(basename $@) - $(V)$(CC) $^ -o $@ $(LDFLAGS) -shared -ldl -lpthread + $(V)$(CXX) $^ -o $@ $(LDFLAGS) -shared -ldl -lpthread $(ENGINE_BUILD_DIR)/libpulpvp-debug.so: $(VP_DBG_OBJS) @echo "CXX DBG $<" @mkdir -p $(basename $@) - $(V)$(CC) $^ -o $@ $(LDFLAGS) -shared -ldl -lpthread + $(V)$(CXX) $^ -o $@ $(LDFLAGS) -shared -ldl -lpthread $(ENGINE_BUILD_DIR)/libpulpvp-sv.so: $(VP_SV_OBJS) @echo "CXX SV $<" @mkdir -p $(basename $@) - $(V)$(CC) $^ -o $@ $(LDFLAGS) -shared -ldl -lpthread + $(V)$(CXX) $^ -o $@ $(LDFLAGS) -shared -ldl -lpthread $(ENGINE_BUILD_DIR)/gvsoc_launcher: $(ENGINE_BUILD_DIR)/main.o $(INSTALL_DIR)/lib/libpulpvp.so @echo "CXX $<" @mkdir -p `dirname $@` - $(V)$(CC) $(ENGINE_BUILD_DIR)/main.o -o $@ $(LDFLAGS) -lpthread -ldl -lpulpvp + $(V)$(CXX) $(ENGINE_BUILD_DIR)/main.o -o $@ $(LDFLAGS) -lpthread -ldl -lpulpvp $(ENGINE_BUILD_DIR)/gvsoc_launcher_debug: $(ENGINE_BUILD_DIR)/dbg/main.o $(INSTALL_DIR)/lib/libpulpvp-debug.so @echo "CXX DBG $<" @mkdir -p `dirname $@` - $(V)$(CC) $(ENGINE_BUILD_DIR)/dbg/main.o -o $@ $(LDFLAGS) -lpthread -ldl -lpulpvp-debug + $(V)$(CXX) $(ENGINE_BUILD_DIR)/dbg/main.o -o $@ $(LDFLAGS) -lpthread -ldl -lpulpvp-debug $(foreach file, $(VP_HEADERS), $(eval $(call declareInstallFile,$(file)))) diff --git a/tools/gvsoc/common/examples/launcher/Makefile b/tools/gvsoc/common/examples/launcher/Makefile index 1775e216..15bc3492 100644 --- a/tools/gvsoc/common/examples/launcher/Makefile +++ b/tools/gvsoc/common/examples/launcher/Makefile @@ -1,6 +1,6 @@ BUILD_DIR ?= $(CURDIR)/build -CC = g++ +# CC = g++ CFLAGS += -MMD -MP -O2 -g -std=c++11 -Werror -Wall -I$(INSTALL_DIR)/include LDFLAGS += -O2 -g -Werror -Wall -L$(INSTALL_DIR)/lib -lpulpvp-debug @@ -12,11 +12,11 @@ all: $(BUILD_DIR)/launcher $(BUILD_DIR)/%.o: %.cpp mkdir -p $(dir $@) - $(CC) $(CFLAGS) -o $@ -c $< + $(CXX) $(CFLAGS) -o $@ -c $< $(BUILD_DIR)/launcher: $(OBJS) mkdir -p $(dir $@) - $(CC) $^ -o $@ $(LDFLAGS) + $(CXX) $^ -o $@ $(LDFLAGS) clean: rm -rf $(BUILD_DIR) diff --git a/tools/gvsoc/common/launcher/Makefile b/tools/gvsoc/common/launcher/Makefile index 1a6dcc35..7d9f52f3 100644 --- a/tools/gvsoc/common/launcher/Makefile +++ b/tools/gvsoc/common/launcher/Makefile @@ -6,7 +6,7 @@ LAUNCHER_BUILD_DIR = $(ROOT_VP_BUILD_DIR)/launcher -include $(INSTALL_DIR)/rules/vp_models.mk -CC = g++ +# CC = g++ CFLAGS += -MMD -MP -O2 -g -fpic -std=c++11 -Werror -Wall -I$(INSTALL_DIR)/include LDFLAGS += -O2 -g -shared -Werror -Wall -L$(INSTALL_DIR)/lib -Wl,--whole-archive -ljson -Wl,--no-whole-archive @@ -30,15 +30,15 @@ endef $(LAUNCHER_BUILD_DIR)/%.o: src/%.c @mkdir -p $(basename $@) - $(CC) $(CFLAGS) -o $@ -c $< + $(CXX) $(CFLAGS) -o $@ -c $< $(LAUNCHER_BUILD_DIR)/%.o: src/%.cpp @mkdir -p $(basename $@) - $(CC) $(CFLAGS) -o $@ -c $< + $(CXX) $(CFLAGS) -o $@ -c $< $(LAUNCHER_BUILD_DIR)/libpulpvplauncher.so: $(LAUNCHER_OBJS) @mkdir -p $(basename $@) - $(CC) $^ -o $@ $(LDFLAGS) + $(CXX) $^ -o $@ $(LDFLAGS) diff --git a/tools/gvsoc/common/models/cpu/iss/Makefile.sa b/tools/gvsoc/common/models/cpu/iss/Makefile.sa index 510b7df7..a5f76540 100644 --- a/tools/gvsoc/common/models/cpu/iss/Makefile.sa +++ b/tools/gvsoc/common/models/cpu/iss/Makefile.sa @@ -14,7 +14,7 @@ $(BUILD_DIR)/riscy_decoder_gen.cpp: isa_gen/isa_riscv_gen.py isa_gen/isa_gen.py isa_gen/isa_riscv_gen.py --source-file=$(BUILD_DIR)/riscy_decoder_gen.cpp --header-file=$(BUILD_DIR)/riscy_decoder_gen.hpp $(BUILD_DIR)/pulp_iss: $(SA_ISS_SRCS) - g++ -o $@ $^ $(SA_ISS_CFLAGS) $(SA_ISS_LDFLAGS) + $(CXX) -o $@ $^ $(SA_ISS_CFLAGS) $(SA_ISS_LDFLAGS) $(INSTALL_DIR)/bin/pulp_iss: $(BUILD_DIR)/pulp_iss diff --git a/tools/gvsoc/common/vp_models.mk b/tools/gvsoc/common/vp_models.mk index 6ae58ec6..7813b140 100644 --- a/tools/gvsoc/common/vp_models.mk +++ b/tools/gvsoc/common/vp_models.mk @@ -5,8 +5,9 @@ VP_PY_INSTALL_PATH ?= $(INSTALL_DIR)/python VP_MAKEFILE_LIST = $(addsuffix /Makefile,$(VP_DIRS)) -CPP=g++ -CC=gcc +# CPP=g++ +CPP = $(CXX) +# CC=gcc ifndef VERBOSE V = @ diff --git a/tools/pulp-debug-bridge/Makefile b/tools/pulp-debug-bridge/Makefile index ed1dfb96..13466201 100644 --- a/tools/pulp-debug-bridge/Makefile +++ b/tools/pulp-debug-bridge/Makefile @@ -94,10 +94,10 @@ install: $(BUILD_DIR)/%.o: %.cpp @mkdir -p $(basename $@) - g++ $(CFLAGS) -o $@ -c $< + $(CXX) $(CFLAGS) -o $@ -c $< $(BUILD_DIR)/libpulpdebugbridge.so: $(OBJS) - g++ -o $@ $^ $(LDFLAGS) + $(CXX) -o $@ $^ $(LDFLAGS) $(INSTALL_DIR)/lib/libpulpdebugbridge.so: $(BUILD_DIR)/libpulpdebugbridge.so install -D $< $@ From dcf6b58714eb0e7faf5522cf2c47d9e33320cc07 Mon Sep 17 00:00:00 2001 From: Georg Rutishauser Date: Fri, 21 May 2021 02:06:15 +0200 Subject: [PATCH 2/4] add MAGICK_ROOT variable to specify graphicsmagick installation prefix --- Makefile | 6 ++++++ tools/dpi-models/Makefile | 2 +- tools/dpi-models/models/camera/Makefile | 16 +++++++++++++--- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index e7cb4744..62b25bb9 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,9 @@ +# the MAGICK_ROOT variable can be used to pass an alternative installation +# prefix for the GraphicsMagick library. +ifdef MAGICK_ROOT +export MAGICK_ROOT := $(realpath $(MAGICK_ROOT)) +endif + SHELL=bash ifndef PULP_SDK_HOME diff --git a/tools/dpi-models/Makefile b/tools/dpi-models/Makefile index 93b504b9..fd313e04 100644 --- a/tools/dpi-models/Makefile +++ b/tools/dpi-models/Makefile @@ -1,7 +1,7 @@ VSIM_DETECTED_PATH=$(dir $(shell which vsim)) BUILD_DIR ?= build -CFLAGS += -std=gnu++11 -MMD -MP -O3 -g +CFLAGS += -std=c++11 -MMD -MP -O3 -g CFLAGS += -I$(INSTALL_DIR)/include -fPIC LDFLAGS += -L$(INSTALL_DIR)/lib -fPIC -shared -O3 -g -ljson diff --git a/tools/dpi-models/models/camera/Makefile b/tools/dpi-models/models/camera/Makefile index 5d364228..8c35e1cc 100644 --- a/tools/dpi-models/models/camera/Makefile +++ b/tools/dpi-models/models/camera/Makefile @@ -2,11 +2,21 @@ DPI_MODELS += camera camera_SRCS = camera/camera.cpp -MAGICK=$(shell pkg-config --exists GraphicsMagick --atleast-version=1.3.23 || echo FAILED) +MAGICK_PKG_CFG_CMD := pkg-config +ifdef MAGICK_ROOT +# MAGICK_ROOT can be set to specify the root directory (containing e.g. /lib/, +# /include/ etc) where GraphicsMagick was installed from source +MAGICK_PKG_CFG_PATH := $(MAGICK_ROOT)/lib/pkgconfig:$(PKG_CONFIG_PATH) +camera_CFLAGS += -Wl,-rpath=$(MAGICK_ROOT)/lib +MAGICK_PKG_CFG_CMD := PKG_CONFIG_PATH=$(MAGICK_PKG_CFG_PATH) pkg-config +endif + +MAGICK=$(shell $(MAGICK_PKG_CFG_CMD) --exists GraphicsMagick --atleast-version=1.3.23 || echo FAILED) + ifeq '$(MAGICK)' '' -camera_CFLAGS += $(shell pkg-config GraphicsMagick --cflags) +camera_CFLAGS += $(shell $(MAGICK_PKG_CFG_CMD) GraphicsMagick++ --cflags) camera_CFLAGS += -D__MAGICK__ -camera_LDFLAGS += -lGraphicsMagick++ -lGraphicsMagick +camera_LDFLAGS := $(shell $(MAGICK_PKG_CFG_CMD) GraphicsMagick++ --libs) #LDFLAGS += $(shell Magick++-config --ldflags) endif From c364dc95d94ba2ffde57a179a74f1ecbc57de559 Mon Sep 17 00:00:00 2001 From: Francesco Conti Date: Sat, 19 Jun 2021 10:41:49 +0200 Subject: [PATCH 3/4] [NE16] align streamin/out base address calculation --- tools/gvsoc/pulp/models/pulp/ne16/src/ne16_streamin.cpp | 7 ++++++- tools/gvsoc/pulp/models/pulp/ne16/src/ne16_streamout.cpp | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/gvsoc/pulp/models/pulp/ne16/src/ne16_streamin.cpp b/tools/gvsoc/pulp/models/pulp/ne16/src/ne16_streamin.cpp index 2193aafb..a2fe7df9 100644 --- a/tools/gvsoc/pulp/models/pulp/ne16/src/ne16_streamin.cpp +++ b/tools/gvsoc/pulp/models/pulp/ne16/src/ne16_streamin.cpp @@ -44,7 +44,12 @@ void Ne16::constant_setup() { void Ne16::streamin_setup() { - auto base_addr_streamin = this->outfeat_ptr + (this->i_major*this->FILTER_SIZE*this->w_out*this->k_out + this->j_major*this->FILTER_SIZE*this->k_out + this->k_out_major*this->TP_OUT) * 4; + auto tp = this->depthwise ? this->TP_IN : this->TP_OUT; + + auto outfeat_hom_iter = this->FILTER_SIZE * this->outfeat_d2_stride; + auto outfeat_wom_iter = this->FILTER_SIZE * this->outfeat_d1_stride; + + auto base_addr_streamin = this->outfeat_ptr + this->i_major*outfeat_hom_iter + this->j_major*outfeat_wom_iter + this->k_out_major*tp*this->quantization_bits/8; auto k_out_lim = this->depthwise ? 1 : (this->k_out_major == this->subtile_nb_ko-1 && this->subtile_rem_ko != this->TP_OUT && this->subtile_rem_ko != 0) ? this->subtile_rem_ko : this->TP_OUT; diff --git a/tools/gvsoc/pulp/models/pulp/ne16/src/ne16_streamout.cpp b/tools/gvsoc/pulp/models/pulp/ne16/src/ne16_streamout.cpp index ad1d6350..f9afb2c3 100644 --- a/tools/gvsoc/pulp/models/pulp/ne16/src/ne16_streamout.cpp +++ b/tools/gvsoc/pulp/models/pulp/ne16/src/ne16_streamout.cpp @@ -24,7 +24,10 @@ void Ne16::streamout_setup() { auto tp = this->depthwise ? this->TP_IN : this->TP_OUT; - auto base_addr_y = this->outfeat_ptr + (this->i_major*this->FILTER_SIZE*this->w_out*this->k_out + this->j_major*this->FILTER_SIZE*this->k_out + this->k_out_major*tp) * this->quantization_bits/8; + auto outfeat_hom_iter = this->FILTER_SIZE * this->outfeat_d2_stride; + auto outfeat_wom_iter = this->FILTER_SIZE * this->outfeat_d1_stride; + + auto base_addr_y = this->outfeat_ptr + this->i_major*outfeat_hom_iter + this->j_major*outfeat_wom_iter + this->k_out_major*tp*this->quantization_bits/8; auto streamout_k_out_lim = !this->depthwise ? this->mv_k_out_lim : (this->k_out_major == this->subtile_nb_ko-1 && this->subtile_rem_ko != this->TP_IN && this->subtile_rem_ko != 0) ? this->subtile_rem_ko : this->TP_IN; ; From a4b072635be2cdf0d999c983cec2df963af44e92 Mon Sep 17 00:00:00 2001 From: Francesco Conti Date: Fri, 16 Jul 2021 14:46:38 +0200 Subject: [PATCH 4/4] [Preload] Add facilities to preload L2/L1 memory when performing an RTL sim The correct generation of preloaded data depends on a mem.json file that is located inside the ROOT/sim folder of each given PULP chip, and describes the memory architecture. For example, the typical architecture of a PULPissimo SoC with 32+32 KiB of private L2 and 448 KiB of shared L2 divided in 4 word-interleaved banks is described as follows: ``` { "pri0": { "base" : "0x1c000000", "length" : "32768", "instance": "/tb_pulp/i_dut/soc_domain_i/pulp_soc_i/l2_ram_i/bank_sram_pri0_i/sram", "interleaving": "None" }, "pri1": { "base" : "0x1c008000", "length" : "32768", "instance": "/tb_pulp/i_dut/soc_domain_i/pulp_soc_i/l2_ram_i/bank_sram_pri1_i/sram", "interleaving": "None" }, "l2_0": { "base" : "0x1c010000", "length" : "458752", "instance": "/tb_pulp/i_dut/soc_domain_i/pulp_soc_i/l2_ram_i/CUTS[0]/bank_i/sram", "interleaving": "4", "interleaving_bank": "0" }, "l2_1": { "base" : "0x1c010000", "length" : "458752", "instance": "/tb_pulp/i_dut/soc_domain_i/pulp_soc_i/l2_ram_i/CUTS[1]/bank_i/sram", "interleaving": "4", "interleaving_bank": "1" }, "l2_2": { "base" : "0x1c010000", "length" : "458752", "instance": "/tb_pulp/i_dut/soc_domain_i/pulp_soc_i/l2_ram_i/CUTS[2]/bank_i/sram", "interleaving": "4", "interleaving_bank": "2" }, "l2_3": { "base" : "0x1c010000", "length" : "458752", "instance": "/tb_pulp/i_dut/soc_domain_i/pulp_soc_i/l2_ram_i/CUTS[3]/bank_i/sram", "interleaving": "4", "interleaving_bank": "3" } } ``` The SDK will automatically generate one file for each JSON dictionary entry inside `vectors`, but keep the JTAG loading method by default. To switch to preloading, one can set the `bootmode` env variable on the fly while calling the Make command: ``` make all run platform=rtl bootmode=preload ``` --- tools/gapy/runner/rtl/chips/pulp.py | 4 +++ tools/gapy/runner/rtl/rtl_runner.py | 54 +++++++++++++++++++++++++++-- 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/tools/gapy/runner/rtl/chips/pulp.py b/tools/gapy/runner/rtl/chips/pulp.py index 898a8afb..9233db08 100644 --- a/tools/gapy/runner/rtl/chips/pulp.py +++ b/tools/gapy/runner/rtl/chips/pulp.py @@ -34,6 +34,10 @@ def __init__(self, args, config): if os.environ.get('QUESTA_CXX') is not None: self.set_arg('-dpicpppath ' + os.environ.get('QUESTA_CXX')) + if os.environ.get('bootmode') is not None: + if os.environ.get('bootmode') == "preload": + self.set_arg('-gLOAD_L2=PRELOAD') + self.set_arg('-permit_unmatched_virtual_intf') self.set_arg('+preload_file=efuse_preload.data') self.set_arg('-gBAUDRATE=115200') diff --git a/tools/gapy/runner/rtl/rtl_runner.py b/tools/gapy/runner/rtl/rtl_runner.py index 2159549d..0cb29a2f 100644 --- a/tools/gapy/runner/rtl/rtl_runner.py +++ b/tools/gapy/runner/rtl/rtl_runner.py @@ -21,6 +21,7 @@ import errors import argparse import json_tools as js +import json try: import gv.gvsoc except: @@ -152,6 +153,10 @@ def exec(self): self.__create_symlink(plt_path, 'tcl_files') self.__create_symlink(plt_path, 'waves') self.__create_symlink(plt_path, 'models') + try: + self.__create_symlink(plt_path, 'mem.json') + except: + pass self.__create_symlink(plt_path, 'ips_inputs') else: @@ -213,8 +218,7 @@ def gen_stim_txt(self): binary = self.config.get_str('runner/boot-loader') self.gen_stim_slm_64('vectors/stim.txt', [binary]) - - + self.gen_stim_mem('vectors/stim.txt', [binary], ) def __gen_stim_slm(self, filename, width): @@ -230,6 +234,38 @@ def __gen_stim_slm(self, filename, width): file.write('%X_%0*X\n' % (int(key), width*2, self.mem.get(key))) + def __gen_stim_mem(self, filename, mem_dict): + + for mem_ in mem_dict.keys(): + self.dump(' Generating to file: ' + mem_ + ".mem") + + try: + os.makedirs(os.path.dirname(filename)) + except: + pass + + with open(os.path.dirname(filename) + "/" + mem_ + ".mem", 'w') as file: + + file.write("""// memory data file (do not edit the following line - required for mem load use) +// instance=%s +// format=hex addressradix=h dataradix=h version=1.0 wordsperline=1\n""" % (mem_dict[mem_]['instance'])) + + base_ = int(mem_dict[mem_]['base'], 16) + + for key in sorted(self.mem.keys()): + if not (int(key) >= base_ and int(key) < base_+int(mem_dict[mem_]['length'])): + continue + + addr_ = (int(key) - base_) / 4 + if not mem_dict[mem_]['interleaving'] == "None": + bank_ = addr_ % int(mem_dict[mem_]['interleaving']) + if bank_ != int(mem_dict[mem_]['interleaving_bank']): + continue + addr_ = addr_ / int(mem_dict[mem_]['interleaving']) + + data_ = self.mem.get(key) + file.write('@%x %08x\n' % (addr_, data_)) + def __add_mem_word(self, base, size, data, width): @@ -311,6 +347,18 @@ def gen_stim_slm_64(self, stim_file, binaries): self.__gen_stim_slm(stim_file, 8) + def gen_stim_mem(self, stim_file, binaries): + + self.__parse_binaries(4, binaries) + + try: + with open(self.platform_path + "/mem.json", "r") as fp: + mem_dict = json.load(fp) + except: + mem_dict = None + if mem_dict is not None: + self.__gen_stim_mem(stim_file, mem_dict) + def __process_args(self): if self.args.gui: @@ -407,4 +455,4 @@ def set_cmd_arg(self, arg): self.cmd_args.append(arg) def get_args(self): - return self.plt_args \ No newline at end of file + return self.plt_args