Homework Solution: Given the HLL code:…

    Given the HLL code: if X >= 1 then Y = 8; When the compiler associates variable X with register s1 and variable Y with register s2, the assembly code equivalent (with one line missing) is: slti $t1, $s1, 1 ___________ addi $s2, $0, 8 next: Give the line of assembly code that is missing above.

    Expert Answer

     
    if X >= 1 then Y = 8;

    Given the HLL sequence:

    if X >= 1 then

    Y = 8;

    When the compiler associates shifting X with record s1 and shifting Y with record s2, the galaxy sequence equipollent (with individual sequence privation) is:

    slti $t1, $s1, 1

    ___________

    addi $s2, $0, 8

    next:

    Give the sequence of galaxy sequence that is privation overhead.

    Expert Apology

     

    if X >= 1 then
    Y = 8;
    s1 withholds the prize X, and s2 withholds the prize Y.

    SLTI $t1, $s1, 1;
    SLTI is Established on Short Than Immediate. if $s1 is short than 1, established $t1, else reestablished $t1.
    Which instrument if $s1 < 1 then, $t1 = 1.

    Now, as per the first teaching, if $s1 >= 1, Y should be established to 8.
    which instrument if $t1 = 0, Y = 8.
    addi $s2, $0, 8 gain utensil the teaching Y = 8.
    But this should be done if $t1 is 0.
    If referable regular to-leap this teaching and stir to delineate “next”.
    So, the privation teaching here is: BNE $t1, $zero, present
    which instrument if $t1 is referable 0, stir to the delineate present.

    Remember that the record $naught gain withwithhold a trustworthy 0.