加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

nlint使用心得

(2008-01-03 15:56:47)
标签:

it

分类: 学习
最近在用nlint检查verilog语法,仔细看了一下nlint的batch model 的使用方法,在shell中试用了一下,竟然可以使用,于是编写了一个pl文件,把所有的模块都用同样的规则检查了一遍,自动产生了相应的报告!方便!
先看看 nlint的命令,通过cmd 到shell 中,敲击
nlint -f tmp -out $1.nlint -verilog -2001 -sort s -beauty
-f 命令用来添加文件列表
-out 用来指定输入文件是什么
-verilog verilog 语法
-2001 按照2001标准来检查,一开始就是这个选项没有找到,费老半天劲了!相关资料来自于novals网站
-sort 排序
-beauty 让输出结果自动缩进
 
上面的命令试验成功后,用perl管理了一下,爽了!

#!/usr/bin/perl

 

use File::Find;

use File::stat;

use File::Copy;

use Cwd;

require "glob_hash.pl";

 

sub wanted {

              chomp;

              shift;

              if ( m/(\w+)\.file\.list\.v$/ ) {

 

                 my $fileType = $1;

 

                 # escape not defined module

                 if ( $module_top_name{$fileType} eq "" ) {

                    return;

                 } elsif ( m/fft_mode2/ ) {

                    return;

                 } elsif ( m/fft_mode3/ ) {

                    return;

                 } elsif ( m/fft_mode4/ ) {

                    return;

                 }

 

                 {

                    open my $tmpin, "$1.file.list.v" or die "$!\n";

                    open my $tmpot, ">tmp" or die "$!\n";

 

                    my @contents = <$tmpin>;

 

                    foreach ( @contents) {

                       chomp;

                       if ( m/\bTestBench\b/ ) {

                          next;

                       }

                       print $tmpot "$_\n";

                    }

 

                    close( $tmpin);

                    close( $tmpot);

                 }

 

                 open my $OT, ">nlint.pl" or die"$!";

 

                 print $OT   <<BLOCK;

#!/usr/bin/perl

#system "nlint -f $1.file.list.v -out $1.nlint -sort s -beauty -r 16651 -r 16905";

#system "nlint -f tmp -out $1.nlint -verilog -sort s -beauty -r 16651 -r 16905";

system "nlint -f tmp -out $1.nlint -verilog -sort s -beauty ";

 

BLOCK

 

                 close ( $OT );

 

                 chdir ( $File::Find::dir );

                 system "nlint.pl";

                 File::Copy::move("$1.nlint" , "../../nlint");

                 printf "%-30s nlint finished\n", $module_top_name{$fileType};                

              } 

} 

my $dir = Cwd::getcwd(); 

if ( !-d nlint ) {

              mkdir nlint;

} 

File::Find::find(\&wanted, "$dir"); 

close($read_file_list_hdl);

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有