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

Having trouble with this might have missed the class could anyone help? a) Write

ID: 3809937 • Letter: H

Question

Having trouble with this might have missed the class could anyone help?

a) Write an assembly language (Table attached) program for the MIPs to perform the following: Output a countdown starting from an input integer and terminating with an output of zero (e.g., for an input of 3, the output will be: 3 2 1 0) Place a pseudo code version of each instruction to the right of each assembly language instruction. Assume the MIPS maps input to RAM address 0 and output to RAM address 4. b) Give the machine language for the MIPS assembly language instruction shown below. Show the field values in base 10. (A MIPs machine language table is attached.) srl $s4, $s1, 22 c) In one sentence explain why are some address modes are faster than others? d) Give the address modes of the MIPS instructions whose mnemonics are: 1) add 2) addi 3) lw Notation: R stands for Register N is and integer, written in base 10 notation I is and integer, written in base 10 notation Subscripts: D, S, O1 and O2 are register numbers, either 0, 1, 2, or 3 Examples: lw R_2, 31//load reg. 2 with contents of memory (RAM) byte 31 add R_3, R_1, R_2//add contents of R_1 and R_2 place the result in R_3 beq R_1, 16//jump to instruction at byte 16 if contents of R_1 = = R_0 beq R_1, 0//jump to instruction at byte 0 if contents of R_1 = = R_0 src R_3, R_1, R_2//Shift R_3 right circular R_2 bits Examples: lw R_2, 31//R2 leftarrow 31 add R_3, R_1, R_2//R3 leftarrow R1 + R2 beq R_1, 16//if (R1 = = R0) PC leftarrow 16 beq R_1, 0//if (R_1 = = R0) PC leftarrow 0 src R_3, R_1, R_2//R3 leftarrow R3 right circular shifted R2 bits

Explanation / Answer

a)

Code :

    .data
prompt .asciiz "Enter an input "
spa   .asciiz " "

   .text
main:
   li $v0,4
   la $a0,prompt
   syscall

   li $v0,5
   syscall

   add $t1,$zero,$a0

LOOP:
   li $v0,0
   move $a0,$t0
   syscall

   li $v0,4
   la $a0,prompt
   syscall

   subi $t0,$t0,1

   bne $t0,$zero,LOOP

   li $v0,10
   syscall

c) Some addressing modes are faster than others because of the type of accessing it does.Some addressing modes access through memory, some through registers and some are directly immediate values. So, access memory takes more time therefore , the indirect address mode or memory addressing takes more time.In such manner,the time for every addressing mode depends on what area the data is accessed

d)

1)add - direct addressing - directly for the register file

2) addi - It works on immediate addressing - directly by the value provided to the instruction

3) lw - it works on both base addressing and PC relative addressing whatever is provided

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