EE 360N - Programming Assignment 2 Clarifications

  1. Local variable address should be incremented only by 1 in both for loops in the mdump function. We corrected this mistake on the lc3bsim.c file on the webpage as of 2/17/2003. If you downloaded lc3bsim.c before that date, please make this correction in the shell code. The mdump function should look like:
    void mdump(FILE * dumpsim_file, int start, int stop) {          
        int address; /* this is a byte address */
        printf("\nMemory content [0x%0.4x..0x%0.4x] :\n", start, stop);
        for (address = (start >> 1); address <= (stop >> 1); address++)
    	printf("  0x%0.4x (%d) : 0x%0.2x%0.2x\n", address << 1, address << 1, MEMORY[address][1], MEMORY[address][0]);
        /* dump the memory contents into the dumpsim file */
        fprintf(dumpsim_file, "\nMemory content [0x%0.4x..0x%0.4x] :\n", start, stop);
        fprintf(dumpsim_file, "-------------------------------------\n");
        for (address = (start >> 1); address <= (stop >> 1); address++)
    	fprintf(dumpsim_file, " 0x%0.4x (%d) : 0x%0.2x%0.2x\n", address << 1, address << 1, MEMORY[address][1], MEMORY[address][0]);
        fprintf(dumpsim_file, "\n");

  2. Do we need to implement the TRAP routines?

    No. Whenever a TRAP instruction is processed, after the last state, PC will be set to 0, if you implement the TRAP instruction correctly. The simulator halts whenever PC becomes 0.

  3. What could be the cause of "Warning: Extra bit(s) in control store file ucode."?

    This means that the ucode file has more than 35 columns. One reason why this can happen is if you've transferred the ucode file from Windows to Unix. Run dos2unix program on UNIX machines to remove the extra control characters inserted by Windows. You can do this by typing:

    dos2unix ucode ucode
    on any LRC SunOS or Linux machine. If this doesn't work, check to make sure that your ucode file has at most 35 columns.

  4. What is CYCLE_COUNT? Is this the counter for memory access?

    CYCLE_COUNT is a global variable used by the simulator to count the number of machine cycles elapsed since the program started execution. Do not change this variable. You will need to use another variable for simulating memory latency.

  5. How do we handle Memory Mapped I/O for this lab?

    You do not need to implement Memory Mapped I/O for this lab.

  6. You may assume that the code running on your simulator has been assembled correctly and that the instructions your simulator sees comply with the ISA specifications

  7. Information about the updated lc3bsim.c file