# Read all .pins files in the project and create pin assignments

set source_file_coll [get_all_global_assignments -name SOURCE_FILE]
foreach_in_collection file_asgn $source_file_coll {
    set file [lindex $file_asgn 2]
    if {[string match -nocase *.pins $file]} {
	set fd [open $file RDONLY]
	while {[gets $fd line] >= 0} {
	    set pin [string toupper [lindex $line 0]]
	    set signal [lindex $line 1]
	    if {[string match {[0-9A-Z]*} $pin]} {
		set_location_assignment PIN_$pin -to $signal
	    }
	}
	close $fd
    }
}