From 72c9c6aaac9f6dc5c956fc2953f53adc94d35db9 Mon Sep 17 00:00:00 2001 From: James Stine Date: Wed, 18 Jun 2025 09:14:10 -0500 Subject: [PATCH] Add initial run of VC Spyglass Linting. Currently works by putting all results in lint-spyglass-reports dir which can be subsequently pulled up with spyglass. The scripts work in batch and can probably be tailored to ones liking in the lint_spyglass.sh bash script --- bin/cvw.prj | 32 ++++++++++++++++++++ bin/lint-spyglass.sh | 71 ++++++++++++++++++++++++++++++++++++++++++++ bin/waivers.tcl | 10 +++++++ 3 files changed, 113 insertions(+) create mode 100644 bin/cvw.prj create mode 100755 bin/lint-spyglass.sh create mode 100644 bin/waivers.tcl diff --git a/bin/cvw.prj b/bin/cvw.prj new file mode 100644 index 000000000..9f135dc25 --- /dev/null +++ b/bin/cvw.prj @@ -0,0 +1,32 @@ +# +# Synopsys SpyGlass Lint Flow +# james.stine@okstate.edu 11 June 2025 +# + +# Sets directory for output reports +set_option projectwdir lint-spyglass-reports/ +set_option language_mode mixed +set_option designread_enable_synthesis no +set_option designread_disable_flatten no +set_option active_methodology $SPYGLASS_HOME/GuideWare/latest/block/rtl_handoff +set_option enableSV12 yes +set_option handlememory yes +set_option top wallywrapper +set_parameter handle_large_bus yes + +# Include DIR +set_option incdir $WALLY/config/WALLYVER +set_option incdir $WALLY/config/shared + +# main CVW +read_file -type verilog $WALLY/src/cvw.sv +read_file -type verilog $WALLY/testbench/wallywrapper.sv +read_file -type awl $WALLY/bin/waivers.tcl + +# generic read of Wally src files +read_file -type verilog $WALLY/src/*/* +read_file -type verilog $WALLY/src/*/*/* + +current_methodology $SPYGLASS_HOME/GuideWare/latest/block/rtl_handoff + + diff --git a/bin/lint-spyglass.sh b/bin/lint-spyglass.sh new file mode 100755 index 000000000..0f6c34c0b --- /dev/null +++ b/bin/lint-spyglass.sh @@ -0,0 +1,71 @@ +#!/bin/bash + +############################################################################### +# Script Name: lint_spyglass.sh +# Author: james.stine@okstate.edu 11 June 2025 +# Description: +# This script automates the running of Synopsys SpyGlass linting for +# various Wally RISC-V configurations. It substitutes the WALLYVER value +# in the base project file and runs SpyGlass for a specified lint goal. +# +# - Cleans out the lint-synopsys directory (if it exists) +# - Accepts one configurable linting goal +# - Iterates over multiple Wally configurations +# - Generates temporary .prj files for each run +############################################################################### + +# Check or set WALLY environment variable +if [ -z "$WALLY" ]; then + echo "Error: WALLY environment variable is not set." + echo "Please make sure you source your setup before running this script." + exit 1 +fi + +# OPTIONAL: choose one of: lint/lint_rtl or lint/lint_rtl_enhanced +GOAL="lint/lint_rtl" + +# List of configurations (add configurations for linting) +configs=(rv32e) + +# Set current dir to make sure it writes to the current dir +CUR_DIR=$(pwd) + +# Base project file for Spyglass +TEMPLATE_PRJ="$WALLY/bin/cvw.prj" + +# Clean out the lint-synopsys directory (if it exists) +if [ -d "$CUR_DIR/lint-spyglass-reports" ]; then + echo "Cleaning lint-spyglass directory..." + rm -rf "$CUR_DIR/lint-spyglass-reports"/* +fi + +for config in "${configs[@]}"; do + echo "Processing configuration: $config" + + # Output project file + CONFIG_PRJ="$CUR_DIR/cvw_${config}.prj" + + # Replace WALLYVER with current config and save to new .prj + # Also replaces path for Tcl so can incorporate everything correctly + sed -e "s|\$WALLY|$WALLY|g" \ + -e "s|WALLYVER|$config|g" \ + -e "s|read_file -type awl waivers.tcl|read_file -type awl $WALLY/bin/waivers.tcl|g" \ + -e "s|set_option projectwdir lint-spyglass/|set_option projectwdir ${CUR_DIR}/lint-spyglass/|g" \ + "$TEMPLATE_PRJ" > "$CONFIG_PRJ" + + # Run spyglass using the generated project file + echo "Running spyglass for: $config" + spyglass -project "$CONFIG_PRJ" -goal "$GOAL" -batch + + # Optional: handle errors + if [ $? -ne 0 ]; then + echo "Error running spyglass for configuration: $config" + else + echo "Completed: $config" + fi + + # Optional: uncomment the line below to keep each prj after each run + rm "$CONFIG_PRJ" + +done + diff --git a/bin/waivers.tcl b/bin/waivers.tcl new file mode 100644 index 000000000..3b53948fd --- /dev/null +++ b/bin/waivers.tcl @@ -0,0 +1,10 @@ +# +# Synopsys SpyGlass Lint Waivers +# james.stine@okstate.edu 11 June 2025 +# + +# Add waivers that are not neededed to be checked +waive -rule { W240 W528 W123 W287b } +# Add waiver for undriven outputs for items like Uncore +waive -du { {rom1p1r} {uncore} } -rule { {UndrivenInTerm-ML} } +