You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sicp-all-tasks/sicp/5_002e12

27 lines
959 B

Exercise 5.12: The simulator can be used to help
determine the data paths required for implementing a machine with a given
controller. Extend the assembler to store the following information in the
machine model:
a list of all instructions, with duplicates removed, sorted by instruction type
(assign, goto, and so on);
a list (without duplicates) of the registers used to hold entry points (these
are the registers referenced by goto instructions);
a list (without duplicates) of the registers that are saved
or restored;
for each register, a list (without duplicates) of the sources from which it is
assigned (for example, the sources for register val in the factorial
machine of Figure 5.11 are (const 1) and ((op *) (reg n)
(reg val))).
Extend the message-passing interface to the machine to provide access to this
new information. To test your analyzer, define the Fibonacci machine from
Figure 5.12 and examine the lists you constructed.