sp99 homequiz 4 solution

# Computer Organization and Design: The Hardware/Software Interface

This preview shows pages 1–3. Sign up to view the full content.

1 University of California, Berkeley College of Engineering Computer Science Division EECS Spring 1999 John Kubiatowicz Homework Quiz (HW #4) March 15, 1999 CS152 Computer Architecture and Engineering This quiz covers one of the problems from homework #4. Good Luck! Your Name: SID Number: Discussion Section: Total:

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2 The VSCALE instrucition Figure 1: A multicycle data path In your homework, you implemented the bcp (block copy) instruction. Here is the pseudo-code for a related instruction, called vscale . It is the same as block copy, except that it multiplies every source word by a constant before copying it to its destination. Let v1 be the starting address of the input vector, v2 be the starting address of the destination vector, length be the length of both vectors (in words), and scale be the scale factor: vscale(v1,v2,length,scale) { int index = (length-1) × 4; /* mult × 4 since we want byte addr */ while (index >= 0) { M[v2+index] = scale × M[v1+index]; index = index – 4; } } Your job is to implement the vscale instruction in the multicycle data path. Here is the coding of vscale instruction: opcode = Instruction[31:26] = 0x31 (an unused opcode) R[rs] v1, R[rt] v2, R[rd] length-1, Instruction[10:0] scale The scale value is hard-coded into the lower 11 bits of the instruction.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern