X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FApp%2FScheme79asm.pm;h=374a8a3f43af771517da7dec974c96f7e2bb798d;hb=04be023f8bc114edb6dddae6cee3bd58ea758561;hp=fb99ee33ef5a51fc4bd05ddbaf25896fdde4a929;hpb=1756f22980afffd139ded7742af489196f928c1a;p=app-scheme79asm.git diff --git a/lib/App/Scheme79asm.pm b/lib/App/Scheme79asm.pm index fb99ee3..374a8a3 100644 --- a/lib/App/Scheme79asm.pm +++ b/lib/App/Scheme79asm.pm @@ -10,7 +10,7 @@ use Data::Dumper qw/Dumper/; use Data::SExpression qw/consp scalarp/; use Scalar::Util qw/looks_like_number/; -our $VERSION = '0.004'; +our $VERSION = '0.005001'; our %TYPES = ( LIST => 0, @@ -71,6 +71,7 @@ sub process { die "Type too large: $type\n" if $type >= (1 << $self->{type_bits}); die "Addr too large: $addr\n" if $addr >= (1 << $self->{addr_bits}); my $result = ($type << $self->{addr_bits}) + $addr; + unless ($location) { $self->{freeptr}++; $location = $self->{freeptr} @@ -120,9 +121,9 @@ sub print_binary16 { die "addr_bits + type_bits >= 16\n"if $self->{addr_bits} + $self->{type_bits} > 16; my $length = @{$self->{memory}}; - print $fh pack 'n', $length or croak "Failed to print memory size: $!"; + print $fh pack 'n', $length or croak "Failed to print memory size: $!"; # uncoverable branch true for (@{$self->{memory}}) { - print $fh pack 'n', $_ or croak "Failed to print memory: $!" + print $fh pack 'n', $_ or croak "Failed to print memory: $!" # uncoverable branch true } } @@ -146,7 +147,7 @@ sub print_verilog { my $string = "mem[$index] <= $val;"; $string .= "$spaces // $comment" if defined $comment; - say $fh $string or croak "Failed to print verilog: $!"; + say $fh $string or croak "Failed to print verilog: $!"; # uncoverable branch true } }