|
Assignment 1: DatalabIntroductionThe purpose of this assignment is to become more familiar with representing and manipulating data as bits. You’ll do this by solving a series of programming “puzzles.” Many of these puzzles are quite artificial, but you’ll find yourself thinking much more about bits in working your way through them. You are to work individually on this assignment. Assignments later in the semester may be done in pairs. Getting Started
We are providing you with a skeleton code file and testing
utilities. To obtain these, copy the file
tar xvf datalab-handout.tarto the shell. This will cause twelve files to be created in your directory:
| |||
The only file you will be modifying and turning in is
bits.c . All other files should be left as-is.
The file btest.c allows you to evaluate the functional
correctness of your code. The file README contains
additional documentation about btest . Use the command:
make btestto generate the test code and run it with the command: ./btest
Looking at the file
The ! ~ & ^ | + << >>A few of the functions further restrict this list. See the comments in bits.c for detailed
rules and a discussion of the desired coding style. Note also that
casts and arrays are not allowed, that you may only declare
variables of type int , and that you may only
initialize variables to values in the range 0L - 255L .
Grading
Your code will be compiled with
The 15 puzzles you must solve have been given a difficulty rating
between 1 and 4, such that their weighted sum totals to 41. We
will evaluate your functions using the test arguments in
Regarding performance, our main concern at this point in the course is that you get the right answer. However, we want to instill in you a sense of keeping things as short and simple as you can. Furthermore, some of the puzzles can be solved by brute force, but we want you to be more clever. Thus, for each function we’ve established a maximum number of operators that you are allowed to use for each function. This limit is very generous and is designed only to catch egregiously inefficient solutions. You will receive two points for each function that satisfies the operator limit. Finally, we’ve reserved 5 points for a subjective evaluation of the style of your solutions and your commenting. Your solutions should be as clean and straightforward as possible. Your comments should be informative, but they need not be extensive. Project DetailsPart I: Bit Manipulations
The table above describes a set of functions that manipulate and test sets of bits. The “rating” field gives the difficulty rating (and thus the number of points) for the puzzle, and the “max ops” field gives the maximum number of operators you are allowed to use to implement each function. Part II: Two’s Complement Arithmetic
The table above describes a set of functions that make use of the two’s complement representation of integers. The “rating” and “max ops” fields have the same meaning as in Part I. Part III: Floating Point Operations
The table above describes a set of functions that operate on the bit-level representations of (single-precision) floating-point numbers. The “rating” and “max ops” fields have the same meaning as in Part I.
In this section, you are allowed to use standard control structures
(conditionals, loops, and you may use both
You can use ./fshow 2080374784 AdviceYou are welcome to do your code development using any system or compiler you choose. Just make sure that the version you turn in compiles and runs correctly on the CSUG Linux machines. If it doesn’t compile, we can’t grade it.
The ./dlc -e bits.cThe program runs only on the CSUG Linux machines.
Check the file ./btest -f bitAnd
The ./driver.pl “Trivia” assignmentBefore noon, Thursday, Jan. 20, send email to with the subject line "[cs252] Trivia 1 - uname" (without the quotes, where uname is your login name) containing answers to the following 4 questions:
What/how to turn in
The “trivia” assignment will be submitted via email.
The main assignment will be submitted using the script
Before running the
DUE DATES:For the “trivia” assignment: noon, Thursday, January 20. For the main assignment: 11:59pm, Friday, January 28. |