Skip to content

Commit

Permalink
Connect spyglass lint target to Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
micprog committed Feb 23, 2024
1 parent 8fbaaa4 commit e7edf95
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 34 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ ifneq (,$(wildcard /etc/iis.version))
endif

include target/sim/questasim/Makefile
include target/lint/spyglass/Makefile
include $(PULPISSIMO_ROOT)/utils/utils.mk


Expand Down
50 changes: 20 additions & 30 deletions target/lint/spyglass/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,49 +14,39 @@

PROJECT_NAME ?= pulpissimo
PULP_PATH ?= $(shell git rev-parse --show-toplevel)
SG_SHELL_CMD ?= spyglass-2019.06 sg_shell
SG_GUI_CMD ?= spyglass-2019.06 spyglass
SG_SHELL_CMD ?= spyglass-2022.06 sg_shell
SG_GUI_CMD ?= spyglass-2022.06 spyglass
SPYGLASS_DIR ?= $(PULP_PATH)/target/lint/spyglass
SPYGLASS_WORKING_DIR = $(PULP_PATH)/build/spyglass

.DEFAULT_GOAL := help
include $(PULPISSIMO_ROOT)/utils/utils.mk

.PHONY: $(PULP_PATH)/spyglass/working_dir/sources.f
$(PULP_PATH)/spyglass/working_dir/sources.f: $(PULP_PATH)/bender
mkdir -p $(PULP_PATH)/spyglass/working_dir
$(PULP_PATH)/bender script -t synthesis verilator > $(PULP_PATH)/spyglass/working_dir/sources.f
.PHONY: $(SPYGLASS_WORKING_DIR)/sources.f
$(SPYGLASS_WORKING_DIR)/sources.f: $(PULPISSIMO_UTILS)/bender
mkdir -p $(SPYGLASS_WORKING_DIR)
$(PULPISSIMO_UTILS)/bender script -t synthesis verilator > $(SPYGLASS_WORKING_DIR)/sources.f

.PHONY: lint_rtl
## Run spyglass lint with rtl_handoff methodology
lint_rtl: $(PULP_PATH)/spyglass/working_dir/reports/lint_rtl.report.xml
lint_rtl: $(SPYGLASS_WORKING_DIR)/reports/lint_rtl.report.xml

$(PULP_PATH)/spyglass/working_dir/reports/moresimple.rpt: $(PULP_PATH)/spyglass/working_dir/sources.f
$(SPYGLASS_WORKING_DIR)/reports/moresimple.rpt: $(SPYGLASS_WORKING_DIR)/sources.f
echo $(SG_SHELL_CMD)
cd $(PULP_PATH)/spyglass/working_dir && $(SG_SHELL_CMD) -tcl_file_continue_on_error -tcl $(PULP_PATH)/spyglass/run_lint_rtl_handoff.tcl
cd $(SPYGLASS_WORKING_DIR) && $(SG_SHELL_CMD) -tcl_file_continue_on_error -tcl $(SPYGLASS_DIR)/run_lint_rtl_handoff.tcl

# generate generate junit report from spyglass report
$(PULP_PATH)/spyglass/working_dir/reports/lint_rtl.report.xml: $(PULP_PATH)/spyglass/working_dir/reports/moresimple.rpt
./convert_report_to_junit.py --error-level error $(PULP_PATH)/spyglass/working_dir/reports/moresimple.rpt > $(PULP_PATH)/spyglass/working_dir/reports/lint_rtl.report.xml
$(SPYGLASS_WORKING_DIR)/reports/lint_rtl.report.xml: $(SPYGLASS_WORKING_DIR)/reports/moresimple.rpt
./convert_report_to_junit.py --error-level error $(SPYGLASS_WORKING_DIR)/reports/moresimple.rpt > $(SPYGLASS_WORKING_DIR)/reports/lint_rtl.report.xml

.PHONY: show_results
## Open the generated lint results in Spyglass GUI
show_results:
cd $(PULP_PATH)/spyglass/working_dir && $(SG_GUI_CMD) -project $(PROJECT_NAME).prj
cd $(SPYGLASS_WORKING_DIR) && $(SG_GUI_CMD) -project $(PROJECT_NAME).prj

.PHONY: clean_spyglass clean
## Clean all
clean: clean_spyglass
## Delete the spyglass working directory
.PHONY: clean
clean:
rm -rf $(PULP_PATH)/spyglass/working_dir

.PHONY: help
help: Makefile
@printf "PULP Platform\n"
@printf "Available targets\n\n"
@awk '/^[a-zA-Z\-\_0-9]+:/ { \
helpMessage = match(lastLine, /^## (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":")-1); \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
printf "%-15s %s\n", helpCommand, helpMessage; \
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)

clean_spyglass:
rm -rf $(SPYGLASS_WORKING_DIR)
21 changes: 17 additions & 4 deletions target/sim/questasim/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
ifndef PULPISSIMO_ROOT
$(error PULPISSIMO_ROOT is not defined. Please go to pulpissimos toplevel directory and run "source sourceme.sh" first.)
endif
# Copyright 2024 ETH Zurich and University of Bologna

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

BUILD_DIR = $(PULPISSIMO_ROOT)/build/questa
$(shell mkdir -p $(BUILD_DIR))
Expand Down Expand Up @@ -62,8 +72,11 @@ build: $(BUILD_DIR)/compile.tcl
## @param VCOM_ARGS="-suppress 2444" Additional flags to supply to vcom
scripts: $(BUILD_DIR)/compile.tcl

.PHONY: clean_questasim clean
## Clean all
clean: clean_questasim
## Clean up files left to build and run simulation
clean:
clean_questasim:
rm -rf $(BUILD_DIR)

# Generate the compile scripts
Expand Down

0 comments on commit e7edf95

Please sign in to comment.