#!/usr/bin/python # Copyright 2007 Jeff Epler # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """pincompare.py: compare pin assignments from Quartus II .qsf files Usage: python pincompare.py first.qsf second.qsf""" import re, sys r = re.compile("set_location_assignment (.*) -to (.*)$") d = {} e = {} for f in open(sys.argv[1]): m = r.match(f.strip()) if not m: continue d[m.group(1)] = m.group(2) for f in open(sys.argv[2]): m = r.match(f.strip()) if not m: continue if d.get(m.group(1)) != m.group(2): print "%8s %8s %8s" % (m.group(1), m.group(2), d.get(m.group(1))) for k, v in d.items(): if k not in e: print "%8s %8s %8s" % (k, None, v)