Computer Organization and Design: The Hardware/Software Interface

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

View Full Document Right Arrow Icon
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:
Background image of page 1

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

View Full DocumentRight Arrow Icon
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];
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

sp99 homequiz 4 - University of California, Berkeley...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online