CS 213 Spring '00
Lab 1

Lab Assignment L1 ( L1.ps cry.ps )

Revisions and Updates:

*******************************************

c2c compiler (Last update: Jan 30th, 1:00)

*******************************************

There is a new version of "c2c" in the HOME213/L1 directory. The old "c2c" compiler does not count the pre-increment and pre-decrement operator, this version should have fixed the problem.

***************

ATTENTION

***************

PLEASE FIX THE FOLLOWING IN YOUR ASSIGNMENT:

  • There is a new file under HOME213/L1 names code4. Please replace your old copy of code4 with the new version. You will not be able to decode the 4th message without the new file.
  • In state_machine_expansion and state_machine_compression, start from the least significant 6 bits or 3 bits chunk.
  • In state_machine_expansion, the assignment says the most significant bits are in "r1". This is wrong. The most significant 16 bits are in the lower bits of r2, The least significant 32 bits are in r1 (as it is everywhere else in the assignment).

    =================================================================

    Please ignore my previous posting regarding the following functions:

  • int greater(int arg1, int arg2);
  • int less(int arg1, int arg2);
  • int greaterEq(int arg1, int arg2);
  • int lessEq(int arg1, int arg2);
  • int equalto(int arg1, int arg2);

    All restrictions are as stated in the handout.

    The threshold for number of operators and number of control flow constructs.

    The following rules are used to evaluate bits.c:

  • You are allowed to use up to 100 operators in bits.c
  • For each operators in bits.c that is over 100, you will lose 0.2 point
  • For each operators in bits.c that is below 100, you will gain 0.2 point
  • You are allowed to use up to 25 control flow constructs in bits.c
  • For each control flow constructs in bits.c that is over 25, you will lose 0.5 point
  • For each control flow constructs in bits.c that is below 25, you will gain 0.5 point

    To help you count the number of operators and control flow constructs in bits.c, you are also given c2c in the lab directory HOME213/L1.

    c2c gives a cumulative count on the number of operators and control flow constructs for each function. To run c2c, enter the following command:

    cpp bits.c | c2c

    cpp is the C preprocessor. c2c also prints out all illegal operators.

    ============

    e_perm table

    ============

    In cry.ps, the description of expand_permutation says that "for each block of 4 input bits, the first and fourth bits appear twice in the output while the two middle bits appear once." If I understand that correctly, then I think there may be a mistake in the declaration of the e_perm array in bits.c. I've copied e_perm below, and the part that I'm confused about is the second row, which reads in part "8,9,9,9."

    int e_perm[48] = {32, 1, 2, 3, 4, 5, 4, 5, 6, 7, 8, 9, 9, 9, 10, 11, 12, 13, 12, 13, 14, 15, 16, 17, 16, 17, 18, 19, 20, 21, 20, 21, 22, 23, 24, 25, 24, 25, 26, 27, 28, 29, 28, 29, 30, 31, 32, 1};

    Why is 9 repeated three times instead of twice? Should it be "8,9,8,9" or did I misunderstand the description of expand_permutation?

    It is a mistake in the e_perm table. However do NOT fix the table, use the values in the table for your expand_permutation function.

    =======================================================

    In and_n or_n and not_n, the last "arg3" bits refer to the least significant arg3 bits.

    =======================================================

    You are not allowed to change the order in which the functions are defined.

    =======================================================

    There are two version of bits.c out there, with different function order. Both function order will be accepted.

    =======================================================

    Recursive solutions are allowed.

    =======================================================

    Assignment operator "=" is allowed.

    =======================================================

    You could change "static state" to "static int state" if you choose to. It should not effect the output of the program.

    Back to CS213 home page.