【脚本篇】---spyglass lint脚本

news2024/11/18 9:51:10

目录结构

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

sg_lint.tcl (顶层)

#1.source env
#date
set WORK_HOME .
set REPORT_PATH ${WORK_HOME}/reports
puts [clock format [clock second] -format "%Y-%m-%d %H:%M:%S"]
#2.generate source filelist
#3.set top module
puts "######### set top module #########"
source ${WORK_HOME}/scripts/set_top_module.tcl

#4.set waiver
puts "######### set waiver file #########"
source ${WORK_HOME}/scripts/set_top_waiver.tcl

#5.new project
puts "######### new project #########"
#new_project sg_lint -projectwdir ${WORK_HOME}/project/  -force
new_project sg_lint -force

#6.read design file
puts "######### read design file #########"
read_file -type sourcelist ${WORK_HOME}/../02_flst/filelist.f

#7.read waiver file
puts "######### read waiver file #########"
read_file -type awl $TOP_WAIVER_FILE

#8.set common option and parameter
puts "######### set common option and parameter #########"
source ${WORK_HOME}/scripts/set_option_and_parameter.tcl

#9.methodlogy and goal setup
puts "######### methodlogy and goal setup #########"
source ${WORK_HOME}/scripts/set_methodology_and_goal.tcl

#10.set rules
puts "######### set rules #########"
source ${WORK_HOME}/scripts/set_sg_lint_rules.tcl


#11.run goal
puts "######### run goal #########"
run_goal

#12.analyze results
puts "######### analyze results #########"
write_report goal_summary > $REPORT_PATH/$TOP_MODULE/goal_summary.rpt
write_report goal_setup   > $REPORT_PATH/$TOP_MODULE/goal_setup.rpt
write_report moresimple   > $REPORT_PATH/$TOP_MODULE/moresimple.rpt
write_report summary      > $REPORT_PATH/$TOP_MODULE/summary.rpt
write_report waiver       > $REPORT_PATH/$TOP_MODULE/waiver.rpt

puts "$REPORT_PATH/$TOP_MODULE/goal_summary.rpt"
puts "$REPORT_PATH/$TOP_MODULE/goal_setup.rpt"
puts "$REPORT_PATH/$TOP_MODULE/moresimple.rpt"
puts "$REPORT_PATH/$TOP_MODULE/summary.rpt"
puts "$REPORT_PATH/$TOP_MODULE/waiver.rpt"

#14.save & close project
puts "######### save & close project #########"
save_project  -force sg_lint.prj
close_project -force
#date
puts "######### Using follow command to open SG_Lint project #########"
puts "spyglass -project sg_lint.prj &"

set_methodology_and_goal.tcl

set METHODOLOGY_TYPE  initial_rtl
set GOAL_TYPE         mandatory
if { $METHODOLOGY_TYPE == "initial_rtl" } {
    current_methodology $env(SPYGLASS_HOME)/GuideWare2.0/block/initial_rtl
    set regression_mandatory_list {lint/lint_rtl adv_lint/adv_lint_struct}
    set regression_optional_list  {lint/design_audit lint/lint_functional_rtl}
} else {
    current_methodology $env(SPYGLASS_HOME)/GuideWare2.0/block/rtl_handoff
    set regression_mandatory_list {lint/lint_rtl adv_lint/adv_lint_verify}
    set regression_optional_list  {lint/lint_functional_rtl lint/abstract}
}
append regression_all_list {regression_mandatory_list} {regression_optional_list}

if { $GOAL_TYPE == "mandatory" } {
    current_goal Group_Run -goal ${regression_mandatory_list} -top $TOP_MODULE
} elseif { $GOAL_TYPE == "optional" } {
    current_goal Group_Run -goal ${regression_optional_list} -top $TOP_MODULE
} else {
    current_goal Group_Run -goal ${regression_all_list} -top $TOP_MODULE
}
unset regression_all_list

set_option_and_parameter.tcl

#refer to 《SpyGlass_Explorer_UserGuide.pdf》
# ##################### set options #####################
#Use this design-read option to specify macro definitions in your Verilog analysis run.
set_option define {RD = 0}

