Digital Signal Processing Reference
In-Depth Information
In the logical XOR instruction each bit is exclusive OR'ed with the corresponding bit in
each operation for a total of sixteen independent exclusive OR operations. This is called a
bitwise logical operation. OR and AND are also bitwise logical operations. The add-
immediate instruction, ADDI, sign extends the 8-bit address field value to 16 bits. To
sign extend, copy the sign bit to all eight high bits. This allows the use of both positive
and negative two's complement numbers for the 8-bit immediate value stored in the
instruction.
4. Add the following two shift instructions to the simple computer model and verify with a
test program and simulation.
Instruction
Function
Opcode
AC = AC shifted left address bits
SHL
address
0C
AC = AC shifted right address bits
SHR
address
0D
The function LPM_CLSHIFT is useful to implement multiple bit shifts. SHL and SHR
can also be used if 1993 VHDL features are enabled in the compiler. Only the low four
bits of the address field contain the shift amount. The other four bits are always zero.
5. Run the ΜP 3 computer model using one of the FPGA boards. Use a debounced
pushbutton for the clock and the other pushbutton for reset. Output the PC in hex to the
LCD display or seven segment LEDs. Run a test program on the board and verify the
correct value of the PC appears in the LCD display by stepping through the program
using the pushbutton.
6. Add these two input/output (I/O) instructions to the ΜP 3 computer model running on the
UP3 board.
Instruction
Function
Opcode
IN i/o address
AC = switch bits (low 4 bits)
0E
LCD or 7-Seg LED displays hex value of
AC
OUT i/o address
0F
These instructions modify or use only the low eight bits of AC. Remove the PC display
feature from the previous problem, if it was added or for more of a challenge place the
AC value on the second line of the hex display by modifying the LCD display code. Test
the new I/O instructions by writing a program that reads in the switches, adds one to the
switch value, and outputs this value to the LED display. Repeat the input, add, and output
operation in an infinite loop by jumping back to the start of the program. Add a new
register, register_output, to the input of the seven-segment decoder that drives the LED
display or use the LCD display. The register is loaded with the value of AC only when an
OUT instruction is executed. Compile, download, and execute the program on the FPGA
board. When several I/O devices are present, they should respond only to their own
unique I/O address, just like memory.
Search WWH ::




Custom Search