Week 05 Laboratory Exercises
Objectives
- to practice using C's bitwise operations
- to understand how integer values are represented
- to practice manipulating dynamic memory
- to explore working with binary-coded decimal values
- to explore arbitrary precision integer arithmetic
Preparation
Before the lab you should re-read the relevant lecture slides and their accompanying examples.
Getting Started
lab05
and changing to this directory.
mkdir lab05 cd lab05
There are some provided files for this lab which you can fetch with this command:
1521 fetch lab05
If you're not working at CSE, you can download the provided files as a zip file or a tar file.
Exercise — individual:
Convert 16 Binary Digits to A Signed Number
When you think your program is working,
you can use autotest
to run some simple automated tests:
1521 autotest sixteen_in
When you are finished working on this exercise,
you must
submit your work by running give
:
give cs1521 lab05_sixteen_in sixteen_in.c
You must run give
before Monday 21 October 12:00 (midday) (2024-10-21 12:00:00)
to obtain the marks for this lab exercise.
Note that this is an individual exercise,
the work you submit with give
must be entirely your own.
Exercise — individual:
Convert a 16-bit Signed Number to Binary Digits
When you think your program is working,
you can use autotest
to run some simple automated tests:
1521 autotest sixteen_out
When you are finished working on this exercise,
you must
submit your work by running give
:
give cs1521 lab05_sixteen_out sixteen_out.c
You must run give
before Monday 21 October 12:00 (midday) (2024-10-21 12:00:00)
to obtain the marks for this lab exercise.
Note that this is an individual exercise,
the work you submit with give
must be entirely your own.
Exercise — individual:
Convert a 2 digit BCD Value to an Integer
When you think your program is working,
you can use autotest
to run some simple automated tests:
1521 autotest bcd
When you are finished working on this exercise,
you must
submit your work by running give
:
give cs1521 lab05_bcd bcd.c
You must run give
before Monday 21 October 12:00 (midday) (2024-10-21 12:00:00)
to obtain the marks for this lab exercise.
Note that this is an individual exercise,
the work you submit with give
must be entirely your own.
Exercise — individual:
Convert an 8 digit Packed BCD Value to an Integer
When you think your program is working,
you can use autotest
to run some simple automated tests:
1521 autotest packed_bcd
When you are finished working on this exercise,
you must
submit your work by running give
:
give cs1521 lab05_packed_bcd packed_bcd.c
You must run give
before Monday 21 October 12:00 (midday) (2024-10-21 12:00:00)
to obtain the marks for this lab exercise.
Note that this is an individual exercise,
the work you submit with give
must be entirely your own.
Challenge Exercise — individual:
Add 2 Arbitrary Length BCD Values
When you think your program is working,
you can use autotest
to run some simple automated tests:
1521 autotest bcd_add
When you are finished working on this exercise,
you must
submit your work by running give
:
give cs1521 lab05_bcd_add bcd_add.c
You must run give
before Monday 21 October 12:00 (midday) (2024-10-21 12:00:00)
to obtain the marks for this lab exercise.
Note that this is an individual exercise,
the work you submit with give
must be entirely your own.
Challenge Exercise — individual:
MIPS NUXI
When you think your program is working,
you can use autotest
to run some simple automated tests:
1521 autotest nuxi
When you are finished working on this exercise,
you must
submit your work by running give
:
give cs1521 lab05_nuxi nuxi.s
You must run give
before Monday 21 October 12:00 (midday) (2024-10-21 12:00:00)
to obtain the marks for this lab exercise.
Note that this is an individual exercise,
the work you submit with give
must be entirely your own.
Challenge Exercise — individual:
Subtract, Multiply and Divide 2 Arbitrary Length BCD Values
When you think your program is working,
you can use autotest
to run some simple automated tests:
1521 autotest bcd_arithmetic
When you are finished working on this exercise,
you must
submit your work by running give
:
give cs1521 lab05_bcd_arithmetic bcd_arithmetic.c
You must run give
before Monday 21 October 12:00 (midday) (2024-10-21 12:00:00)
to obtain the marks for this lab exercise.
Note that this is an individual exercise,
the work you submit with give
must be entirely your own.
Submission
give
.
You can run give
multiple times.
Only your last submission will be marked.
Don't submit any exercises you haven't attempted.
If you are working at home, you may find it more convenient to upload your work via give's web interface.
Remember you have until Week 7 Monday 12:00:00 (midday) to submit your work without receiving a late penalty.
You cannot obtain marks by e-mailing your code to tutors or lecturers.
You check the files you have submitted here.
Automarking will be run by the lecturer several days after the submission deadline,
using test cases different to those autotest
runs for you.
(Hint: do your own testing as well as running autotest
.)
After automarking is run by the lecturer you can view your results here. The resulting mark will also be available via give's web interface.
Lab Marks
When all components of a lab are automarked you should be able to view the the marks via give's web interface or by running this command on a CSE machine:
1521 classrun -sturec