CIS 351 |
Lab 2: Introduction Assembly |
Fall 2018 |
For this lab, you are going to write some assembly code and test it using using the
MUnit testing
framework.
MUnit tests. Follow these steps:
assemblyIntroSample.asm,
AssemblyIntroSampleTest.java,
and munit.jar into this
directory (or copy them from ~kurmasz/public/CIS351/AssemblyIntro).
assemblyIntroSample.asm and see if you can spot the bug.javac -cp munit.jar
AssemblyIntroSampleTest.java. (If you are doing this on
your own machine, make sure the javac executable is in
your path.)java -jar munit.jar assemblyIntroSample.asm
AssemblyIntroSampleTest.class. (Notice that you are
specifying the name of the class file, not the name of
the class.)
At this point, you should see the following output:
MIPSUnit::MUnit version 1.1 built Sun Apr 08 14:26:21 EDT 2018. Built with MARS version 4.4 Failure: triples_positive_number(AssemblyIntroSampleTest): expected:<6> but was:<4> Failure: triples_negative_numbers(AssemblyIntroSampleTest): expected:<-18> but was:<-12> Tests run: 6, Failures: 2These tests fail because there is a bug in
triple. Edit
assemblyIntroSample.asm and fix the bug. When you have
fixed the bug, you will see
MIPSUnit::MUnit version 1.1 built Sun Apr 08 14:26:21 EDT 2018. Built with MARS version 4.4 All tests (6) passed.
Do not continue until you have (1) figured out how to run my test code,
and (2) have found and fixed the bug in triple!
Do not continue until CodingBat has indicated that you have solved all three problems correctly. If you don't know how to code these problems in Java, you certainly won't be able to do it in assembly!
.globl monkeyTrouble sleepIn posNeg
.text.globl.)
monkeyTrouble,
sleepIn, and posNeg respectively.
a0, a1, and a2.jr $ra.1 for true and 0 for false.Each of these above rules is demonstrated in assemblyIntroSample.asm
To test your code, download this starter test file into your directory for this homework and follow the steps given in step 1. These tests are not complete; you will need to add some of your own.
Demonstrate to the instructor that your code passes all tests; then, submit a printed copy of the assembly code
!a0, do the following:not $a0, $a0andi $a0, $a0, 1andi instruction makes sure that only the least-significant bit has a value other than 0.)
beq and bne),
but you don't need them to complete this assignment. Anything you think you need a branch for can be
done using slt and slti.Updated Monday, 1 October 2018, 10:05 AM