ECE 449 Assignment 5
- Write an assembly language program to do the following:
- Use movi to load
the date 05-03-2008 (hex 0x05032008) into r3. Then write your
birthdate (in hex) into r4 using
ori and
orhi.
- Set r5 = -1 using
addi.
- Set r5 = 0xFFFF0000 by using
xori.
- Set r5 = 0xFFFF by using
nor (with r0).
- Eliminate the upper 16 bits of r2 and r3 (leaving just the
year) by anding them with r5.
- Subtract r4 from r3 to generate your "age". Why does this
"fail"?
- Try again, using decimal numbers for 2008 and your birthyear.
- Use the existing instructions to do a logical "not" of a
register and a logical "nand" of two registers. Try to do each of
these with just two instructions.
- Write code to calculate 15 + 30 - 18 using both immediate and
register format instructions
Run your program within the Nios II Command shell, producing the
usual text files and generate a MIF of your program.
- Modify the risc processor started in the last assignment by
adding an ALU. I am providing you with rformat
and iformat look-up tables and the ALU input multiplexer.
Setup your DE2 project so that it displays the results of each
instruction on the DE-2 board. Download de2risc2 for a version based on the last
assignment. Demonstrate that your project runs the assembly language
program from the previous problem.
- Use the Nios II with timer project (or use mine) from
assignment 3. Write a C program to find the time required for
- multiplication of two integers
- division of two integers
- addition of two integers
- multiplication of two doubles
- division of two doubles
- addition of two doubles
- sqrt()
- sin()
You will need to "fool" the compiler into thinking you really
want the results (maybe by saving them to an array that you then sum).
Otherwise the compiler may "optimize" them away and never do the
calculation.
- Modify the audio program to do "Karoke" by making the output
equal to the difference of the two input channels. This will often
eliminate the vocal track (depending on the recording). You could
improve on simple subtraction by adjusting the relative contribution
of each channel. I suggest a combinational calculation of the type:
out = right + u*(left-right)/64
where u varies from 0 to 64 (start with 32). Note that
division by 64 is just a shift operation.
Use KEY3 to increase u and KEY2 to decrease u.
Use SW0 to enable Karoke mode. If SW0 is off, just pass the input to
the output. Display u on the seven-segment display.
Maintained by John Loomis,
last updated 14 Feb 2008