Presentation is loading. Please wait.

Presentation is loading. Please wait.

Data Lab: Manipulating Bits

Similar presentations


Presentation on theme: "Data Lab: Manipulating Bits"— Presentation transcript:

1 Data Lab: Manipulating Bits

2 Introduction Purpose: To be more familiar with bit-level representations of integers and floating point numbers. Individual project Programming environment Linux server: Telnet & login with your ID & password

3 Handout instructions Start by copying datalab-handout.tar to a directory using the command cp /var/share/datalab-handout.tar . tar xvf datalab-handout.tar This will cause a number of files to be unpacked in the directory. The only file you need to modify is bits.c. bits.c Contains a skeleton for 15 programming puzzles. You must complete each function skeleton using only straight-line code for integer puzzles (no loops or conditionals). Only allowed 8 operators: ! ~ & ^ | + << >> You are not allowed to use any constants longer than 8 bits.

4 Puzzles Bit manipulations
Rating: difficulty (also the number of points) Max ops: the maximum number of operators allowed to use to implement each function

5 Puzzles Two’s complement arithmetic

6 Puzzles Floating-point operations
You can used standard control structures (loops, conditionals). You may use both int and unsigned data types, including arbitrary integer and unsigned constants. You may not use union, struct, or array. Any floating point operand will be passed to the function as having type unsigned, and any returned floating point value will be of type unsigned. float_neg & float_twice must handle the full range of possible argument values including NaN and infinity.

7 Helper programs fshow ishow
Helps you understand the structure of floating point numbers. You can use fshow to see that an arbitrary pattern represents as a floating point number Example # ./fshow Floating point value e+36 Bit Representation 0x7c000000, sign = 0, exponent = 0xf8, fraction = 0x000000 Normalized X 2^(121) ishow Helps you understand the structure of integer numbers.

8 Compile Switch to the handout directory and type make

9 Evaluation Correctness points: 41 Performance points: 30
By executing btest, points are automatically evaluated. Performance points: 30 2 points for each function satisfying the operator limits. dlc is used to evaluate the number of operators. Bonus points: 6 Student(s) who implement the functions bitCount, ilog2, and float_i2f with the smallest number of operators will be given 2 points. A student may get 6 bonus points at maximum. The number of operators should be smaller than the operator limits. It should be done during the Lab time.


Download ppt "Data Lab: Manipulating Bits"

Similar presentations


Ads by Google