#!/usr/bin/perl ##----------------------------------------------------------------------------- ## Title : Build Script ## Project : Generic ##----------------------------------------------------------------------------- ## File : buildAsicTest.pl ## Author : Ryan Herbst, rherbst@slac.stanford.edu ## Created : 03/06/2008 ##----------------------------------------------------------------------------- # Description: # Execute this script to build the ASIC Test FPGA. This script will execute # synplify_pro for synthesis and Xilinx ISE for translate, map, place & route. # Options for the synthesis are set in the AsicTestSyn.tcl file. Options # for the remaining steps are set at the top of this file. # # This script is called in the following manner: # perl buildAsicTest.pl [syn tran map par time bit prom] # # Include the following optional suffixes, if none are passed the default set # is assumed. # syn = Execute synthesis step. (default) # tran = Execute translate step. (default) # map = Execute map step. (default) # par = Execute plac & route step. (default) # time = Execute timing report step. (default) # bit = Execute bit file generation step. (default) # prom = Execute prom file generation step. (default) #----------------------------------------------------------------------------- # Copyright (c) 2007 by Ryan Herbst. All rights reserved. #----------------------------------------------------------------------------- # Modification history: # 03/06/2008: created. #----------------------------------------------------------------------------- use Cwd; # Current And Output Directory $OUT = "/u/asic_test/"; $PWD = cwd(); # Source Directories, Relative To Current Directory $PgpSrc = "$PWD/../../../../rce/pgp/rtl"; $PgpAppl = "$PWD/../../../../rce/pgp/app"; $RtlSrc = "$PWD/../rtl"; # SDC File $SdcFile = "$PWD/AsicTest.sdc"; # UCF File $UcfFile = "$PWD/AsicTest.ucf"; # Synplicity Batch File $SynScript = "$PWD/AsicTestSyn.tcl"; # Directory for xilinx cores $CoreDirA = "$PWD/../xil_cores/"; $CoreDirB = "$PWD/../../../../rce/pgp/xil_cores/"; # Project name, used for input/output file names. # $Project.edn must match the file name set for the output EDIF file in FebSyn.tcl $Project = "AsicTest"; # Set Target Device $Target = "xc4vfx20-ff672-11"; # Cover Mode: area, speed or balanced $MapCover = "balanced"; # Pack FF Mode: i, o or b $MapPack = "b"; # Function Size: 4,5,6,7 or 8 $MapFunc = "4"; # Pack Factor: 0 - 100 $MapFactor = "100"; # Tristate Tranformation Mode: on, off, agressive or limit $MapTristate = "off"; # Effort Level: std, med or high $MapEffort = "high"; # Overall Place & Route Level: std, med, high $ParLevel = "high"; # Place & Route Start Table Entry $ParTable = "1"; # Number of Place & Route Iterations to run $ParCount = "1"; # Number of Place & Route Iterations to save $ParSave = "1"; # Timing Report Type: e or v (error or verbose) $TwrType = "v"; # Timing Report Error/Verbose Count $TwrCount = "30"; # Timing Report Limit $TwrLimit = "30"; # Prom Type For Generation $PromType = "xcf08p"; #################### END CONFIG SECTION #################### use Cwd; # Get build directory $dstdir = $OUT; # Process the remaining compile flags if ( @ARGV > 0 ) { $doSyn = 0; $doTran = 0; $doMap = 0; $doPar = 0; $doTime = 0; $doBit = 0; $doProm = 0; foreach $arg ( @ARGV ) { if ( $arg =~ /syn/ ) { $doSyn = 1; } if ( $arg =~ /tran/ ) { $doTran = 1; } if ( $arg =~ /map/ ) { $doMap = 1; } if ( $arg =~ /par/ ) { $doPar = 1; } if ( $arg =~ /time/ ) { $doTime = 1; } if ( $arg =~ /bit/ ) { $doBit = 1; } if ( $arg =~ /prom/ ) { $doProm = 1; } } } # Use defaults else { $doSyn = 1; $doTran = 1; $doMap = 1; $doPar = 1; $doTime = 1; $doBit = 1; $doProm = 1; } # Attempt to create build directory, change to build directory mkdir $dstdir || dir ("Could Not Create Build Directory: $dstdir"); chdir($dstdir); # Set environment, needed by synplify script $ENV{'PGPSRC'} = $PgpSrc; $ENV{'PGPAPPL'} = $PgpAppl; $ENV{'RTLSRC'} = $RtlSrc; $ENV{'SDCFILE'} = $SdcFile; # Print Header String print "\n===== Build Script Started\n"; print " Dest=$dstdir\n\n"; # Do we synthesize? if ($doSyn == 1) { # Synthesize using synplicity print "\n===== Starting Synthesis.\n\n"; system ("synplify_pro","-batch","$SynScript") == 0 or die ("Synthesis Failed.\n\n"); print "===== Synthesis Complete.\n\n"; } # Do we translate? if ($doTran == 1) { print "\n===== Starting Translate.\n\n"; system ("ngdbuild","-p","$Target", "-sd","$CoreDirA", "-sd","$CoreDirB", "-dd","_ngo", "-uc","$UcfFile", "-intstyle","ise", "syn/$Project.edn","$Project.ngd") == 0 or die ("\n===== Translate Failed.\n\n"); print "\n===== Translate Complete.\n\n"; } # Do we map? if ($doMap == 1) { $map_file = $Project . "_map.ncd"; print "\n===== Starting Map.\n\n"; system ("map","-intstyle","ise","-p","$Target","-cm","$MapCover", "-detail","-pr","$MapPack","-k","$MapFunc","-c","$MapFactor","-tx","$MapTristate", "-ol","$MapEffort","-o","$map_file","$Project.ngd","$Project.pcf") == 0 or die ("\n===== Map Failed.\n\n"); print "\n===== Map Complete.\n\n"; } # Do we place & route if ($doPar) { $map_file = $Project . "_map.ncd"; print "\n===== Starting Place & Route.\n"; system ("par","-w","-intstyle","ise", "-ol","$ParLevel","-t","$ParTable", "-s","$ParSave","-n","$ParCount","$map_file","$Project", "$Project.pcf") == 0 or die ("\n===== Place & Route Failed.\n\n"); print "\n===== Place & Route Complete.\n\n"; } # Do we generate timing report? if ($doTime) { # Create Timing Report Type $twropt = "-"."$TwrType"; # Execute Command print "\n===== Starting Timing Report.\n"; system ("trce","-intstyle","ise","$twropt","$TwrCount","-l","$TwrLimit", "-xml","$Project.xml","$Project.ncd","-o","$Project.twr","$Project.pcf") == 0 or die ("\n===== Timing Report Failed.\n\n"); print "\n===== Timing Report Complete.\n\n"; } # Do we generate bit file if ($doBit) { # Execute Command print "\n===== Starting Bitgen.\n"; system ("bitgen","-w","-intstyle","ise","$Project.ncd") == 0 or die ("\n===== Bitgen Failed.\n\n"); print "\n===== Bitgen Complete.\n\n"; } # Do we generate prom file if ($doProm) { print "\n===== Starting Prom Gen.\n"; system ("promgen","-w","-p","mcs","-c","FF","-u","0","$Project.bit", "-x","$PromType") == 0 or die ("\n===== Prom Build Failed.\n\n"); print "\n===== Prom Gen Complete.\n\n"; }