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

📄 v2html

📁 v2html - verilog to html converter 主要为FPGA和ASIC工作人员
💻
📖 第 1 页 / 共 5 页
字号:
#!/usr/bin/perl -w################################################################################# File:         v2html# RCS:          $Header: /home/cc/v2html/RCS/v2html,v 7.30 2002/09/22 20:27:40 cc Exp $# Description:  Verilog to html converter# Author:       Costas Calamvokis# Created:      Wed Aug 20 11:24:31 1997# Modified:     Sun Sep 22 21:26:40 2002# Language:     Perl## Copyright 1998-2002 Costas Calamvokis# Copyright 1997      Hewlett-Packard Company##  This file nay be copied, modified and distributed only in accordance#  with the terms of the limited licence contained in the accompanying#  file LICENCE.TXT.#################################################################################use strict;# Define the global variables use vars qw($output_hier $output_index $hier_file $frame_file $quiet $incremental	    $maint $frames $frame_bottom $frame_middle $frame_top $frame_code	    $link_to_source $cgi_script $web_base $js_hier	    $js_file $out_dir $js_cookies	    $print_unconnected $print_no_mods $grey_ifdefed_out $cgi_key	    $t_and_f_in_hier $compress @compress_cmd $compress_extension	    $hier_comment $tabstop $js_sigs $help_info @inc_dirs @lib_dirs 	    @lib_exts %navbar %classes $lines_per_file $index_info $style_sheet_link	    @output_files @args $css	    $verilog_db	    @verilog_keywords 	    %verilog_keywords_hash %verilog_compiler_keywords_hash            $version $vert_frames $mail_regexp $http_regexp $VID $icon_c $icon_i	    $icon_x @newer_files @files $file @hier_tops %cmd_line_defines	    $module $debug $ul_id @index_stack );# check the perl version is high enoughif ( $] < 5.004 ) {    print "Error: this script can only run with Perl version 5.004 or greater\n";    exit 1;}# initialize&init;# read the arguments&process_args;# legal stuff - do not deleteif (!$quiet) {    print "v2html version $version. See LICENCE.TXT for licence.\n";    print " Copyright 1998-2002 Costas Calamvokis\n";    print " Copyright 1997      Hewlett-Packard Company\n";}$style_sheet_link  =  "<link rel=\"Stylesheet\" title=\"v2html stylesheet\" ".     "media=\"Screen\" href=\"$css\">\n";# set up the navbar$navbar{order} = [ ];if ( $output_hier ) {    push ( @{$navbar{order}} , ( 'Hierarchy' ) );}if ( $output_index ) {     push ( @{$navbar{order}} , ( 'Files' , 'Modules' , 'Signals' , 'Tasks' , 'Functions' ));}push ( @{$navbar{order}} , ( 'Help' ) );# now set what each navbar item links to$navbar{Hierarchy} = $hier_file;($navbar{Files}    = $hier_file) =~ s/(\..*|)$/-f$1/;($navbar{Modules}  = $hier_file) =~ s/(\..*|)$/-m$1/;($navbar{Signals}  = $hier_file) =~ s/(\..*|)$/-s$1/;($navbar{Tasks}    = $hier_file) =~ s/(\..*|)$/-t$1/;($navbar{Functions}= $hier_file) =~ s/(\..*|)$/-fn$1/;$navbar{Help}      = "http://www.burbleland.com/v2html/help_7_30.html?$help_info";# check incrementalif ($incremental) {    if (check_incremental($out_dir)) {	print "All html files are up to date, nothing to do.\n" unless $quiet;	exit 0;    }    print "Rebuilding all files\n" unless $quiet;}$verilog_db = &rvp::read_verilog(\@files,[],\%cmd_line_defines,				 $quiet,\@inc_dirs,\@lib_dirs,\@lib_exts);if ($output_index) {    print "Writing indexes\n" unless $quiet;    print_indexes($verilog_db,$js_hier);}# write the hierarchy (must be done after the indexes)if ($output_hier) {    print "Writing hierarchy to $hier_file\n" unless $quiet;    print_hier($hier_file,$js_hier,\@hier_tops);}# write the framesif ($frames) {    print "Writing frames to $frame_file\n" unless $quiet;    if (defined(@hier_tops)) {	print_frame_top($frame_file,$hier_file,join(", ",@hier_tops),			$js_hier,$vert_frames);    }    else {	print_frame_top($frame_file,$hier_file,$web_base,			$js_hier,$vert_frames);    }}# print out gif icons used print_gifs($out_dir, ($cgi_script || $js_hier), $output_index );# print out the cascading style sheetprint_css($out_dir);# convert each fileforeach $file (&rvp::get_files($verilog_db)) {    convert(&rvp::get_files_full_name($verilog_db,$file));}# Write out a file list for incremental - we can not rely on the user provided#  one because we may have read more files finding modules and includesif ($incremental) {    write_filelist($verilog_db,$out_dir);}foreach my $problem (&rvp::get_problems($verilog_db)) {    if ( $problem !~ m/\n/ ) {	$problem =~ s/(.{60,79}) /$1\n    /g;    }    print "$problem.\n";}exit 0;################################################################################   Subroutines############################################################################################################################################################### initialize global variables#sub init {    @output_files=(); # stores a list of files we've written for incremental    $output_hier = 1;    $output_index = 1;    $hier_file = 'hierarchy.html';    $frame_file="frame.html";    $quiet     = 0;    $incremental = 0;    $maint     = '';    $frames      = 0;    $vert_frames = 0;    $frame_bottom = "";    $frame_middle = "";    $frame_code   = ""; # frame for jumping to code    $frame_top    = "";    $link_to_source = 0;    $cgi_script = "";    $web_base  = "";    $js_file = "";    $help_info = "";    $print_unconnected=1;    $print_no_mods=1;    $grey_ifdefed_out = 1;    $t_and_f_in_hier=0;    $compress=0;    $hier_comment = "";    @compress_cmd = ('compress', '-f');    $compress_extension = '.Z';    srand( time() ^ ( $$ + ( $$ << 15)));    $cgi_key= substr(rand,2,-1);    $tabstop=0;    @inc_dirs=('.');    @lib_dirs=('.');    @lib_exts=('');    $lines_per_file=1000;    $js_hier   =1; # javascript hierarchy    $js_sigs   =1; # javascript signals    $js_cookies=1; # javascript cookies    $css= 'v2html.css'; # default cascading style sheet name    $out_dir='./';    @verilog_keywords = (       qw(       always assign attribute begin case casex casez deassign default       defparam disable edge else end endattribute endcase endfunction       endmodule endprimitive endspecify endtable endtask event for force       forever fork function highz0 highz1 if initial join large macromodule       medium module negedge parameter posedge primitive pull0 pull1 release       repeat rtranif1 scalared small specify specparam strength strong0       strong1 table task trior use vectored wait weak0 weak1 while),       (@rvp::verilog_gatetype_keywords),       (@rvp::verilog_sigs),       qw(       config endconfig design instance liblist use library cell       generate endgenerate automatic));  # V2001    @verilog_keywords_hash{@verilog_keywords} = "" x @verilog_keywords;    @verilog_compiler_keywords_hash{@rvp::verilog_compiler_keywords} = 	"" x @rvp::verilog_compiler_keywords;    $version = '$Header: /home/cc/v2html/RCS/v2html,v 7.30 2002/09/22 20:27:40 cc Exp $'; #'    $version =~ s/^\S+ \S+ (\S+) .*$/$1/;    # map from easy to remember names to the crytic class names used in html files    %classes = (comment=>'C', pp_ignore=>'P', string=>'S', compiler=>'M',		systemtask=>'ST', keyword=>'K', signal_input=>'SI',		signal_output=>'SO', signal_output_reg=>'SOR',		signal_inout_reg=>'SIOR', signal_inout=>'SIO', signal_reg=>'SR',		signal_integer=>'SIT', signal_wire=>'SW', signal_tri=>'STI',		signal_tri0=>'ST0', signal_tri1=>'ST1', signal_triand=>'STA',		signal_trireg=>'STR', signal_supply0=>'SS0',signal_trior=>'STO',		signal_supply1=>'SS1', signal_wand=>'SWA', signal_wor=>'SWO',		signal_time=>'STM', signal_realtime=>'SRT', signal_real=>'SRL', 		module=>'MM', task=>'T',		function=>'F', define=>'D', parameter=>'PA',		navbar=>'NB',		signal_genvar=>'GV', attribute=>'AT',  # V2001		);     # the regexp to find a mail address in a comment (for linking)    $mail_regexp='\b([^@ \t\n]+@[^@ \t\n\.]+\.[^@ \n\t]+)\b';    $http_regexp='\b(http:[^ \n\t]+)';    # a verilog identifier is this reg exp     #  a non-escaped identifier is A-Z a-z _ 0-9 or $     #  an escaped identifier is \ followed by non-whitespace    #   why \\\\\S+ ? This gets \\\S+ in to the string then when it    #   it used we get it searching for \ followed by non-whitespace (\S+)    $VID = '[A-Za-z_][A-Za-z_0-9\$]*|\\\\\S+';    # icons for hierarchy when using javascript     $icon_c = "<img align=bottom border=0 src=\"v2html-c.gif\">";    $icon_x = "<img align=bottom border=0 src=\"v2html-x.gif\">";    $icon_i = "<img align=top border=0 alt=\"Index\" src=\"v2html-i.gif\">";}################################################################################   Command line processing############################################################################################################################################################### Set up any variables as specified in the arg list.# Put input filenames in @files#sub process_args {    my ($f,$value,%files_seen);    # $#ARGV is the index of last arg.         @args=( @ARGV );    while ($_ = $ARGV[0]) {	shift(@ARGV);	if ( /^-debug$/ ) { 	    $debug = 1; 	    &rvp::set_debug();	    next;	    }	elsif ( /^-o$/ ) { 	    $out_dir = shift(@ARGV);	    $out_dir =~ s/[\/]?$/\//;	    next; 	    }	elsif ( /^-m$/ ) { 	    &usage("$_ needs an argument") if ($#ARGV < 0);	    $maint = shift(@ARGV);	    next; 	    }	elsif ( /^-ht$/ ) { 	    &usage("$_ needs an argument") if ($#ARGV < 0);	    push(@hier_tops,shift(@ARGV));	    next; 	    }	elsif ( /^-h$/ ) { 	    &usage("$_ needs an argument") if ($#ARGV < 0);	    $hier_file = shift(@ARGV);	    next; 	    }	elsif ( /^-hc$/ ) { 	    &usage("$_ needs an argument") if ($#ARGV < 0);	    $hier_comment = shift(@ARGV);	    quote_html(\$hier_comment);	    next; 	    }	elsif ( /^-nh$/ ) { 	    $output_hier = 0;	    $help_info.='nh-';	    next; 	    }	elsif ( /^-htf$/ ) { 	    $t_and_f_in_hier=1;	    $help_info.='htf-';	    next; 	    }	elsif ( /^-nu$/ ) { 	    $print_unconnected = 0;	    $help_info.='nu-';	    next; 	    }	elsif ( /^-nnm$/ ) { 	    $print_no_mods = 0;	    $help_info.='nnm-';	    next; 	    }	elsif ( /^-ni$/ ) { 	    $grey_ifdefed_out = 0;	    $help_info.='ni-';	    next; 	    }	elsif ( /^-nindex$/ ) { 	    $output_index = 0;	    $help_info.='nindex-';	    next; 	    }	elsif ( /^-q$/ ) { 	    $quiet = 1;	    next; 	    }	elsif ( /^-i$/ ) { 	    $incremental = 1;	    $help_info.='i-';	    next; 	    } 	elsif ( /^-c$/ ) { 	    &usage("$_ needs two arguments") if ($#ARGV < 1);	    $js_hier =0; 	    $cgi_script = shift(@ARGV); 	    $web_base  = shift(@ARGV); 	    if (($cgi_script !~ m&^/&) || ($web_base   !~ m&^/&)) { 		die "\nError: -c option must be followed by:\n".		    "   /path/cgi_script_name\n".		    "   /path_to_html_files\n".		    " relative web server's root (not file system root)\n\n"; 	    } 	    $web_base =~ s|/$||;	    $help_info.='c-'; 	    next;  	    }	elsif ( /^-js$/ || /^-qs$/ || /^-nqs$/ ) { 	    print "Warning: obsolete option $_\n";	    # js hierarchy is now on by default - qs now wrapped into sigpopup	    next; 	    }	elsif ( /^-njshier$/ ) { 	    $js_hier = 0;	    $help_info.='njshier-';	    next; 	    }	elsif ( /^-nsigpopup$/ ) { 	    $js_sigs = 0;	    $help_info.='nsigpopup-';	    next; 	    }	elsif ( /^-ncookies$/ ) { 	    $js_cookies = 0;	    $help_info.='ncookies-';	    next; 	    }	elsif ( /^-s$/ ) { 	    $link_to_source = 1;	    $help_info.='s-';	    next; 	    }	elsif ( /^-z$/ ) { 	    $compress = 1;	    $help_info.='z-';	    next; 	    }	elsif ( /^-zc$/ ) { 	    &usage("$_ needs an argument") if ($#ARGV < 0);	    $_ = shift(@ARGV);	    @compress_cmd = split ;	    next; 	    }	elsif ( /^-ze$/ ) { 	    &usage("$_ needs an argument") if ($#ARGV < 0);	    $compress_extension = shift(@ARGV);	    next; 	    }	elsif ( /^-font$/ ) { 	    &usage if ($#ARGV < 0);	    $_ = shift(@ARGV);	    print "Warning -font option option is no longer supported ".		"edit cascading style sheet (v2html.css) instead\n";	    next; 	}	elsif ( /^-f$/ ) { 	    &usage("$_ needs an argument") if ($#ARGV < 0);	    add_options_from_file(shift(@ARGV)); 	    next;	}

⌨️ 快捷键说明

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