ECE 595c Computer and Digital Design Assignment 2

  1. Run the NIOS II IDE debugger with your hello_world_small program. Step through the execution until the characters "hell" have appeared in the console output. Then capture a screen image of the IDE and include it in your report.

  2. Run the NIOS II IDE command window. Enter the commands
       echo your name
       cal 2007
    
    which should produce your name and a 2007 calendar. Capture a screen image and include it in your report. Then capture a portion of the command window using right-click ... edit ... mark, select the portion of the console display containing your name and the month of January 2007 (the selected portion should appear in reverse video), strike the "Enter" key, then paste the results into your report.

    Note that in the ordinary console (command) window you can right-click anywhere to bring up the context-sensitive menu. With the NIOS II console, the cursor must be in the title bar in order to obtain a context-sensitive menu.

  3. Write C-programs to do the following, submit code and test reports demonstrating correct operation. Note that you can use a generic C compiler (e.g., Microsoft Visual C) for development, but you should demonstrate its operation on a Nios system.

    1. Write a procedure void strgen(char *buf, int n) that fills a character buffer with n alphanumeric characters followed by a null character. The calling program is responsible for allocating space in buf for at least n+1 characters. For example strgen(buf,5) might fill the buffer with "abcde".

    2. Write a procedure int strlen(char * pstr), that takes a pointer to a null-teriminated ASCII string and returns the length of the string, excluding its null terminator. For example, if the argument to strlen points to the string "not very long", the returned value will be 13.

    3. Combine procedures from the previous two exercises in a loop to test strlen for string lengths from 0 to 15.

  4. Modify your system to connect the 18 toggle switches to digital input and the 7-segment displays to digital output (through hex_7segment converters). Write a program to read the switches and echo the value to the console (if the value changes) and to the 7-segment display as a decimal integer.

  5. Measure the time required to calculate sin(w*t) by placing the calculation in a loop and sending a pulse to a pin on the expansion header at each pass through the loop. You can use the DE2 board to measure the time or an external meter.


Maintained by John Loomis, last updated 29 May 2007