modelsim仿真常用系统函数

(1)$time

   作用:返回所在模块的仿真时间,可以查看信号的出现的时间,用来把握信号的时序。

   如:$display(''the time is %t'',$time) ;//显示当时的时间

 (2)$display

作用: 将需要显示的内容在命令栏显示出来

如: $display("the signal is % d",ad); //将ad信号以十进制的方式显示出来

 (3)$monitor

作用:监视变量的变化,一旦变量变化,则将变量显示出来

如:$monitor ("at time is %t and the signal is %b\n",$time , signal) ;

  (3) 文件操作类

     $fopen

作用:打开一个文件面,对文件的操作

 $fdisplay

作用:在打开的文件里,写入显示的内容

 $fmonitor

作用:在打开的文件里,写入监视的变量变化时的内容

 $fclose

作用:关闭当前的内容

如:initial

      Begin :block  //可以在内部声明局部变量

      Integer  out_file;

      out_file = $fopen("data.out","w") ; //打开data.out这个文件后,从第一行开始写,如果该文件没有,则首先创建该文件,然后再写。打开文件后返回out_file这个文件整形指针

      $fdisplay(out_file,"at the time is %t ",$time);

      .....

      $fmonitor(out_file,"at the time is %t and the signal is %b\n ",$time ,signal);

       ......

      $fclose(out_file);

      End

posted @ 2014-06-12 18:58  lianjiehere  阅读(473)  评论(0编辑  收藏  举报