CS520
Assembly Language Programming and Machine Organization
Fall 2009
Instructor: P.
Hatcher
Office: Kingsbury N229/N221D
Phone: 862-2678
E-mail:
hatcher@unh.edu
Office Hours:
Mon/Wed 8:15-8:45am and 10:00-10:30am; Fri 10:00-10:30am;
or by appointment (send e-mail to request an appointment).
The prerequisite for this course is
CS515.
The key goals for the course are to understand program and data representation,
to become familiar with assembly language and machine language programming,
to understand the impact on software of basic computer architecture
concepts such as the memory hierarchy, and to study
fundamental system software such as assemblers and linkers.
The University is committed to providing students with documented
disabilities equal access to all university programs and facilities.
If you think you have a disability requiring accommodations,
you must register with
Disability
Services for Students (DSS).
Contact DSS at (603) 862-2607 or visit them in MUB 118.
If you have received Accommodation Letters for this course from DSS,
please provide me with that information privately so that we can
review those accommodations.
Tentative Schedule
- week of August 31
- Monday (8:10-10am): course overview; binary/hex; 2's complement; C bitwise operators.
- Wednesday (8:45-10am): IEEE floating-point.
- Friday (A-K 8:10-9am; L-Z 9:10-10am): Lab 1: start Program 1.
- Reading: BO 1.1-10, 2.1-4.
- week of September 7
- Monday: Labor Day: no class.
- Wednesday (8:45-10am): basic computer architecture; ASCII; Endian-ness.
- Friday (A-K 9:10-10am; L-Z 8:10-9am): Lab 2: Program 1 code review.
- Reading: BO 1.4.1, 2.1.5, 2.1.4.
- week of September 14
- Monday (8:45-10am): C stdio, C pointers, C malloc/free.
- Wednesday (8:45-10am): program representation; maTe class file.
- Friday (A-K 8:10-9am; L-Z 9:10-10am): Lab 3: start Program 2.
- Reading: maTe virtual machine specification.
- week of September 21
- Monday (8:45-10am): maTe virtual machine.
- Wednesday (8:45-10am): assemblers and linkers.
- Friday (A-K 9:10-10am; L-Z 8:10-9am): Lab 4: Program 2 code review.
- Reading: BO 7.1-14.
- week of September 28
- Monday (8:45-10am): using valgrind.
- Wednesday (8:45-10am): implementing an assembler.
- Friday (A-K 8:10-9am; L-Z 9:10-10am): Lab 5: start Program 3.
- Reading: Valgrind Quick Start Guide.
- week of October 5
- Monday (8:45-10am): virtual method calls.
- Wednesday (8:45-10am): implementing the maTe virtual machine.
- Friday (A-K 9:10-10am; L-Z 8:10-9am): Lab 6: Program 3 code review.
- Reading: Virtual Method Calls.
- week of October 12
- Monday: Fall Break: no class.
- Tuesday (follow Monday schedule; 8:45-10am): catch-up; review for midterm.
- Wednesday (8:10-10am): midterm.
- Friday (A-K 8:10-9am; L-Z 9:10-10am): Lab 7: start Program 4.
- week of October 19
- Monday (8:45-10am): implementing garbage collection I.
- Wednesday (8:45-10am): implementing garbage collection II.
- Friday (A-K 9:10-10am; L-Z 8:10-9am): Lab 8: Program 4 code review.
- Reading: BO 10.10.
- week of October 26
- Monday (8:45-10am): Intel IA-32 architecture I.
- Wednesday (8:45-10am): Intel IA-32 architecture II.
- Friday (A-K 8:10-9am; L-Z 9:10-10am): Lab 9: start Program 5.
- Reading: BO 3.1-7.
- week of November 2
- Monday (8:45-10am): Just-In-Time compilation.
- Wednesday (8:45-10am): implementing a JIT for maTe.
- Friday (A-K 9:10-10am; L-Z 8:10-9am): Lab 10: Program 5 code review.
- Reading: Just-In-Time Compilation.
- week of November 9
- Monday (8:45-10am): cache memory.
- Wednesday: Veterans Day: no class.
- Friday (A-K 8:10-9am; L-Z 9:10-10am): Lab 11: start Program 6.
- Reading: BO 6.2-8.
- week of November 16
- Monday (8:45-10am): virtual memory.
- Wednesday (8:45-10am): POSIX threads I.
- Friday (A-K 9:10-10am; L-Z 8:10-9am): Lab 12: Program 6 code review.
- Reading: BO 10.1-7, 13.3-5, 13.7.
- week of November 23
- Monday (8:45-10am): POSIX threads II.
- Wednesday (8:45-10am): catch-up.
- Friday: Thanksgiving Day holiday: no class.
- week of November 30
- Monday (8:45-10am): I/O.
- Wednesday (8:45-10am): historical machines.
- Friday (A-K 8:10-9am; L-Z 9:10-10am): Lab 13: start Program 7.
- Reading: BO 6.1, 8.1;
- week of December 7
- Monday (8:45-10am): catch-up.
- Wednesday (8:45-10am): review for final exam.
- Friday (A-K 9:10-10am; L-Z 8:10-9am): Lab 14: Program 7 code review.
- week of December 14
- Wednesday, 8:10am-10am, Kingsbury N121: final exam
Readings
The readings given in the above schedule are recommended but not required.
They are intended to be supplementary to the lectures.
Everything you need to know for an assignment or
an exam will be covered in lecture or laboratory.
However, the readings will provide a second presentation of
most of the material for the course, in case you find things
confusing.
For most people, seeing the material twice is very helpful.
Grading
Course grades will be assigned in the following manner:
- 14%: 14 laboratories (1% each)
- 70%: 7 programming assignments (10% each)
- 5%: 1 midterm exam
- 11%: 1 final exam
Laboratories grades will be based upon attendance and effort.
All laboratories are based upon the current programming assignment.
Each programming assignment will have two labs.
The purpose of the first lab is to help you get started on the
assignment.
At the end of this lab you will submit your code
that you have written so far for the current assignment.
Your grade for this lab will largely depend on the effort you make
during lab.
The purpose of the second lab is to encourage you to bring nearly
finished code to lab for review.
At the beginning of this lab you will submit
your code that you have written so far for the current assignment.
Your code should be substantially complete.
That is, the functionality should be fully implemented, but possibly
not fully tested and debugged.
The grade assigned for a code review will include both the layout and
documentation of the code (see below) and the level of functionality
attempted so far.
Laboratory sessions are 50 minutes long and will be held on Fridays
in Kingsbury N218.
Students whose last names begin with A-K will be in one session
and students whose last names begin with L-Z will be in the opposite
session.
Be sure to check the above schedule each week to see which session
you are in, either 8:10-9am or 9:10-10am.
The programming assignments are (with tentative due dates):
-
Convert
IEEE floating-point to and from integer: due Sept 13.
-
Disassemble
maTe class files: due Sep 27.
-
Write an
assembler for maTe class files: due Oct 11.
-
Implement
the maTe virtual machine: due Oct 25.
-
Add
a garbage collector to the maTe virtual machine: due Nov 8.
-
Add
just-in-time translation to the maTe virtual machine: due Nov 22.
-
Modify
the maTe garbage collector to be concurrent: due Dec 13.
The programming assignments must be done in C.
Each programming assignment will be worth 100 points.
Programming assignments may be handed in late at a penalty of 2 points for
one day late, 5 points for two days late, 10 points for three days
late, 20 points for four days late, and 40 points for five days late.
No program may be turned in more than 5 days late.
An assignment is not considered late unless turned in after 8am
on the day after the due date.
The grading of programming assignments will be based primarily
upon demonstrated correct functionality.
That is, you will be awarded points for what your program actually
does.
Some test cases may be public but others will be hidden, so careful
testing will be required.
Points will be deducted from your programming assignment grade if your work
is not adequately documented and structured.
You must follow the following guidelines:
- your code should be properly and consistently indented;
- place { and } in a consistent manner;
- use blank lines liberally to improve readability;
- test all library calls (e.g. malloc) for failure;
- your code should compile without any warning messages;
- each function should have a header explaining its purpose;
- avoid long functions;
- global variables should be used sparingly and for good purpose;
- modularize appropriately (hide symbols);
- function bodies should be well-commented;
- use symbolic constants when appropriate;
- always use function prototypes; and,
- choose meaningful variable and function names.
In addition, lines should not exceed 80 characters when printed using
a tabstop width of 8.
It is best to not put tabs in your files.
Have your editor automatically expand tabs into spaces.
It is also best to use a small indentation amount, like 2.
If you have any questions about these rules for program layout,
see me in advance, not after your first program review.
The final exam will be comprehensive.
Students receiving at least 65% of the course points are guaranteed
at least a C-.
Students receiving at least 75% of the course points are guaranteed
at least a B-.
Students receiving at least 85% of the course points are guaranteed
at least an A-.
Textbooks
There is no required textbook for this course.
On reserve in the
Kingsbury
library:
The purchase of these books is not required, so the local bookstores
will not have them.
However, if you want your own copy,
they are readily available from on-line retailers.
Also you can get on-line access to C references via the UNH library's
license for Safari Tech Books.
See the
website
for the Kingsbury Library for more information.
Once in Safari, select the Programming category and then select C.
Computer Accounts
agate.cs.unh.edu is
the primary computing resources for this course.
You should automatically be given an account on this machine.
During the semester you may use any other machines that you have access to,
but for grading purposes your programs must execute correctly on
agate.cs.unh.edu.
Policy on Cheating
All students are expected to do their own work on all
assignments.
No collaboration is allowed, either with current
or prior CS520 students, or anyone else.
One general rule to follow is that you may discuss your programs with
other students at the concept level but never at the coding level.
If you are at all unclear about this general rule, don't discuss your
programs with other students at all.
Note that this "no collaboration" policy does not distinguish between
the "giver" and the "taker".
I consider both parties equally guilty.
In addition, submitting programs that are based upon code retrieved
from Internet sources is also explicitly forbidden and will be
considered "cheating".
Be aware that I use tools for automatic plagiarism detection that analyze both
current and past assignment submissions.
Because so much of your course grade is based upon the programming
assignments, I will treat cases of cheating severely.
If caught cheating on an assignment, you can expect to (at least)
receive a failing grade for the course.
In addition, of course, collaboration is also not allowed on
the midterm exam or the final exam.
Last modified on November 22, 2009.
Comments and questions should be directed to
hatcher@unh.edu