Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Tentamen (uitwerkingen)

CEG 2136 DGD4 2.25 Exercises

Beoordeling
-
Verkocht
-
Pagina's
11
Cijfer
A+
Geüpload op
07-03-2026
Geschreven in
2025/2026

2.25 Exercises Appendix A describes the MIPS simulator, which is helpful for these exercises. Although the simulator accepts pseudoinstructions, try not to use pseudoinstructions for any exercises that ask you to produce MIPS code. Your goal should be to learn the real MIPS instruction set, and if you are asked to count instructions, your count should reflect the actual instructions that will be executed and not the pseudoinstructions. There are some cases where pseudoinstructions must be used (for example, the la instruction when an actual value is not known at assembly time). In many cases, they are quite convenient and result in more readable code (for example, the li and move instructions). If you choose to use pseudoinstructions for these reasons, please add a sentence or two to your solution stating which pseudoinstructions you have used and why. 2.1 [5] §2.2 For

Meer zien Lees minder
Instelling
Revision
Vak
Revision

Voorbeeld van de inhoud

2.25 Exercises
Appendix A describes the MIPS simulator, which is helpful for these
exercises. Although the simulator accepts pseudoinstructions, try not
to use pseudoinstructions for any exercises that ask you to produce
MIPS code. Your goal should be to learn the real MIPS instruction
set, and if you are asked to count instructions, your count should
reflect the actual instructions that will be executed and not the
pseudoinstructions.
There are some cases where pseudoinstructions must be used (for
example, the la instruction when an actual value is not known at
assembly time). In many cases, they are quite convenient and result
in more readable code (for example, the li and move instructions). If
you choose to use pseudoinstructions for these reasons, please add a
sentence or two to your solution stating which pseudoinstructions
you have used and why.

2.1 [5] <§2.2> For the following C statement, what is the
corresponding MIPS assembly code? Assume that the C
variables f, g, and h, have already been placed in registers $s0,
$s1, and $s2, respectively. Use a minimal number of MIPS
assembly instructions.
f = g + (h – 5);
2.2 [5] <§2.2> Write a single C statement that corresponds to the
two MIPS assembly instructions below.
add f, g, h
add f, i, f
2.3 [5] <§§2.2, 2.3> For the following C statement, write the
corresponding MIPS assembly code. Assume that the variables
f, g, h, i, and j are assigned to registers $s0, $s1, $s2, $s3, and
$s4, respectively. Assume that the base address of the arrays A
and B are in registers $s6 and $s7, respectively.
B[8] = A[i–j];
2.4 [5] <§§2.2, 2.3> For the MIPS assembly instructions above,
what is the corresponding C statement? Assume that the

, variables f, g, h, i, and j are assigned to registers $s0, $s1, $s2,
$s3, and $s4, respectively. Assume that the base address of the
arrays A and B are in registers $s6 and $s7, respectively.




2.5 [5] <§2.3> Show how the value 0xabcdef12 would be
arranged in memory of a li le-endian and a big-endian
machine. Assume the data are stored starting at address 0 and
that the word size is 4 bytes.
2.6 [5] <§2.4> Translate 0xabcdef12 into decimal.
2.7 [5] <§§2.2, 2.3> Translate the following C code to MIPS.
Assume that the variables f, g, h, i, and j are assigned to
registers $s0, $s1, $s2, $s3, and $s4, respectively. Assume that
the base address of the arrays A and B are in registers $s6 and
$s7, respectively. Assume that the elements of the arrays A and
B are 8-byte words:
B[8] = A[i] + A[j];
2.8 [10] <§§2.2, 2.3> Translate the following MIPS code to C.
Assume that the variables f, g, h, i, and j are assigned to
registers $s0, $s1, $s2, $s3, and $s4, respectively. Assume that
the base address of the arrays A and B are in registers $s6 and
$s7, respectively.
addi $t0, $s6, 4
add $t1, $s6, $0
sw $t1, 0($t0)

Geschreven voor

Instelling
Revision
Vak
Revision

Documentinformatie

Geüpload op
7 maart 2026
Aantal pagina's
11
Geschreven in
2025/2026
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

€9,78
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
Abbyy01 Exam Questions
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
96
Lid sinds
4 jaar
Aantal volgers
33
Documenten
1337
Laatst verkocht
3 dagen geleden

3,5

13 beoordelingen

5
5
4
2
3
3
2
1
1
2

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen