|
CS/ECE 354 Machine Organization and Programming
Fall 2008 Section 1
Instructor
Mark D. Hill
TAs
Mark Liu &
Somayeh Sardashti
|
Assignment 5 // Due Friday, November 21, before 5pm
Send e-mail questions to Somayeh Sardashti, somayeh@cs.wisc.edu
Collaboration Policy
For this assignment, you may work in pairs (2 people).
All students (whether working in a pair or not) must individually
turn in the assignment by individually running the handin program.
Therefore, 2 copies of the assignment will be turned in for those
working as a pair.
The grader will choose to grade only one copy of a pair's work,
and assign the same score to both students.
If working in a pair,
the names of BOTH students must appear at the top of the turned in assignment.
(38 points total)
Your answers for these questions are to be placed into
2 separate files that will be turned in.
For questions 1-3, place your answers into a file
named a5A.
For question 4, follow the instructions with
the question, and place your answer into a file
named a5B.
- (8 points)
Do synthesis to generate
TAL assembly language code for the
following MAL code fragment.
Assume that variable
X is assigned address 0x0040a784.
(Note: your answer is TAL assembly language, not machine code.)
move $12, $11
putc $12
sb $13, X
rem $14, $13, $12
- (6 points)
The assembler places the machine code for the TAL instruction
bltz $14, loop
at address 0x0800de20.
The address for label loop is assigned to be 0x0800de84.
Give machine code for the branch instruction (in both hexadecimal and in
binary).
Show work to receive partial credit in case your answer is incorrect.
- (12 points)
The MIPS assembler is assembling the instruction
bgtz $9, error_in_input
The machine code for this bgtz instruction is assigned
to address
0x00800014,
and label error_in_input is assigned address
0x00ffcd04.
PART A
What difficulty does the assembler encounter in creating
machine code for this bgtz instruction?
Show work that supports your identified difficulty.
PART B
Give a TAL synthesis (assembly language, not machine code)
that works for this instruction (and would work for all
variations of this difficulty).
- (12 points)
Hand assemble the following TAL code section starting at address
0x00808020.
To facilitate grading of this question,
use the exact format as given in the file a5B.template. If you are on a lab computer, this file can be found at:
/p/course/cs354-markhill/public/html/Fall2008/handouts/a5B.template
Copy this file to your own directory, and rename the file to be
a5B.
Your answer modifies only the '?' characters.
Copy the last line of the file for further lines of the
machine code.
Do not introduce blank lines.
Note that this file will not have your name, id, partner's
name (if there is one), etc. We will obtain that information
from the other turned in file.
while:
ori $10, $12, 0xc4e6
sb $13, -24($10)
and $14, $15, $13
j while
Handing In the Homework
Your answers to the questions, including showing your work,
where appropriate,
are to be placed into two files
(a5A and a5B)
which will be turned in.
Both files will be a simple text files.
Please remember to put your name in the a5A file!
Turn in your program by running the lab-supported handin program.
Use the following command to run the handin program:
handin -c cs354-1 -a a5 -d .
while your current working directory is
the one containing the two files.
This program copies the specifically named files to
a directory accessible by the instructor and TAs.
This command presumes that your path was modified as directed
in Assignment 1.
|