Homework#1-Solution

Homework#1-Solution - Computer Architecture Homework#1...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

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

Unformatted text preview: Computer Architecture Homework #1 February 11, 2012 Veton Këpuska 2 Problem 2.3 Write the code to implement the expression A=(B+C)*(D+E) on, 3-, 2-, 1-, and 0-address machines. In accordance with programming language practice, computing the expression should not change the values of its operands. Solution: T is a memory location used as temporary 3-address 2-address 1-address 0-address ADD A, B, C LOAD A, B LDA D PUSH D ADD T, D, E ADD A, C ADD E PUSH E MPY A, A, T LOAD T, D STA T ADD ADD T, E LDA B PUSH C MPY A, T ADD C PUSH B MPY T ADD STA A MPY POP A February 11, 2012 Veton Këpuska 3 Problem 2.4 Write SRC code to implement the expression in Exercise 2.3 Solution: Assume that operands and results are stored in memory addresses that can be accessed with direct addressing. Also assume that ARC has a multiply instruction, mpy , that uses format 6....
View Full Document

This note was uploaded on 02/10/2012 for the course ECE 4551 taught by Professor Johnhadjilogiou during the Fall '09 term at FIT.

Page1 / 5

Homework#1-Solution - Computer Architecture Homework#1...

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

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