Skip to content

Commit 5a908f6

Browse files
committed
fix: resolve xspcomm from picker path in mem_direct template
1 parent 123ce20 commit 5a908f6

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/codegen/mem_direct.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ namespace picker { namespace codegen {
8080
if (varibles.size() == 0) { return; }
8181
inja::Environment env;
8282
nlohmann::json data;
83+
std::string erro_message;
8384
std::vector<std::string> offset_array;
8485
std::string offset_funcs, offset_funcs_define; // begin with "render_varible_info_0(base);\n"
8586
std::string src_dir = opts.source_dir; // "mem_direct" folder has been added in the upper level
@@ -106,9 +107,12 @@ namespace picker { namespace codegen {
106107
for (const auto &type : type_set) {
107108
cpp_type_set.push_back(type);
108109
}
110+
auto cpplib_location = picker::get_xcomm_lib("lib", erro_message);
111+
if (cpplib_location.empty()) { PK_FATAL("%s", erro_message.c_str()); }
112+
data["__XSPCOMM_LIB__"] = cpplib_location;
109113
data["__yaml_varible_type_set__"] = cpp_type_set;
110114
data["__SIMULATOR__"] = opts.sim;
111115
recursive_render(dst_dir_tmp, dst_dir, data, env);
112116
}
113117

114-
}}; // namespace picker::codegen
118+
}}; // namespace picker::codegen

template/mem_direct/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ V_ROOT := $(shell verilator -V | grep ROOT | grep verilator | tail -n 1 | awk '{
2020
CXXFLAGS += -I ${V_ROOT}/include -I ${V_ROOT}/include/vltstd/ \
2121
-I ../build/DPI${TOP_NAME} \
2222
-L../build ${CFLAGS}
23-
LDFLAGS += $(WHOLE_ARCHIVE_LDFLAGS) -Wl,-undefined,dynamic_lookup
24-
LDLIBS += -lpthread -lz -L/usr/local/lib -lxspcomm
23+
LDFLAGS += $(WHOLE_ARCHIVE_LDFLAGS) -Wl,-undefined,dynamic_lookup -Wl,-rpath,{{__XSPCOMM_LIB__}}
24+
LDLIBS += -lpthread -lz -L{{__XSPCOMM_LIB__}} -lxspcomm
2525
{% endif %}
2626

2727
{% if __SIMULATOR__ == "gsim" %}

0 commit comments

Comments
 (0)