#Use this design-read option to specify a top-level module so that all design units instantiated directly 
#or indirectly under this module are included in the scope of SpyGlass analysis.
set_option top $TOP_MODULE

#Use this design-read option to enable or disable SystemVerilog
#compatibility mode. By default, this option is disabled.
set_option enableSV yes

#Use this command to enable parsing of SystemVerilog constructs.
#By default, SpyGlass reports SystemVerilog constructs as syntax errors.
set_option enableSV09 yes

#Use this command to specify the operating language for the current SpyGlass run.
set_option language_mode mixed

#Use this command to specify a default waiver file for saving interactive
#waiver commands. If you do not specify a default waiver file by using this command, SpyGlass
#Explorer considers the <project-wdir>/<project_name>.awl file as the default waiver file.
set_option default_waiver_file $TOP_WAIVER_FILE

#Disables flattening during the compile_design command in the sg_shell.
#Also disables flattening while opening a project, if the project was closed with a flattened view.
set_option designread_disable_flatten no

#The default value of the enable_save_restore option is yes.
#Use this design-read option to view built-in messages during the restore
#run that were reported during the save run.
set_option enable_save_restore no

#Use this design-read option to translate design attributes from SDC format
#to SGDC format. These attributes are then used during SpyGlass analysis.
set_option sdc2sgdc no

#Use this command to print the waived messages in the waiver report when
#the -ip argument of the waive constraint is specified. By default, only
#the count of waived messages is reported in the waiver report.
set_option report_ip_waiver yes

#If you set the force_gateslib_autocompile command to yes to
#automatically compile gate libraries, any criteria for re-compilation of gate
#libraries is not evaluated. In such cases, the specified .lib files are always
#compiled and these files overwrite the existing .sglib file present in the
#cache directory.
set_option force_gateslib_autocompile yes


# ##################### set parameters #####################
#Specifies whether the related rules check the bit_width as per LRM.
#By default, the nocheckoverflow rule parameter is set to no, and the affected rules do not check the bit-width as per LRM.
#Lint: W116, W164a, W164b, W164c, W486, W110, W263, W362
set_parameter nocheckoverflow no

#(Optional) Causes the CombLoop rule to proceed from enable pin to Q (output) pin of a latch, while detecting the combinational loop.
#By default, the enableE2Q rule parameter is unset and the CombLoop rule does not traverse through latches for locating combination loops.
set_parameter enableE2Q yes

#The default value is no. Set this parameter toyes to use the automatically-generated clock information.
#NOTE: This is the parameter of SpyGlass CDC solution
set_parameter use_inferred_clocks yes

#Specifies whether the STARC02-2.10.3.7 rule reports a violation for hexal, octal, and decimal based 
#numbers if the width specified is greater than the actual bit-width of the based number.
#The STARC02-2.10.3.7 rule reports based numbers where the bit-width definition and specified value do not match.
#If the bit-width definition-part and the value part does not match like the examples below, it can easily lead to mistakes:
#a = 3'b11111111;
#a = 3'b11;
set_parameter ignore_based_width yes

#Specifies whether the STARC-2.11.3.1 rule reports a violation for sequential block infer counter logic.
#By default, the value of the ignore_fsm_counter parameter is set to no and the STARC-2.11.3.1 rule reports a violation for sequential block infer 
#counter logic.Set the value of this parameter to yes to ignore violations for such cases.This parameter is only applicable for Verilog.
#STARC-2.11.3.1 : Ensure that the sequential and combinational parts of an FSM description should be in separate always blocks. (Verilog)
#Use this rule to report detect the sequential and combinational parts of an FSM that are in the same always or sequential blocks.
set_parameter ignore_fsm_counter yes

#(Optional) Specifies the maximum number of logic levels beyond which the LogicDepth rule should flag an error message.
set_parameter delaymax 250

#Enables the W164a, W164b, W116, and W362 rules to report a violation for static expressions and non-static expressions that contain static 
#expressions.By default, this parameter is set to no. In this case, the specified rules do not report a violation for static expressions and non-static #expressions that contain static expressions.
set_parameter check_static_value yes

