Be combined concatenated with not linked with the two

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

be combined (Concatenated with, not linked) with the two procedures: “isPrime” and “print”. Convert the above program into a procedure. 2.2 Tracing Assembly Code lis $5 .word end jalr $5 end: jr $31 What does the above program do? 2
Image of page 2

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

2.3 Assembler Concepts Why does the assembler need to make two passes over the input program? What is done during each pass? Construct a Symbol Table for the following program mult: mult $1, $2 beq $0, $0, BL frog: gorf: .word gorf BL: ;branch here ;now return jr $31 end: 2.4 Exercise lis $3 lw $3, 20($0) sw $3, 12($0) add $3, $0, $0 jr $31 .word 20 What does the program do? Write a procedure called “isPrime” that determines whether the number given in $1 is prime and returns either 0 (false) or 1 (true) in $3. Since this is a procedure, make sure you save all used registers on the stack. Write an assembly language program that is equivalent to the following program, but does not contain labels. d: beq $1, $2, a .word b c: .word c a: bne $3, $5, d b: jr $31 3
Image of page 3
3 MERL - MIPS executable, relocatable, link- able 3.1 MERL format Header - cookie (0x10000002), length (length of MERL in bytes), clen (length of code + header in bytes) Footer - Sticky Notes The MERL specifications will be given on the exa 3.2 Relocation Which lines of the following MIPS program needs to be relocated? beq $30, $29, EOL .word label .word abcd EOL: lis $4 .word abcd jr $4 label: .word 4 .word 0x10 abcd: jr $31 Give the Footer for the above program 3.3 Linking Consider the following program .import toop .export goop goop: add $3, $0, $0 loop: lis $17 .word toop jalr $17 add $3, $3, $3 beq $3, $17, loop jr $31 .word loop 4
Image of page 4

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

Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

{[ 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