Build a command line LC3 simulator that will allow you to run some of the LC3 instructions
$10-30 USD
En curso
Publicado hace casi 2 años
$10-30 USD
Pagado a la entrega
Purpose: 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 below
Student Learning Outcomes: The following student-learning outcomes are addressed in this
assignment:
• translate between assembly instructions and machine code
• explain the instruction execution cycle
Simulator 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
[login to view URL] and [login to view URL] 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:
• [login to view URL]
• [login to view URL]
• [login to view URL]
BitString: 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.