homework7-asmfunc-solutions.pdf - homework7-asmfunc.asm...

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

;**************************************************************** ; homework7-asmfunc.asm: Assembly code for homework 7 assignment. ; ; Created by Zhao Zhang for ECE 266 spring 2018 ;**************************************************************** .cdecls "homework7.h" .text ;**************************************************************** ; void sat12Array(short X[], int N) ; Saturate every element of X[] to 12 bits. ;**************************************************************** .global sat12Array ssat12Array .asmfunc MOV r2, #0 ; i = 0 B cond2 ; check condition first loop2 LDRSH r3, [r0, r2, LSL #1] ; load X[i] SSAT r3, #12, r3 ; saturate X[i] to 12 bits STRH r3, [r0, r2, LSL #1] ; store back X[i] ADD r2, #1 ; i++ cond2 CMP r2, r1 ; compare i and N BLT loop2 ; continue loop if i < N BX lr ; return .endasmfunc ;**************************************************************** ; int dotProduct(short X[], short Y[], int N) ; Calculate the dot product of X[] and Y[]. ;**************************************************************** .global dotProduct
Image of page 1

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

Image of page 2
This is the end of the preview. Sign up to access the rest of the document.
  • Fall '17
  • SEPTA Regional Rail, Subroutine, Void type, Jaguar Racing

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern