Docsity

EECS 443 Homework 2: Implementing Operations with RISC Instructions and VHDL - Prof. Perry, Assignments of Digital Systems Design

Toggle sidebar
bg1
EECS 443 โ€“ Digital Systems Design
Homework 2
February 19, 2008
1. RISC processing is based on the principle that a small number of highly
efficient operations is more effective than many complex, special purpose
instructions. Thus, we need to start thinking about how typical operations
can be implemented using RISC instructions. Use the instruction set of
KURM08 (Project 2) to implement the following two operations: (Remem-
ber that R0and R1contain constant values.)
(a) Load R11 with the contents of the memory location stored in R12. (Di-
rect addressing)
(b) Load R11 with the contents of the memory location stored in the mem-
ory location stored R12. (Indirect addressing)
(c) Copy the contents of the memory location stored in R11 to the memory
location stored in R12. (Memory move)
(d) Copy the contents of R10 words of memory starting with the address
stored in R11 to the memory location starting with R12. (Block mem-
ory move)
(e) Increment R15 by 2.
(f) Branch to the address P C + 8 if the contents of R11 are less than 0.
(g) Branch to the address P C + 8 if the contents of R11 are greater than 1.
(h) Simulate a stack push by treating the contents of R12 as data to be
pushed on a stack in memory whose top is pointed to by R15. Your
stack should grown down in memory. (Set up for a function call.)
(i) Simulate a stack pop by moving the top element of a stack pointed to
by R15 into R12. (Return from a function call.)
1
pf3

Partial preview of the text

Download EECS 443 Homework 2: Implementing Operations with RISC Instructions and VHDL - Prof. Perry and more Assignments Digital Systems Design in PDF only on Docsity!

EECS 443 โ€“ Digital Systems Design

Homework 2

February 19, 2008

  1. RISC processing is based on the principle that a small number of highly efficient operations is more effective than many complex, special purpose instructions. Thus, we need to start thinking about how typical operations can be implemented using RISC instructions. Use the instruction set of KURM08 (Project 2) to implement the following two operations: (Remem- ber that R 0 and R 1 contain constant values.)

(a) Load R 11 with the contents of the memory location stored in R 12. (Di- rect addressing) (b) Load R 11 with the contents of the memory location stored in the mem- ory location stored R 12. (Indirect addressing) (c) Copy the contents of the memory location stored in R 11 to the memory location stored in R 12. (Memory move) (d) Copy the contents of R 10 words of memory starting with the address stored in R 11 to the memory location starting with R 12. (Block mem- ory move) (e) Increment R 15 by 2. (f) Branch to the address P C + 8 if the contents of R 11 are less than 0. (g) Branch to the address P C + 8 if the contents of R 11 are greater than 1. (h) Simulate a stack push by treating the contents of R 12 as data to be pushed on a stack in memory whose top is pointed to by R 15. Your stack should grown down in memory. (Set up for a function call.) (i) Simulate a stack pop by moving the top element of a stack pointed to by R 15 into R 12. (Return from a function call.)

(j) Simulate a state add by popping two elements of a stack pointed to by R 15 into registers, adding the registers, and storing the result on the top of the stack. (Stack-based mathematical operations.)

On the stack-based problems, remember to update the stack pointer after all operations.

  1. Assume the following VHDL fragment representing the skeleton of a simple CPU model:

architecture beh of cpu is begin CPU: process M : array of word; R11,R12,R13 : word; PC : word; begin ... end process CPU; end architecture beh;

Using VHDL statements, define behaviors for the following operators and memory addressing modes: (Note that you need to indicate only the VHDL needed to implement the function. You may assume that word addition and comparison functions exist. These are not necessarily instructions that are defined for KURM.)

(a) LW R11 #99 - Load R11 with the value 99. (b) LW R11 R12 - Load R11 from the address stored in R (c) LW R11 (R12) - Load R11 from the address stored in the memory location at the address in R (d) SW R11 R13(R12) - Store R11 using register indirect addressing with an offset stored in R13. (e) ADD R12 R13 R11 - Add contents of R12 and R13 storing the re- sult in R (f) INC R11 - Increment R11 by 1 (g) MOV R11 R12 - Move the contents of R11 into R