Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Computer Architecture- Describe the 3 instruction formats (R-type, I-type, and J

ID: 3587096 • Letter: C

Question

Computer Architecture-

Describe the 3 instruction formats (R-type, I-type, and J-type).

How does the MIPS support only beq and bne? Explain.

Describe the effects and consequences of using the jal instruction.

Describe the three general parts of any procedure (prologue, body, and epilogue).

Under what conditions is a procedure required to use the stack?

Under what conditions may a procedure use the $t0-$t9 registers? Explain

What is the nature of syscall?

Which is more efficient: arrays or pointers? Explain.

Will more powerful instructions result in more efficient programs? Explain.

Under what circumstances is it prudent to avoid writing code in assembly language?

Explanation / Answer

* Describe the 3 instruction formats (R-type, I-type, and J-type)

R-type instructions format:

OP rd, rs, rt

- Where OP is the mnemonic for the particular instruction.
- rs and rt are the source registers
- rd is the destination register

I-type instructions format:

OP rs, rt, IMM

- Where rt is the target register
- rs is the source register
- IMM is the immediate value.


J-type instructions format:

OP LABEL

- Where OP is the mnemonic for the particular jump instruction
- LABEL is the target address to jump to.

* How does the MIPS support only beq and bne?

The MIPS processor only supports two branch instructions beq and bne and the other branches are all pseudo-instructions.

but to simplify your life the assembler provides the following other branches:
blt $t0, $t1, Lab1 # Branch if $t0 < $t1
ble $t0, $t1, Lab2 # Branch if $t0 <= $t1
bgt $t0, $t1, Lab3 # Branch if $t0 > $t1
bge $t0, $t1, Lab4 # Branch if $t0 >= $t1

There are also immediate versions of these branches where the second source is a constant instead of a register


* Describe the effects and consequences of using the jal instruction

The register that is used for linkage is register $31, which is called $ra by the extended assembler.

It holds the return address for a subroutine. The instruction that puts the return address into $ra is the jal instruction.

So in order to understand how jal works the machine cycle review.

The MIPS endlessly cycles through three basic steps. Each cycle executes one machine instruction.

* Under what conditions is a procedure required to use the stack?

- A stack is a container of objects that are inserted and removed according to the last in first out principle.

- The conditions which the stacks operates are:
- push the item into the stack
- pop the item out of the stack.

A stack is a limited access data structure elements can be added and removed from the stack only at the top.

- Push adds an item to the top of the stack pop removes the item from the top.

- A helpful analogy is to think of a stack of books we can remove only the top book also we can add a new book on the top.

- A stack is a recursive data structure.

- A stack is either empty or it consistes of a top and the rest which is a stack.


* What is the nature of syscall

- The nature of the syscall is to proxies some problems that may effect the decisions to use in the situations.

- With lot of unwanted things by syscall. It can also proxies the most dynamic way of exploiting any shellcode type bug.

- The nature of the syscall also can wellworth implementation.


* Which is more efficient: arrays or pointers? Explain


The pointer is more effective because a pointer is a variable which contains the address in memory of another variable. We can have a pointer to any variable type.

But An array is a container object that holds a fixed number of values of a single type.

- Pointers and arrays are very closely linked in C.

- IF we think of array elements arranged in consecutive memory locations and We can have arrays of pointers since pointers are variables.


* Will more powerful instructions result in more efficient programs? Explain.

Yes if we have more powerful instructions then the result will be in more efficient

Because if we have more instruction in program we can easily identify the errors and we can easily the define it.

With help of the instructions in a program we can find the source register and destination register with all type of instruction keys.


* Under what circumstances is it prudent to avoid writing code in assembly language?

The recommendation to avoid in high level programming languages only applies to well high level languages.

So Assembler is a low level language and jumps are essential.


Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote