use entity name from pin2io storable
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 12 Jun 2016 21:19:59 +0000 (23:19 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 12 Jun 2016 21:19:59 +0000 (23:19 +0200)
vhdl-pingen.pl

index e496546..fb365d3 100755 (executable)
@@ -8,7 +8,15 @@ use Data::Dump qw(dump);
 
 my $sections = 4;
 
-my $pin2io = retrieve('/dev/shm/pin2io.storable');
+my $file = shift @ARGV;
+die "Usage: $0 *.pin2io.storable\n" unless $file;
+
+my $name = $file;
+$name =~ s/^.*\///;
+$name =~ s/\..+$//;
+$name = 'epm' . $name if $name =~ m/^\d+/;
+
+my $pin2io = retrieve($file);
 warn "# $= ",dump($pin2io);
 my @pin2io = @{ $$pin2io };
 warn "# @= ",dump( @pin2io );
@@ -41,16 +49,16 @@ print qq{
 library ieee;
 use ieee.std_logic_1164.all;
 use ieee.std_logic_unsigned.all;
-entity epm3128 is
+entity $name is
  port(
 
 }, join("\n", @ports), qq {
 
  );
-end epm3128;
+end $name;
 
 
-architecture rtl of epm3128 is
+architecture rtl of $name is
 
 signal }, join(", ", map { "s$_" } sort keys %{ $stat->{sections} }), qq{ : std_logic;
 
@@ -73,7 +81,7 @@ end rtl;
 
 };#/vhdl
 
-open(my $qsf, '>', 't.qsf');
+open(my $qsf, '>', $name.'.qsf');
 foreach (@location_assignment) {
        print $qsf "set_location_assignment PIN_$_ -to IO$_\n";
 }