VM::Dreamer::Operations - Help with the machine's operation
my $machine = get_new_machine( $base, $op_code_width, $operand_width, $instruction_set ); add_one_to_counter( $counter, $greatest_digit );
This function is called by VM::Dreamer::initialize_machine after it has validated the machine's definition.
It sets the initial values for the machine's components as based on the machine's definition.
It returns a reference to the newly initialized machine.
Used by VM::Dreamer::increment_counter.
Does just what it says - increments the counter by 1. It uses greatest_digit to know when to carry from one column to the next.
For example, if the machine's greatest digit was 7 and the counter was set to 5473777, this function would return 5474000.
Or, if the machine's greatest digit was 9 and the counter was set to 10259, this fuction would return 10260.
It should be undefined what happens when the maximum value of the counter is passed to this function (but it just returns all zero's).
William Stevenson <william at coders dot coop>
This software is Copyright (c) 2013 by William Stevenson.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)