The design of Sim286 facilitated the extensions and modifications we made in incorporating features of the Intel386 processor. The use of inheritance in the design of Sim286 minimized the impact of making changes to the simulator. For example, in the extension of Sim286 to include ELF executables, only the Memory class needed modification. The modifications to the Memory class are outlined in Section 3.1. Another example of the extensibility of Sim286 is the addition of instructions to the simulator. In adding instructions, we only needed to derive our class, for the instruction, from a choice of existing classes. The choice of which class to inherit from depended on the number of operands to the instruction. Only the class CpuDecodeEvent and, occasionally, ExtendedCpuDecodeEvent also needed to be informed of the new instruction. Refer to Figure 2.4 for an illustration of the class framework of Sim286. However, in extending Sim286 to include 32-bit processing, we did find some areas in the design that could be improved. For example, the extension of Sim286 to include 32-bit processing required changes to 85% of the classes in the simulator. These deficiencies in the design are a direct result of Sim286 adding the functionality of 16-bit processing without appropriate extensions in the design to maintain a high level of extensibility and ease of modification in the changing of processing size. Figure 5.1 illustrates the history of design and implementation extensions of processing sizes in Sim8088/86, Sim286 and Sim386.
![]() |
Our suggestions for future work, on the design of Sim386, are aimed at making Sim386 more extensible to modifications involving changes to the size of the processing environment. For example, we would like the design of Sim386 to better facilitate an extension to 64-bit processing. One such improvement we suggest is the inclusion of templates in classes that are dependent on the current processing size of the simulator. Sim286 does contain one templated class, the Register class. This is a good example of the type of class that would benefit from templating. To convert the registers in the simulator to a size of 32-bit only required one change. A non-inclusive list of other classes that would become more extensible through the use of templating are: SegRegister, SegDescriptor, DescriptorTable, VirtualAddress, PhysicalAddress, and Instruction.
Another suggested improvement to the design of Sim386 is redesigning classes that alter their processing depending on the current size their arguments. A number of the classes check the size of their operands (8-bit, 16-bit, or 32-bit) and perform disjoint operations based on this determination. We suggest redesigning these classes by moving size specific processing into subclasses leaving the original class as a common interface to the rest of the simulator. For instance, the class used to determine the current addressing mode, MemOp, could have been greatly simplified and made more extensible if it had been changed to a virtual base class with one class, say MemOp8, to handle 8-bit processing and another class, say MemOp16, to handle 16-bit processing. This would have made Sim286 easier to modify to include 32-bit addressing modes (SEE FIGURE 5.2)