Please find the answer below.
Please do comments in case of any issue. Also, don't forget to rate
the question. Thank You.
code.asm
.data
prompt1 : .asciiz "\nInput a character (lowercase letter or digit
0-9)"
error : .asciiz "\nNeed a lower case letter or digit. Try
again"
retry : .asciiz "\nDo you want to re-run the program(Y for
yes)?"
char :.asciiz "0123456789abcdefghijklmnopqrstuvwxyz"
prompt3 : .asciiz "\n The ordered string is : "
prompt4 : .asciiz "\n Program ternimated "
display : .space 40
.text
askAgain:
li $v0,4
la $a0,prompt1 #it will print prompt
syscall
li $v0, 12
syscall
bge $v0,'a',checkZ
j checkDigit
checkZ:
ble $v0,'z',lowercase
checkDigit:
bge $v0,'0',check9
j errorShow
check9:
ble $v0,'9',digit
j errorShow
lowercase:
digit:
move $t1,$v0 #move data to t0
li $v0,11
li $a0,'\n'
syscall
li $v0,4
la $a0,prompt3 #it will print prompt
syscall
la $t0,char
loop:
lb $t2,0($t0)
beqz $t2,end
li $v0,11
move $a0,$t2 #move character to print
syscall
beq $t2,$t1,end
add $t0,$t0,1
j loop
end:
li $v0,4
la $a0,retry #it will print prompt
syscall
li $v0, 12
syscall
beq $v0,'Y',askAgain
beq $v0,'y',askAgain
li $v0,4
la $a0,prompt4 #it will print prompt
syscall
li $v0,10
syscall
errorShow:
li $v0,4
la $a0,error #it will print prompt
syscall
j askAgain
output:
Write the following program in MIPS for use in the SPIM simulator. 1) Determine the number of occurrences of a specific character in a string. The character and the string are input by the user. The program should output Character <ch> occurs in string <string> <n> times.
Write a MIPS procedure using spim or MARS that implements the assignment A[k] = 28 for some specified value of k, where A is an integer array with elements indexed starting from 0. Your procedure should take as its arguments the base address of the array A, and the index k of the array element that is the target of the assignment. You must use the standard procedure conventions discussed in class. You do not need to write a main...
The following MIPS program is to be run on a MIPS pipeline processor of 5 stages (IF-ID-EX-MEM-WB). Work out and diagram the optimal pipeline schedule using full forwarding from EX or MEM stages to any other stage, Draw the pipeline execution diagram for this code and then compute the pipeline CPI: addi $t6, $t6, 10 sub $t5, $t6, $t4 srl $t5, $t5, 2 sw $t5, 20($t5) lw $t2, 0($t6) add $t7, $t2, $t3 beq $t5, $t7, End
In the SPIM simulator in MIPS assembly, write the itri routine in the itri.s skeleton to make it print an inverted triangle. The height of the triangle will be given in $a0, and will be between 1 and 40 inclusive. For the first three tests, the included test harness should print (spimsimulator(dot)sourceforge(dot)net) 1. (25 pts.) In the SPIM simulator in MIPS assembly, write the itri routine in the itri.s skeleton to make it print an inverted trian- gle. The height...
What are the important differences between basic MIPS processor architecture and the one with pipelined implementation?
Draw a MIPS processor that implements only three instructions: add, sub, beq only.
Suppose the times required by each of the functional units of a MIPS processor to do their work are: Instruction Memory: 400 ps Data Memory: 400 ps ALU: 300 ps Register file: 200 ps lgnoring the overhead introduced by the pipeline registers, what is the maximum speedup achieved by the pipelined processor with fetch, decode, execute, memory and write back stages vis-a-vis the single-cycle processor? Give your answer to two decimal places.
Please write a MIPS program to print the first thirty numbers in the Fibonacci sequence in which each number is the sum of the two preceding ones, starting from 0 and 1. Note that each number in the Fibonacci sequence should be calculated using MIPS instructions. After that please run your MIPS program using SPIM software to display the result in the output (console) window. Save your execution result in a log file of SPIM.What to submit: 1. Your MIPS...
Note: not just code for an adder! Verilog code for a 32 bit MIPS Processor unit. (NOT pipelined). Please include all code, a testbench code and the software used. (Please do not give code already online). Thank vou!
Calculate the minimum clock period for the One-bus organization of the MIPS processor. L.Mom 200ps AddM ux 70ps 20ps ALU 90ps Rags 9ops D-Mom 250ps Sien-ExtendShift Loft 2 15ps 10ps