Formal -- VC Formal FPV study

Introduction to Formal Verification

Requirements

  • Assertion/Cover
  • Assume(Constraint)
  • Synthesizable RTL

Formal Results

  • Proof
  • Falsification
  • Bounded Proof

VC Formal

Flow

Components

FPV

Methodology

Inputs for FPV

Analyze and elaborate commands (example, read_file )

Clock and reset commands (example, create_clock, create_reset )

Execute commands (example, check_fv )

Report commands (example, report_fv )

 Onputs for FPV

Property Status

  • Assertion status: Proven, Falsified, Vacuous(先决条件没有cover到), Witness-Coverable, Uncoverable and Inconclusive(没有得到证明)
  • Assume status: Non-Vacuous, Vacuous(assume无效),Uncoverable and Inconclusive
  • Cover status: Coverable and Uncoverable

Execue FPV

vcf -f run.tcl

vcf -f run.tcl -verdi

 Analyzing Results

report_fv

Property Control

Formal Runtime Control

控制time/memory/engine

  • set_fml_var fml_max_time <time, ex. 24H>
  • set_fml_var fml_progress_time_limit <time, ex. 100M>
  • set_fml_var fml_max_mem <Maximum memory size>

Controlling Engine Effort

  • set_engine [-on|-off] <engine id>
  • set_fml_var fml_effort <effort level, ex. high>

Controlling Resume

  • set_fml_var fml_enable_resume true
  • set_fml_var fml_enable_resume_depth true

Controlling Grid Usage

  • set_grid_usage -type [LSF|SGE|RTDA]=<#_of_workers> ...
  • report_grid_usage

Convergence Improvement

  • snip_driver
  • set_blackbox
  • set_abstractions
  • get_abstractions
  • report_abstraction

snip_driver

example:

packages/formal_sva_lib/fml_abstracted_models/ram_and_fifo/example/xxx

usage:

snip_driver spec.reg
snip_driver impl.reg
fvassume -expr { spec.reg == impl.reg }

And if we add the following assertions:
fvassert -expr { $driver(spec.reg) == $driver(impl.reg) }
 

Verdi Debug Command

生成proven的波形的

set_fml_var fml_witness_on true

Setting up Enviroment

Session

%vcf -session my_path/my_session

%vcf> save_session -session <session_name>

Application mods

vcf -fmode FPV|CC

set_fml_appmode FPV|CC

Compiling Designs

read_file

analyze

elaborate

Verilog + SVA example

read_file –format verilog –sva –top arb –vcs “-sverilog arb.v arb.sva arb_bind.v”
or
analyze –format verilog –vcs “-sverilog arb.v arb.sva arb_bind.v”
elaborate arb -sva

SystemVerilog+SVA example

read_file –format sverilog –sva –top arb –vcs “arb.sv arb.sva arb_bind.v”
or
analyze –format sverilog –vcs “arb.v arb.sva arb_bind.v”
elaborate arb -sva


Support for Multiple-Edge-Assignment and the Multiple-Process-Assignment

set_fml_var fml_enable_ndmerge true


Changing Severity of VC Static Error Messages

%vcf> set_message_severity -names message_names <error|warning|info>

  eg: %vcf> set_message_severity -name CC_UID017 error  #severity of CC_UID017 should be error
 

%vcf> set_message_error_action [-stop_at_error_count error_count] <stop | continue>

  eg: set_message_error_action stop ##stop on CC_UID017 error
 

Block Boxing Modules in a Design

set_blackbox 必须再read_file 或者elaborate 之前

set_blackbox -help

set_blackbox [-level N] [-exclude <design>] [-cells <cell>] [-designs <design>]

eg: 

  set_blackbox -designs {moduleA}
  read_file -format verilog -top top top.v
 

Specifying User-defined Clocks

create_clock -help