#Use this command to enable reporting of incremental messages so that you can compare results of a previously run goal with the current goal.
if { ![file exists ${WORK_HOME}/out/${TOP_MODULE}.vdb] } {
    set_goal_option report_incr_messages yes
	#Specifies path of previous Violation Database file for consideration in Incremental Mode
	set_goal_option old_vdbfile ${WORK_HOME}/out/${TOP_MODULE}.vdb
} else {
    set_goal_option report_incr_messages no
}

set_sg_lint_rules.tcl

# ########################### ignore rules ###########################
#The W446 rule flags output ports that are read in the module where they are set.
#Such models could lead to an unintended feedback path from the instantiating module in the post-synthesis simulation while this issue is not apparent 
#in the pre-synthesis simulation. Such models are also not recommended for some test tools that need to handle inout ports specially (by attaching 
#bus-holders, for example).
set_goal_option ignorerules {'W446'}

#The W280 rule flags intra-assignment delays specified with nonblocking assignments.
#Such description is unlikely to correspond to the physical implementation. However, such description may be required to use a unit delay to avoid 
#race conditions in simulation.
set_goal_option ignorerules {'W280'}


set_goal_option ignorerules {'W11'}

#Use this rule to report unregistered output from a top module./ Use this rule to report output ports in a module that are not driven by a flip-flop.
set_goal_option ignorerules {'RegOutputs'}

#The CheckDelayTimescale-ML rule reports a violation if a delay is used in a module and no timescale units are specified using the 'timescale compiler directive.
set_goal_option ignorerules {'checkDelayTimescale-ML'}

#The LogNMux rule reports multiplexer constructs in which log of the number of select input pins is greater than the specified number, that is, the logmux_max value that is 3 by default. 
set_goal_option ignorerules {'LogNMux'}

#The FlopDataConstant rule reports flip-flop instances for which the data pin is tied to a constant value.
set_goal_option ignorerules {'FlopDataConstant'}

#The sim_race01 rule reports signals that are assigned and used within the same module in the same simulation cycle. 
#This rule detects signals that are in two always constructs in the same module or one always construct and one continuous 
#assignment statement in the same module.
set_goal_option ignorerules {'sim_race01'}

#The ArrayIndex rule reports violation for the bus signals that are declared with the low-order bit first, 
#that is, it reports those multi-bit signals that do not follow the specified bit-order specification convention.
set_goal_option ignorerules {'ArrayIndex'}

#The DisabledAnd rule reports AND or NAND gate instances for which at least one input is tied low. 
#Therefore, these gate instances are effectively disabled.
set_goal_option ignorerules {'DisabledAnd'}
#The DisabledOr rule reports OR or NOR type gate instances for which at least one input is tied high. 
#Therefore, these gate instances are effectively disabled.
set_goal_option ignorerules {'DisabledOr'}

#The MuxSelConst rule reports the MUX gate instances for which the select pin is tied to a constant value.
set_goal_option ignorerules {'MuxSelConst'}

#The DiffTimescaleUsed-ML rule flags different timescales used in the design.If different timescales are used in different modules of the design, 
#then in a single simulation, delay values in one module will be different from that of other module.
set_goal_option ignorerules {'DiffTimescaleUsed-ML'}

#The LogicDepth rule reports logic paths, which originate or terminate at flip-flops or primary pins, 
#where the number of delay levels exceeds the specified value. This rule performs a simplified version of the critical path analysis.
set_goal_option ignorerules {'LogicDepth'}

# ########################### change the rules' level ###########################
#The W210 rule flags a violation for module or interface instances with unconnected ports.
#The W210 rule flags message only when number of terminals are less than the number of ports. 
#The W210 rule ignores ports that are intentionally kept open (by passing extra comma [Verilog] or by connecting them to open [VHDL]).
#If any of the unconnected ports are inputs or inouts, this is an error. It may or may not be an error if the unconnected ports are outputs.
set_option overloadrules W210+severity=Error

#The W287a rule flags module or gate instances where nets connected to input ports are not driven and the instance input which are not connected.
set_option overloadrules W287a+severity=Error

#The W480 rule reports violation for those for constructs in which the loop index variable evaluates to a non-integer.
set_option overloadrules W480+severity=Error

