⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 v2html

📁 v2html - verilog to html converter 主要为FPGA和ASIC工作人员
💻
📖 第 1 页 / 共 5 页
字号:
	elsif ( /^-F$/ || /^-VF$/ ) { 	    $frames = 1;	    if ( /^-VF$/ ) {		$vert_frames = 1;		$help_info.='VF-';	    }	    else {		$help_info.='F-';	    }	    $frame_bottom = 'target="bottom"';	    $frame_middle = 'target="middle"';	    $frame_code   = 'target="middle"';	    $frame_top    = 'target="upper"';	    if ($#ARGV >= 0) { 		if ($ARGV[0] =~ m/.*\.html$/) {		    $frame_file = shift(@ARGV);		}	    }	    next; 	}	elsif ( /^-g$/ ) {	    print "Warning: obsolete option $_\n";	    $f = shift(@ARGV);	}	elsif ( /^-lines$/ ) {	    &usage("$_ needs an argument") if ($#ARGV < 0);	    $lines_per_file = shift(@ARGV);	}	elsif ( /^\+define\+($VID)(?:(?:=)(.*))?$/o ) {	    # define with optional value (+define+NAME or +define+NAME=VALUE	    if ($2) {			$cmd_line_defines{$1}=$2;	    }	    else {		$cmd_line_defines{$1}="";	    }	}	elsif ( /^-k$/ ) {	    &usage("$_ needs an argument") if ($#ARGV < 0);	    $cgi_key = shift(@ARGV);	}	elsif ( /^-tab$/ ) { 	    &usage("$_ needs an argument") if ($#ARGV < 0);	    $tabstop = shift(@ARGV);	    next; 	    }	elsif ( /^-css$/ ) {	    &usage("$_ needs an argument") if ($#ARGV < 0);	    $css = shift(@ARGV);	}	elsif ( /^-y$/ ) { 	    &usage("$_ needs an argument") if ($#ARGV < 0);	    push(@lib_dirs,shift(@ARGV));	    next; 	    }	elsif ( /^\+incdir\+(.+)$/ ) { 	    push(@inc_dirs,split(/\+/,$1));	    next; 	    }	elsif ( /^\+libext\+(.+)$/ ) { 	    push(@lib_exts,split(/\+/,$1));	    next; 	    }	elsif ( /^-exp$/ ) { 	    print "Warning: obsolete option -exp (defines are always expanded)\n";	    next; 	    }	else {	    if ( /^-v$/ ) { # -v file is exactly the same as file without -v		&usage("$_ needs an argument") if ($#ARGV < 0);		$_=shift(@ARGV);	      }	    my @fglobbed;	    if (-r $_) { @fglobbed = ("$_"); }	    else       { @fglobbed = glob($_); }	    if ( 1 == @fglobbed && ! -r $fglobbed[0] ) { # arg didn't expand & is not readable as a file	      # try it as a VCS/verilog with no parameters	      if (/^-([BCIMRSVu])|(Mupdate)|(ID)|(O0)|(PP)|(RI)|(RIG)|(RPP)$/ ||		  /^-(line)|(lmc-hm)|(lmc-swif)|(location)|(platform)$/ ||		  /^-(p[a-zA-Z0-9]+)$/ ||		  /^\+.*$/ ) {		print "Warning: ignoring VCS/verilog option $_\n" unless $quiet;		next;	      }	      # try it as a VCS/verilog with one parameter	      if (/^-([jJlPL])|(ASFLAGS)|(CC)|(CFLAGS)|(LDFLAGS)|(as)$/ ||		  /^-(cc)|(grw)|(ld)|(syslib)|(vcd)$/) {		$value = $_ ." ". shift(@ARGV);		print "Warning: ignoring VCS/verilog option $value\n" 		  unless $quiet;		next;	      }	      # report an error: if it doesn't look like a bad option	      #   report it as an unreadable file	      if ( /^[-+]/ ) { &usage("Unrecognized option: $_"); }	      else        { &usage("Verilog file $_ is not readable"); }	    }	    else {	      # Must be a file	      foreach $f ( @fglobbed ) { 		if ( -r $f ) { # see if it is readable		  if (exists($files_seen{$f})) {		    print "Warning: ignoring duplicate file on command line $f\n";		  }		  else {		    push(@files,$f);		  }		  $files_seen{$f}=1;		}		else {		  &usage("Verilog file $_ is not readable");		}	      }	    }	  }    }    &usage("No verilog files specified") if (@files == 0);    die "\nError: You can not use Javascript and CGI at the same time\n\n"	if ($js_hier && $cgi_script);    $frame_code = 'target="_top"' if ($js_hier && !$frames);}################################################################################ show usage#sub usage {    my ($msg) = @_;    print "\nError: $msg\n";    print <<EOF;usage: v2html [options] file1 [file2] ...Verilog like options:  +define: Specify a define for use when processing, can be either:            +define+NAME or +define+NAME=VALUE  +incdir: Specify a directory to search for includes +incdir+DIR_NAME  -y     : Specify a library to search for modules eg: -y DIR_NAME  +libext: Specify a the extension for libraries eg: +libext+.v or +libext+.v+.V  -v     : Specify a library file (same as putting the file without -v)options: -f        : file to read options and file names from -o        : output directory for html files (default: current directory). -q        : be quiet. -m        : mail address for site maintainer. -F        : generate output using three frames - default output is frame.html             you can change this by putting a file name (with .html extension             after the -F option) -VF       : same as -F but does vertical frames with the hierarchy down the side -i        : incremental - check dates of files, if all .v.html files are newer              than their .v files then do nothing, otherwise convert them all. -ht       : specify a top module to print the hierarchy for (the default             is to do all hierarchies found in the input files) multiple             -ht options can be specified. -htf      : print tasks and functions in the hierarchy -hc       : a comment to print at the top of the hierarchy -nh       : skip writing the hierarchy. -nindex   : skip writing the indexes. -nu       : skip writing the list of unconnected modules in the hierarchy -nnm      : skip writing the list of files with no modules in the hierarchy -ni       : do not 'grey out' code that is ifdefed out -s        : link to the source (in footer of each page) only works if:             - your web server has access to the source code             - you run v2html in the output directory or use absolute               path names for the verilog -njshier  : turn off Javascript hierarchy generation. -ncookies : turn off Javascript cookies (for remembering js hierarchy state) -nsigpopup: turn off Javascript signal popup window. -css      : specify a URL for the cascading style sheet to use -z        : compress html files -zc       : compress command to use (default is compress) -ze       : extension of compressed files (default is .Z) -tab      : set tabstop to specified value -lines    : lines per html page (big files are split across multiple pages) -c        : activate CGI features (expanding of hierarchy) - to use this              you must have the v2html CGI script on your webserver - see man page. -k        : key to use for hierarchy CGI (default is to use a random one) -h        : name of file to write the hierarchy to (default: hierarchy.html). -debug    : useless info for debuggingIgnored options:   most VCS options (the only conflicts with v2html options are -o -s and -i)  all +options not mentioned aboveexample:  v2html -hc "Our Chip" -o /users/www/p/html -m Joe_Blogs\@jb.com     +incdir+/p/includes -y /p/verilog +libext+.v+.V /p/verilog/chip_top.vSee http://www.burbleland.com/v2html/v2html.html for more detailsEOF    exit 1;} #'################################################################################ The argument specifies a file that contains arguments - exactly the#  same as on the command line# comments are # or // you can quote things like this: -zc 'gzip -f'#sub add_options_from_file {    my ($file) = @_;    my (@args_found,$text_s);        open(F,"<$file") || usage("can not open $file to read arguments");    $/ = undef;    $text_s = <F>;    $/ = "\n";    close(F);    while ($text_s =~ m%((?:/\*.*?\*/)|(?://[^\n]*(?:\n|\Z))|(?:#[^\n]*\n)|(?:'[^']*')|(?:"[^"]*")|(?:\S+))%gs )    {   #'){ get emacs mode back in sync!	$_ = $1;	if ( m%((?:/\*.*?\*/)|(?://[^\n]*(?:\n|\Z)))%s ) { # comment, chuck it 	    print " cmdfile: chucking comment :|$_|\n" if $debug;	}	elsif ( m/^['"]/ ) {        # "']{	    s/\A.//;	    s/.\Z//;	    print " cmdfile: found string |$_|\n" if $debug;	    push(@args_found,$_);	}	else {	    print " cmdfile: found word |$_|\n" if $debug;	    push(@args_found,$_);	}    }    unshift( @ARGV, @args_found );    push( @args , @args_found );}################################################################################   Misc functions############################################################################################################################################################### given a source file name work out the .html file name#  without the path#sub hfile {    my ($sfile,$sline) = @_;    my ($page);    # debugging checks    # die "No line passed to hfile!\n" unless defined($sline);    # die  "bad sline: $sline\n" unless $sline=~m/^[0-9-]+$/;    # NB sline starts at 1    $page = ($sline <= $lines_per_file) ? '' : 	".p" . (1+int(($sline-1)/$lines_per_file));    $sfile  =~ s/^.*[\/\\]//;    $sfile .= "$page.html";    $sfile .= $compress_extension if $compress;    return $sfile;}################################################################################ given a source file name work out the file without the path#sub ffile {    my ($sfile) = @_;    $sfile =~ s/^.*[\/\\]//;    return $sfile;}################################################################################ Check whether we need to rebuild - delete any old files if we do#sub check_incremental {    my ($out_dir) = @_;    my ($incr_file,$filelist,$rebuild,@old_input_files,@old_output_files,@old_args,	$file,$mtime,$mtime_s,$mtime_o,$section);    local(*F);    $incr_file="$out_dir.v2html_incr";    $rebuild=0;    if ( ! -r $incr_file ) {	print "Could not find file list $incr_file\n" unless $quiet;	$rebuild= 1;    }        # read the incremental file, and check that the options match    if ($rebuild==0) {	open(F,"<$incr_file") || die "can not open $filelist read to file list";	$section=1;	# Read incr file, be quite careful, as anything read into old_output_files 	#  can get deleted	while (<F>) { 	    chomp; 	    if (m/^---output files/) {		if ($section==1) {		    $section++;		}		else {		    print "Corrupt incremental file $out_dir.v2html_incr, remove and retry\n"; 		    exit;		}	    }	    elsif (m/^---options/) {		if ($section==2) {		    $section++;		}		else {		    print "Corrupt incremental file $out_dir.v2html_incr, remove and retry\n"; 		    exit;		}	    }	    else {		if    ($section==1) { push(@old_input_files,$_);  }		elsif ($section==2) { push(@old_output_files,$_); }		elsif ($section==3) { push(@old_args,$_); }	    }	}	if ($section!=3) {	    print "Corrupt incremental file $out_dir.v2html_incr, remove and retry\n"; exit;	}	if ("@args" ne "@old_args") {	    print "Arguments are different\n" unless $quiet;	    $rebuild=1;	}    }    if ($rebuild==0) {	$mtime_s=$mtime_o=0;	# find the newest source file	foreach $file (@old_input_files) {	    if ( -r $file ) {		$mtime   = (stat( $file ))[9];		$mtime_s = ($mtime>$mtime_s) ? $mtime : $mtime_s;	    }	    else {		print "Source file $file has gone\n" unless $quiet;		$rebuild=1;		last;	    }	}	# find the oldest output file	foreach $file (@old_output_files) {	    if ( -r $file ) {		$mtime   = (stat( $file ))[9];		$mtime_o = (($mtime<$mtime_o)||($mtime_o==0)) ? $mtime : $mtime_o;	    }	    else {		print "Output file $file has gone\n" unless $quiet;		$rebuild=1;		last;	    }	}    }    if ($rebuild==0) {	if ($mtime_o < $mtime_s ) {	    print "Some source files are newer than the output files\n"		unless $quiet;	    $rebuild=1;	}	elsif ($mtime_o < (stat( $0 ))[9]) {	    print "Some output files are older than $0\n"		unless $quiet;	    $rebuild=1;	}    }    # Need to remove files produced on the last run to stop junk accumulating    #  in the output dir (now that multiple pages    if ($rebuild) {	print "Removing old output files\n" unless $quiet;	foreach $file (@old_output_files) {	    if ( $file =~ m/\.html/ ) {		unlink($file);	    }	    else {		print "Warning: skipping remove of $file (does not end in .html)\n";	    }	}    }    return ($rebuild==0);}################################################################################ Write out the files read for incremental compiles#sub write_filelist {    my ($fdata,$out_dir)= @_;    my ($file,$opt);    local (*F);    open(F,">$out_dir.v2html_incr") || die "Could not write to $out_dir.v2html_incr";    foreach $file (sort &rvp::get_files($verilog_db)) {	print F &rvp::get_files_full_name($verilog_db,$file) . "\n";    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -