Digital Signal Processing Reference
In-Depth Information
9.7 Laboratory Exercises
1. Compile and simulate the ΜP 3 computer VHDL or Verilog model. Rewrite the machine
language program in the program.mif file to compute A = (B + C) + D. Store D in
location 13 in memory. End the program with a Jump instruction that jumps to itself. Be
sure to select the UP3's Cyclone device as the target. Find the maximum clock rate of the
ΜP 3 computer. Examine the project's compiler report and find the logic cell (LC)
percentage utilized.
2. Add the JNEG execute state to the CASE statement in the model. JNEG is Jump if AC <
0. If A >= 0 the next sequential instruction is executed. In most cases, a new instruction
will just require a new execute state in the decode CASE statement. Use the opcode value
of 04 for JNEG. Test the new instruction with the following test program that implements
the operation, IF A>= 0 THEN B = C
Assembly Language
Machine Language Memory Address
LOAD A
0210
00
JNEG
End_of_If
0404
01
LOAD C
0212
02
STORE B
0111
03
End_of_If:
JMP End_of_If
0304
04
End_of_If is an example of a label; it is a symbolic representation for a location in the
program. Labels are used in assembly language to mark locations in a program. The last
line that starts out with End_of_If: is the address used for the End_of_If symbol in the
Jump instruction address field. Assuming the program starts at address 00, the value of
the End_of_If label will be 04. Test the JNEG instruction for both cases A < 0 and
A >= 0. Place nonzero values in the *.mif file for B and C so that you can verify the
program executes correctly.
3. Add the instructions in the table below to the VHDL model, construct a test program for
each instruction, compile and simulate to verify correct operation. In JPOS and JZERO
instructions, both cases must be tested.
Instruction
Function
Opcode
SUBT address
AC = AC MDR
05
XOR
address
AC = AC XOR MDR
06
OR
address
AC = AC OR MDR
07
AND
address
AC = AC AND MDR
08
JPOS address
IF AC > 0 THEN PC = address
09
JZERO address
IF AC = 0 THEN PC = address
0A
ADDI address
AC = AC + address
0B
Search WWH ::




Custom Search