#The W213 rule reports PLI tasks and functions used in the design.
set_option overloadrules W213+severity=Error

#Reports constant assignments that are X-extended
set_option overloadrules W342+severity=Error

#The STARC05-1.3.1.3 rule reports violation for asynchronous reset/preset signals that are used as non-reset/preset signals or as synchronous reset/preset signals.
set_option overloadrules STARC05-1.3.1.3+severity=Error

#The STARC05-2.1.4.5 rule reports violation for logical operators that are used on vector operands.
#No violation is reported for logical negation on integer variables.
set_option overloadrules STARC05-2.1.4.5+severity=Error

#Bit-width of operands of a logical operator must match. (Verilog)
#The STARC05-2.10.3.2a rule flags bit-width mismatches between operand expressions of logical operations.
#Bit-width mismatch between operands of a logical operation may lead to incorrect results.
#The STARC05-2.10.3.2a rule does not flag a relational operation if an integer constant is used as one of the operands and the width of that constant is less than or equal to the width of the other operand.
set_option overloadrules STARC05-2.10.3.2a+severity=Error

#Do not mix descriptions of flip-flops with asynchronous reset and flip-flops without asynchronous reset in the same process/always block
#The STARC05-2.3.6.1 rule flags those always or process constructs that have a flip-flop description with a reset line and another flip-flop description without a reset line.
#The STARC05-2.3.6.1 rule does not report violation for hanging flip-flops.
#Mixing the descriptions of flip-flops with and without reset lines in the same always or process construct has the following issues:
#Such description may be confusing and difficult to debug
#Such description may also cause problems for synthesis tools.
set_option overloadrules STARC05-2.3.6.1+severity=Error

#The IntReset rule reports internally generated asynchronous resets in the design.
set_option overloadrules IntReset+severity=Error

#The DisallowCaseX-ML rule reports violation for casex constructs used in the design.
set_option overloadrules DisallowCaseX-ML+severity=Error


#The W443 rule flags based numbers that contain the unknown value character (X).
#The unknown value character (X) has no physical counterpart and may lead to a mismatch between pre- and post-synthesis simulation.
#By default, the W443 rule does not check the presence of X value in the default statement of the case construct in Verilog designs. 
#Use the strict rule parameter to check in the default statement also.
#For Verilog, no rule checking is done for unused macro definitions and unused parameters.
set_option overloadrules W443+severity=Error

#A signal is included in the sensitivity list of a combinational always block but none of its bits are read in that block (Verilog)
#The W456a rule flags signals that are in the sensitivity list of a combinational always construct but are never read in the construct.
set_option overloadrules W456a+severity=Error

#Do not connect buses in reverse order
#The W156 rule flags reverse connected buses.
#Making reversed connections (for example, 15:0 connected to 0:15) is legal but bad design practice and may represent an error.
#One exception (which can be handled with a waiver) is in making a big-endian/little-endian choice in connecting to a processor bus port.
set_option overloadrules W156+severity=Error

#Reports a case expression width that does not match case select expression width
#The W263 rule reports the case clause labels whose widths do not match the width of the corresponding case construct selector.
set_option overloadrules W263+severity=Error

set_top_module.tcl

#get top module from environment
if { [info exist $env(TOP_MODULE)] } {
    set TOP_MODULE $env(TOP_MODULE)
} else {
    set TOP_MODULE async_fifo_mem
}
puts "TOP_MODULE = $TOP_MODULE"

set_top_waiver.tcl

#set top waiver file
set TOP_WAIVER_FILE ${WORK_HOME}/waiver/${TOP_MODULE}.awl
if { ![file exists $TOP_WAIVER_FILE] } {
    exec touch $TOP_WAIVER_FILE
} 

执行脚本

1、cd /home/xxx/chip/eda_test
2、source SourceMe
3、cd 03_lint
4、sg_shell < scripts/sg_lint.tcl | tee sg_lint_screen.log
5、spyglass -project sg_lint &

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1697319.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

BFS 解决最短路问题

