Assembly Programming

1 answer below »
Assembly Programming
TCSS371 – Machine OrganizationAssignment 5 – Simulator 20 PointsPurpose: This homework will test your understanding of LC3 instructions that we covered this quarter. You will build a command line LC3 simulator that will allow you to run some of the LC3 instructions as outlined belowStudent Learning Outcomes: The following student-learning outcomes are addressed in this assignment:· translate between assembly instructions and machine code· explain the instruction execution cycleSimulator Instructions: Use the starter code provided with this description.· You don’t need to modify anything in the BitString class.· You will only need to comment and uncomment a few lines in the Simulator class.· You will add methods to the Computer class to implement the instructions below.Before you start writing code, become familiar with the existing code. Testing must be done in a class named ComputerTest. Please use JUnit 4 or JUnit 5 tests. Submit your and files on Canvas. Follow the coding conventions provided in the starter code and don’t rewrite or change any of the method signatures. LC3 simulator starter code includes the following files: ··· Simulator.javaBitString: The simulation is based on the class BitString. The existing code provides many methods that can manipulate BitString objects for you and you don’t need to write additional methods. A BitString contains an array of char, but the values in each char are ‘0’ or ‘1’. There is an associated length member that keeps track of how full the array is (anywhere from 0 to 16). Simulator: The class Simulator includes a short LC3 program in two different forms, assembly language and binary. This program prints the numbers 9 down to 1 and halts. There is also some test code to test the NOT instruction. After you understand this test, then remove the test code from the Simulator class and place it into a JUnit test in a class called ComputerTest. You can use this test as a template for writing other tests. Computer: The Computer class uses BitString objects to represent the contents of all registers and memory locations. The memory and register file are treated as arrays of BitString. To execute a single instruction, you will generally need to use a couple of BitString objects out of the Computer object, convert them to integers, do some calculations on the integer and vice versa. By frequently displaying the Computer object during development, you can verify that individual instructions are behaving properly. Please remove the frequent display before submitting code. The required instructions that you must implement are ADD, AND, LD, BR, OUT and HALT. To finish the simulation, you will need to at least do the following:· Add methods to the Computer class to execute the unimplemented instructions (like ADD, AND, LD, BR, OUT, HALT). · Complete the NOT instruction to set the condition code· Complete other instructions that set the condition code · Modify the execute method in the Computer class, so that it executes instructions until it runs into a HALT instruction.· Write JUnit test methods for each instruction in ComputerTest class other than OUT and HALT. You can model ADD, AND, LD and BR after the NOT instruction provided. You will need to examine the bits in IR and modify memory, condition codes, registers, and the PC as the current instruction would if executed by the LC3. For OUT and HALT, which would normally trigger trap routines, the simulator should instead perform the required action. In the case of HALT, the execute method should quit (by exiting its loop) and for OUT, a single character should appear on the IDE's console based on the ASCII code currently in R0. Your program does not need to execute any other LC3 instructions, but your code should be general enough to work with similar assembly programs. You will note that the amount of memory available in the simulator is quite small - roughly 50 words. This is enough for running simple programs. If you want to try other programs, the LC3 editor program creates a .bin file containing 0/1 strings for any assembly program that you compile. The trap vector and interrupt vector tables are not included in this simulation. We are also omitting input/output related hardware such as KBDR/KBSR and DDR/DSR.As a general strategy, you might execute single-instruction programs to test the quality of your simulator before testing a multi-line program.Extra Credit: Implement LEA, LDI, STI, LDR, STR in addition to the above instructions for extra credit: 1 point for each instruction implemented along with the tests. You must create test methods in ComputerTest class to test these new methods.Submission guidelines: Submit your homework on Canvas before the due date with the filenames provided.Grading Criteria: This assignment is worth 20 points and will be graded using the rubric below.PointsEach instruction is implemented 9 points Total2 points for each instruction:ADD, AND, LD, BR1 point for the followingTRAP, OUTCC works correctly for the instructions that set it.2 pointsJunit tests are created for the 4 instructions and all scenarios are tested including setting CC8 Points Total2 points for each testSimulator program runs and displays 9 to 11 point
Answered 1 days AfterMay 31, 2022

Answer To: Assembly Programming

Swapnil answered on Jun 02 2022
21 Votes

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here