Bubble+Sort


 * Bubble sort algorithm**

The bubble sort program written in assembly language:

main: addi $11, $0, 0 addi $9, $11, 1 lw $11, ($11) addi $11, $11, -1 addi $14, $0, 1 ITER: lw $12, ($9) lw $13, 1($9) slt $15, $13, $12 beq $15, $0, NOSWAP sw $12, 1($9) sw $13, ($9) addi $14, $0, 0 NOSWAP: addi $9, $9, 1 addi $11, $11, -1 beq $11, $0, DONE_ITER beq $0, $0, ITER DONE_ITER: beq $14, $0, main lw $1, ($0) addi $2, $0, 1 SKIPIFEQ: lw $3, ($2) uart $3 addi $2, $2, 1 beq $1, $2, SKIPIFEQ loopy: beq $0, $0, loopy SKIPIFEQ:


 * MIF Program File**

The MIF program file after adding the NOPs for the pipeline is presented below:

Depth = 256; Width = 32; Address_radix = HEX; Data_radix = HEX;

Content Begin

00: 00000000 ; 01: 200b0000 ; 02: 00000000 ; 03: 00000000 ; 04: 00000000 ; 05: 00000000 ; 06: 21690001 ; 07: 8d6b0000 ; 08: 00000000 ; 09: 00000000 ; 0A: 00000000 ; 0B: 00000000 ; 0C: 216bffff ; 0D: 200e0001 ;

0E: 8d2c0000 ; 0F: 8d2d0001 ; 10: 00000000 ; 11: 00000000 ; 12: 00000000 ; 13: 00000000 ; 14: 01ac782a ; 15: 00000000 ; 16: 00000000 ; 17: 00000000 ; 18: 00000000 ; 19: 11e00006 ; 1A: 00000000 ; 1B: 00000000 ;

1C: ad2c0001 ; 1D: ad2d0000 ; 1E: 200e0000 ; 1F: 21290001 ; 20: 216bffff ; 21: 00000000 ; 22: 00000000 ; 23: 00000000 ; 24: 00000000 ; 25: 11600006 ; 26: 00000000 ; 27: 00000000 ; 28: 1000ffe6 ; 29: 00000000 ; 2A: 00000000 ;

2B: 11c0ffd6 ; 2C: 00000000 ; 2D: 00000000 ; 2E: 8c110000 ; 2F: 00000000 ; 30: 00000000 ; 31: 00000000 ; 32: 00000000 ; 33: 22310001 ; 34: 20020001 ; 35: 00000000 ; 36: 00000000 ; 37: 00000000 ; 38: 00000000 ; 39: 8c430000 ; 3A: 00000000 ; 3B: 00000000 ;

3C: 00000000 ; 3D: 00000000 ; 3E: 200b0000 ; 3F: 00000000 ; 40: 00000000 ; 41: 00000000 ; 42: 00000000 ; 43: 21690001 ; 44: 8d6b0000 ; 45: 00000000 ; 46: 00000000 ; 47: 00000000 ; 48: 00000000 ; 49: 216bffff ; 4A: 200e0001 ; 4B: 8d2c0000 ; 4C: 8d2d0001 ; 4D: 00000000 ;

4E: 00000000 ; 4F: 00000000 ; 50: 00000000 ; 51: 01ac782a ; 52: 00000000 ; 53: 00000000 ; 54: 00000000 ; 55: 00000000 ; 56: 11e00006 ; 57: 00000000 ; 58: 00000000 ; 59: ad2c0001 ; 5A: ad2d0000 ; 5B: 200e0000 ; 5C: 21290001 ; 5D: 216bffff ; 5E: 00000000 ; 5F: 00000000 ;

60: 00000000 ; 61: 00000000 ; 62: 11600006 ; 63: 00000000 ; 64: 00000000 ; 65: 1000ffe6 ; 66: 00000000 ; 67: 00000000 ; 68: 11c0ffd6 ; 69: 00000000 ; 6A: 00000000 ; 6B: 8c110000 ; 6C: 00000000 ; 6D: 00000000 ; 6E: 00000000 ; 6F: 00000000 ;

70: 22310001 ; 71: 20020001 ; 72: 00000000 ; 73: 00000000 ; 74: 00000000 ; 75: 00000000 ; 76: 8c430000 ; 77: 00000000 ; 78: 00000000 ; 79: 00000000 ; 7A: 00000000 ; 7B: a8600000 ; 7C: 20420001 ; 7D: 00000000 ; 7E: 00000000 ; 7F: 00000000 ;

80: 00000000 ; 81: 1222fff5 ; 82: 00000000 ; 83: 00000000 ; 84: 10000000 ; 85: 00000000 ; 86: 00000000 ;

End;