App-Scheme79asm
view release on metacpan or search on metacpan
lib/App/Scheme79asm.pm view on Meta::CPAN
=over
=item type_bits
=item address_bits
A word is made of a type and an address, with the type occupying the
most significant C<type_bits> (default 3) bits, and the address
occupying the least significant C<address_bits> (default 8) bits.
Therefore the word size is C<type_bits + address_bits> (default 11).
=item freeptr
A pointer to the last used byte in memory (default 6). The program
will be laid out starting with location C<freeptr + 1>.
=item memory
The initial contents of the memory. Note that locations 4, 5, 6 will
be overwritten, as will every location larger than the value of
C<freeptr>.
=item comment
The initial comments for memory entries. C<< $comment->[$i] >> is the
comment for C<< $memory->[$i] >>. Note that the first 7 entries of
this array will be overwritten with the default comments. This is
useful when using custom initial memory contents and freeptr, because
this key can be used to provide comments for the extra reserved
locations in memory.
=back
=item $asm->B<parse>(I<$string>)
Parse a sequence of S-expressions and lay it out in memory.
Can be called multiple times to lay out multiple sequences of
S-expressions one after another.
=item $asm->B<process>(I<$sexp>)
Given an already-parsed sexp (meaning a
L<Data::SExpression> object), lay it out in memory.
Can be called multiple times to lay out multiple sequences of
S-expressions one after another.
=item $asm->B<finish>
Move the last pointer to position 5, and put the free pointer at
position 4. After all sequences of S-expressions have been given to
B<parse>, this method should be called.
=item $asm->B<print_binary16>([I<$fh>])
Print the length of the memory (as a big-endian 16-bit value),
followed by the memory contents as a sequence of big-endian 16-bit
values to the given filehandle (default STDOUT). Dies if
C<addr_bits + type_bits> is more than 16.
Big-endian 16-bit values can be decoded with C<unpack 'n', $value>.
=item $asm->B<print_verilog>([I<$fh>])
Print a block of Verilog code assigning the memory contents to an
array named C<mem> to the given filehandle (default STDOUT).
=item $asm->B<parse_and_print_binary16>(I<$string>[, I<$fh>])
Convenience method that calls B<parse>($string), B<finish>, and then
B<print_binary16>($fh).
=item $asm->B<parse_and_print_verilog>(I<$string>[, I<$fh>])
Convenience method that calls B<parse>($string), B<finish>, and then
B<print_verilog>($fh).
=back
=head1 SEE ALSO
L<http://repository.readscheme.org/ftp/papers/ai-lab-pubs/AIM-514.pdf>
=head1 AUTHOR
Marius Gavrilescu, E<lt>marius@ieval.roE<gt>
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2018 by Marius Gavrilescu
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.24.3 or,
at your option, any later version of Perl 5 you may have available.
=cut
( run in 0.490 second using v1.01-cache-2.11-cpan-600a1bdf6e4 )