在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 14119|回复: 20

如何在modelsim中进行基于OVL库断言语句的设计和验证

[复制链接]
发表于 2008-12-2 11:44:10 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
我想在modelsim中进行基于断言的设计验证,OVL库应该添加到哪个目录下,除此之外还需要别的什么设置才能进行断言语句的调用呢?
有谁做过相关的工作,给点帮助吧,不胜感激!
 楼主| 发表于 2008-12-2 17:59:07 | 显示全部楼层
没人用过吗?自己顶一下
发表于 2008-12-3 14:49:00 | 显示全部楼层
testbench文件如下:
module tb_assert_always();
reg reset_n, clk;
reg[7:0] count;
wire clr;
wire[2:0] fire;
always @(posedge clk)
   count <= (~reset_n || clr) ? 8'b0 : (count + 8'd1);
   
assign clr = (count >= 8'd143) ? 1'b1 : 1'b0;
`ifdef OVL_ASSERT_ON  
   ovl_always #(
      `OVL_ERROR,
      `OVL_ASSERT,
      "ERROR: count > 15",
      `OVL_COVER_CORNER,
      `OVL_POSEDGE,
      `OVL_ACTIVE_LOW,
      `OVL_GATE_CLOCK)
       chk_cnt(
          clk,
          reset_n,
          1'b1,
          count <= 8'd15,
          fire);
`endif
initial begin
    clk = 0;
    reset_n = 0;
    #7 reset_n = 1;
end
always begin
   #5 clk = ~clk;
end   
always @(posedge clk)
   $monitor("At time %t, count = %d", $time, count);
endmodule

modelsim命令运行文件run.do文件内容如下:
# All Rights Reserved.
#
# THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY INFORMATION
# WHICH IS THE PROPERTY OF MENTOR GRAPHICS CORPORATION
# OR ITS LICENSORS AND IS SUBJECT TO LICENSE TERMS.
# Use this run.do file to run this example.
# Either bring up ModelSim and type the following at the "ModelSim>" prompt:
#     do run.do
# or, to run from a shell, type the following at the shell prompt:
#     vsim -do run.do -c
# (omit the "-c" to see the GUI while running from the shell)
onbreak {resume}
# create library
if [file exists work] {
    vdel -all
}
vlib work
# compile and link C source files
#sccom -g count.cpp
#sccom -link
# compile Verilog/VHDL source files
#vlog -f filelist.ovl
vlog +define+OVL_ASSERT_ON ovl_always.v tb_assert_always.v
# open debugging windows
quietly view *
# start and run simulation
vsim tb_assert_always
run 200 ns

注意红体字,就是OVL断言库涉及内容。这样就可以在modelsim中进行《基于断言的RTL设计》了,哥们我半年前就开始做这方面的尝试了,而且是软硬协同仿真。
 楼主| 发表于 2008-12-3 20:15:54 | 显示全部楼层
请问一下count.cpp,filelist.ovl
是什么文件?
filelist.ovl
是不是OVL库文件的列表?
发表于 2008-12-3 21:47:37 | 显示全部楼层
count.cpp是我用systemC写的一个加法器的行为级模型,如果你的设计中没有包含systemC/C++模型,那么可以把
发表于 2008-12-3 21:54:12 | 显示全部楼层
count.cpp是我用systemC写的加法器的行为级模型,如果你的仿真中没有systemC/C++模型模块,那么可以把sccom -g count.cpp和sccom -link注销掉 。
 楼主| 发表于 2008-12-3 22:01:59 | 显示全部楼层
谢谢你呀,网上只能搜到问问题的,但是没有像你这样回答问题的。
还有问题:
1、你的ovl_always.v    tb_assert_always.v   count.cpp 是放在同一个PROJECT里面的吗?那MODELSIM怎么能区分哪个是断言呢?
2、为什么我的ASSERTION    WINDOW没有反应?一直是空的

[ 本帖最后由 jungswee 于 2008-12-3 22:03 编辑 ]
发表于 2008-12-3 22:30:14 | 显示全部楼层
1. ovl_always.v是用verilog写的断言文件 ,放在project下
vlog +define+OVL_ASSERT_ON ovl_always.v tb_assert_always.v
以上编译命令中的红色字体部分可以使modelsim对断言语句进行辨认,如果没有+define+OVL_ASSERT_ON ,则在仿真时忽略断言,这个和verilog语法是一致的

在项目中好好琢磨有些问题吧,modelsim的功能是非常强大的,特别是在软硬协同仿真和验证方面
发表于 2008-12-4 09:59:12 | 显示全部楼层
学学学学学
发表于 2009-8-18 15:32:57 | 显示全部楼层
感觉还行
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /2 下一条

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-4-27 20:45 , Processed in 0.032490 second(s), 8 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表