HW_7_Solutions

HW_7_Solutions - and B and use DS to allocate memory...

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

View Full Document Right Arrow Icon
ECE252 Microprocessor Fall 2008 Homework #7 Solutions, 100 Points Due on Nov. 18, 2008 1. Programming: Vector (one-dimension array) multiplication: write a subroutine VECMUL that multiplies two vectors, C = A T x B. Vectors A, B, and C are of the same size n . The vector multiplication is performed as follow, [c 0 , c 1 , . .., c n-1 ] = [a 0 , a 1 , . .., a n-1 ] T x [b 0 , b 1 , . .., b n-1 ], where c i = a i * b i , 0 <= i < n. Test your implementation by calling VECMUL from the main program. The addresses of vectors A, B, and C should be put into A0, A1, A2, and the size of vector should be put into D1, before subroutine VECMUL is called. Use DC to define and initialize vectors A
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
Background image of page 3

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

View Full DocumentRight Arrow Icon
Background image of page 4
Background image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: and B, and use DS to allocate memory storage for vector C. (50 pts) Solution: 2. Programming: Write a subroutine SubStrSearch for searching a substring from a given large string and return the index (of the first character) for the first match. Test it with the string “This is a wonderful world!” and the substring “world”, which are defined as f o l l o w s : ( 5 p t s ) ORG $2000 L_String DC.B ‘This is a wonderful world!’, 0 S_String DC.B ‘world’, 0 ORG $2100 SubStrSearch … … RTS ORG$2200 START … … MOVE.B #9, D0 TRAP #15 END START Solution:...
View Full Document

This note was uploaded on 02/18/2010 for the course ECET 252 taught by Professor Hu during the Spring '10 term at NJIT.

Page1 / 5

HW_7_Solutions - and B and use DS to allocate memory...

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

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