minor scope analyzer fix

This commit is contained in:
Blaise Tine
2021-08-13 19:23:57 -07:00
parent 36d95fd892
commit 4336dcb2a8
3 changed files with 12 additions and 9 deletions

View File

@@ -74,7 +74,7 @@ json: ../../hw/opae/vortex_afu.json
afu_json_mgr json-info --afu-json=$^ --c-hdr=$@ afu_json_mgr json-info --afu-json=$^ --c-hdr=$@
scope-defs.h: $(SCRIPT_DIR)/scope.json scope-defs.h: $(SCRIPT_DIR)/scope.json
$(SCRIPT_DIR)/scope.py $(RTL_INCLUDE) $(CONFIGS) -cc scope-defs.h -vl $(RTL_DIR)/scope-defs.vh $(SCRIPT_DIR)/scope.json $(SCRIPT_DIR)/scope.py $(CONFIGS) -cc scope-defs.h -vl $(RTL_DIR)/scope-defs.vh $(SCRIPT_DIR)/scope.json
# generate scope data # generate scope data
scope: scope-defs.h scope: scope-defs.h

View File

@@ -1,8 +1,9 @@
{ {
"version": 1, "version": 1,
"includes":[ "includes":[
"../dpi/util_dpi.vh",
"../rtl/VX_config.vh", "../rtl/VX_config.vh",
"../rtl/VX_platform.vh", "../rtl/VX_platform.vh",
"../rtl/VX_define.vh", "../rtl/VX_define.vh",
"../rtl/cache/VX_cache_define.vh" "../rtl/cache/VX_cache_define.vh"
], ],

View File

@@ -125,6 +125,11 @@ def parse_func_args(text):
return (args, l) return (args, l)
def load_include_path(dir):
if not dir in include_dirs:
print("*** include path: " + dir)
include_dirs.append(dir)
def resolve_include_path(filename, parent_dir): def resolve_include_path(filename, parent_dir):
if os.path.basename(filename) in exclude_files: if os.path.basename(filename) in exclude_files:
return None return None
@@ -137,7 +142,7 @@ def resolve_include_path(filename, parent_dir):
filepath = os.path.join(dir, filename) filepath = os.path.join(dir, filename)
if os.path.isfile(filepath): if os.path.isfile(filepath):
return os.path.abspath(filepath) return os.path.abspath(filepath)
raise Exception("couldn't find include file: " + filename) raise Exception("couldn't find include file: " + filename + " in " + parent_dir)
def remove_comments(text): def remove_comments(text):
text = re.sub(re.compile("/\*.*?\*/",re.DOTALL ), "", text) # multiline text = re.sub(re.compile("/\*.*?\*/",re.DOTALL ), "", text) # multiline
@@ -356,15 +361,11 @@ def parse_includes(includes):
for include in includes: for include in includes:
parse_include(include, 0) parse_include(include, 0)
load_include_path(os.path.dirname(include))
# restore current directory # restore current directory
os.chdir(old_dir) os.chdir(old_dir)
def load_include_dirs(dirs):
for dir in dirs:
#print("*** include dir: " + dir)
include_dirs.append(dir)
def load_defines(defines): def load_defines(defines):
for define in defines: for define in defines:
key_value = define.split('=', 2) key_value = define.split('=', 2)
@@ -801,7 +802,8 @@ def main():
global br_stack global br_stack
if args.I: if args.I:
load_include_dirs(args.I) for dir in args.I:
load_include_path(dir)
if args.D: if args.D:
load_defines(args.D) load_defines(args.D)