上两篇主要是讲述断言的概念,基本语法,总结等等

这一篇主要是以PPT的形式展示各个场景下关于断言的应用。

为了在设计中加入断言的功能,因此需要写一个DUT。如下:

`define true
`define free (a && b && c && d) module assertion(
input clk,
input rst_n
); reg a = 'b0 ;
reg b = 'b0 ;
reg c = 'b0 ;
reg d = 'b0 ;
reg e = 'b0 ;
reg f = 'b0 ;
reg start = 'b0 ;
reg stop = 'b0 ; always @(posedge clk)
begin
a <= $urandom_range(,);
b <= $urandom_range(,);
c <= $urandom_range(,);
d <= $urandom_range(,);
e <= $urandom_range(,);
f <= $urandom_range(,);
start <= $urandom_range(,);
stop <= $urandom_range(,);
end assign state = {a,b,c,d};
assign bus = {a,b,c,d}; `ifdef SIM_ASSERTION_ON
//a1
sequence s1;
@(posedge clk) a;
endsequence property p1;
s1;
endproperty a1: assert property (p1); //a2
sequence s2;
@(posedge clk) $rose(a);
endsequence property p2;
s2;
endproperty a2: assert property (p2); //a3
property p3;
@(posedge clk) a || b;
endproperty a3: assert property (p3); //a4
sequence s4;
@(posedge clk) a ## b;
endsequence property p4;
s4;
endproperty a4: assert property (p4); //a5
property p5;
@(posedge clk) a ## b;
endproperty a5:assert property(p5); //a6
sequence s6;
@(posedge clk) a ## b;
endsequence property p6;
not s6;
endproperty a6: assert property(p6); //a7
property p7;
@(posedge clk) a ## b;
endproperty a7: assert property (p7)
$display("Property p7 successed\n");
else
$display("Property p7 failed\n"); //a8
property p8;
@(posedge clk) a |-> b;
endproperty a8: assert property (p8); //a9
property p9;
@(posedge clk) a |=> b;
endproperty a9: assert property (p9); //a10
property p10;
@(posedge clk) a |-> ## b;
endproperty a10: assert property (p10); //a11
sequence s11a;
@(posedge clk)(a && b) ## c;
endsequence sequence s11b;
@(posedge clk) ## !d;
endsequence property p11;
s11a |-> s11b;
endproperty a11: assert property (p11); //a12
property p12;
@(posedge clk) ( a&&b ) |-> ## [:] c;
endproperty a12: assert property (p12); //a13
property p13;
@(posedge clk) ( a&&b ) |-> ## [:] c;
endproperty a13: assert property (p13); //a14
property p14;
@(posedge clk) a |-> ##[:$] b ##[:$] c;
endproperty a14: assert property (p14); //a15
sequence s15a;
@(posedge clk) a ## b;
endsequence sequence s15b;
@(posedge clk) c ## d;
endsequence property p15a;
s15a |=> s15b;
endproperty property p15b;
s15a.ended |-> ## s15b.ended;
endproperty a15a: assert property (p15a);
a15b: assert property (p15b); //a17
property p17;
@(posedge clk) c ? d == a : d == b;
endproperty a17: assert property(p17); //a18
sequence s18a;
@(posedge clk) a ## b;
endsequence sequence s18a_ext;
@(posedge clk) a ## b ## `true;
endsequence sequence s18b;
@(posedge clk) c ## d;
endsequence property p18;
@(posedge clk) s18a.ended |-> ## s18b.ended;
endproperty property p18_ext;
@(posedge clk) s18a_ext.ended |-> ## s18b.ended;
endproperty a18: assert property (p18);
a18_ext: assert property (p18_ext); //a19
property p19;
@(posedge clk) (c && d) |-> ($past((a&&b), ) == 'b1);
endproperty a19: assert property (p19); //a20
property p20;
@(posedge clk) (c && d) |-> ($past ( ( a&&b ), , e) == 'b1);
endproperty a20: assert property (p20); //a21
property p21;
@(posedge clk) $rose(start) |-> ## (a[*]) ## stop ## !stop ;
endproperty a21: assert property (p21); //a22
property p22;
@(posedge clk) $rose(start) |-> ## ((a ## b) [*]) ## stop ;
endproperty a22: assert property (p22); //a23
property p23;
@(posedge clk) $rose(start) |-> ## ((a ##[:] b) [*]) ## stop ;
endproperty
a23: assert property (p23); //a24
property p24;
@(posedge clk) $rose(start) |-> ## (a [* : $]) ## stop ;
endproperty a24: assert property (p24); //a25
property p25;
@(posedge clk) $rose(start) |-> ## (a [->]) ## stop ;
endproperty a25: assert property (p25); //a26
property p26;
@(posedge clk) $rose(start) |-> ## (a [=]) ## stop ## !stop;
endproperty a26: assert property (p26); //a27
sequence s27a;
@(posedge clk) a ##[:] b;
endsequence sequence s27b;
@(posedge clk) c ##[:] d;
endsequence property p27;
@(posedge clk) s27a and s27b ;
endproperty a27: assert property(p27); //a28
sequence s28a;
@(posedge clk) a ##[:] b;
endsequence sequence s28b;
@(posedge clk) c ##[:] d;
endsequence property p28;
@(posedge clk) s28a intersect s28b ;
endproperty a28: assert property(p28); //a29
sequence s29a;
@(posedge clk) a ##[:] b;
endsequence sequence s29b;
@(posedge clk) c ##[:] d;
endsequence property p29;
@(posedge clk) s29a or s29b ;
endproperty a29: assert property(p29); //a30
sequence s30a;
@(posedge clk) a ##[:] b;
endsequence sequence s30b;
@(posedge clk) c ##[:] d;
endsequence property p30;
@(posedge clk) first_match (s30a or s30b) ;
endproperty a30: assert property(p30); //a31
property p31;
@(posedge clk) $fell(start) |->
(!start) throughout
(## ( !a && !b ) ## ( c[->] ) ## ( a&&b ) );
endproperty a31: assert property(p31); //a32
sequence s32a;
@(posedge clk)
(( !a && !b ) ## ( c[->] ) ## ( a&&b ) );
endsequence sequence s32b;
@(posedge clk)
$fell(start) ## [:] $rose(start);
endsequence sequence s32;
@(posedge clk)
s32a within s32b;
endsequence property p32;
@(posedge clk)
$fell(start) |-> s32;
endproperty a32: assert property(p32); //a33
a33a: assert property( @ (posedge clk) $onehot(state) ); a33b: assert property( @ (posedge clk) $onehot0(state) ); a33c: assert property( @ (posedge clk) $isunknown(bus) ); a33d: assert property( @ (posedge clk) $countones (bus) ); //a34
property p34;
@(posedge clk)
disable iff (rst_n)
$rose (start) |-> a[=] ## b[=] ## !start ;
endproperty //a35
property p35;
(@(posedge clk) [*:] intersect(a ##[:$] b ##[:$] c));
endproperty a35: assert property(p35); //a36
property arb (a,b,c,d);
@(posedge clk) ($fell (a) ##[:] $fell(b) ) |->
## ($fell (c) && $fell(d) ) ##
(!c && !d) [*] ## (c&&d) ## b;
endproperty a36_1: assert property(arb(a1,b1,c1,d1));
a36_2: assert property(arb(a2,b2,c2,d2));
a36_3: assert property(arb(a3,b3,c3,d3)); //a37
property p_nest;
@(posedge clk) $fell (a) |->
## (!b && !c && !d ) |->
## [:] `free;
endproperty a_nest: assert property(p_nest); property p_nest1;
@(posedge clk) $fell (a) ## (!b && !c && !d )
|-> ## [:] `free;
endproperty a_nest1: assert property(p_nest1); //a_if_else
property p_if_else;
@(posedge clk) ($fell (start)##(a || b))|->
if (a)
(c[->] ## e)
else
(d[->] ## f);
endproperty a_if_else: assert property(p_if_else); `endif endmodule

通过运行Makefile脚本,调用VCS以及Verdi命令来实现以及查看断言的波形。

总结如下:

目录

1、概述

2、断言的常用语法

3、断言的应用

至此,关于断言的知识点全部更新完全,有疑问的欢迎交流。

SystemVerilog Assertion 设计、调试、测试总结(3)的更多相关文章

  1. SystemVerilog Assertion 设计、调试、测试总结(1)

    暑期实习两个月的其中一个任务是:如何在设计中加入断言?以及断言的基本语法.三种应用场景下的断言(如FIFO.FSM.AXI4-lite总线).参考书籍:<System Verilog Asser ...

  2. SystemVerilog Assertion 设计、调试、测试总结(2)

    上一篇博客主要写了SVA的基本语法(详细),这一篇主要写SVA语法总结,以及如何查看SVA波形等. 断言assertion被放在verilog设计中,方便在仿真时查看异常情况.当异常出现时,断言会报警 ...

  3. systemverilog assertion

    1.一般是单独写一个module 里面放assertion,  然后在验证平台顶层和RTL的实例化bind起来​ 2. |->表示直接进行判断,|=>表示下一拍判断,一般一个断言最好只写一 ...

  4. [连载]《C#通讯(串口和网络)框架的设计与实现》- 0.前言

                                  目       录 前言 前言 刚参加工作,使用过VB.VC开发软件,随着C#的崛起,听说是C++++,公司决定以后开发软件使用C#,凭借在 ...

  5. 在线调试lua原型设计

    在规模日益增长的软件项目开发中, 如何有效的进行代码调试成为影响开发效率的致命因素之一.在当今网络游戏项目中, lua几乎成了项目脚本的标配.编译型的语言, 诸如C++, 都有良好的ide支持调试.而 ...

  6. SystemVerilog的历史

    随着软件的功能需求越来越复杂,C语言不足以解决现有的问题,于是C++被发明了:C++的指针漫天飞,对内存的处理过于复杂,于是Java被发明了:芯片的功能不断地扩大,Verilog不足以应对日益复杂的芯 ...

  7. Chrome 控制台console的用法(学了之后对于调试js可是大大有用的哦)

    大家都有用过各种类型的浏览器,每种浏览器都有自己的特色,本人拙见,在我用过的浏览器当中,我是最喜欢Chrome的,因为它对于调试脚本及前端设计调试都有它比其它浏览器有过之而无不及的地方.可能大家对co ...

  8. 痞子衡嵌入式:飞思卡尔Kinetis开发板OpenSDA调试器那些事(上)- 背景与架构

    大家好,我是痞子衡,是正经搞技术的痞子.今天痞子衡给大家介绍的是飞思卡尔Kinetis MCU开发板板载OpenSDA调试器(上篇). 众所周知,嵌入式软件开发几乎离不开调试器,因为写一个稍有代码规模 ...

  9. JS调试技巧

    大家都有用过各种类型的浏览器,每种浏览器都有自己的特色,本人拙见,在我用过的浏览器当中,我是最喜欢Chrome的,因为它对于调试脚本及前端设计调试都有它比其它浏览器有过之而无不及的地方.可能大家对co ...

随机推荐

  1. PHP如何实现处理过期或者超时订单的,并还原库存

    订单是我们在日常开发中经常会遇到的一个功能,最近在做一个订单过期与超时的开发.订单过期与超时就不用我解释了吧,其实两者都是同一个问题来着,就是订单未支付的处理,我们要做的是对这些未支付的订单到了一定时 ...

  2. java月利率计算(等额本息贷款)

    等额本息 每月还款计算公式: 每月本息金额 = (本金×月利率×(1+月利率)^还款月数)÷ ((1+月利率)^还款月数-1)) 反转求出 月利率 月利率 如果根据上面公式反转是算不出来的. 下面给出 ...

  3. ParameterizedType 使用方法

    ParameterizedType 它是jdk提供的参数化类型,包括了如下 请求参数,和响应参数都是 参数话类型.记住凡是含有<T>中的都是参数话类型. public static < ...

  4. 一个arctan积分的两种解法

    \[\Large\int_{0}^{1}\frac{\arctan x}{\sqrt{1-x^{2}}}\mathrm{d}x\] \(\Large\mathbf{Solution:}\) 首先第一种 ...

  5. win10使用L2TP连接失败,报远程服务器未响应错误解决办法,亲测可用!

    报错如下: 原因是L2TP连接需要IPSec加密,远程服务器未响应说明IPSec加密被禁用了,需要在注册表启用它,具体步骤如下: 1.以管理员账号身份打开CMD,win10 是 win+x键 2.找到 ...

  6. 吴裕雄 python 神经网络——TensorFlow训练神经网络:卷积层、池化层样例

    import numpy as np import tensorflow as tf M = np.array([ [[1],[-1],[0]], [[-1],[2],[1]], [[0],[2],[ ...

  7. Java 数据脱敏 工具类

    一.项目导入Apache的commons的Jar包. Jar包Maven下载地址:https://mvnrepository.com/artifact/org.apache.commons/commo ...

  8. 【原】centos安装django

    一.更新系统软件包yum update -y 二.安装软件管理包和可能使用的依赖 yum -y groupinstall "Development tools" yum insta ...

  9. navicat for mysql 中文破解版(无需激活码)

    1.下载破解版Navicat for MySQ中文破解版 链接: https://pan.baidu.com/s/19BlJRx7tLnDPIM4U6DNWvA 提取码: d9ci 2.解压下载后的文 ...

  10. 关于Java大整数是否是素数

    题目描述 请编写程序,从键盘输入两个整数m,n,找出等于或大于m的前n个素数. 输入格式: 第一个整数为m,第二个整数为n:中间使用空格隔开.例如: 103 3 输出格式: 从小到大输出找到的等于或大 ...