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

📄 sdf.pl

📁 another 8051 core porocesssor vhdl source code
💻 PL
字号:
die "usage: perl sdf.pl <sdf_file> <verilog,vhdl>\n" if ($#ARGV < 1) ;$sdf       = $ARGV[0] ;$target    = $ARGV[1] ;open (FP,"<$sdf") or die "Cannot find file $sdf\n" ;$celltype = "youwontfindthisname" ;$cnt = 1 ;while (<FP>) {  print STDERR "// processed $cnt lines\n" if (($cnt % 10000) == 0) ; $cnt++ ;  chomp ;    ## change edge sensitive SDF#  if ($target =~ /vhdl/) {        #    # DEFINE CELLTYPE    #    $celltype = "youwontfindthisname" if (/INTERCONNECT/) ;    if (/CELLTYPE/) {      ($celltype) = ($_ =~ /CELLTYPE\s+\W*(\w+)\W*/) ;    }    #    # MUX|XOR|XNOR|ADD Fixes    #    next if ($_ =~ /negedge/ && $celltype =~ /MUX|XOR|XNOR|ADD/) ;    s/\Wposedge\s+(\w+)\W/$1/ if ($celltype =~ /MUX|XOR|XNOR|ADD/) ;    #    # LAT_E_\d+ Fixes    #    s/(IOPATH\s+)(E)/$1(posedge $2)/             	if ($celltype =~ /LAT_.*E_/) ;    s/(IOPATH\s+)(EB)/$1(negedge $2)/             	if ($celltype =~ /LAT_.*EB_/) ;    s/(IOPATH\s+)\Wnegedge\s+(RB)\W/$1$2/             	if ($celltype =~ /LAT/) ;    s/(IOPATH\s+)\Wnegedge\s+(SB)\W/$1$2/             	if ($celltype =~ /LAT/) ;    s/(WIDTH\s+)(\W\w+\s+E[B]*\W)/$1(COND RB==1 $2)/ 	if ($celltype =~ /LAT_RB_E[B]*/) ;    s/(WIDTH\s+)(\W\w+\s+E[B]*\W)/$1(COND SB==1 $2)/ 	if ($celltype =~ /LAT_SB_E[B]*/) ;    s/(WIDTH\s+)(\W\w+\s+E[B]*\W)/$1(COND cond0 $2)/ 	if ($celltype =~ /LAT_SB_RB_E[B]*/) ;    s/(WIDTH\s+)(\Wnegedge\s+SB\W)/$1(COND RB==1 $2)/   if ($celltype =~ /LAT_SB_RB/) ;    s/(WIDTH\s+)(\Wnegedge\s+RB\W)/$1(COND SB==1 $2)/   if ($celltype =~ /LAT_SB_RB/) ;    #    # DFF_SB_RB Fixes    #    s/(IOPATH\s+)(RB)/$1(negedge $2)/ 		   	if ($celltype =~ /DFF|JKFF/) ;    s/(IOPATH\s+)\Wnegedge\s+(SB)\W/$1$2/             	if ($celltype =~ /DFF[S]*_SB_RB/) ;    s/(WIDTH\s+)(\Wnegedge\s+SB\W)/$1(COND RB==1 $2)/ 	if ($celltype =~ /DFF[S]*_SB_RB/) ;    s/(WIDTH\s+)(\Wnegedge\s+RB\W)/$1(COND SB==1 $2)/ 	if ($celltype =~ /DFF[S]*_SB_RB/) ;    s/(WIDTH\s+)(\W\w+\s+CLK\W)/$1(COND cond0 $2)/    	if ($celltype =~ /DFF_SB_RB/) ;    s/(WIDTH\s+)(\W\w+\s+CLK\W)/$1(COND cond4 $2)/    	if ($celltype =~ /DFFS_SB_RB/) ;    #    # DFF_RB Fixes    #    s/(WIDTH\s+)(\W\w+\s+CLK\W)/$1(COND RB==1 $2)/ 	if ($celltype =~ /DFF[Q]*[S]*_RB/) ;    #    # DFF_SB_\d+ Fixes    #    s/(WIDTH\s+)(\W\w+\s+CLK\W)/$1(COND SB==1 $2)/ 	if ($celltype =~ /DFF[S]*_SB_\d+/) ;    s/(IOPATH\s+)(SB)/$1(negedge $2)/ 		   	if ($celltype =~ /DFF[S]*_SB_\d+/) ;    #    # JKFF_RB Fixes    #    s/(PERIOD\s+)(CLK)/$1(COND RB==1 $2)/    		if ($celltype =~ /JKFF_RB/) ;    s/(WIDTH\s+)(\W\w+\s+CLK\W)/$1(COND RB==1 $2)/ 	if ($celltype =~ /JKFF_RB/) ;    #    # JKFF_SB Fixes    #    s/(PERIOD\s+)(CLK)/$1(COND SB==1 $2)/    		if ($celltype =~ /JKFF_SB_\d+/) ;    s/(WIDTH\s+)(\W\w+\s+CLK\W)/$1(COND SB==1 $2)/ 	if ($celltype =~ /JKFF_SB_\d+/) ;    s/(IOPATH\s+)(SB)/$1(negedge $2)/ 		   	if ($celltype =~ /JKFF_SB_\d+/) ;    #    # JKFF_SB_RB Fixes    #    s/(PERIOD\s+)(CLK)/$1(COND cond2 $2)/    		if ($celltype =~ /JKFF_SB_RB/) ;    s/(WIDTH\s+)(\Wnegedge\s+SB\W)/$1(COND RB==1 $2)/ 	if ($celltype =~ /JKFF_SB_RB/) ;    s/(WIDTH\s+)(\Wnegedge\s+RB\W)/$1(COND SB==1 $2)/ 	if ($celltype =~ /JKFF_SB_RB/) ;    s/(WIDTH\s+)(\W\w+\s+CLK\W)/$1(COND cond2 $2)/    	if ($celltype =~ /JKFF_SB_RB/) ;  }  if (/RECOVERY|SETUP|HOLD/) {        #    # \W\w+\s+\w+\W 				: finds (posedge CLK)    # \w+ 	    				: finds D    # \WCOND\s+\w+\s*=*\d*\w+\W			: finds (COND expr CLK)    # \WCOND\s+\w+\s*=*\d*\W\w+\s+\w+\W\W	: finds (COND expr (posedge CLK))    # (\W.*\W\W)$				: finds (triplet))\n    #    ($check,$a1,$a2,$a3) = ($_ =~ /^\s+\((\w+)\s+    (\W\w+\s+\w+\W|\w+|\WCOND\s+\w+\s*=*\d*\s*\w+\W|\WCOND\s+\w+\s*=*\d*\s*\W\w+\s+\w+\W\W)\s+    (\W\w+\s+\w+\W|\w+|\WCOND\s+\w+\s*=*\d*\s*\w+\W|\WCOND\s+\w+\s*=*\d*\s*\W\w+\s+\w+\W\W)\s+    (\W.*\W\W)/x);        #    # DEBUG REXP    #    #print "hi *$_\n" ;    #print "hi *$check*\n";    #print "hi a1 *$a1*\n";    #print "hi a2 *$a2*\n";    #print "hi a3 *$a3*\n";    #    #    if ($target =~ /vhdl/ && $a2 !~ /COND/) {			# you better check vs. celltype      $a2 = "(COND RB==1 $a2)" if ($a1 =~ /D/ && $celltype =~ /DFF[Q]*_RB_|LAT_RB_E[B]*_/) ;      $a2 = "(COND SB==1 $a2)" if ($a1 =~ /D/ && $celltype =~ /DFF_SB_\d+|LAT_SB_E[B]*_\d+/)  ;      $a2 = "(COND cond0 $a2)" if ($a1 =~ /D/ && $celltype =~ /DFF_SB_RB|LAT_SB_RB_E[B]*/) ;      $a2 = "(COND RB==1 $a2)" if ($a1 =~ /SB/ && $celltype =~ /DFF[S]*_SB_RB|JKFF_SB_RB|LAT_SB_RB_E[B]*/) ;      $a2 = "(COND SB==1 $a2)" if ($a1 =~ /RB/ && $celltype =~ /DFF[S]*_SB_RB|JKFF_SB_RB|LAT_SB_RB_E[B]*/) ;      $a2 = "(COND cond0 $a2)" if ($a1 =~ /J/ && $celltype =~ /JKFF/) ;      $a2 = "(COND cond1 $a2)" if ($a1 =~ /K/ && $celltype =~ /JKFF/) ;      if ($celltype =~ /DFF[Q]*S_\d+/) {	$a2 = "(COND cond0 $a2)" if ($a1 =~ /SE/) ;	$a2 = "(COND SE==0 $a2)" if ($a1 =~ /D/) ;	$a2 = "(COND SE==1 $a2)" if ($a1 =~ /SI/) ;      } elsif ($celltype =~ /DFF[Q]*S_[SB_]*[RB_]*\d+/) {	$a2 = "(COND cond0 $a2)" if ($a1 =~ /SE/) ;	$a2 = "(COND cond2 $a2)" if ($a1 =~ /D/) ;	$a2 = "(COND cond3 $a2)" if ($a1 =~ /SI/) ;      }    }    if ($a2 =~ /COND/) {            # get the expression      ($expr) = $a2 =~ /\WCOND\s+(\w+\s*\W*\d*)/ ; $expr =~ s/\(//g ; $expr =~ s/\)//g ;      $a2 =~ s/\WCOND\s+(\w+\s*=*\d*)// ;       # remove the condition from a2      $a2 =~ s/\(COND// if ($a2 =~ /\)\)/) ;      $a2 =~ s/\)// if ($a2 =~ /\)\)/) ;#      $a3 =~ s/\)// if ($a3 =~ /\)\)/) ;      # print it out      if ($a1 !~ /edge/) {		# hold times seem to have noedge arguments, so fix them	$a1_p = "(COND $expr (posedge $a1))" ;	$a1_n = "(COND $expr (negedge $a1))" ;	print "\t($check $a1_p $a2 $a3\n" ;	print "\t($check $a1_n $a2 $a3\n" ;      } else {        	# translate the condition to the first arg and fix it.	$a1_p = "(COND $expr $a1)" ;	print "\t($check $a1_p $a2 $a3\n" ;      }    } elsif ($a1 !~ /edge/) {	# hold times seem to have noedge arguments, so fix them	$a1_p = "(posedge $a1)" ;	$a1_n = "(negedge $a1)" ;	print "\t($check $a1_p $a2 $a3\n" ;	print "\t($check $a1_n $a2 $a3\n" ;    } else {        print $_,"\n"  ;    }  } elsif (/IOPATH\s+CLK/) {    s/CLK/(posedge CLK)/ ;     print $_,"\n"  ;  } else {      print $_,"\n"  ;  }}

⌨️ 快捷键说明

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