create_clock -period <period_value> (Specifies clock period value)
                      [-name <clock_name>] (Specifies clock name)
                      [-waveform <edge_list>] (Specifies edge list)
                      [-add] (Add new options to the original clock)
                      [-comment <string>] (Specifies comment)
                      [-refclk] (Use clock as reference clock [formal])
                      [-initial <value>] (Specify clock initial value (0/1 - default 1) at time 0

create_clock clk -waveform {10 90} -period 100

Specifying Reference Clock

create_clock clk -period 100 [-refclk]

Specifying User-defined Resets

create_reset -help
create_reset
    [-sync] (If signal drives synchronous reset)
    [-async] (If signal drives asynchronous reset)

    [-type reset|set|load] (specifies the type of reset signal, default is reset)
    [-name <rst_name>] (specifies the name of reset signal)
    [-sense low|high|any] (specifies active value for reset)
    [-clock <clk_name>] (specifies list of clock name)
    [-synchronized] (specifies whether reset de assertion is syncronized or not)

Specifying Single Resets

create_reset rst_n -sense low

(same: sim_force rst -apply 1’b0, set_constant rst -apply 1’b1)

Constraints and Properties for Formal Analysis

Constraint

Constraints for formal analysis can be added as properties in the RTL source file, checker files, or script properties using the fvassume command.

%vcf> fvassume -help
fvassume const_pipeid –stable -expr {pipe_id} #pipe_id is either 0 or 1 in cycle 1, and remains
constant thereafter.一开始随机,后面stable

depth constraint

fvassume -expr <expr> -depth <n>
eg: fvassume -expr { state == 2'b0 } -depth 3 #reset之后前3个cycle 约束state == 0

Environment Global Constraints

Environment constraints 生效在reset和formal analysis期间,必须在sim_run command 之前,应用于primary inputs, undriven nets, snip points or black box outputs

eg: fvassume -env -expr {vld_status == 1 }

Constant Constraints

set_constant scan_en –value 0

If used together on the same signal, the value set by set_constant can be overridden by sim_force during the reset phase.

example: signal SCAN_EN should be set to 1 during reset and changed to 0 during formal analysis as the following code snippet shows:
set_constant SCAN_EN –apply 0
sim_force SCAN_EN –apply 1
...
sim_run
sim_save_reset
如果出现在进行重置和形式化分析时,可能会遇到由于不匹配而导致的造假初始状态,可以使用 fvassume 

sim_force SSE –apply 1
...
sim_run
sim_save_reset
fvassume sse0 –expr {SSE == 0}
 

Property Attributes

Automatically Extracted Properties

AEPs 是tool 分析完design后自动提取出来的property,Use the read_file or elaborate command to enable AEPs.
read_file -aep arith_oflow+x_assign -sva -top $top -format verilog -vcs “-sverilog -f demo.files”
read_file -aep all -sva -top $top -format verilog -vcs “-sverilog -f demo.files”

Coverage Properties

read_file -cov line+cond -sva -top $top -format verilog -vcs “-sverilog -f demo.files”

read_file -cov all -sva -top $top -format verilog -vcs “-sverilog -f demo.files”


Source Properties

fvassume, fvassert, fvcover, fvenable and fvdisable等命令改变source property使用


Script Properties

  • fvassert property_name –expr <expression>
  • fvassume property_name –expr <“expression”>
  • fvcover property_name –expr <“expression”>

Builtin functions

  • $onehot(<expr>): 

  • $onehot0(<expr>):

  • $countbits(<expr>): 

  • $countones(<expr>): 

  • $isunknown(<expr>): 

  • $signed(<expr>): 

  • $unsigned(<expr>): 

  • $stable(<stableExpr>): 

  • $rose(<expr>): 

  • $fell(<expr>):

  • $past(<expr>[, <#cycles>): 

Performing and Configuring VC Formal Checks

Performing VC Formal Checks

vcf> check_fv -help

check_fv 

  [-block] (Makes command input block while this command is active.)
  [-run_finish <cmds>] (Set of commands to run when this command finishes in non-
blocking mode.)
  [-stop] (Stops execution)
  [-break <#of falsification(s)>]
  [-property <list-or-collection-of-properties>] (List or collection of properties)
  [-subtype <list-of-subtypes>] (goal subtype selection: property, vacuity, witness)
  [-assume] (Use proven assertions and uncoverable covers as constraints)



eg:

check_fv –run_finish {
  report_fv –list –status falsified > falsification_list.txt
  report_fv –list –status proven > proven_list.txt
  report_fv –list –status unknown > unknown_list.txt
  quit
}

Running on Compute Farm

Configuring Grids

vcf> set_grid_usage -help

Use the following command to configure an LSF farm for 10 Linux redhat 4 machines, where each machine has at least 8G memory:

set_grid_usage -type lsf=10 -control { bsub -q bnormal -R arch==glinux -R os_version==WS4_0 -R rusage[mem=8000] }

Report of Grid Configuration

vcf> report_grid_usage

Debugging the Grid Setup

vcf> report_fml_hosts

Controlling check_fv Runs

set_fml_var fml_max_time 10H

set_fml_var fml_max_mem 8GB

Restoring Session

set_app_var fml_auto_save true/false

vcf –session <session_name> –restore\

Viewing Progress of check_fv Runs

report_fml_engines
report_fml_jobs

Profiling bound Statistics for Goals

set_app_var fml_orc_bmc_depth_profile true

Supporting the Bug Hunting Feature

%vcf> bug_hunting_config [-mode 0-4] [-random <0|1>] [-saveDir dir]
%vcf> report_fml_bug_hunting [-jobId <id>] [-status <0|1>] [-nlines <n>] [-pos
<head|tail|all>]


Providing User-Defined Property Order to Improve Bug Hunting


The fvorder Command:

%vcf> fvorder [-clear] [-print]<list-of-names-ids-or-collections-of-properties>

Debugging Results of Formal Verification


 


 


 



  

  • 9
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 正式验证(formal verification)是指通过严格的数学证明或形式化验证方法来验证计算机程序或系统的正确性和可靠性。与传统的测试方法相比,正式验证能够全面地覆盖程序或系统的所有执行路径,从而可以发现所有可能存在的错误或漏洞。正式验证在高可靠性和高安全性的计算机系统和软件开发中得到了广泛应用。 ### 回答2: 正式验证(formal verification)是指对计算机系统或软件系统进行全面、精确和自动化的验证方法。在软件和硬件开发领域中,正式验证是一种非常重要的技术,能够帮助开发人员验证设计的正确性并确保系统可以在安全和可靠的环境中运行。 正式验证主要利用数学和形式化方法对系统进行分析和验证。这里的数学方法指的是逻辑、自动机理论、代数和图论等。利用这些数学方法,设计人员可以将系统的规范和要求转化为可计算的形式,然后利用计算机工具来进行分析和验证,以确定系统的正确性和安全性。 正式验证可以帮助设计人员避免由于错误或故障导致的系统问题。在开发软件或硬件系统时,错误和故障是难以避免的。这些问题可能导致系统失效,造成数据损失或其他安全问题。通过使用正式验证技术,设计人员可以对设计进行全面的检查,以确保系统满足所有规范和要求,并且能够进行正确的操作。 正式验证技术还可以为设计人员提供高效、可复用和可扩展的工具集。通过使用这些工具,设计人员可以轻松地对不同类型的系统进行验证,同时也可以快速定位和解决系统中的问题。这使得正式验证在软件和硬件开发领域中得到了广泛的应用。 总之,正式验证是计算机系统和软件系统开发过程中一项非常重要的技术。通过利用数学和形式化方法对系统进行分析和验证,设计人员可以保证系统的正确性和安全性,并避免由于错误或故障导致的问题。这种技术的广泛应用,具有极高的实用性和可行性,使得它被广泛用于软件和硬件开发等领域。 ### 回答3: 形式验证(formal verification)是一种严谨的数学方法,用于验证硬件或软件系统的正确性。它使用形式化的语言和数学工具来证明系统的设计符合特定规范或要求,并且排除了设计中可能存在的任何错误或漏洞。这些规范可以是严格的数学规则,也可以是用户的需求文档或其他设计规范。 形式验证可以在不运行实际代码或硬件设计之前发现错误,而不是依靠测试和修复错误。这种方法能够提高系统的质量和安全性,特别是在关键系统中,如航天、医疗、安全和金融领域的系统等。 形式验证的主要方法包括模型检查、定理证明和符号执行等。模型检查是一种自动化的技术,它为系统设计创建一个形式化模型,并使用模型检查工具验证设计符合特定规范。定理证明是使用数学证明技术来证明系统的正确性,它需要人工编写证明,但能够提供高度保证和严谨性。符号执行是对程序的具体执行路径进行符号计算,从而发现程序执行中可能存在的漏洞。 形式验证虽然具有高度的保证和可靠性,但也存在困难和挑战。其中一个是形式规范的编写,需要精确和详尽的描述系统的要求和目标;另一个是应对系统规模和复杂性的挑战,需要使用高效的算法和工具,以及强大的计算资源。 总之,形式验证技术是一种重要而严谨的方法,用于确保系统的正确性,保障关键系统的安全和可靠性。它是未来软硬件设计的重要趋势之一,将在越来越多的领域得到广泛应用。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值