目录 一、前言 1.1 如何使用 BFS 找到最短路&#xff1a; 1.2 为什么不用 dfs &#xff1a; 二、模板套路 三、例题练习 3.1 例题1&#xff1a;迷宫中离入口最近的出口 3.2 例题2&#xff1a;最小基因变化 3.3 例题3&#xff1a;单词接龙 3.4 例题4&#xff1a;为高尔…

Springboot+Vue+ElementUI开发前后端分离的员工管理系统01--系统介绍

项目介绍 springboot_vue_emp是一个基于SpringbootVueElementUI实现的前后端分离的员工管理系统 功能涵盖&#xff1a; 系统管理&#xff1a;用户管理、角色管理、菜单管理、字典管理、部门管理出勤管理&#xff1a;请假管理、考勤统计、工资发放、工资统计、离职申请、个人资…

低频量化周报(指数分位值,指数风险溢价比,配债完整数据集,可转债策略)...

低频量化周报&#xff08;2024-05-25&#xff09; 指数分位值指数风险溢价比小规模配债<5亿配债完整数据 5 批文通过4 发哥通过3 交易所受理2 股东大会通过1 董事会预案可转债策略 双低策略四因子策略网格策略ETF抄底指标<3历史操作记录本周心得最后 指数分位值 指数名称…

秋招突击——算法打卡——5/25、5/26——寻找两个正序数组的中位数

题目描述 自我尝试 首先&#xff0c;就是两个有序的数组进行遍历&#xff0c;遍历到一半即可。然后求出均值&#xff0c;下述是我的代码。但这明显是有问题的&#xff0c;具体错误的代码如下。计算复杂度太高了&#xff0c;O&#xff08;n&#xff09;&#xff0c;所以会超时&…

2024年【高压电工】新版试题及高压电工找解析

题库来源&#xff1a;安全生产模拟考试一点通公众号小程序 高压电工新版试题是安全生产模拟考试一点通生成的&#xff0c;高压电工证模拟考试题库是根据高压电工最新版教材汇编出高压电工仿真模拟考试。2024年【高压电工】新版试题及高压电工找解析 1、【单选题】 110KV及以下…

C++课程设计:学校人员信息管理系统(可视化界面)

目录 学校人员信息管理系统 操作演示 MP4转GIF动图 设计功能要求 评分标准 QT Creator安装和新建项目 QT安装 QT新建项目 管理系统程序设计 mainwindow.h 文件 mainwindow.h 程序释义 mainwindow.cpp 文件 mainwindow.cpp 程序释义 main.h 文件 TXT文件生成 博主…

redis6.2.7 搭建一主多从

1、集群规划 节点端口角色192.168.137.1026379master192.168.137.1026380slave192.168.137.1036381slave 2、伪集群搭建 2.1 创建fake_cluster 目录存放 公共配置文件 # 进入redis目录 cd /app/apps/redis-6.2.7# 创建存放伪集群的目录 mkdir fake_cluster#复制redis.conf到…

东方通TongWeb结合Spring-Boot使用

一、概述 信创需要; 原状:原来的服务使用springboot框架,自带的web容器是tomcat,打成jar包启动; 需求:使用东方通tongweb来替换tomcat容器; 二、替换步骤 2.1 准备 获取到TongWeb7.0.E.6_P7嵌入版 这个文件,文件内容有相关对应的依赖包,可以根据需要来安装到本地…

【Qt 学习笔记】Qt窗口 | 菜单栏 | QMenuBar的使用及说明

博客主页&#xff1a;Duck Bro 博客主页系列专栏&#xff1a;Qt 专栏关注博主&#xff0c;后期持续更新系列文章如果有错误感谢请大家批评指出&#xff0c;及时修改感谢大家点赞&#x1f44d;收藏⭐评论✍ Qt窗口 | 菜单栏 | QMenuBar的使用及说明 文章编号&#xff1a;Qt 学习…

顺序栈的实现

顺序栈是用数组实现的&#xff1a;&#xff08;假设我们有8个位置&#xff08;下标0-7&#xff09;&#xff09; #include<stdio.h> #include<malloc.h> #include<assert.h> #include <iostream> #define MAX_SIZE 8#define Elemtype int typedef str…

Android 配置 Kapt 编译器插件

