ELEC5260_6260 hw6 Subroutines

ELEC5260_6260 hw6 Subroutines - ELEC 5260/6260 Homework #6...

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

View Full Document Right Arrow Icon
ELEC 5260/6260 Homework #6 Due Friday, 2/5/2010 PROGRAM 1: To practice writing and using subroutines, write a subroutine that calculates the expression: Z = (a0 * x0) – (a1 * x1). The values of the four variables a0, a1, x0, x1 are to be passed to the subroutine in registers. The address of variable Z is to be passed to the subroutine in a register. The “main” program is to call the subroutine two times, once for each of the following sets of data. You may not use “immediate” data within the subroutine – all values are to be read from memory and results are to be stored in memory. x0 and x1 are to be 32-bit integers. a0, a1, and z are to be stored using Q24.8 format, i.e. 24 integer bits and 8 fraction bits, stored in a 32-bit word as follows: n 23 n 22 n 21… n 1 n 0 . n -1 n -2 … n -7 n -8 First call: x0=200, x1=100, a0=5.25, a1=6.75. Store the answer at variable z1. Second call: x0=300, x1=200, a0=3.5, a1=4.125. Store the answer at variable z2.
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/23/2011 for the course ELEC 6260 taught by Professor Nelson,v during the Summer '08 term at Auburn University.

Page1 / 2

ELEC5260_6260 hw6 Subroutines - ELEC 5260/6260 Homework #6...

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

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