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=$@
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
scope: scope-defs.h

View file

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

View file

@ -125,6 +125,11 @@ def parse_func_args(text):
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):
if os.path.basename(filename) in exclude_files:
return None
@ -137,7 +142,7 @@ def resolve_include_path(filename, parent_dir):
filepath = os.path.join(dir, filename)
if os.path.isfile(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):
text = re.sub(re.compile("/\*.*?\*/",re.DOTALL ), "", text) # multiline
@ -356,15 +361,11 @@ def parse_includes(includes):
for include in includes:
parse_include(include, 0)
load_include_path(os.path.dirname(include))
# restore current directory
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):
for define in defines:
key_value = define.split('=', 2)
@ -801,7 +802,8 @@ def main():
global br_stack
if args.I:
load_include_dirs(args.I)
for dir in args.I:
load_include_path(dir)
if args.D:
load_defines(args.D)