以 Android Studio 2023.3.1 最新版本为准。 步骤1:打开版本信息配置文件 找到libs.versions.toml文件。 这是打开后的样子&#xff1a; 步骤2&#xff1a;配置版本信息 你需要在[plugins]下面添加一条kapt的配置信息&#xff1a; 要添加的配置信息如下&#xff1a; jetbr…

YOLOv8_pose的训练、验证、预测及导出[关键点检测实践篇]

1.关键点数据集划分和配置 从上面得到的数据还不能够直接训练,需要按照一定的比例划分训练集和验证集,并按照下面的结构来存放数据,划分代码如下所示,该部分内容和YOLOv8的训练、验证、预测及导出[目标检测实践篇]_yolov8训练测试验证-CSDN博客是重复的,代码如下: …

粒子辐照环境中相机镜头防护及LabVIEW图像处理注意事项

在粒子辐照环境测试电路板性能的实验中&#xff0c;需要对相机镜头进行有效防护&#xff0c;同时利用LabVIEW进行图像识别和处理。本文将讨论相机镜头防护的关键因素和LabVIEW处理过程中的注意事项&#xff0c;包括防辐射材料选择、辐射屏蔽措施、散热管理、空间布局及LabVIEW软…

CorelCAD v2022.5 解锁版 安装教程(2D制图 3D设计和打印的简化软件)

前言 CorelCAD&#xff0c;加拿大Corel公司开发的一款适用于2D制图、3D设计和打印的简化版CAD软件。它是款专业的2D制图和3D设计软件&#xff0c;拥有行业标准文件兼容性&#xff0c;支持 .DWG、.STL、.PDF、 .CDR*等文件格式&#xff0c;轻松实现协作和项目共享&#xff0c;利…

6818 android 修改开机 logo, 编译脚本分析

问题&#xff1a; 客户需要去掉 android5.1 的开机logo. 说明&#xff1a; 对于Android5.1 来说&#xff0c;uboot 与kernel 的logo 是一个。 过程&#xff1a; 其实对于开机logo 的修改很简单&#xff0c;直接参考厂家手册就可以了。 这是 android4.4 的开机logo 的修改&…

Qt | QStackedLayout 类(分组布局或栈布局)、QStackedWidget

01、QStackedLayout 类 1、使用 QStackedLayout 可以实现一个多页面切换的界面,多 页面切换就是类似于选项卡(如右图)类型的界面。 2、QStackedLayout 并没有直接实现多页面切换的办面,只是我们可以通过该类实现多页面切 换的功能,因此要使用 QStackedLayout 类实现多面面…

LeetCode 第399场周赛个人题解

100323. 优质数对的总数 I 原题链接 100323. 优质数对的总数 I 思路分析 签到题 AC代码 class Solution:def numberOfPairs(self, nums1: List[int], nums2: List[int], k: int) -> int:n, m len(nums1), len(nums2)ret 0for i in range(n):for j in range(m):if nu…

GDPU JavaWeb mvc模式

搭建一个mvc框架的小实例。 简易计算器 有一个名为inputNumber.jsp的页面提供一个表单&#xff0c;用户可以通过表单输入两个数和运算符号提交给Servlet控制器&#xff1b;由名为ComputerBean.java生成的JavaBean负责存储运算数、运算符号和运算结果&#xff0c;由名为handleCo…

qt-C++笔记之使用QtConcurrent异步地执行槽函数中的内容,使其不阻塞主界面

qt-C笔记之使用QtConcurrent异步地执行槽函数中的内容&#xff0c;使其不阻塞主界面 code review! 参考博文&#xff1a; qt-C笔记之使用QtConcurrent异步地执行槽函数中的内容&#xff0c;使其不阻塞主界面 qt-C笔记之QThread使用 文章目录 qt-C笔记之使用QtConcurrent异步地…

23种设计模式顺口溜

口诀&#xff1a; 原型 抽风 &#xff0c;单独 建造 工厂 &#xff08;寓意&#xff1a;&#xff08;这里代指本来很简单的东西&#xff0c;却要干工厂这里复杂的业务&#xff09; 抽风&#xff1a;抽象工厂单独&#xff1a;单例桥代理组合享元适配器&#xff0c;&#xff0…