А жүйесіне бағдарламаны іске қосу үшін 300 секунд қажет. Дәл сол бағдарламаның жаңа в жүйесінде жұмыс істеуі үшін 250 секунд қажет. В-ның а-дан жоғары жылдамдығы қандай? В-ның а-ға қарағанда өнімділігінің жақсаруы қандай?


Стектегі мәндерді сақтау/қалпына келтіру және стек көрсеткішін жаңарту үшін келесі нұсқауларды пайдалануға болады



бет5/5
Дата13.04.2023
өлшемі256,37 Kb.
#82372
1   2   3   4   5
Стектегі мәндерді сақтау/қалпына келтіру және стек көрсеткішін жаңарту үшін келесі нұсқауларды пайдалануға болады:
procA:
addi $sp, $sp, -32
sw $s0, 0($sp)
sw $s1, 4($sp)
sw $s2, 8($sp)
sw $s3, 12($sp)
sw $t0, 16($sp)
sw $t1, 20($sp)
sw $t2, 24($sp)
sw $t3, 28($sp)
addi $a0, $zero, 42
addi $a1, $zero, 43
addi $a2, $zero, 44
jal procB
lw $s1, 4($sp)
lw $t1, 20($sp)
lw $t3, 28($sp)
lw $a1, 44($sp)
addi $sp, $sp, 32 #
jr $ra
procB:
addi $sp, $sp, -16
sw $a0, 0($sp)
sw $a1, 4($sp)
sw $a2, 8($sp)
addi $s1, $zero, 45
4.Download and install the MARS simulator. Read this Google doc before you start. Create a new file and copy-paste the code below into the Edit window. Execute the program. The program should print "BOO5" at the bottom. Take a screenshot of your MARS screen. Annotate this image to show that one of the registers and one of the memory locations has the integer 5, and three registers and three memory locations have the ASCII codes for the three characters "B", "O", and "O". Your annotation can be as simple as a circle with the corresponding label (5, B, O, O). (15 points)

.data


str: .asciiz "BOO"
myint: .word 5

.text


li $v0, 4 # load immediate; 4 is the code for print_string
la $a0, str # the print_string syscall expects the string
# address as the argument; la is the instruction
# to load the address of the operand (str)
syscall # MARS will now invoke syscall-4.
# This should print the string on the bottom of the screen.
lb $t1, ($a0) # load the byte at address $a0 into register $t1
lb $t2, 1($a0) # load the byte at address $a0+1 into register $t2
lb $t3, 2($a0) # load the byte at address $a0+2 into register $t3
li $v0, 1 # syscall-1 corresponds to print_int
lw $a0, myint # Bring the value at label myint to register $a0.
# print_int expects the integer to be printed in $a0.
syscall # MARS will now invoke syscall-1


Достарыңызбен бөлісу:
1   2   3   4   5




©emirsaba.org 2024
әкімшілігінің қараңыз

    Басты бет