ee357_hw3_sol

ee357_hw3_sol - EE 357 Homework 3 Spring 07 Redekopp Name:...

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

View Full Document Right Arrow Icon
EE 357 Homework 3 Spring ’07 Redekopp Name: ____Solutions________________________________ Lec: 9:30 / 11:00 / 2:00 Due: Mon./Tues. Feb. 5 th /6 th Score: ________ Note: Attach all work to receive full credit HLL to Assembly Translation 1.) Translate the following C code statements to an equivalent assembly language implementation. Add labels (like L1, L2, L3) in front of instructions where needed . #define MAX 20 ... for(i=0;i < MAX; i++){ code A } i DS.W 1 MAX EQU 20 ... CLR.W i LOOP CMPI.W #MAX,i __ ___ BEQ.S DONE ____ ___ Code A instructions ___ ADDI.W #1,i____ ___ BRA.S LOOP____ DONE ... if(x > 10) code A else if (x == 10) code B else code C x DS.W 1 ... CMPI.W #10,x ___ ___ BLE.S _ L1 ______ ___ Code A instructions ___ BRA DONE ____ L1 CMPI.W #10,x _ ___ BNE.S L2 _____ ___ Code B instructions ___ BRA __ DONE ____ L2 _ Code C instructions DONE ... Program Flow (Comparison and Branch) Instructions 2.) Assume that (D0) = $7824FCEA before execution of EACH of the following instructions
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 11/26/2008 for the course EE 357 taught by Professor Mayeda during the Spring '08 term at USC.

Page1 / 3

ee357_hw3_sol - EE 357 Homework 3 Spring 07 Redekopp Name:...

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