Skip to content
Snippets Groups Projects
Commit fa8ca0c8 authored by dam1n19's avatar dam1n19
Browse files

SOC1-208: Added scripts to generate html for different layers of heirarchy

parent 7118711f
No related branches found
No related tags found
No related merge requests found
......@@ -21,10 +21,7 @@ OUT_DIR ?= $(PROJECT_DIR)
# Name of generated filelist by python script
OUTPUT_FILELIST := $(OUT_DIR)/filelist.flist
bootrom:
make -C $(NANOSOC_TECH_DIR)/system bootrom
htmlgen: bootrom
gen_html:
@echo building HTML tree
@mkdir -p $(OUT_DIR)/build
@(cd $(OUT_DIR)/build; \
......
#!/usr/bin/env python3
#------------------------------------------------------------------------------------
# HTML Project Generation Script
# - Generates HTML based on all filelist in PROJECT_DIR/flist/project
# A joint work commissioned on behalf of SoC Labs, under Arm Academic Access license.
#
# Contributors
#
# David Mapstone (d.a.mapstone@soton.ac.uk)
# Copyright (c) 2023, SoC Labs (www.soclabs.org)
#------------------------------------------------------------------------------------
import argparse
import subprocess
import os
def top_mod_find(filelist):
# Open Filelist
f = open(filelist, "r")
filelines = f.readlines()
f.close()
# Iterate over file and find first match for DESIGN_TOP in file comments
for line in filelines:
line_list = line.strip().split()
if len(line_list) > 2:
if (line_list[0] == "//") and (line_list[1] == "DESIGN_TOP"):
return line_list[2]
def bootrom_gen():
# Runs Bootrom generation script in NanoSoC Directory
bootrom_scipt_dir = os.getenv("NANOSOC_TECH_DIR")+"/system"
subprocess.run(["make","-C",bootrom_scipt_dir,"bootrom"])
def html_gen(filelist_path):
filelist = os.path.basename(filelist_path)
filelist_name = os.path.splitext(filelist)[0]
print("Generating HTML for: "+filelist_name)
# Find Top-level module name
top_mod = top_mod_find(filelist_path)
# Work out output Directory
outdir = os.getenv("PROJECT_DIR")+"/"+filelist_name+"/html"
print(outdir)
html_scipt_dir = os.getenv("SOCTOOLS_FLOW_DIR")+"/bin/htmlgen"
subprocess.run(["make","-C",html_scipt_dir,"gen_html","TOP_MODULE="+top_mod,"OUT_DIR="+outdir])
def project_gen(args):
# Has filelist option been passed to script
if args.filelist == None:
# Generate bootrom
bootrom_gen()
# Find all filelist in project filelist directory
for filelist in os.listdir(os.getenv("PROJECT_DIR")+"/flist/project"):
filelist_path = os.getenv("PROJECT_DIR")+"/flist/project/"+filelist
html_gen(filelist_path)
else:
if args.bootrom is True:
# Generate bootrom
bootrom_gen()
# Generate HTML for given filelist
html_gen(args.filelist)
if __name__ == "__main__":
# Capture Arguments from Command Line
parser = argparse.ArgumentParser(description='Generates HTML based on all filelist in PROJECT_DIR/flist/project')
parser.add_argument("-f", "--filelist", type=str, help="Generate only from this List", required=False)
parser.add_argument("-b", "--bootrom", action='store_true', help="Generate Bootrom first", required=False)
parser.add_argument("-o", "--output", type=str, help="Output Filelist location", required=False)
args = parser.parse_args()
project_gen(args)
\ No newline at end of file
tools/htmlgen 100644 → 100755
#!/bin/bash
#-----------------------------------------------------------------------------
# HTML Generatoration Tools Script
# A joint work commissioned on behalf of SoC Labs, under Arm Academic Access license.
#
# Contributors
#
# David Mapstone (d.a.mapstone@soton.ac.uk)
#
# Copyright � 2021-3, SoC Labs (www.soclabs.org)
#-----------------------------------------------------------------------------
# Call Python script and pass options across
python3 $SOCTOOLS_FLOW_DIR/bin/htmlgen/project_html_gen.py $@
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment