CA6.pdf - COMPUTER ARCHITECTURE LAB ASSIGNMENT AKSHAYA...

This preview shows page 1 - 3 out of 9 pages.

COMPUTER ARCHITECTURE LAB ASSIGNMENT AKSHAYA ARUNACHALAM 2019503003 1.Write an MIPS program to implement the bubble sort technique for sorting n numbers.
addi $t1,$t1,1 slt $t2,$s0,$t1 beq $t2,$zero,printtable li $v0,10 syscall buble_sort: add $t0,$zero,$zero loop1: addi $t0,$t0,1 bgt $t0,$a1,endloop1 add $t1,$a1,$zero loop2: bge $t0,$t1,loop1 addi $t1,$t1,-1 mul $t4,$t1,4 addi $t3,$t4,-4 add $t7,$t4,$a0 add $t8,$t3,$a0 lw $t5,0($t7) lw $t6,0($t8) bgt $t5,$t6,loop2 sw $t5,0($t8) sw $t6,0($t7) j loop2 endloop1: jr $ra

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture