« blib/lib/Perlilog/sysclasses/PLinterface.pl
↑ Summary
blib/lib/Perlilog/siteclasses/vars2vars.pl »
| 1 | # | ||
| 2 | # This file is part of the Perlilog project. | ||
| 3 | # | ||
| 4 | # Copyright (C) 2003, Eli Billauer | ||
| 5 | # | ||
| 6 | # This program is free software; you can redistribute it and/or modify | ||
| 7 | # it under the terms of the GNU General Public License as published by | ||
| 8 | # the Free Software Foundation; either version 2 of the License, or | ||
| 9 | # (at your option) any later version. | ||
| 10 | # | ||
| 11 | # This program is distributed in the hope that it will be useful, | ||
| 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | # GNU General Public License for more details. | ||
| 15 | # | ||
| 16 | # You should have received a copy of the GNU General Public License | ||
| 17 | # along with this program; if not, write to the Free Software | ||
| 18 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 19 | # | ||
| 20 | # A copy of the license can be found in a file named "licence.txt", at the | ||
| 21 | # root directory of this project. | ||
| 22 | # | ||
| 23 | |||
| 24 | ${__PACKAGE__.'::errorcrawl'}='system'; | ||
| 25 | sub new { | ||
| 26 | my $this = shift; | ||
| 27 | my $self = $this->SUPER::new(@_); | ||
| 28 | |||
| 29 | $self -> const('static', 1); | ||
| 30 | return $self; | ||
| 31 | } | ||
| 32 | |||
| 33 | sub who { | ||
| 34 | my $self = shift; | ||
| 35 | return "Static Verilog Obj. \'".$self->get('name')."\'"; | ||
| 36 | } | ||
| 37 | |||
| 38 | sub sanity { | ||
| 39 | my $self = shift; | ||
| 40 | $self->SUPER::sanity(@_); | ||
| 41 | |||
| 42 | my $file = $self -> get('source'); | ||
| 43 | wrong($self->who." declared without the \'source\' property set\n") | ||
| 44 | unless (defined $file); | ||
| 45 | wrong($self->who. | ||
| 46 | " has property \'source\' set to ".$self->prettyval($file). | ||
| 47 | ", which is a nonexistent file\n") | ||
| 48 | unless (-e $file); | ||
| 49 | } | ||
| 50 | |||
| 51 | sub generate { | ||
| 52 | my $self = shift; | ||
| 53 | my $file = $self -> get('source'); | ||
| 54 | |||
| 55 | blow("Failed to open \'$file\', the source file of ". | ||
| 56 | $self->who()."\n") unless open(FILE, $file); | ||
| 57 | |||
| 58 | $self->const('verilog', join('', <FILE>)); | ||
| 59 | close FILE; | ||
| 60 | } |