Discussion:
Lab 2 Grades & Advice
(too old to reply)
A. Karl Kornel
2005-08-13 04:35:08 UTC
Permalink
Dear students,

I have completed the grading of Lab 2. For those of you who
turned in an alias, here are your grades:

Anne: 100
dynastyw4: 98
ochtend: 00
shanghai2k5: 92
Tastethe: 91

It is now too late to get an alias if you do not already have one.

14 assignments were submitted. The highest grade was 100. The
lowest grade (if you ignore those who didn't turn it in) was 47. The
average was ~84.93 with a standard deviation of 16.564. The median was
91.5.

I noticed that one of the people who got a lower score on the lab did
not come to the Lab 2 help session after the midterm. In the future,
you may wish to take the opportunity when it becomes available!

If your program has errors, I suggest that you fix them as soon as
possible. Because Lab 3 is based on Lab 2, you really need a working
version of Lab 2.

To be as helpful as possible, I'll make this offer: If you had
problems with Lab 2 (in other words, you did not get a 100), and you
have fixed them, then you can come to me and I will look them over. If
you come to me during office hours, I will try to assemble and test your
new Lab 2, and I will also look at your code to see if it looks good.
If you come to me when I am in the lab, the only thing I will do is look
at your code.

Now, onto the general comments:

I tested using two programs. The first program I will not reveal to
you. The second program was taken exactly from Lab 1, with the addition
of a HALT instruction:

0x00: 0x80 LOAD 0
0x01: 0x7F DIV 31
0x02: 0xAF STORE 15
0x03: 0x1F ADD 31
0x04: 0x2F SUB 15
0x05: 0x5F MPY 31
0x06: 0xC0 HALT
0x1F: ** ( data )

For ** I used either 0x03 or 0x05. In both cases I knew exactly what
the output should be. The HALT instruction has 31 in the address field,
but since the field is not being used it should not make any difference.

Some people used `cmp %r8, %r0` to compare a register to %r0.
Instead of doing this, you might want to write `tst %r8`, which does the
same thing and. You can also use `clr %r1` instead of `set 0, %r1`, and
`inc %r2` instead of `add %r2, 1, %r2`. None of these are required, but
they may make your program easier to understand.

Most of you were being very cautious when it came to the use of the
branch delay slot, inserting nops no matter what. On almost every
assignment, if I found a place where noops were not needed I marked it.
You can still use nops in the branch delay slots, but you should start
thinking of ways to fill those slots.

There is also something I wanted to note about the way your program
ends. Normally, you would use something like this to end your program:

pHALT: ! Test for the HALT opcode, and exit if found
cmp %r1, HALT ! %r1 holds the opcode in the lower 3 digits
! HALT is a symbol set in the .data section
be END ! If %r1 == HALT, go to END
nop ! (branch delay slot)

... more code here ...

END: ! End program execution
ta 0 ! Stop execution

The code above works, but it involves a bit of extra work. Is there
an easier way? Yes! So far you have been using the `ta` instruction,
"trap always", which performs the requested trap no matter what. If you
look at your ISEM reference card, you will see that there are many other
kinds of trap instructions. For example, the `te` instruction, "trap if
equals", executes the trap only if the the previously-compared registers
are equal. So you can take the code from above and change it to this:

pHALT: ! Test for the HALT opcode, and exit if found
cmp %r1, HALT ! %r1 holds the opcode in the lower 3 digits
! HALT is a symbol set in the .data section
te 0 ! If %r1 == HALT, stop execution

... more code here ...

END: <<<<< This is no longer needed!

This is completely optional! Let me say that again: YOU DO NOT HAVE
TO USE `te`! If you do use `te` you will not get any extra credit, and
if you do it the normal way you will not lost points.
--
=============================
| Alfred Karl Kornel
| -- ***@cse.ohio-state.edu
| Member- Europa Research Group
| UNIX / RESOLVE Consultant
=============================
B A Bair
2005-08-15 14:20:05 UTC
Permalink
I encourage you to take up Karl's offer of extra help on Lab2, if you are
still having errors.

WRT optimizing your code and using synthetics for readability:

In class, I advised you to use 'nop's where ever possible. It sounds like
you were listening! :-)

Karl makes a good argument for scheduling instructions for optimizing your
code. (this is something that good compilers do) His discussion of
alternate instructions are also interesting for students that are looking
for opportunities to add depth to their Sparc skills.

However, we will never take off points if you don't optimize your code.

:-)
Bettina

Loading...