sp99 homequiz 4 solution

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]; 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. Assume that it is a signed number.
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 / 5

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

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