From 3edd831528bcbb0837574b608720f3370821da52 Mon Sep 17 00:00:00 2001 From: Manuel Penschuck Date: Wed, 4 Jun 2014 17:44:38 +0200 Subject: [PATCH] create_project: more helpful error messages & bug-fix --- base/create_project.pl | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/base/create_project.pl b/base/create_project.pl index 658daab..dfb4e74 100755 --- a/base/create_project.pl +++ b/base/create_project.pl @@ -9,6 +9,7 @@ use strict; use warnings; use Data::Dumper; use File::Copy; +use Term::ANSIColor; sub parsePRJ { my $input = shift; @@ -22,7 +23,7 @@ sub parsePRJ { $options->{$1} = $2; } - if ($line =~ m/^\s*add_file -(vhdl|verilog) (-lib "?([^"\s]+)"?|) "?([^"]+)"?$/g) { + if ($line =~ m/^\s*add_file -(vhdl|verilog)( -lib "?([^"\s]+)"?|)? "?([^"]+)"?$/g) { push @files, [$3, $4]; } } @@ -54,6 +55,9 @@ sub generateLDF { print FH " \n"; print FH " \n"; print FH " \n"; + + my $lpf_included = 0; + for my $filer (@{$files}) { my $file = $filer->[1]; my $lib = $filer->[0]; @@ -61,21 +65,28 @@ sub generateLDF { my $fpath = $path . $file; $suffix =~ s/^.*\.([^.]+)$/$1/g; if ("vhd" eq $suffix) { - print FH " \n" + print FH " \n"; } elsif ("v" eq $suffix) { - print FH " \n" + print FH " \n"; } elsif ("lpf" eq $suffix) { - print FH " \n" + print FH " \n"; + $lpf_included = 1; } else { print "WARNING: Could not determine type of input file $file. Not included!\n"; } } - + print FH " \n"; print FH " \n"; print FH "\n"; close FH; + + if (!$lpf_included) { + print color "red bold"; + print "WARNING: No lpf included. You won't be able to load this project with diamond. Check your compile_constraints.pl script!\n"; + print color "reset"; + } } sub generateSTY { @@ -284,7 +295,7 @@ STY # parse PRJ file my ($options, $files) = parsePRJ $input; - + # create dir if necessary mkdir 'project' unless (-e 'project'); -- 2.43.0