The Machine Instructions Dialog

The machine instructions dialog (see Figure 21) allows you to edit all machine instructions for the current machine.


Figure 21. The dialog for editing machine instructions.

The left section of the dialog

The table on the left part of the dialog displays all existing machine instructions, including their names, opcodes, and format. The right part of the dialog is for editing the execute sequence (that is, the list of microinstructions that are executed when the machine instruction is executed) for the currently selected machine instruction.

To edit the name, opcode, or format of an instruction, just double-click on the entry and type in a new value.

To delete a machine instruction, first select it by clicking on it in the table on the left. Then click the Delete button below the table.

To create a new machine instruction, click the New button.

The Duplicate button below the left table allows you to easily create new machine instructions that are variations on other machine instructions. To use this feature, first select in the left table the machine instruction you wish to duplicate. Then click in the Duplicate button. A new machine instruction will be created with the same sequence of microinstructions. You can then edit the name of the new instruction, its opcode, and its microinstructions as you would any other machine instruction.

You can sort the list of machine instructions by name, opcode, or format, by clicking on the header of the appropriate column in the table on the left.

The right section of the dialog

To edit an instruction's execute sequence, first select the instruction you wish to edit by clicking on it in the table on the left. Its execute sequence will appear in the list in the center of the dialog box. The list on the far right shows all existing microinstructions.

To add a microinstruction to the currently selected machine instruction's execute sequence, first click on the desired microinstruction in the list on the right. Then in the middle table select where you want the new microinstruction to appear. More precisely, select the microinstruction in the machine instruction's execution sequence before which you want to insert the new microinstruction. Then just click the «insert« button. If you do not select a microinstruction in the center list, the desired microinstruction will be added to the end of the execute sequence.

To delete a microinstruction from the currently selected machine instruction's execute sequence, select the desired microinstruction in the center list and click the »delete button.

To reorder the microinstructions in the execute sequence of the current machine instruction, click on the microinstruction you want to move and drag it up or down to its new position in the execute sequence.

At the bottom of the list of all microinstructions on the right (not shown in Figure 21), there is a microinstruction named "Comment". When executed, this microinstruction does nothing. Instead, this microinstruction plays the role of a comment in the machine instruction's implementation. To add a Comment micro to a machine instruction's implementation list, first select it and then press «insert«. A new Comment microinstruction is added to the implementation. You can now edit the comment in the implementation list by double-clicking it (or pressing F2). Comments are colored gray and use an italics font to distinguish them from regular microinstructions.

Note: When creating or editing the implementation of a machine instruction, you need to use at least one End microinstruction. The End microinstruction indicates the end of the machine cycle and so causes CPU Sim to start a new machine cycle, beginning with the fetch sequence.