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

nLint & HAL

(2012-02-29 13:14:09)
标签:

杂谈

分类: EDA工具

nLint & HAL

 

nLint&HAL

常言道:“一千个人眼中就有一千个哈姆雷特(扯淡啦)”,同样一种电路,1000个攻城师有1000种攻法,譬如本人的if…… if语句就经常被人攻击。因此,如何证明一种coding style合乎业界规范,那就请EDA工具(也就是一大群前辈来把关)帮忙!


常用的Coding-Stytle Check工具有nLintHAL


nLint运行方式如下,

nlint -f tmp -out $1.nlint -verilog -2001 -sort s -beauty
-f
命令用来添加文件列表
-out
用来指定输入文件是什么
-verilog verilog
语法
-2001
按照2001标准来检查,一开始就是这个选项没有找到,费老半天劲了!相关资料来自于novals网站
-sort
排序
-beauty
让输出结果自动缩进



Hal -f $FileList.f \

-rulefile hal.def \

-warnwax 1000 \

-log hal.log

-bb_nonsynth


 

结果查看

ncvbrowse -64bit \

-cdslib ./INCA_libs/irun.nc/cds.lib \

-hdlvar ./INCA_libs/irun.nc/hdl.var

-rulefile hal.def \

-sorby severity \

-sortby category \

-sortby tag

hal.log

注:

hal.def文件在Cadence安装目录下查找,该文件可以量身定制,当然,需要有一个好裁缝才行,本人不是哈!


关于nLint,附短文一篇,只是有点不知所云,如下


最近在用nlint检查verilog语法,仔细看了一下nlintbatch model 的使用方法,在shell中试用了一下,竟然可以使用,于是编写了一个pl文件...

 

最近在用nlint检查verilog语法,仔细看了一下nlintbatch model 的使用方法,在shell中试用了一下,竟然可以使用,于是编写了一个pl文件,把所有的模块都用同样的规则检查了一遍,自动产生了相应的报告!方便!
先看看 nlint的命令,通过cmdshell 中,敲击
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 | 产品答疑

新浪公司 版权所有