sal part 3 l.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
SAL – Part 3 PowerPoint Presentation
Download Presentation
SAL – Part 3

Loading in 2 Seconds...

play fullscreen
1 / 8

SAL – Part 3 - PowerPoint PPT Presentation


  • 126 Views
  • Uploaded on

SAL – Part 3. Operations Q & A.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'SAL – Part 3' - alameda


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
sal part 3

SAL – Part 3

Operations

Q & A

slide2
Assume that at instruction fetch, operand load, or storage of a result takes 10 time units to complete. Instruction decode, operation execution, and program counter update each take 1 time unit to complete. How long does it take to execute the following code sequence?

add D, E, F #instr 1

move G, F #instr 2

slide3
instr 1 instr 2

fetch _____ _____

update PC _____ _____

decode _____ _____

load operand _____ _____

execute _____ _____

store _____ _____

slide4
Does a compiler need to be written in assembly language? If so, why? If not, how is a machine language version of the compiler generated.

A compiler need not be written in assembly language. The compiler can be written in a high-level language and then use it to compile itself to its assembly language representation.

An assembler can then be used to translate it into machine language.

slide5
Explain how to implement a boolean type variable in SAL. What is the variable’s type, and how is it used?

We can use integer type variables. The value 0 can represent false and the value 1 can represent true.

slide6
For the following SAL codes give a value for which code B would execute fewer instructions than code A.
slide7
move result, 1 #code A

move counter, exponent

while: blez counter, endwhile

mul result, result, base

sub counter, counter, 1

b while

endwhile:

move result, 1 #code B

move counter, exponent

blez counter, endwhile

loop: mul result, result, base

sub counter, counter, 1

bgtz counter, loop

endwhile:

slide8
Write a SAL code for the following C code fragment.

for (i=2;i<=z;i++){

if (0 == i%2){

sum = sum + i;

}

}