SM213 Simple Machine Simulator Eclipse Installation Instructions
To load the simple machine into Eclipse from the course distribution, you have two choices. You can load a zipped Eclipse project called sm-student-213-eclipse.zip or you can create your own project and add the jar and zip files found in sm-student-213.zip.
1 Load Pre-Packaged Simple Machine Project into Eclipse
These steps load the simulator into a pre-packaged Eclipse project called 213. If you follow these steps, you should skip the next section.
2
1. 2.
3.
4.
Select ”Import …” from the Eclipse menu.
Expand the ”General” line in the ”Select an import source:” on the ”Import” dialog, select
”Existing Projects into Workspace”thatappearsunderthisitem,andclick”Next >”.
Clickthe”Select archive file:”radiobutton,clickthe”Browse”buttononthisline,navigateinyour filesystem to the distribution file called sm-student-213-eclipse.zip that you downloaded from the course website, select this file and click the ”Open” button.
Ensure that the project named ”213 (213)” is selected in the ”Projects:” pane and click the ”Finish” button.
Add the Simple Machine to your own Eclipse Project
The steps in this section are an alternative to the first section. Follow these steps only if you want to create the simulator Eclipse project yourself.
2.1 Load the Simple Machine Project into Eclipse
1. Unpack Simple Machine distribution zip file called sm-student-213.zip to reveal the following contents in the directory named sm-student-213:
• SimpleMachine213.jar a stand-alone executable jar fully implements the sm213 ISA. The classes in this jar have been obfuscated so that you can not decompile them to get the solution.
• SimpleMachineStudent.jar a jar file that contains all but the solution classes. These classes are not obfuscated. This is the jar file that you include in the classpath for your solution.
• SimpleMachineStudentDoc213.zip java doc.
• SimpleMachineSrc.zip full source for all classes but the solution, you will ignore virtually all of
these, paying attention only to the Memory and CPU classes.
2. Select ”New → Java Project” from the Eclipse menu.
3. Enter a name for the project (e.g., 213) and click the ”Next >” button.
1
4. 5. 6. 7.
8. 9.
10.
2.2
1. 2. 3.
4.
5. 6. 7.
8.
1. 2.
3.
On the ”Java Settings” dialogue that is now displaying, click the ”Libraries” tab.
Click the ”Add External JARS…” button.
Navigate to the file SimpleMachineStudent.jar in the directory sm-student-213 and select it.
In the ”JARs and class folders on build path:” list, click the triangle next to the line listing ”SimpleMachineStudent.jar …”toexpandit.
Doubleclick”Source attachment”,click”External File…”,navigatetothefileSimpleMachineStudentSrc. in the directory sm-student-213, select it and click ”OK”.
Doubleclick”Javadoc location”,clickthe”Javadoc in archive”radiobutton,click”Browse…” nextto”Archive path:”,navigatetoSimpleMachineStudentDoc213.zipinthedirectorysm-student-213, select it, and click ”OK”.
Click the ”Finish” button.
Add Simple Machine Source files to Eclipse
Select your project’s ”src” folder.
Select ”Import” from the Eclipse menu to display the Import dialogue.
Expand the ”General” line in the ”Select an import source:” area, click ”Archive File”, and clickthe”Next >”button.
Clickthe”Browse”button,navigatetothefileSimpleMachineStudentSrc.zipinthedirectorysm-student-213, and click ”Open”.
Clicking recursively on expansion triangles, reveal the directory arch/sm213/machine/student. Click the ”Deselect All” button to uncheck all boxes in the directory pane.
Check the single box next to student and click on the ”Finish” button to import this source package into your src folder.
Thetwofilesyouwilledit,CPU.javaandMainMemory.java,arenowinthearch.sm213.machine.student package in the src folder of your project.
Build and Run the Simple Machine in Eclipse
Click on your project and select ”Run As” → ”Java Application” from the Eclipse menu. Clickonthelinelabeled”SimpleMachine$Sm213Student” in the “\verbMatchingItems:=”pane
to select it and click on ”OK”.
Subsequently, you can just select ”Run” from the Eclipse menu to build and start the simulator.
Run the Reference Simple Machine Implementation
3
4
1. Atthecommandlinenavigatetothedirectorysm-student-213andtype”java -jar SimpleMachine213.jar” or on some systems, navigate to this file and double click it.
z