Write a small statistical package in SPARC assembler. If you have ever done anything like this before you will find it interesting to compare your previous experience with doing it in assembler!
Your package should accept as input an integer n between 1 and 300 (decimal) followed by n integers between -100 and +99 (decimal). Input will be done by loading a data file that begins with the directive
.data 0x1F00followed by n+1
.word directives with two labels as shown in
the sample data file
1.sample.dat.s
which you should look at.
All data files will have those same two labels and the .global directives
which precede them in the sample data file.
Your program is required to produce as output
-100 - -91 **************
-90 - -81 ********
-80 - -71 **
-70 - -61 ****
etc.
...
90 - 99 ********
(indicating that there were 2 numbers between -80 and -71 inclusive,
4 numbers between -70 and -61 inclusive etc.)
Recall that the mode is the score(s) which occur most commonly and the
median is the middle score when the scores are written in order (thus
1 1 3 has 1 as both mode and median while 1 2 3 5 6 6 has 6 as the mode
and 4 (half way between the middle two scores of 3 and 5) as median).
You should use traps for output (as in the practical exercises).
You will be rewarded for efficiency: optimize your program first for time efficiency (make the program take as few cycles as you can) and then for space efficiency, but above all make sure that it works! You will be penalised for writing programs which the marker can't understand, so if you do unusual things in the interest of efficiency, document them clearly. (Note that comments do not have any effect on the efficiency of your program).
You should use isem to see how many cycles your program takes.
Special details about your program:
As part of the assignment you must keep a reflective journal that records your ideas and progress towards solving the problem. Journal entries can be brief, but should make clear your state of progress and should include succinct descriptions of your thoughts and plans. Try to add to the journal each time you are thinking about assignment 1, and do at least once a day record your progress. (It's painless, as long as you do it every day. Make your first entry today, the same day that you read this!)
The journal is part of your assignment. Twice a week, on Tuesdays and Fridays before 10am, or earlier (you can do it on Mondays and Thursdays if that's more convenient), you should submit a copy of your journal to the comp226 assignment box in E6A. Remember, the journal is meant to be notes to yourself about your progress in your thinking as well as your coding. So, by the time you've carefully read this assignment spec you will have things to write - make your first entry right away, and then keep adding to it as you think about the assignment.
Put that first entry, and any other thoughts you have over the next couple of days, in the assignment box by 10am on Friday August 23. (And if you are reading this for the first time after 10am on Friday August 23, begin your first entry "Oops! I didn't read the assignment 1 spec early enough and I'm already running a bit late, so I'd better get started very quickly! Here are my first thoughts....")
If you'd prefer to submit your journal electronically (but still twice a week), let me know and I'll set it up. (I'm doing it on manually because often people prefer not to keep journals electronically, and those who do like to keep it electronically can always print it out and submit it with those who have photocopied their hand written versions.)
There is now a program which you can use to test your output against mine. Read about it here.
There is also a program which you can use to submit your completed source code. Read about it here.
Remember, your journal consists of notes to yourself about your progress. It can include thoughts, snippets of code, lists of what you've finished, lists of what you have to do, plans of how you're going to do those things, proposed timetables (schedules of what you plan to do when, and I put it in the plural, because probably your schedule will change and you'll need a new one), etc. Do make it reasonably readable and understandable for me too. But don't worry, it doesn't have to be perfect. Often it won't be correct (sometimes the ideas we have don't turn out to be correct, but it's still better to have, and to record, ideas!).
Good luck! This should be a good opportunity to learn lots about assembly programming so make the most of it.
Mike.
PS: Your assignment will only be tested using valid input (as defined by the specifications). There is no need to include code to check that, for example, there is the correct number of numbers and nothing superfluous in the data file.
| Mike, August 18, 2013. | COMP226 home page |