

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


College of Computing
CS3220 | Pro cessor Design Spring 2001
CS3220 Issued: February 21, 2001 Pro ject 3 Due: March 28, 2001
Purp ose: This pro ject emb o dies the second ma jor p oint of the course: you will build a translator to extend a hardware implementation to a di erent instruction set.
Reading: none
Problems: 1. Translator
Like Pro ject 2, this pro ject requires a signi cant amount of work. Start early.
On-line copies of the linker and circuit may b e found on the pro ject web page: http://www.cc.gatech.edu /classe s/AY200 1/cs32 20 spring/project3/
Problem 1: Translator
Mo dify the linker program to translate iJVM instructions to iMIPS instructions. The output should b e a .hex le which will execute on the msim simulator or on the iMIPS hardware.
We recommend the following approach (as discussed in class):
De ne stack lo cations as registers (reserving a few registers for metho d invo cation). Use a technique similar to the compute stackdepth() algorithm you wrote for Home- work 3 to gure out the stack depth at each iJVM instruction in the source program. Assign each stack depth to a physical iMIPS register. Don't worry ab out running out of registers. Convert iJVM instructions individually into equivalent iMIPS op erations on regis- ters. There should b e a more or less one-to-one corresp ondence b etween instructions. Exceptions are instructions with delay slots, for which you add a NOP, and the IN- VOKESTATIC case, which turns into a sequence of instructions. Extend the control- ow graph data structures (bb t and method info t) as required. Here's a simple approach for pro cedure calls. First, save al l stack-state registers and the link register on the stack in memory. Second, move pro cedure arguments into registers R1, R2, etc. Third, use JAL to call the pro cedure. Fourth, after return, restore the link and stack-state registers. Finally, move R1, the return value, to the appropriate stack-state register. OPTIONAL: Perform optimizations. E.g., eliminate unnecessary MOVE instructions, p erform p eephole reordering to remove pip eline-induced NOP instructions, p erform con- stant propagation, p erform live-register analysis to avoid spill/reload at pro cedure invo cation p oints, etc. Finish co de generation by mo difying linker.c as necessary, e.g., to insert iMIPS GOTOs and iMIPS startup co de.
Make your changes primarily by adding new passes over the BB data structure in the manner of rewrite method() along with any required changes to the wrapp er co de in linker.c.
A: Turn in your mo di ed co de indicating the changes.