
########## Tcl recorder starts at 03/14/05 15:17:22 ##########

set version "4.2"
#set proj_dir "d:/reference/qdr2/par/xp/synplicity"
cd $proj_dir

# Get directory paths
set pver $version
regsub -all {\.} $pver {_} pver
set lscfile "lsc_"
append lscfile $pver ".ini"
set lsvini_dir [lindex [array get env LSC_INI_PATH] 1]
set lsvini_path [file join $lsvini_dir $lscfile]
if {[catch {set fid [open $lsvini_path]} msg]} {
	 puts "File Open Error: $lsvini_path"
	 return false
} else {set data [read $fid]; close $fid }
foreach line [split $data '\n'] { 
	set lline [string tolower $line]
	set lline [string trim $lline]
	if {[string compare $lline "\[paths\]"] == 0} { set path 1; continue}
	if {$path && [regexp {^\[} $lline]} {set path 0; break}
	if {$path && [regexp {^bin} $lline]} {set cpld_bin $line; continue}
	if {$path && [regexp {^fpgapath} $lline]} {set fpga_dir $line}}

set cpld_bin [string range $cpld_bin [expr [string first "=" $cpld_bin]+1] end]
regsub -all "\"" $cpld_bin "" cpld_bin
set cpld_bin [file join $cpld_bin]
set install_dir [string range $cpld_bin 0 [expr [string first "ispcpld" $cpld_bin]-2]]
regsub -all "\"" $install_dir "" install_dir
set install_dir [file join $install_dir]
set fpga_dir [string range $fpga_dir [expr [string first "=" $fpga_dir]+1] end]
regsub -all "\"" $fpga_dir "" fpga_dir
set fpga_dir [file join $fpga_dir]

switch $tcl_platform(platform) {
   windows {
      set fpga_bin [file join $fpga_dir "bin" "nt"]
	     if {[string match "*$fpga_bin;*" $env(PATH)] == 0 } {
	        set env(PATH) "$fpga_bin;$env(PATH)" } }
   unix {
      set fpga_bin [file join $fpga_dir "bin" "sol"]
      if {[string match "*$fpga_bin;*" $env(PATH)] == 0 } {
         set env(PATH) "$fpga_bin;$env(PATH)"}}}

if {[string match "*$cpld_bin;*" $env(PATH)] == 0 } {
   set env(PATH) "$cpld_bin;$env(PATH)" }

lappend auto_path [file join $install_dir "ispcpld" "tcltk" "lib" "ispwidget" "runproc"]
package require runcmd

# Commands to make the Process: 
# Hierarchy
if [runCmd "\"$cpld_bin/edfin\" -i ../../../synthesis/xp/synplicity/rev_1/qdr2_io.edn -jhd qdr2.jhd -log qdr2.log -dev orca -lbp \"$fpga_dir/data\""] {
	return
} else {
	vwait done
	if [checkResult $done] {
		return
	}
}

########## Tcl recorder end at 03/14/05 15:17:22 ###########


########## Tcl recorder starts at 03/14/05 15:18:33 ##########

# Commands to make the Process: 
# Hierarchy
if [runCmd "\"$cpld_bin/edfin\" -i ../../../synthesis/xp/synplicity/rev_1/qdr2_io.edn -jhd qdr2.jhd -log qdr2.log -dev orca -lbp \"$fpga_dir/data\""] {
	return
} else {
	vwait done
	if [checkResult $done] {
		return
	}
}

########## Tcl recorder end at 03/14/05 15:18:33 ###########


########## Tcl recorder starts at 03/14/05 15:18:34 ##########

# Commands to make the Process: 
# Generate Timing Simulation Files
if [runCmd "\"$fpga_bin/edif2ngd\" -l mg5g00 \"../../../synthesis/xp/synplicity/rev_1/qdr2_io.edn\" \"qdr2.ngo\""] {
	return
} else {
	vwait done
	if [checkResult $done] {
		return
	}
}
if [runCmd "\"$cpld_bin/edfmodgen\" -inp \"../../../synthesis/xp/synplicity/rev_1/qdr2_io.edn\" -log \"qdr2.emg\" -arch mg5g00 -dev lfxp10c"] {
	return
} else {
	vwait done
	if [checkResult $done] {
		return
	}
}
if [runCmd "\"$fpga_bin/ngdbuild\" -a mg5g00 -p \"$proj_dir\" \"qdr2.ngo\" \"qdr2.ngd\""] {
	return
} else {
	vwait done
	if [checkResult $done] {
		return
	}
}
if [catch {open qdr2.m2t w} rspFile] {
	puts stderr "Cannot create response file qdr2.m2t: $rspFile"
} else {
	puts $rspFile "#MAP file
"
	close $rspFile
}
if [runCmd "\"$cpld_bin/mapwrap\" -a mg5g00 -p lfxp10c -t fpbga388 -s 4 -c 0 \"qdr2.ngd\" -o \"qdr2.ncd\" -f qdr2.m2t -dep \"qdr2.nc1\" "] {
	return
} else {
	vwait done
	if [checkResult $done] {
		return
	}
}

if [catch {open qdr2.p2t w} rspFile] {
	puts stderr "Cannot create response file qdr2.p2t: $rspFile"
} else {
	puts $rspFile "-w
-i 6
-l 5
-n 1
-t 1
-s 1
-c 0
-e 0
"
	close $rspFile
}
if [catch {open qdr2.p3t w} rspFile] {
	puts stderr "Cannot create response file qdr2.p3t: $rspFile"
} else {
	puts $rspFile "-rem
-log qdr2.log
-o qdr2.par
-pr qdr2.prf
"
	close $rspFile
}
if [runCmd "\"$cpld_bin/multipar\" -p qdr2.p2t -f \"qdr2.p3t\" \"qdr2_map.ncd\" \"qdr2.ncd\""] {
	return
} else {
	vwait done
	if [checkResult $done] {
		return
	}
}

if [catch {open qdr2.p2b w} rspFile] {
	puts stderr "Cannot create response file qdr2.p2b: $rspFile"
} else {
	puts $rspFile "-w -l orca
"
	close $rspFile
}
if [runCmd "\"$fpga_bin/ldbanno\" \"qdr2.ncd\" -f qdr2.p2b -n verilog -o \"qdr2.vo\""] {
	return
} else {
	vwait done
	if [checkResult $done] {
		return
	}
}

########## Tcl recorder end at 03/14/05 15:18:34 ###########


########## Tcl recorder starts at 03/14/05 15:21:15 ##########

# Commands to make the Process: 
# Place & Route TRACE Report
if [catch {open qdr2.p2t w} rspFile] {
	puts stderr "Cannot create response file qdr2.p2t: $rspFile"
} else {
	puts $rspFile "#Trace after PAR
"
	close $rspFile
}
if [catch {open qdr2.rs7 w} rspFile] {
	puts stderr "Cannot create response file qdr2.rs7: $rspFile"
} else {
	puts $rspFile "-inp \"qdr2.ncd\" -f \"qdr2.pt\" -o \"qdr2.twr\" 
-prf post_route_qdr2.prf
"
	close $rspFile
}
if [runCmd "\"$cpld_bin/trcewrap\" @qdr2.rs7"] {
	return
} else {
	vwait done
	if [checkResult $done] {
		return
	}
}

########## Tcl recorder end at 03/14/05 15:21:15 ###########

