Hexadecimal and Tables

Information

Hexadecimal

The hexadecimal numbering system (base 16) is used commonly in computing science, due to its easy translation to and from binary. Compared to binary, hexadecimal is extremely succinct, representing 4 binary digits with a single hexadecimal digit. Hexadecimal, unlike decimal, can be translated to binary digit by digit, with digits not affecting each other in the binary result.

Due to this direct correlation, the algorithm to create a binary number from ASCII hexadecimal digits to a binary integer only involves converting the ASCII digit to the value it represents, and shifting left 4 before oring in the next hexadecimal digit.

Going from a binary number to ASCII hexadecimal is similarly simple, involving masking out each 4-bit section and converting it to its associated ASCII character. A full table of ASCII characters can be found here.

Tables

A table in assembly is simply a known amount of allocated space with a known base address. Depending on how many fields need to be in the table, fields in the same row can be stored in the same table or each field may be stored in a separate table while all the fields corresponding to the same entry share an index value. As a rule, in large tables with fields of differing alignments, for instance a word field and a byte field, it is more efficient to use two index-correlated tables than to allocate extra space or deal with unaligned word issues. If the alignments of all of the entries match, it is more efficient to use a spacially-correlated table.

Assignment

Your job is to implement the following 3 functions:

To assist you in the creation and testing of these functions, a MIPS testing file test.s has been created for you. This testing file creates a simple interactive terminal which allows you to enter a hexadecimal number, uses readHex to convert it to an unsigned integer, countAccess to count the times that integer has been entered, and printHex to print the integer back in hexadecimal. This will allow you to ensure correctness across all your functions. When marking, values will be provided directly to each function, so ensure that your functions do not rely on previous execution of each other. During marking, no guarantees about input are provided beyond those indicated in the specifications for each function.

Notes

Resources

Marking Guide

Assignments too short to be adequately judged for code quality will be given a zero.

Submission

There is a single file to be submitted for this lab. The file name should be lab2.s and it should contain only the code for the functions specified above. Make sure to not include a main function in your solution. Use the link provided in the course page for submission. Your solution MUST include the CMPUT 229 Student Submission License at the top of the file containing your solution and you must include your name in the appropriate place in the license text.