Compare commits
10 Commits
1e2af48a8c
...
31e742c431
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
31e742c431
|
||
|
|
521cf0a826
|
||
|
|
94d62c5b86
|
||
|
|
76fed1406a
|
||
|
|
0c92cfff3d
|
||
|
|
b21c6b34ae
|
||
|
|
835e7b2b5f
|
||
|
|
de2e42bef3
|
||
|
|
234a19037f
|
||
|
|
6fc70b789d
|
213
22display_num_in_mem_empty.asm
Normal file
213
22display_num_in_mem_empty.asm
Normal file
@@ -0,0 +1,213 @@
|
||||
.text
|
||||
#initialize $sp
|
||||
lui $sp, 0x4000
|
||||
addi $sp, $sp, 0x7ff
|
||||
|
||||
# load digit to mem
|
||||
lui $s0, 0x4000
|
||||
addi $s0, $s0, 0x20
|
||||
#0
|
||||
addi $s1, $zero, 0x3f
|
||||
sw $s1, 0($s0)
|
||||
#1
|
||||
addi $s1, $zero, 0x6
|
||||
sw $s1, 4($s0)
|
||||
#2
|
||||
addi $s1, $zero, 0x5b
|
||||
sw $s1, 8($s0)
|
||||
#3
|
||||
addi $s1, $zero, 0x4f
|
||||
sw $s1, 12($s0)
|
||||
#4
|
||||
addi $s1, $zero, 0x66
|
||||
sw $s1, 16($s0)
|
||||
#5
|
||||
addi $s1, $zero, 0x6d
|
||||
sw $s1, 20($s0)
|
||||
#6
|
||||
addi $s1, $zero, 0x7d
|
||||
sw $s1, 24($s0)
|
||||
#7
|
||||
addi $s1, $zero, 0x7
|
||||
sw $s1, 28($s0)
|
||||
#8
|
||||
addi $s1, $zero, 0x7f
|
||||
sw $s1, 32($s0)
|
||||
#9
|
||||
addi $s1, $zero, 0x6f
|
||||
sw $s1, 36($s0)
|
||||
#A
|
||||
addi $s1, $zero, 0x77
|
||||
sw $s1, 40($s0)
|
||||
#B
|
||||
addi $s1, $zero, 0x7c
|
||||
sw $s1, 44($s0)
|
||||
#C
|
||||
addi $s1, $zero, 0x58
|
||||
sw $s1, 48($s0)
|
||||
#D
|
||||
addi $s1, $zero, 0x5e
|
||||
sw $s1, 52($s0)
|
||||
#E
|
||||
addi $s1, $zero, 0x79
|
||||
sw $s1, 56($s0)
|
||||
#F
|
||||
addi $s1, $zero, 0x71
|
||||
sw $s1, 60($s0)
|
||||
|
||||
# save the numbers to be sorted
|
||||
lui $s0, 0x4000
|
||||
addi $s0, $s0, 0x60
|
||||
|
||||
addi $s1, $zero, 0x4b8d
|
||||
sw $s1, 0($s0)
|
||||
addi $s1, $zero, 0x2307
|
||||
sw $s1, 4($s0)
|
||||
addi $s1, $zero, 0xfae0
|
||||
sw $s1, 8($s0)
|
||||
addi $s1, $zero, 0x7815
|
||||
sw $s1, 12($s0)
|
||||
addi $s1, $zero, 0xc105
|
||||
sw $s1, 16($s0)
|
||||
addi $s1, $zero, 0x84f0
|
||||
sw $s1, 20($s0)
|
||||
addi $s1, $zero, 0xdb6
|
||||
sw $s1, 24($s0)
|
||||
addi $s1, $zero, 0xf21d
|
||||
sw $s1, 28($s0)
|
||||
addi $s1, $zero, 0xe97a
|
||||
sw $s1, 32($s0)
|
||||
addi $s1, $zero, 0xa3b6
|
||||
sw $s1, 36($s0)
|
||||
addi $s1, $zero, 0x8466
|
||||
sw $s1, 40($s0)
|
||||
addi $s1, $zero, 0x3a25
|
||||
sw $s1, 44($s0)
|
||||
addi $s1, $zero, 0x5df
|
||||
sw $s1, 48($s0)
|
||||
addi $s1, $zero, 0xd2de
|
||||
sw $s1, 52($s0)
|
||||
addi $s1, $zero, 0xba7a
|
||||
sw $s1, 56($s0)
|
||||
addi $s1, $zero, 0x7809
|
||||
sw $s1, 60($s0)
|
||||
addi $s1, $zero, 0xf6a8
|
||||
sw $s1, 64($s0)
|
||||
addi $s1, $zero, 0x361d
|
||||
sw $s1, 68($s0)
|
||||
addi $s1, $zero, 0x3adb
|
||||
sw $s1, 72($s0)
|
||||
addi $s1, $zero, 0x969a
|
||||
sw $s1, 76($s0)
|
||||
|
||||
main:
|
||||
addi $a0, $zero, 20
|
||||
# jal insertion_sort
|
||||
|
||||
lui $s0, 0x4000
|
||||
# s1 = 0x40000010
|
||||
addi $s1, $s0, 0x10
|
||||
# s0 = 0x40000060
|
||||
addi $s0, $s0, 0x60
|
||||
display_numbers_loop:
|
||||
addi $s2, $zero, 0
|
||||
addi $s3, $zero, 20
|
||||
display_single_number:
|
||||
sll $t0, $s2, 2
|
||||
add $t0, $s0, $t0
|
||||
lw $a0, 0($t0)
|
||||
addi $a1, $s1, 0
|
||||
jal display_number
|
||||
|
||||
addi $s2, $s2, 1
|
||||
sub $t0, $s3, $s2
|
||||
bgtz $t0, display_single_number
|
||||
|
||||
|
||||
jal display_empty
|
||||
j display_numbers_loop
|
||||
|
||||
# ------------------------------------------------------
|
||||
|
||||
# a0 is the number to be displayed, a1 is the bcd control addr
|
||||
display_number:
|
||||
addi $sp, $sp, -32
|
||||
sw $ra, 4($sp)
|
||||
sw $s0, 8($sp)
|
||||
sw $s1, 12($sp)
|
||||
sw $s2, 16($sp)
|
||||
sw $s3, 20($sp)
|
||||
sw $s4, 24($sp)
|
||||
sw $s5, 28($sp)
|
||||
sw $s6, 32($sp)
|
||||
|
||||
# s0 is the number to be displayed
|
||||
addi $s0, $a0, 0
|
||||
|
||||
# s1 is the bcd_control addr
|
||||
addi $s1, $a1, 0
|
||||
|
||||
# s2 is the base addr for display digit
|
||||
lui $s2, 0x4000
|
||||
addi $s2, $s2, 0x20
|
||||
|
||||
# s3 is the counter for a complete scan of 4 digit
|
||||
# addi $s3, $zero, 0x17c4
|
||||
addi $s3, $zero, 0xbe2
|
||||
all_digit_scan_loop:
|
||||
# s4 is the num being shifted gradually
|
||||
addi $s4, $s0, 0
|
||||
# s6 is the enable digit
|
||||
addi $s6, $zero, 0x100
|
||||
|
||||
addi $s5, $zero, 4
|
||||
single_digit_loop:
|
||||
# get a digit
|
||||
andi $t0, $s4, 0xf
|
||||
# digit * 4 is the memory shift
|
||||
sll $t0, $t0, 2
|
||||
add $t0, $s2, $t0
|
||||
lw $t0, 0($t0)
|
||||
or $t0, $t0, $s6
|
||||
sw $t0, 0($s1)
|
||||
|
||||
srl $s4, $s4, 4
|
||||
sll $s6, $s6, 1
|
||||
|
||||
addi $t0, $zero, 0x400
|
||||
wait_time_loop:
|
||||
addi $t0, $t0, -1
|
||||
bgtz $t0, wait_time_loop
|
||||
|
||||
addi $s5, $s5, -1
|
||||
bgtz $s5, single_digit_loop
|
||||
# end of single digit loop
|
||||
|
||||
# ** depends on the clock **
|
||||
# four digit, 328.68us.
|
||||
# 1s / 328.68us = 3042 = (be2)hex
|
||||
|
||||
addi $s3, $s3, -1
|
||||
bgtz $s3, all_digit_scan_loop
|
||||
|
||||
lw $ra, 4($sp)
|
||||
lw $s0, 8($sp)
|
||||
lw $s1, 12($sp)
|
||||
lw $s2, 16($sp)
|
||||
lw $s3, 20($sp)
|
||||
lw $s4, 24($sp)
|
||||
lw $s5, 28($sp)
|
||||
lw $s6, 32($sp)
|
||||
addi $sp, $sp, 32
|
||||
jr $ra
|
||||
|
||||
display_empty:
|
||||
lui $t0, 0x4000
|
||||
addi $t0, $t0, 0x10
|
||||
sw $zero, 0($t0)
|
||||
|
||||
lui $t0, 0x100
|
||||
display_empty_wait_loop:
|
||||
addi $t0, $t0, -1
|
||||
bgtz $t0, display_empty_wait_loop
|
||||
jr $ra
|
||||
165
22display_num_in_mem_empty.txt
Normal file
165
22display_num_in_mem_empty.txt
Normal file
@@ -0,0 +1,165 @@
|
||||
20'd0: instruction <= 32'h3c1d4000;
|
||||
20'd1: instruction <= 32'h23bd07ff;
|
||||
20'd2: instruction <= 32'h3c104000;
|
||||
20'd3: instruction <= 32'h22100020;
|
||||
20'd4: instruction <= 32'h2011003f;
|
||||
20'd5: instruction <= 32'hae110000;
|
||||
20'd6: instruction <= 32'h20110006;
|
||||
20'd7: instruction <= 32'hae110004;
|
||||
20'd8: instruction <= 32'h2011005b;
|
||||
20'd9: instruction <= 32'hae110008;
|
||||
20'd10: instruction <= 32'h2011004f;
|
||||
20'd11: instruction <= 32'hae11000c;
|
||||
20'd12: instruction <= 32'h20110066;
|
||||
20'd13: instruction <= 32'hae110010;
|
||||
20'd14: instruction <= 32'h2011006d;
|
||||
20'd15: instruction <= 32'hae110014;
|
||||
20'd16: instruction <= 32'h2011007d;
|
||||
20'd17: instruction <= 32'hae110018;
|
||||
20'd18: instruction <= 32'h20110007;
|
||||
20'd19: instruction <= 32'hae11001c;
|
||||
20'd20: instruction <= 32'h2011007f;
|
||||
20'd21: instruction <= 32'hae110020;
|
||||
20'd22: instruction <= 32'h2011006f;
|
||||
20'd23: instruction <= 32'hae110024;
|
||||
20'd24: instruction <= 32'h20110077;
|
||||
20'd25: instruction <= 32'hae110028;
|
||||
20'd26: instruction <= 32'h2011007c;
|
||||
20'd27: instruction <= 32'hae11002c;
|
||||
20'd28: instruction <= 32'h20110058;
|
||||
20'd29: instruction <= 32'hae110030;
|
||||
20'd30: instruction <= 32'h2011005e;
|
||||
20'd31: instruction <= 32'hae110034;
|
||||
20'd32: instruction <= 32'h20110079;
|
||||
20'd33: instruction <= 32'hae110038;
|
||||
20'd34: instruction <= 32'h20110071;
|
||||
20'd35: instruction <= 32'hae11003c;
|
||||
20'd36: instruction <= 32'h3c104000;
|
||||
20'd37: instruction <= 32'h22100060;
|
||||
20'd38: instruction <= 32'h20114b8d;
|
||||
20'd39: instruction <= 32'hae110000;
|
||||
20'd40: instruction <= 32'h20112307;
|
||||
20'd41: instruction <= 32'hae110004;
|
||||
20'd42: instruction <= 32'h3c010000;
|
||||
20'd43: instruction <= 32'h3421fae0;
|
||||
20'd44: instruction <= 32'h00018820;
|
||||
20'd45: instruction <= 32'hae110008;
|
||||
20'd46: instruction <= 32'h20117815;
|
||||
20'd47: instruction <= 32'hae11000c;
|
||||
20'd48: instruction <= 32'h3c010000;
|
||||
20'd49: instruction <= 32'h3421c105;
|
||||
20'd50: instruction <= 32'h00018820;
|
||||
20'd51: instruction <= 32'hae110010;
|
||||
20'd52: instruction <= 32'h3c010000;
|
||||
20'd53: instruction <= 32'h342184f0;
|
||||
20'd54: instruction <= 32'h00018820;
|
||||
20'd55: instruction <= 32'hae110014;
|
||||
20'd56: instruction <= 32'h20110db6;
|
||||
20'd57: instruction <= 32'hae110018;
|
||||
20'd58: instruction <= 32'h3c010000;
|
||||
20'd59: instruction <= 32'h3421f21d;
|
||||
20'd60: instruction <= 32'h00018820;
|
||||
20'd61: instruction <= 32'hae11001c;
|
||||
20'd62: instruction <= 32'h3c010000;
|
||||
20'd63: instruction <= 32'h3421e97a;
|
||||
20'd64: instruction <= 32'h00018820;
|
||||
20'd65: instruction <= 32'hae110020;
|
||||
20'd66: instruction <= 32'h3c010000;
|
||||
20'd67: instruction <= 32'h3421a3b6;
|
||||
20'd68: instruction <= 32'h00018820;
|
||||
20'd69: instruction <= 32'hae110024;
|
||||
20'd70: instruction <= 32'h3c010000;
|
||||
20'd71: instruction <= 32'h34218466;
|
||||
20'd72: instruction <= 32'h00018820;
|
||||
20'd73: instruction <= 32'hae110028;
|
||||
20'd74: instruction <= 32'h20113a25;
|
||||
20'd75: instruction <= 32'hae11002c;
|
||||
20'd76: instruction <= 32'h201105df;
|
||||
20'd77: instruction <= 32'hae110030;
|
||||
20'd78: instruction <= 32'h3c010000;
|
||||
20'd79: instruction <= 32'h3421d2de;
|
||||
20'd80: instruction <= 32'h00018820;
|
||||
20'd81: instruction <= 32'hae110034;
|
||||
20'd82: instruction <= 32'h3c010000;
|
||||
20'd83: instruction <= 32'h3421ba7a;
|
||||
20'd84: instruction <= 32'h00018820;
|
||||
20'd85: instruction <= 32'hae110038;
|
||||
20'd86: instruction <= 32'h20117809;
|
||||
20'd87: instruction <= 32'hae11003c;
|
||||
20'd88: instruction <= 32'h3c010000;
|
||||
20'd89: instruction <= 32'h3421f6a8;
|
||||
20'd90: instruction <= 32'h00018820;
|
||||
20'd91: instruction <= 32'hae110040;
|
||||
20'd92: instruction <= 32'h2011361d;
|
||||
20'd93: instruction <= 32'hae110044;
|
||||
20'd94: instruction <= 32'h20113adb;
|
||||
20'd95: instruction <= 32'hae110048;
|
||||
20'd96: instruction <= 32'h3c010000;
|
||||
20'd97: instruction <= 32'h3421969a;
|
||||
20'd98: instruction <= 32'h00018820;
|
||||
20'd99: instruction <= 32'hae11004c;
|
||||
20'd100: instruction <= 32'h20040014;
|
||||
20'd101: instruction <= 32'h3c104000;
|
||||
20'd102: instruction <= 32'h22110010;
|
||||
20'd103: instruction <= 32'h22100060;
|
||||
20'd104: instruction <= 32'h20120000;
|
||||
20'd105: instruction <= 32'h20130014;
|
||||
20'd106: instruction <= 32'h00124080;
|
||||
20'd107: instruction <= 32'h02084020;
|
||||
20'd108: instruction <= 32'h8d040000;
|
||||
20'd109: instruction <= 32'h22250000;
|
||||
20'd110: instruction <= 32'h0c000074;
|
||||
20'd111: instruction <= 32'h22520001;
|
||||
20'd112: instruction <= 32'h02724022;
|
||||
20'd113: instruction <= 32'h1d00fff8;
|
||||
20'd114: instruction <= 32'h0c00009e;
|
||||
20'd115: instruction <= 32'h08000068;
|
||||
20'd116: instruction <= 32'h23bdffe0;
|
||||
20'd117: instruction <= 32'hafbf0004;
|
||||
20'd118: instruction <= 32'hafb00008;
|
||||
20'd119: instruction <= 32'hafb1000c;
|
||||
20'd120: instruction <= 32'hafb20010;
|
||||
20'd121: instruction <= 32'hafb30014;
|
||||
20'd122: instruction <= 32'hafb40018;
|
||||
20'd123: instruction <= 32'hafb5001c;
|
||||
20'd124: instruction <= 32'hafb60020;
|
||||
20'd125: instruction <= 32'h20900000;
|
||||
20'd126: instruction <= 32'h20b10000;
|
||||
20'd127: instruction <= 32'h3c124000;
|
||||
20'd128: instruction <= 32'h22520020;
|
||||
20'd129: instruction <= 32'h20130be2;
|
||||
20'd130: instruction <= 32'h22140000;
|
||||
20'd131: instruction <= 32'h20160100;
|
||||
20'd132: instruction <= 32'h20150004;
|
||||
20'd133: instruction <= 32'h3288000f;
|
||||
20'd134: instruction <= 32'h00084080;
|
||||
20'd135: instruction <= 32'h02484020;
|
||||
20'd136: instruction <= 32'h8d080000;
|
||||
20'd137: instruction <= 32'h01164025;
|
||||
20'd138: instruction <= 32'hae280000;
|
||||
20'd139: instruction <= 32'h0014a102;
|
||||
20'd140: instruction <= 32'h0016b040;
|
||||
20'd141: instruction <= 32'h20080400;
|
||||
20'd142: instruction <= 32'h2108ffff;
|
||||
20'd143: instruction <= 32'h1d00fffe;
|
||||
20'd144: instruction <= 32'h22b5ffff;
|
||||
20'd145: instruction <= 32'h1ea0fff3;
|
||||
20'd146: instruction <= 32'h2273ffff;
|
||||
20'd147: instruction <= 32'h1e60ffee;
|
||||
20'd148: instruction <= 32'h8fbf0004;
|
||||
20'd149: instruction <= 32'h8fb00008;
|
||||
20'd150: instruction <= 32'h8fb1000c;
|
||||
20'd151: instruction <= 32'h8fb20010;
|
||||
20'd152: instruction <= 32'h8fb30014;
|
||||
20'd153: instruction <= 32'h8fb40018;
|
||||
20'd154: instruction <= 32'h8fb5001c;
|
||||
20'd155: instruction <= 32'h8fb60020;
|
||||
20'd156: instruction <= 32'h23bd0020;
|
||||
20'd157: instruction <= 32'h03e00008;
|
||||
20'd158: instruction <= 32'h3c084000;
|
||||
20'd159: instruction <= 32'h21080010;
|
||||
20'd160: instruction <= 32'had000000;
|
||||
20'd161: instruction <= 32'h3c080100;
|
||||
20'd162: instruction <= 32'h2108ffff;
|
||||
20'd163: instruction <= 32'h1d00fffe;
|
||||
20'd164: instruction <= 32'h03e00008;
|
||||
165
22display_num_in_mem_empty_mars.txt
Normal file
165
22display_num_in_mem_empty_mars.txt
Normal file
@@ -0,0 +1,165 @@
|
||||
3c1d4000
|
||||
23bd07ff
|
||||
3c104000
|
||||
22100020
|
||||
2011003f
|
||||
ae110000
|
||||
20110006
|
||||
ae110004
|
||||
2011005b
|
||||
ae110008
|
||||
2011004f
|
||||
ae11000c
|
||||
20110066
|
||||
ae110010
|
||||
2011006d
|
||||
ae110014
|
||||
2011007d
|
||||
ae110018
|
||||
20110007
|
||||
ae11001c
|
||||
2011007f
|
||||
ae110020
|
||||
2011006f
|
||||
ae110024
|
||||
20110077
|
||||
ae110028
|
||||
2011007c
|
||||
ae11002c
|
||||
20110058
|
||||
ae110030
|
||||
2011005e
|
||||
ae110034
|
||||
20110079
|
||||
ae110038
|
||||
20110071
|
||||
ae11003c
|
||||
3c104000
|
||||
22100060
|
||||
20114b8d
|
||||
ae110000
|
||||
20112307
|
||||
ae110004
|
||||
3c010000
|
||||
3421fae0
|
||||
00018820
|
||||
ae110008
|
||||
20117815
|
||||
ae11000c
|
||||
3c010000
|
||||
3421c105
|
||||
00018820
|
||||
ae110010
|
||||
3c010000
|
||||
342184f0
|
||||
00018820
|
||||
ae110014
|
||||
20110db6
|
||||
ae110018
|
||||
3c010000
|
||||
3421f21d
|
||||
00018820
|
||||
ae11001c
|
||||
3c010000
|
||||
3421e97a
|
||||
00018820
|
||||
ae110020
|
||||
3c010000
|
||||
3421a3b6
|
||||
00018820
|
||||
ae110024
|
||||
3c010000
|
||||
34218466
|
||||
00018820
|
||||
ae110028
|
||||
20113a25
|
||||
ae11002c
|
||||
201105df
|
||||
ae110030
|
||||
3c010000
|
||||
3421d2de
|
||||
00018820
|
||||
ae110034
|
||||
3c010000
|
||||
3421ba7a
|
||||
00018820
|
||||
ae110038
|
||||
20117809
|
||||
ae11003c
|
||||
3c010000
|
||||
3421f6a8
|
||||
00018820
|
||||
ae110040
|
||||
2011361d
|
||||
ae110044
|
||||
20113adb
|
||||
ae110048
|
||||
3c010000
|
||||
3421969a
|
||||
00018820
|
||||
ae11004c
|
||||
20040014
|
||||
3c104000
|
||||
22110010
|
||||
22100060
|
||||
20120000
|
||||
20130014
|
||||
00124080
|
||||
02084020
|
||||
8d040000
|
||||
22250000
|
||||
0c000074
|
||||
22520001
|
||||
02724022
|
||||
1d00fff8
|
||||
0c00009e
|
||||
08000068
|
||||
23bdffe0
|
||||
afbf0004
|
||||
afb00008
|
||||
afb1000c
|
||||
afb20010
|
||||
afb30014
|
||||
afb40018
|
||||
afb5001c
|
||||
afb60020
|
||||
20900000
|
||||
20b10000
|
||||
3c124000
|
||||
22520020
|
||||
20130be2
|
||||
22140000
|
||||
20160100
|
||||
20150004
|
||||
3288000f
|
||||
00084080
|
||||
02484020
|
||||
8d080000
|
||||
01164025
|
||||
ae280000
|
||||
0014a102
|
||||
0016b040
|
||||
20080400
|
||||
2108ffff
|
||||
1d00fffe
|
||||
22b5ffff
|
||||
1ea0fff3
|
||||
2273ffff
|
||||
1e60ffee
|
||||
8fbf0004
|
||||
8fb00008
|
||||
8fb1000c
|
||||
8fb20010
|
||||
8fb30014
|
||||
8fb40018
|
||||
8fb5001c
|
||||
8fb60020
|
||||
23bd0020
|
||||
03e00008
|
||||
3c084000
|
||||
21080010
|
||||
ad000000
|
||||
3c080100
|
||||
2108ffff
|
||||
1d00fffe
|
||||
03e00008
|
||||
361
23sort_nums.asm
Normal file
361
23sort_nums.asm
Normal file
@@ -0,0 +1,361 @@
|
||||
.text
|
||||
#initialize $sp
|
||||
lui $sp, 0x4000
|
||||
addi $sp, $sp, 0x7ff
|
||||
|
||||
# load digit to mem
|
||||
lui $s0, 0x4000
|
||||
addi $s0, $s0, 0x20
|
||||
#0
|
||||
addi $s1, $zero, 0x3f
|
||||
sw $s1, 0($s0)
|
||||
#1
|
||||
addi $s1, $zero, 0x6
|
||||
sw $s1, 4($s0)
|
||||
#2
|
||||
addi $s1, $zero, 0x5b
|
||||
sw $s1, 8($s0)
|
||||
#3
|
||||
addi $s1, $zero, 0x4f
|
||||
sw $s1, 12($s0)
|
||||
#4
|
||||
addi $s1, $zero, 0x66
|
||||
sw $s1, 16($s0)
|
||||
#5
|
||||
addi $s1, $zero, 0x6d
|
||||
sw $s1, 20($s0)
|
||||
#6
|
||||
addi $s1, $zero, 0x7d
|
||||
sw $s1, 24($s0)
|
||||
#7
|
||||
addi $s1, $zero, 0x7
|
||||
sw $s1, 28($s0)
|
||||
#8
|
||||
addi $s1, $zero, 0x7f
|
||||
sw $s1, 32($s0)
|
||||
#9
|
||||
addi $s1, $zero, 0x6f
|
||||
sw $s1, 36($s0)
|
||||
#A
|
||||
addi $s1, $zero, 0x77
|
||||
sw $s1, 40($s0)
|
||||
#B
|
||||
addi $s1, $zero, 0x7c
|
||||
sw $s1, 44($s0)
|
||||
#C
|
||||
addi $s1, $zero, 0x58
|
||||
sw $s1, 48($s0)
|
||||
#D
|
||||
addi $s1, $zero, 0x5e
|
||||
sw $s1, 52($s0)
|
||||
#E
|
||||
addi $s1, $zero, 0x79
|
||||
sw $s1, 56($s0)
|
||||
#F
|
||||
addi $s1, $zero, 0x71
|
||||
sw $s1, 60($s0)
|
||||
|
||||
# save the numbers to be sorted
|
||||
lui $s0, 0x4000
|
||||
addi $s0, $s0, 0x60
|
||||
|
||||
addi $s1, $zero, 0x4b8d
|
||||
sw $s1, 0($s0)
|
||||
addi $s1, $zero, 0x2307
|
||||
sw $s1, 4($s0)
|
||||
addi $s1, $zero, 0xfae0
|
||||
sw $s1, 8($s0)
|
||||
addi $s1, $zero, 0x7815
|
||||
sw $s1, 12($s0)
|
||||
addi $s1, $zero, 0xc105
|
||||
sw $s1, 16($s0)
|
||||
addi $s1, $zero, 0x84f0
|
||||
sw $s1, 20($s0)
|
||||
addi $s1, $zero, 0xdb6
|
||||
sw $s1, 24($s0)
|
||||
addi $s1, $zero, 0xf21d
|
||||
sw $s1, 28($s0)
|
||||
addi $s1, $zero, 0xe97a
|
||||
sw $s1, 32($s0)
|
||||
addi $s1, $zero, 0xa3b6
|
||||
sw $s1, 36($s0)
|
||||
addi $s1, $zero, 0x8466
|
||||
sw $s1, 40($s0)
|
||||
addi $s1, $zero, 0x3a25
|
||||
sw $s1, 44($s0)
|
||||
addi $s1, $zero, 0x5df
|
||||
sw $s1, 48($s0)
|
||||
addi $s1, $zero, 0xd2de
|
||||
sw $s1, 52($s0)
|
||||
addi $s1, $zero, 0xba7a
|
||||
sw $s1, 56($s0)
|
||||
addi $s1, $zero, 0x7809
|
||||
sw $s1, 60($s0)
|
||||
addi $s1, $zero, 0xf6a8
|
||||
sw $s1, 64($s0)
|
||||
addi $s1, $zero, 0x361d
|
||||
sw $s1, 68($s0)
|
||||
addi $s1, $zero, 0x3adb
|
||||
sw $s1, 72($s0)
|
||||
addi $s1, $zero, 0x969a
|
||||
sw $s1, 76($s0)
|
||||
|
||||
main:
|
||||
jal disp_num_in_mem
|
||||
addi $a0, $zero, 20
|
||||
jal insertion_sort
|
||||
end:
|
||||
jal disp_num_in_mem
|
||||
j end
|
||||
|
||||
disp_num_in_mem:
|
||||
addi $sp, $sp, -20
|
||||
sw $ra, 4($sp)
|
||||
sw $s0, 8($sp)
|
||||
sw $s1, 12($sp)
|
||||
sw $s2, 16($sp)
|
||||
sw $s3, 20($sp)
|
||||
|
||||
lui $s0, 0x4000
|
||||
# s1 = 0x40000010
|
||||
addi $s1, $s0, 0x10
|
||||
# s0 = 0x40000060
|
||||
addi $s0, $s0, 0x60
|
||||
addi $s2, $zero, 0
|
||||
addi $s3, $zero, 20
|
||||
display_single_number:
|
||||
sll $t0, $s2, 2
|
||||
add $t0, $s0, $t0
|
||||
lw $a0, 0($t0)
|
||||
addi $a1, $s1, 0
|
||||
jal display_number
|
||||
|
||||
addi $s2, $s2, 1
|
||||
sub $t0, $s3, $s2
|
||||
bgtz $t0, display_single_number
|
||||
|
||||
|
||||
jal display_empty
|
||||
|
||||
lw $ra, 4($sp)
|
||||
lw $s0, 8($sp)
|
||||
lw $s1, 12($sp)
|
||||
lw $s2, 16($sp)
|
||||
lw $s3, 20($sp)
|
||||
addi $sp, $sp, 20
|
||||
jr $ra
|
||||
|
||||
# ------------------------------------------------------
|
||||
|
||||
# a0 is the number to be displayed, a1 is the bcd control addr
|
||||
display_number:
|
||||
addi $sp, $sp, -32
|
||||
sw $ra, 4($sp)
|
||||
sw $s0, 8($sp)
|
||||
sw $s1, 12($sp)
|
||||
sw $s2, 16($sp)
|
||||
sw $s3, 20($sp)
|
||||
sw $s4, 24($sp)
|
||||
sw $s5, 28($sp)
|
||||
sw $s6, 32($sp)
|
||||
|
||||
# s0 is the number to be displayed
|
||||
addi $s0, $a0, 0
|
||||
|
||||
# s1 is the bcd_control addr
|
||||
addi $s1, $a1, 0
|
||||
|
||||
# s2 is the base addr for display digit
|
||||
lui $s2, 0x4000
|
||||
addi $s2, $s2, 0x20
|
||||
|
||||
# s3 is the counter for a complete scan of 4 digit
|
||||
# addi $s3, $zero, 0x17c4
|
||||
addi $s3, $zero, 0xbe2
|
||||
all_digit_scan_loop:
|
||||
# s4 is the num being shifted gradually
|
||||
addi $s4, $s0, 0
|
||||
# s6 is the enable digit
|
||||
addi $s6, $zero, 0x100
|
||||
|
||||
addi $s5, $zero, 4
|
||||
single_digit_loop:
|
||||
# get a digit
|
||||
andi $t0, $s4, 0xf
|
||||
# digit * 4 is the memory shift
|
||||
sll $t0, $t0, 2
|
||||
add $t0, $s2, $t0
|
||||
lw $t0, 0($t0)
|
||||
or $t0, $t0, $s6
|
||||
sw $t0, 0($s1)
|
||||
|
||||
srl $s4, $s4, 4
|
||||
sll $s6, $s6, 1
|
||||
|
||||
addi $t0, $zero, 0x400
|
||||
wait_time_loop:
|
||||
addi $t0, $t0, -1
|
||||
bgtz $t0, wait_time_loop
|
||||
|
||||
addi $s5, $s5, -1
|
||||
bgtz $s5, single_digit_loop
|
||||
# end of single digit loop
|
||||
|
||||
# ** depends on the clock **
|
||||
# four digit, 328.68us.
|
||||
# 1s / 328.68us = 3042 = (be2)hex
|
||||
|
||||
addi $s3, $s3, -1
|
||||
bgtz $s3, all_digit_scan_loop
|
||||
|
||||
lw $ra, 4($sp)
|
||||
lw $s0, 8($sp)
|
||||
lw $s1, 12($sp)
|
||||
lw $s2, 16($sp)
|
||||
lw $s3, 20($sp)
|
||||
lw $s4, 24($sp)
|
||||
lw $s5, 28($sp)
|
||||
lw $s6, 32($sp)
|
||||
addi $sp, $sp, 32
|
||||
jr $ra
|
||||
|
||||
display_empty:
|
||||
lui $t0, 0x4000
|
||||
addi $t0, $t0, 0x10
|
||||
sw $zero, 0($t0)
|
||||
|
||||
lui $t0, 0x100
|
||||
display_empty_wait_loop:
|
||||
addi $t0, $t0, -1
|
||||
bgtz $t0, display_empty_wait_loop
|
||||
jr $ra
|
||||
|
||||
# a0 is the total number of numbers needed to be sorted
|
||||
insertion_sort:
|
||||
addi $sp, $sp, -12
|
||||
sw $ra, 4($sp)
|
||||
sw $s0, 8($sp)
|
||||
sw $s1, 12($sp)
|
||||
|
||||
# la $t0, num_N
|
||||
# lw $s0, 0($t0) # n in s0
|
||||
addi $s0, $a0, 0
|
||||
|
||||
# li $s1, 1 # i in s1
|
||||
addi $s1, $zero, 1
|
||||
item_loop:
|
||||
# bge $s1, $s0, done_item_loop # if i >= n, done loop
|
||||
sub $t0, $s0, $s1
|
||||
blez $t0, done_item_loop
|
||||
|
||||
li $a0, 0
|
||||
addi $a1, $s1, -1
|
||||
move $a2, $s1
|
||||
jal binary_search
|
||||
|
||||
move $a0, $v0
|
||||
move $a1, $s1
|
||||
jal insert
|
||||
|
||||
addi $s1, $s1, 1 # i ++
|
||||
j item_loop
|
||||
done_item_loop:
|
||||
|
||||
lw $ra, 4($sp)
|
||||
lw $s0, 8($sp)
|
||||
lw $s1, 12($sp)
|
||||
addi $sp, $sp, 12
|
||||
jr $ra
|
||||
|
||||
binary_search: # a0: left, a1: right, a2: i
|
||||
addi $sp, $sp, -20
|
||||
sw $s0, 4($sp)
|
||||
sw $s1, 8($sp)
|
||||
sw $s2, 12($sp)
|
||||
sw $s3, 16($sp)
|
||||
sw $ra, 20($sp)
|
||||
|
||||
# ble $a0, $a1, in_boundary_binary_search # left <= right, in normal position
|
||||
sub $t0, $a0, $a1
|
||||
blez $t0, in_boundary_binary_search
|
||||
|
||||
# move $v0, $a0 # now in boundary condition
|
||||
add $v0, $a0, $zero
|
||||
|
||||
j done_binary_search
|
||||
|
||||
in_boundary_binary_search:
|
||||
move $s0, $a0 # in normal situation
|
||||
move $s1, $a1
|
||||
move $s2, $a2
|
||||
add $s3, $s0, $s1 # s3 = mid = (left + right) >> 1
|
||||
srl $s3, $s3, 1
|
||||
# jal add_compare_count
|
||||
|
||||
# la $t0, num_buff
|
||||
lui $t0, 0x4000
|
||||
addi $t0, $t0, 0x60
|
||||
|
||||
sll $t1, $s3, 2
|
||||
add $t1, $t1, $t0
|
||||
lw $t1, 0($t1) # t1 = v[mid]
|
||||
sll $t2, $s2, 2
|
||||
add $t2, $t2, $t0
|
||||
lw $t2, 0($t2) # t2 = v[n]
|
||||
# ble $t1, $t2, binary_search_right # v[mid] <= v[n], jump to 'else'
|
||||
sub $t0, $t1, $t2
|
||||
blez $t0, binary_search_right
|
||||
binary_search_left:
|
||||
addi $a1, $s3, -1
|
||||
jal binary_search
|
||||
j done_binary_search
|
||||
binary_search_right:
|
||||
addi $a0, $s3, 1
|
||||
jal binary_search
|
||||
done_binary_search:
|
||||
lw $s0, 4($sp)
|
||||
lw $s1, 8($sp)
|
||||
lw $s2, 12($sp)
|
||||
lw $s3, 16($sp)
|
||||
lw $ra, 20($sp)
|
||||
addi $sp, $sp, 20
|
||||
jr $ra
|
||||
|
||||
insert: # $a0: int k, $a1: int n
|
||||
addi $sp, $sp, -12
|
||||
sw $s0, 4($sp)
|
||||
sw $s1, 8($sp)
|
||||
sw $ra, 12($sp)
|
||||
|
||||
# la $s0, num_buff # s0 = &v[0]
|
||||
lui $s0, 0x4000
|
||||
addi $s0, $s0, 0x60
|
||||
|
||||
sll $t0, $a1, 2
|
||||
add $s2, $s0, $t0
|
||||
lw $s2, 0($s2) # s2 = tmp = 'pivot' = v[n]
|
||||
|
||||
addi $s1, $a1, -1 # s1 = i = n - 1
|
||||
|
||||
insert_loop:
|
||||
# blt $s1, $a0, done_insert_loop # i < k, done loop
|
||||
sub $t0, $s1, $a0
|
||||
bltz $t0, done_insert_loop
|
||||
|
||||
sll $t0, $s1, 2
|
||||
add $t0, $s0, $t0 # t0 = &v[i]
|
||||
lw $t1, 0($t0)
|
||||
sw $t1, 4($t0)
|
||||
|
||||
addi $s1, $s1, -1 # i--
|
||||
j insert_loop
|
||||
done_insert_loop:
|
||||
sll $t0, $a0, 2
|
||||
add $t0, $s0, $t0
|
||||
sw $s2, 0($t0) # t0 = &v[k]
|
||||
|
||||
lw $s0, 4($sp)
|
||||
lw $s1, 8($sp)
|
||||
lw $ra, 12($sp)
|
||||
addi $sp, $sp, 12
|
||||
jr $ra
|
||||
266
23sort_nums.txt
Normal file
266
23sort_nums.txt
Normal file
@@ -0,0 +1,266 @@
|
||||
20'd0: instruction <= 32'h3c1d4000;
|
||||
20'd1: instruction <= 32'h23bd07ff;
|
||||
20'd2: instruction <= 32'h3c104000;
|
||||
20'd3: instruction <= 32'h22100020;
|
||||
20'd4: instruction <= 32'h2011003f;
|
||||
20'd5: instruction <= 32'hae110000;
|
||||
20'd6: instruction <= 32'h20110006;
|
||||
20'd7: instruction <= 32'hae110004;
|
||||
20'd8: instruction <= 32'h2011005b;
|
||||
20'd9: instruction <= 32'hae110008;
|
||||
20'd10: instruction <= 32'h2011004f;
|
||||
20'd11: instruction <= 32'hae11000c;
|
||||
20'd12: instruction <= 32'h20110066;
|
||||
20'd13: instruction <= 32'hae110010;
|
||||
20'd14: instruction <= 32'h2011006d;
|
||||
20'd15: instruction <= 32'hae110014;
|
||||
20'd16: instruction <= 32'h2011007d;
|
||||
20'd17: instruction <= 32'hae110018;
|
||||
20'd18: instruction <= 32'h20110007;
|
||||
20'd19: instruction <= 32'hae11001c;
|
||||
20'd20: instruction <= 32'h2011007f;
|
||||
20'd21: instruction <= 32'hae110020;
|
||||
20'd22: instruction <= 32'h2011006f;
|
||||
20'd23: instruction <= 32'hae110024;
|
||||
20'd24: instruction <= 32'h20110077;
|
||||
20'd25: instruction <= 32'hae110028;
|
||||
20'd26: instruction <= 32'h2011007c;
|
||||
20'd27: instruction <= 32'hae11002c;
|
||||
20'd28: instruction <= 32'h20110058;
|
||||
20'd29: instruction <= 32'hae110030;
|
||||
20'd30: instruction <= 32'h2011005e;
|
||||
20'd31: instruction <= 32'hae110034;
|
||||
20'd32: instruction <= 32'h20110079;
|
||||
20'd33: instruction <= 32'hae110038;
|
||||
20'd34: instruction <= 32'h20110071;
|
||||
20'd35: instruction <= 32'hae11003c;
|
||||
20'd36: instruction <= 32'h3c104000;
|
||||
20'd37: instruction <= 32'h22100060;
|
||||
20'd38: instruction <= 32'h20114b8d;
|
||||
20'd39: instruction <= 32'hae110000;
|
||||
20'd40: instruction <= 32'h20112307;
|
||||
20'd41: instruction <= 32'hae110004;
|
||||
20'd42: instruction <= 32'h3c010000;
|
||||
20'd43: instruction <= 32'h3421fae0;
|
||||
20'd44: instruction <= 32'h00018820;
|
||||
20'd45: instruction <= 32'hae110008;
|
||||
20'd46: instruction <= 32'h20117815;
|
||||
20'd47: instruction <= 32'hae11000c;
|
||||
20'd48: instruction <= 32'h3c010000;
|
||||
20'd49: instruction <= 32'h3421c105;
|
||||
20'd50: instruction <= 32'h00018820;
|
||||
20'd51: instruction <= 32'hae110010;
|
||||
20'd52: instruction <= 32'h3c010000;
|
||||
20'd53: instruction <= 32'h342184f0;
|
||||
20'd54: instruction <= 32'h00018820;
|
||||
20'd55: instruction <= 32'hae110014;
|
||||
20'd56: instruction <= 32'h20110db6;
|
||||
20'd57: instruction <= 32'hae110018;
|
||||
20'd58: instruction <= 32'h3c010000;
|
||||
20'd59: instruction <= 32'h3421f21d;
|
||||
20'd60: instruction <= 32'h00018820;
|
||||
20'd61: instruction <= 32'hae11001c;
|
||||
20'd62: instruction <= 32'h3c010000;
|
||||
20'd63: instruction <= 32'h3421e97a;
|
||||
20'd64: instruction <= 32'h00018820;
|
||||
20'd65: instruction <= 32'hae110020;
|
||||
20'd66: instruction <= 32'h3c010000;
|
||||
20'd67: instruction <= 32'h3421a3b6;
|
||||
20'd68: instruction <= 32'h00018820;
|
||||
20'd69: instruction <= 32'hae110024;
|
||||
20'd70: instruction <= 32'h3c010000;
|
||||
20'd71: instruction <= 32'h34218466;
|
||||
20'd72: instruction <= 32'h00018820;
|
||||
20'd73: instruction <= 32'hae110028;
|
||||
20'd74: instruction <= 32'h20113a25;
|
||||
20'd75: instruction <= 32'hae11002c;
|
||||
20'd76: instruction <= 32'h201105df;
|
||||
20'd77: instruction <= 32'hae110030;
|
||||
20'd78: instruction <= 32'h3c010000;
|
||||
20'd79: instruction <= 32'h3421d2de;
|
||||
20'd80: instruction <= 32'h00018820;
|
||||
20'd81: instruction <= 32'hae110034;
|
||||
20'd82: instruction <= 32'h3c010000;
|
||||
20'd83: instruction <= 32'h3421ba7a;
|
||||
20'd84: instruction <= 32'h00018820;
|
||||
20'd85: instruction <= 32'hae110038;
|
||||
20'd86: instruction <= 32'h20117809;
|
||||
20'd87: instruction <= 32'hae11003c;
|
||||
20'd88: instruction <= 32'h3c010000;
|
||||
20'd89: instruction <= 32'h3421f6a8;
|
||||
20'd90: instruction <= 32'h00018820;
|
||||
20'd91: instruction <= 32'hae110040;
|
||||
20'd92: instruction <= 32'h2011361d;
|
||||
20'd93: instruction <= 32'hae110044;
|
||||
20'd94: instruction <= 32'h20113adb;
|
||||
20'd95: instruction <= 32'hae110048;
|
||||
20'd96: instruction <= 32'h3c010000;
|
||||
20'd97: instruction <= 32'h3421969a;
|
||||
20'd98: instruction <= 32'h00018820;
|
||||
20'd99: instruction <= 32'hae11004c;
|
||||
20'd100: instruction <= 32'h0c000069;
|
||||
20'd101: instruction <= 32'h20040014;
|
||||
20'd102: instruction <= 32'h0c0000b5;
|
||||
20'd103: instruction <= 32'h0c000069;
|
||||
20'd104: instruction <= 32'h08000067;
|
||||
20'd105: instruction <= 32'h23bdffec;
|
||||
20'd106: instruction <= 32'hafbf0004;
|
||||
20'd107: instruction <= 32'hafb00008;
|
||||
20'd108: instruction <= 32'hafb1000c;
|
||||
20'd109: instruction <= 32'hafb20010;
|
||||
20'd110: instruction <= 32'hafb30014;
|
||||
20'd111: instruction <= 32'h3c104000;
|
||||
20'd112: instruction <= 32'h22110010;
|
||||
20'd113: instruction <= 32'h22100060;
|
||||
20'd114: instruction <= 32'h20120000;
|
||||
20'd115: instruction <= 32'h20130014;
|
||||
20'd116: instruction <= 32'h00124080;
|
||||
20'd117: instruction <= 32'h02084020;
|
||||
20'd118: instruction <= 32'h8d040000;
|
||||
20'd119: instruction <= 32'h22250000;
|
||||
20'd120: instruction <= 32'h0c000084;
|
||||
20'd121: instruction <= 32'h22520001;
|
||||
20'd122: instruction <= 32'h02724022;
|
||||
20'd123: instruction <= 32'h1d00fff8;
|
||||
20'd124: instruction <= 32'h0c0000ae;
|
||||
20'd125: instruction <= 32'h8fbf0004;
|
||||
20'd126: instruction <= 32'h8fb00008;
|
||||
20'd127: instruction <= 32'h8fb1000c;
|
||||
20'd128: instruction <= 32'h8fb20010;
|
||||
20'd129: instruction <= 32'h8fb30014;
|
||||
20'd130: instruction <= 32'h23bd0014;
|
||||
20'd131: instruction <= 32'h03e00008;
|
||||
20'd132: instruction <= 32'h23bdffe0;
|
||||
20'd133: instruction <= 32'hafbf0004;
|
||||
20'd134: instruction <= 32'hafb00008;
|
||||
20'd135: instruction <= 32'hafb1000c;
|
||||
20'd136: instruction <= 32'hafb20010;
|
||||
20'd137: instruction <= 32'hafb30014;
|
||||
20'd138: instruction <= 32'hafb40018;
|
||||
20'd139: instruction <= 32'hafb5001c;
|
||||
20'd140: instruction <= 32'hafb60020;
|
||||
20'd141: instruction <= 32'h20900000;
|
||||
20'd142: instruction <= 32'h20b10000;
|
||||
20'd143: instruction <= 32'h3c124000;
|
||||
20'd144: instruction <= 32'h22520020;
|
||||
20'd145: instruction <= 32'h20130be2;
|
||||
20'd146: instruction <= 32'h22140000;
|
||||
20'd147: instruction <= 32'h20160100;
|
||||
20'd148: instruction <= 32'h20150004;
|
||||
20'd149: instruction <= 32'h3288000f;
|
||||
20'd150: instruction <= 32'h00084080;
|
||||
20'd151: instruction <= 32'h02484020;
|
||||
20'd152: instruction <= 32'h8d080000;
|
||||
20'd153: instruction <= 32'h01164025;
|
||||
20'd154: instruction <= 32'hae280000;
|
||||
20'd155: instruction <= 32'h0014a102;
|
||||
20'd156: instruction <= 32'h0016b040;
|
||||
20'd157: instruction <= 32'h20080400;
|
||||
20'd158: instruction <= 32'h2108ffff;
|
||||
20'd159: instruction <= 32'h1d00fffe;
|
||||
20'd160: instruction <= 32'h22b5ffff;
|
||||
20'd161: instruction <= 32'h1ea0fff3;
|
||||
20'd162: instruction <= 32'h2273ffff;
|
||||
20'd163: instruction <= 32'h1e60ffee;
|
||||
20'd164: instruction <= 32'h8fbf0004;
|
||||
20'd165: instruction <= 32'h8fb00008;
|
||||
20'd166: instruction <= 32'h8fb1000c;
|
||||
20'd167: instruction <= 32'h8fb20010;
|
||||
20'd168: instruction <= 32'h8fb30014;
|
||||
20'd169: instruction <= 32'h8fb40018;
|
||||
20'd170: instruction <= 32'h8fb5001c;
|
||||
20'd171: instruction <= 32'h8fb60020;
|
||||
20'd172: instruction <= 32'h23bd0020;
|
||||
20'd173: instruction <= 32'h03e00008;
|
||||
20'd174: instruction <= 32'h3c084000;
|
||||
20'd175: instruction <= 32'h21080010;
|
||||
20'd176: instruction <= 32'had000000;
|
||||
20'd177: instruction <= 32'h3c080100;
|
||||
20'd178: instruction <= 32'h2108ffff;
|
||||
20'd179: instruction <= 32'h1d00fffe;
|
||||
20'd180: instruction <= 32'h03e00008;
|
||||
20'd181: instruction <= 32'h23bdfff4;
|
||||
20'd182: instruction <= 32'hafbf0004;
|
||||
20'd183: instruction <= 32'hafb00008;
|
||||
20'd184: instruction <= 32'hafb1000c;
|
||||
20'd185: instruction <= 32'h20900000;
|
||||
20'd186: instruction <= 32'h20110001;
|
||||
20'd187: instruction <= 32'h02114022;
|
||||
20'd188: instruction <= 32'h19000009;
|
||||
20'd189: instruction <= 32'h24040000;
|
||||
20'd190: instruction <= 32'h2225ffff;
|
||||
20'd191: instruction <= 32'h00113021;
|
||||
20'd192: instruction <= 32'h0c0000cb;
|
||||
20'd193: instruction <= 32'h00022021;
|
||||
20'd194: instruction <= 32'h00112821;
|
||||
20'd195: instruction <= 32'h0c0000f0;
|
||||
20'd196: instruction <= 32'h22310001;
|
||||
20'd197: instruction <= 32'h080000bb;
|
||||
20'd198: instruction <= 32'h8fbf0004;
|
||||
20'd199: instruction <= 32'h8fb00008;
|
||||
20'd200: instruction <= 32'h8fb1000c;
|
||||
20'd201: instruction <= 32'h23bd000c;
|
||||
20'd202: instruction <= 32'h03e00008;
|
||||
20'd203: instruction <= 32'h23bdffec;
|
||||
20'd204: instruction <= 32'hafb00004;
|
||||
20'd205: instruction <= 32'hafb10008;
|
||||
20'd206: instruction <= 32'hafb2000c;
|
||||
20'd207: instruction <= 32'hafb30010;
|
||||
20'd208: instruction <= 32'hafbf0014;
|
||||
20'd209: instruction <= 32'h00854022;
|
||||
20'd210: instruction <= 32'h19000002;
|
||||
20'd211: instruction <= 32'h00801020;
|
||||
20'd212: instruction <= 32'h080000e9;
|
||||
20'd213: instruction <= 32'h00048021;
|
||||
20'd214: instruction <= 32'h00058821;
|
||||
20'd215: instruction <= 32'h00069021;
|
||||
20'd216: instruction <= 32'h02119820;
|
||||
20'd217: instruction <= 32'h00139842;
|
||||
20'd218: instruction <= 32'h3c084000;
|
||||
20'd219: instruction <= 32'h21080060;
|
||||
20'd220: instruction <= 32'h00134880;
|
||||
20'd221: instruction <= 32'h01284820;
|
||||
20'd222: instruction <= 32'h8d290000;
|
||||
20'd223: instruction <= 32'h00125080;
|
||||
20'd224: instruction <= 32'h01485020;
|
||||
20'd225: instruction <= 32'h8d4a0000;
|
||||
20'd226: instruction <= 32'h012a4022;
|
||||
20'd227: instruction <= 32'h19000003;
|
||||
20'd228: instruction <= 32'h2265ffff;
|
||||
20'd229: instruction <= 32'h0c0000cb;
|
||||
20'd230: instruction <= 32'h080000e9;
|
||||
20'd231: instruction <= 32'h22640001;
|
||||
20'd232: instruction <= 32'h0c0000cb;
|
||||
20'd233: instruction <= 32'h8fb00004;
|
||||
20'd234: instruction <= 32'h8fb10008;
|
||||
20'd235: instruction <= 32'h8fb2000c;
|
||||
20'd236: instruction <= 32'h8fb30010;
|
||||
20'd237: instruction <= 32'h8fbf0014;
|
||||
20'd238: instruction <= 32'h23bd0014;
|
||||
20'd239: instruction <= 32'h03e00008;
|
||||
20'd240: instruction <= 32'h23bdfff4;
|
||||
20'd241: instruction <= 32'hafb00004;
|
||||
20'd242: instruction <= 32'hafb10008;
|
||||
20'd243: instruction <= 32'hafbf000c;
|
||||
20'd244: instruction <= 32'h3c104000;
|
||||
20'd245: instruction <= 32'h22100060;
|
||||
20'd246: instruction <= 32'h00054080;
|
||||
20'd247: instruction <= 32'h02089020;
|
||||
20'd248: instruction <= 32'h8e520000;
|
||||
20'd249: instruction <= 32'h20b1ffff;
|
||||
20'd250: instruction <= 32'h02244022;
|
||||
20'd251: instruction <= 32'h05000006;
|
||||
20'd252: instruction <= 32'h00114080;
|
||||
20'd253: instruction <= 32'h02084020;
|
||||
20'd254: instruction <= 32'h8d090000;
|
||||
20'd255: instruction <= 32'had090004;
|
||||
20'd256: instruction <= 32'h2231ffff;
|
||||
20'd257: instruction <= 32'h080000fa;
|
||||
20'd258: instruction <= 32'h00044080;
|
||||
20'd259: instruction <= 32'h02084020;
|
||||
20'd260: instruction <= 32'had120000;
|
||||
20'd261: instruction <= 32'h8fb00004;
|
||||
20'd262: instruction <= 32'h8fb10008;
|
||||
20'd263: instruction <= 32'h8fbf000c;
|
||||
20'd264: instruction <= 32'h23bd000c;
|
||||
20'd265: instruction <= 32'h03e00008;
|
||||
266
23sort_nums_mars.txt
Normal file
266
23sort_nums_mars.txt
Normal file
@@ -0,0 +1,266 @@
|
||||
3c1d4000
|
||||
23bd07ff
|
||||
3c104000
|
||||
22100020
|
||||
2011003f
|
||||
ae110000
|
||||
20110006
|
||||
ae110004
|
||||
2011005b
|
||||
ae110008
|
||||
2011004f
|
||||
ae11000c
|
||||
20110066
|
||||
ae110010
|
||||
2011006d
|
||||
ae110014
|
||||
2011007d
|
||||
ae110018
|
||||
20110007
|
||||
ae11001c
|
||||
2011007f
|
||||
ae110020
|
||||
2011006f
|
||||
ae110024
|
||||
20110077
|
||||
ae110028
|
||||
2011007c
|
||||
ae11002c
|
||||
20110058
|
||||
ae110030
|
||||
2011005e
|
||||
ae110034
|
||||
20110079
|
||||
ae110038
|
||||
20110071
|
||||
ae11003c
|
||||
3c104000
|
||||
22100060
|
||||
20114b8d
|
||||
ae110000
|
||||
20112307
|
||||
ae110004
|
||||
3c010000
|
||||
3421fae0
|
||||
00018820
|
||||
ae110008
|
||||
20117815
|
||||
ae11000c
|
||||
3c010000
|
||||
3421c105
|
||||
00018820
|
||||
ae110010
|
||||
3c010000
|
||||
342184f0
|
||||
00018820
|
||||
ae110014
|
||||
20110db6
|
||||
ae110018
|
||||
3c010000
|
||||
3421f21d
|
||||
00018820
|
||||
ae11001c
|
||||
3c010000
|
||||
3421e97a
|
||||
00018820
|
||||
ae110020
|
||||
3c010000
|
||||
3421a3b6
|
||||
00018820
|
||||
ae110024
|
||||
3c010000
|
||||
34218466
|
||||
00018820
|
||||
ae110028
|
||||
20113a25
|
||||
ae11002c
|
||||
201105df
|
||||
ae110030
|
||||
3c010000
|
||||
3421d2de
|
||||
00018820
|
||||
ae110034
|
||||
3c010000
|
||||
3421ba7a
|
||||
00018820
|
||||
ae110038
|
||||
20117809
|
||||
ae11003c
|
||||
3c010000
|
||||
3421f6a8
|
||||
00018820
|
||||
ae110040
|
||||
2011361d
|
||||
ae110044
|
||||
20113adb
|
||||
ae110048
|
||||
3c010000
|
||||
3421969a
|
||||
00018820
|
||||
ae11004c
|
||||
0c000069
|
||||
20040014
|
||||
0c0000b5
|
||||
0c000069
|
||||
08000067
|
||||
23bdffec
|
||||
afbf0004
|
||||
afb00008
|
||||
afb1000c
|
||||
afb20010
|
||||
afb30014
|
||||
3c104000
|
||||
22110010
|
||||
22100060
|
||||
20120000
|
||||
20130014
|
||||
00124080
|
||||
02084020
|
||||
8d040000
|
||||
22250000
|
||||
0c000084
|
||||
22520001
|
||||
02724022
|
||||
1d00fff8
|
||||
0c0000ae
|
||||
8fbf0004
|
||||
8fb00008
|
||||
8fb1000c
|
||||
8fb20010
|
||||
8fb30014
|
||||
23bd0014
|
||||
03e00008
|
||||
23bdffe0
|
||||
afbf0004
|
||||
afb00008
|
||||
afb1000c
|
||||
afb20010
|
||||
afb30014
|
||||
afb40018
|
||||
afb5001c
|
||||
afb60020
|
||||
20900000
|
||||
20b10000
|
||||
3c124000
|
||||
22520020
|
||||
20130be2
|
||||
22140000
|
||||
20160100
|
||||
20150004
|
||||
3288000f
|
||||
00084080
|
||||
02484020
|
||||
8d080000
|
||||
01164025
|
||||
ae280000
|
||||
0014a102
|
||||
0016b040
|
||||
20080400
|
||||
2108ffff
|
||||
1d00fffe
|
||||
22b5ffff
|
||||
1ea0fff3
|
||||
2273ffff
|
||||
1e60ffee
|
||||
8fbf0004
|
||||
8fb00008
|
||||
8fb1000c
|
||||
8fb20010
|
||||
8fb30014
|
||||
8fb40018
|
||||
8fb5001c
|
||||
8fb60020
|
||||
23bd0020
|
||||
03e00008
|
||||
3c084000
|
||||
21080010
|
||||
ad000000
|
||||
3c080100
|
||||
2108ffff
|
||||
1d00fffe
|
||||
03e00008
|
||||
23bdfff4
|
||||
afbf0004
|
||||
afb00008
|
||||
afb1000c
|
||||
20900000
|
||||
20110001
|
||||
02114022
|
||||
19000009
|
||||
24040000
|
||||
2225ffff
|
||||
00113021
|
||||
0c0000cb
|
||||
00022021
|
||||
00112821
|
||||
0c0000f0
|
||||
22310001
|
||||
080000bb
|
||||
8fbf0004
|
||||
8fb00008
|
||||
8fb1000c
|
||||
23bd000c
|
||||
03e00008
|
||||
23bdffec
|
||||
afb00004
|
||||
afb10008
|
||||
afb2000c
|
||||
afb30010
|
||||
afbf0014
|
||||
00854022
|
||||
19000002
|
||||
00801020
|
||||
080000e9
|
||||
00048021
|
||||
00058821
|
||||
00069021
|
||||
02119820
|
||||
00139842
|
||||
3c084000
|
||||
21080060
|
||||
00134880
|
||||
01284820
|
||||
8d290000
|
||||
00125080
|
||||
01485020
|
||||
8d4a0000
|
||||
012a4022
|
||||
19000003
|
||||
2265ffff
|
||||
0c0000cb
|
||||
080000e9
|
||||
22640001
|
||||
0c0000cb
|
||||
8fb00004
|
||||
8fb10008
|
||||
8fb2000c
|
||||
8fb30010
|
||||
8fbf0014
|
||||
23bd0014
|
||||
03e00008
|
||||
23bdfff4
|
||||
afb00004
|
||||
afb10008
|
||||
afbf000c
|
||||
3c104000
|
||||
22100060
|
||||
00054080
|
||||
02089020
|
||||
8e520000
|
||||
20b1ffff
|
||||
02244022
|
||||
05000006
|
||||
00114080
|
||||
02084020
|
||||
8d090000
|
||||
ad090004
|
||||
2231ffff
|
||||
080000fa
|
||||
00044080
|
||||
02084020
|
||||
ad120000
|
||||
8fb00004
|
||||
8fb10008
|
||||
8fbf000c
|
||||
23bd000c
|
||||
03e00008
|
||||
320
24sort_nums_no_init.asm
Normal file
320
24sort_nums_no_init.asm
Normal file
@@ -0,0 +1,320 @@
|
||||
.text
|
||||
#initialize $sp
|
||||
lui $sp, 0x4000
|
||||
addi $sp, $sp, 0x7fc
|
||||
|
||||
# load digit to mem
|
||||
lui $s0, 0x4000
|
||||
addi $s0, $s0, 0x20
|
||||
#0
|
||||
addi $s1, $zero, 0x3f
|
||||
sw $s1, 0($s0)
|
||||
#1
|
||||
addi $s1, $zero, 0x6
|
||||
sw $s1, 4($s0)
|
||||
#2
|
||||
addi $s1, $zero, 0x5b
|
||||
sw $s1, 8($s0)
|
||||
#3
|
||||
addi $s1, $zero, 0x4f
|
||||
sw $s1, 12($s0)
|
||||
#4
|
||||
addi $s1, $zero, 0x66
|
||||
sw $s1, 16($s0)
|
||||
#5
|
||||
addi $s1, $zero, 0x6d
|
||||
sw $s1, 20($s0)
|
||||
#6
|
||||
addi $s1, $zero, 0x7d
|
||||
sw $s1, 24($s0)
|
||||
#7
|
||||
addi $s1, $zero, 0x7
|
||||
sw $s1, 28($s0)
|
||||
#8
|
||||
addi $s1, $zero, 0x7f
|
||||
sw $s1, 32($s0)
|
||||
#9
|
||||
addi $s1, $zero, 0x6f
|
||||
sw $s1, 36($s0)
|
||||
#A
|
||||
addi $s1, $zero, 0x77
|
||||
sw $s1, 40($s0)
|
||||
#B
|
||||
addi $s1, $zero, 0x7c
|
||||
sw $s1, 44($s0)
|
||||
#C
|
||||
addi $s1, $zero, 0x58
|
||||
sw $s1, 48($s0)
|
||||
#D
|
||||
addi $s1, $zero, 0x5e
|
||||
sw $s1, 52($s0)
|
||||
#E
|
||||
addi $s1, $zero, 0x79
|
||||
sw $s1, 56($s0)
|
||||
#F
|
||||
addi $s1, $zero, 0x71
|
||||
sw $s1, 60($s0)
|
||||
|
||||
main:
|
||||
# jal disp_num_in_mem
|
||||
|
||||
lui $t0, 0x4000
|
||||
lw $a0, 0x60($t0)
|
||||
jal insertion_sort
|
||||
end:
|
||||
jal disp_num_in_mem
|
||||
j end
|
||||
|
||||
disp_num_in_mem:
|
||||
addi $sp, $sp, -20
|
||||
sw $ra, 4($sp)
|
||||
sw $s0, 8($sp)
|
||||
sw $s1, 12($sp)
|
||||
sw $s2, 16($sp)
|
||||
sw $s3, 20($sp)
|
||||
|
||||
lui $s0, 0x4000
|
||||
# s1 = 0x40000010
|
||||
addi $s1, $s0, 0x10
|
||||
# s0 = 0x40000060
|
||||
addi $s0, $s0, 0x60
|
||||
addi $s2, $zero, 0
|
||||
# addi $s3, $zero, 20
|
||||
lw $s3, 0($s0) # s3 is the total count
|
||||
addi $s0, $s0, 4
|
||||
display_single_number:
|
||||
sll $t0, $s2, 2
|
||||
add $t0, $s0, $t0
|
||||
lw $a0, 0($t0)
|
||||
addi $a1, $s1, 0
|
||||
jal display_number
|
||||
|
||||
addi $s2, $s2, 1
|
||||
sub $t0, $s3, $s2
|
||||
bgtz $t0, display_single_number
|
||||
|
||||
|
||||
jal display_empty
|
||||
|
||||
lw $ra, 4($sp)
|
||||
lw $s0, 8($sp)
|
||||
lw $s1, 12($sp)
|
||||
lw $s2, 16($sp)
|
||||
lw $s3, 20($sp)
|
||||
addi $sp, $sp, 20
|
||||
jr $ra
|
||||
|
||||
# ------------------------------------------------------
|
||||
|
||||
# a0 is the number to be displayed, a1 is the bcd control addr
|
||||
display_number:
|
||||
addi $sp, $sp, -32
|
||||
sw $ra, 4($sp)
|
||||
sw $s0, 8($sp)
|
||||
sw $s1, 12($sp)
|
||||
sw $s2, 16($sp)
|
||||
sw $s3, 20($sp)
|
||||
sw $s4, 24($sp)
|
||||
sw $s5, 28($sp)
|
||||
sw $s6, 32($sp)
|
||||
|
||||
# s0 is the number to be displayed
|
||||
addi $s0, $a0, 0
|
||||
|
||||
# s1 is the bcd_control addr
|
||||
addi $s1, $a1, 0
|
||||
|
||||
# s2 is the base addr for display digit
|
||||
lui $s2, 0x4000
|
||||
addi $s2, $s2, 0x20
|
||||
|
||||
# s3 is the counter for a complete scan of 4 digit
|
||||
# addi $s3, $zero, 0x17c4
|
||||
addi $s3, $zero, 0xbe2
|
||||
all_digit_scan_loop:
|
||||
# s4 is the num being shifted gradually
|
||||
addi $s4, $s0, 0
|
||||
# s6 is the enable digit
|
||||
addi $s6, $zero, 0x100
|
||||
|
||||
addi $s5, $zero, 4
|
||||
single_digit_loop:
|
||||
# get a digit
|
||||
andi $t0, $s4, 0xf
|
||||
# digit * 4 is the memory shift
|
||||
sll $t0, $t0, 2
|
||||
add $t0, $s2, $t0
|
||||
lw $t0, 0($t0)
|
||||
or $t0, $t0, $s6
|
||||
sw $t0, 0($s1)
|
||||
|
||||
srl $s4, $s4, 4
|
||||
sll $s6, $s6, 1
|
||||
|
||||
addi $t0, $zero, 0x400
|
||||
wait_time_loop:
|
||||
addi $t0, $t0, -1
|
||||
bgtz $t0, wait_time_loop
|
||||
|
||||
addi $s5, $s5, -1
|
||||
bgtz $s5, single_digit_loop
|
||||
# end of single digit loop
|
||||
|
||||
# ** depends on the clock **
|
||||
# four digit, 328.68us.
|
||||
# 1s / 328.68us = 3042 = (be2)hex
|
||||
|
||||
addi $s3, $s3, -1
|
||||
bgtz $s3, all_digit_scan_loop
|
||||
|
||||
lw $ra, 4($sp)
|
||||
lw $s0, 8($sp)
|
||||
lw $s1, 12($sp)
|
||||
lw $s2, 16($sp)
|
||||
lw $s3, 20($sp)
|
||||
lw $s4, 24($sp)
|
||||
lw $s5, 28($sp)
|
||||
lw $s6, 32($sp)
|
||||
addi $sp, $sp, 32
|
||||
jr $ra
|
||||
|
||||
display_empty:
|
||||
lui $t0, 0x4000
|
||||
addi $t0, $t0, 0x10
|
||||
sw $zero, 0($t0)
|
||||
|
||||
lui $t0, 0x100
|
||||
display_empty_wait_loop:
|
||||
addi $t0, $t0, -1
|
||||
bgtz $t0, display_empty_wait_loop
|
||||
jr $ra
|
||||
|
||||
# a0 is the total number of numbers needed to be sorted
|
||||
insertion_sort:
|
||||
addi $sp, $sp, -12
|
||||
sw $ra, 4($sp)
|
||||
sw $s0, 8($sp)
|
||||
sw $s1, 12($sp)
|
||||
|
||||
# la $t0, num_N
|
||||
# lw $s0, 0($t0) # n in s0
|
||||
addi $s0, $a0, 0
|
||||
|
||||
# li $s1, 1 # i in s1
|
||||
addi $s1, $zero, 1
|
||||
item_loop:
|
||||
# bge $s1, $s0, done_item_loop # if i >= n, done loop
|
||||
sub $t0, $s0, $s1
|
||||
blez $t0, done_item_loop
|
||||
|
||||
li $a0, 0
|
||||
addi $a1, $s1, -1
|
||||
move $a2, $s1
|
||||
jal binary_search
|
||||
|
||||
move $a0, $v0
|
||||
move $a1, $s1
|
||||
jal insert
|
||||
|
||||
addi $s1, $s1, 1 # i ++
|
||||
j item_loop
|
||||
done_item_loop:
|
||||
|
||||
lw $ra, 4($sp)
|
||||
lw $s0, 8($sp)
|
||||
lw $s1, 12($sp)
|
||||
addi $sp, $sp, 12
|
||||
jr $ra
|
||||
|
||||
binary_search: # a0: left, a1: right, a2: i
|
||||
addi $sp, $sp, -20
|
||||
sw $s0, 4($sp)
|
||||
sw $s1, 8($sp)
|
||||
sw $s2, 12($sp)
|
||||
sw $s3, 16($sp)
|
||||
sw $ra, 20($sp)
|
||||
|
||||
# ble $a0, $a1, in_boundary_binary_search # left <= right, in normal position
|
||||
sub $t0, $a0, $a1
|
||||
blez $t0, in_boundary_binary_search
|
||||
|
||||
# move $v0, $a0 # now in boundary condition
|
||||
add $v0, $a0, $zero
|
||||
|
||||
j done_binary_search
|
||||
|
||||
in_boundary_binary_search:
|
||||
move $s0, $a0 # in normal situation
|
||||
move $s1, $a1
|
||||
move $s2, $a2
|
||||
add $s3, $s0, $s1 # s3 = mid = (left + right) >> 1
|
||||
srl $s3, $s3, 1
|
||||
# jal add_compare_count
|
||||
|
||||
# la $t0, num_buff
|
||||
lui $t0, 0x4000
|
||||
addi $t0, $t0, 0x64
|
||||
|
||||
sll $t1, $s3, 2
|
||||
add $t1, $t1, $t0
|
||||
lw $t1, 0($t1) # t1 = v[mid]
|
||||
sll $t2, $s2, 2
|
||||
add $t2, $t2, $t0
|
||||
lw $t2, 0($t2) # t2 = v[n]
|
||||
# ble $t1, $t2, binary_search_right # v[mid] <= v[n], jump to 'else'
|
||||
sub $t0, $t1, $t2
|
||||
blez $t0, binary_search_right
|
||||
binary_search_left:
|
||||
addi $a1, $s3, -1
|
||||
jal binary_search
|
||||
j done_binary_search
|
||||
binary_search_right:
|
||||
addi $a0, $s3, 1
|
||||
jal binary_search
|
||||
done_binary_search:
|
||||
lw $s0, 4($sp)
|
||||
lw $s1, 8($sp)
|
||||
lw $s2, 12($sp)
|
||||
lw $s3, 16($sp)
|
||||
lw $ra, 20($sp)
|
||||
addi $sp, $sp, 20
|
||||
jr $ra
|
||||
|
||||
insert: # $a0: int k, $a1: int n
|
||||
addi $sp, $sp, -12
|
||||
sw $s0, 4($sp)
|
||||
sw $s1, 8($sp)
|
||||
sw $ra, 12($sp)
|
||||
|
||||
# la $s0, num_buff # s0 = &v[0]
|
||||
lui $s0, 0x4000
|
||||
addi $s0, $s0, 0x64
|
||||
|
||||
sll $t0, $a1, 2
|
||||
add $s2, $s0, $t0
|
||||
lw $s2, 0($s2) # s2 = tmp = 'pivot' = v[n]
|
||||
|
||||
addi $s1, $a1, -1 # s1 = i = n - 1
|
||||
|
||||
insert_loop:
|
||||
# blt $s1, $a0, done_insert_loop # i < k, done loop
|
||||
sub $t0, $s1, $a0
|
||||
bltz $t0, done_insert_loop
|
||||
|
||||
sll $t0, $s1, 2
|
||||
add $t0, $s0, $t0 # t0 = &v[i]
|
||||
lw $t1, 0($t0)
|
||||
sw $t1, 4($t0)
|
||||
|
||||
addi $s1, $s1, -1 # i--
|
||||
j insert_loop
|
||||
done_insert_loop:
|
||||
sll $t0, $a0, 2
|
||||
add $t0, $s0, $t0
|
||||
sw $s2, 0($t0) # t0 = &v[k]
|
||||
|
||||
lw $s0, 4($sp)
|
||||
lw $s1, 8($sp)
|
||||
lw $ra, 12($sp)
|
||||
addi $sp, $sp, 12
|
||||
jr $ra
|
||||
203
24sort_nums_no_init.txt
Normal file
203
24sort_nums_no_init.txt
Normal file
@@ -0,0 +1,203 @@
|
||||
20'd0: instruction <= 32'h3c1d4000;
|
||||
20'd1: instruction <= 32'h23bd07fc;
|
||||
20'd2: instruction <= 32'h3c104000;
|
||||
20'd3: instruction <= 32'h22100020;
|
||||
20'd4: instruction <= 32'h2011003f;
|
||||
20'd5: instruction <= 32'hae110000;
|
||||
20'd6: instruction <= 32'h20110006;
|
||||
20'd7: instruction <= 32'hae110004;
|
||||
20'd8: instruction <= 32'h2011005b;
|
||||
20'd9: instruction <= 32'hae110008;
|
||||
20'd10: instruction <= 32'h2011004f;
|
||||
20'd11: instruction <= 32'hae11000c;
|
||||
20'd12: instruction <= 32'h20110066;
|
||||
20'd13: instruction <= 32'hae110010;
|
||||
20'd14: instruction <= 32'h2011006d;
|
||||
20'd15: instruction <= 32'hae110014;
|
||||
20'd16: instruction <= 32'h2011007d;
|
||||
20'd17: instruction <= 32'hae110018;
|
||||
20'd18: instruction <= 32'h20110007;
|
||||
20'd19: instruction <= 32'hae11001c;
|
||||
20'd20: instruction <= 32'h2011007f;
|
||||
20'd21: instruction <= 32'hae110020;
|
||||
20'd22: instruction <= 32'h2011006f;
|
||||
20'd23: instruction <= 32'hae110024;
|
||||
20'd24: instruction <= 32'h20110077;
|
||||
20'd25: instruction <= 32'hae110028;
|
||||
20'd26: instruction <= 32'h2011007c;
|
||||
20'd27: instruction <= 32'hae11002c;
|
||||
20'd28: instruction <= 32'h20110058;
|
||||
20'd29: instruction <= 32'hae110030;
|
||||
20'd30: instruction <= 32'h2011005e;
|
||||
20'd31: instruction <= 32'hae110034;
|
||||
20'd32: instruction <= 32'h20110079;
|
||||
20'd33: instruction <= 32'hae110038;
|
||||
20'd34: instruction <= 32'h20110071;
|
||||
20'd35: instruction <= 32'hae11003c;
|
||||
20'd36: instruction <= 32'h3c084000;
|
||||
20'd37: instruction <= 32'h8d040060;
|
||||
20'd38: instruction <= 32'h0c000076;
|
||||
20'd39: instruction <= 32'h0c000029;
|
||||
20'd40: instruction <= 32'h08000027;
|
||||
20'd41: instruction <= 32'h23bdffec;
|
||||
20'd42: instruction <= 32'hafbf0004;
|
||||
20'd43: instruction <= 32'hafb00008;
|
||||
20'd44: instruction <= 32'hafb1000c;
|
||||
20'd45: instruction <= 32'hafb20010;
|
||||
20'd46: instruction <= 32'hafb30014;
|
||||
20'd47: instruction <= 32'h3c104000;
|
||||
20'd48: instruction <= 32'h22110010;
|
||||
20'd49: instruction <= 32'h22100060;
|
||||
20'd50: instruction <= 32'h20120000;
|
||||
20'd51: instruction <= 32'h8e130000;
|
||||
20'd52: instruction <= 32'h22100004;
|
||||
20'd53: instruction <= 32'h00124080;
|
||||
20'd54: instruction <= 32'h02084020;
|
||||
20'd55: instruction <= 32'h8d040000;
|
||||
20'd56: instruction <= 32'h22250000;
|
||||
20'd57: instruction <= 32'h0c000045;
|
||||
20'd58: instruction <= 32'h22520001;
|
||||
20'd59: instruction <= 32'h02724022;
|
||||
20'd60: instruction <= 32'h1d00fff8;
|
||||
20'd61: instruction <= 32'h0c00006f;
|
||||
20'd62: instruction <= 32'h8fbf0004;
|
||||
20'd63: instruction <= 32'h8fb00008;
|
||||
20'd64: instruction <= 32'h8fb1000c;
|
||||
20'd65: instruction <= 32'h8fb20010;
|
||||
20'd66: instruction <= 32'h8fb30014;
|
||||
20'd67: instruction <= 32'h23bd0014;
|
||||
20'd68: instruction <= 32'h03e00008;
|
||||
20'd69: instruction <= 32'h23bdffe0;
|
||||
20'd70: instruction <= 32'hafbf0004;
|
||||
20'd71: instruction <= 32'hafb00008;
|
||||
20'd72: instruction <= 32'hafb1000c;
|
||||
20'd73: instruction <= 32'hafb20010;
|
||||
20'd74: instruction <= 32'hafb30014;
|
||||
20'd75: instruction <= 32'hafb40018;
|
||||
20'd76: instruction <= 32'hafb5001c;
|
||||
20'd77: instruction <= 32'hafb60020;
|
||||
20'd78: instruction <= 32'h20900000;
|
||||
20'd79: instruction <= 32'h20b10000;
|
||||
20'd80: instruction <= 32'h3c124000;
|
||||
20'd81: instruction <= 32'h22520020;
|
||||
20'd82: instruction <= 32'h20130be2;
|
||||
20'd83: instruction <= 32'h22140000;
|
||||
20'd84: instruction <= 32'h20160100;
|
||||
20'd85: instruction <= 32'h20150004;
|
||||
20'd86: instruction <= 32'h3288000f;
|
||||
20'd87: instruction <= 32'h00084080;
|
||||
20'd88: instruction <= 32'h02484020;
|
||||
20'd89: instruction <= 32'h8d080000;
|
||||
20'd90: instruction <= 32'h01164025;
|
||||
20'd91: instruction <= 32'hae280000;
|
||||
20'd92: instruction <= 32'h0014a102;
|
||||
20'd93: instruction <= 32'h0016b040;
|
||||
20'd94: instruction <= 32'h20080400;
|
||||
20'd95: instruction <= 32'h2108ffff;
|
||||
20'd96: instruction <= 32'h1d00fffe;
|
||||
20'd97: instruction <= 32'h22b5ffff;
|
||||
20'd98: instruction <= 32'h1ea0fff3;
|
||||
20'd99: instruction <= 32'h2273ffff;
|
||||
20'd100: instruction <= 32'h1e60ffee;
|
||||
20'd101: instruction <= 32'h8fbf0004;
|
||||
20'd102: instruction <= 32'h8fb00008;
|
||||
20'd103: instruction <= 32'h8fb1000c;
|
||||
20'd104: instruction <= 32'h8fb20010;
|
||||
20'd105: instruction <= 32'h8fb30014;
|
||||
20'd106: instruction <= 32'h8fb40018;
|
||||
20'd107: instruction <= 32'h8fb5001c;
|
||||
20'd108: instruction <= 32'h8fb60020;
|
||||
20'd109: instruction <= 32'h23bd0020;
|
||||
20'd110: instruction <= 32'h03e00008;
|
||||
20'd111: instruction <= 32'h3c084000;
|
||||
20'd112: instruction <= 32'h21080010;
|
||||
20'd113: instruction <= 32'had000000;
|
||||
20'd114: instruction <= 32'h3c080100;
|
||||
20'd115: instruction <= 32'h2108ffff;
|
||||
20'd116: instruction <= 32'h1d00fffe;
|
||||
20'd117: instruction <= 32'h03e00008;
|
||||
20'd118: instruction <= 32'h23bdfff4;
|
||||
20'd119: instruction <= 32'hafbf0004;
|
||||
20'd120: instruction <= 32'hafb00008;
|
||||
20'd121: instruction <= 32'hafb1000c;
|
||||
20'd122: instruction <= 32'h20900000;
|
||||
20'd123: instruction <= 32'h20110001;
|
||||
20'd124: instruction <= 32'h02114022;
|
||||
20'd125: instruction <= 32'h19000009;
|
||||
20'd126: instruction <= 32'h24040000;
|
||||
20'd127: instruction <= 32'h2225ffff;
|
||||
20'd128: instruction <= 32'h00113021;
|
||||
20'd129: instruction <= 32'h0c00008c;
|
||||
20'd130: instruction <= 32'h00022021;
|
||||
20'd131: instruction <= 32'h00112821;
|
||||
20'd132: instruction <= 32'h0c0000b1;
|
||||
20'd133: instruction <= 32'h22310001;
|
||||
20'd134: instruction <= 32'h0800007c;
|
||||
20'd135: instruction <= 32'h8fbf0004;
|
||||
20'd136: instruction <= 32'h8fb00008;
|
||||
20'd137: instruction <= 32'h8fb1000c;
|
||||
20'd138: instruction <= 32'h23bd000c;
|
||||
20'd139: instruction <= 32'h03e00008;
|
||||
20'd140: instruction <= 32'h23bdffec;
|
||||
20'd141: instruction <= 32'hafb00004;
|
||||
20'd142: instruction <= 32'hafb10008;
|
||||
20'd143: instruction <= 32'hafb2000c;
|
||||
20'd144: instruction <= 32'hafb30010;
|
||||
20'd145: instruction <= 32'hafbf0014;
|
||||
20'd146: instruction <= 32'h00854022;
|
||||
20'd147: instruction <= 32'h19000002;
|
||||
20'd148: instruction <= 32'h00801020;
|
||||
20'd149: instruction <= 32'h080000aa;
|
||||
20'd150: instruction <= 32'h00048021;
|
||||
20'd151: instruction <= 32'h00058821;
|
||||
20'd152: instruction <= 32'h00069021;
|
||||
20'd153: instruction <= 32'h02119820;
|
||||
20'd154: instruction <= 32'h00139842;
|
||||
20'd155: instruction <= 32'h3c084000;
|
||||
20'd156: instruction <= 32'h21080064;
|
||||
20'd157: instruction <= 32'h00134880;
|
||||
20'd158: instruction <= 32'h01284820;
|
||||
20'd159: instruction <= 32'h8d290000;
|
||||
20'd160: instruction <= 32'h00125080;
|
||||
20'd161: instruction <= 32'h01485020;
|
||||
20'd162: instruction <= 32'h8d4a0000;
|
||||
20'd163: instruction <= 32'h012a4022;
|
||||
20'd164: instruction <= 32'h19000003;
|
||||
20'd165: instruction <= 32'h2265ffff;
|
||||
20'd166: instruction <= 32'h0c00008c;
|
||||
20'd167: instruction <= 32'h080000aa;
|
||||
20'd168: instruction <= 32'h22640001;
|
||||
20'd169: instruction <= 32'h0c00008c;
|
||||
20'd170: instruction <= 32'h8fb00004;
|
||||
20'd171: instruction <= 32'h8fb10008;
|
||||
20'd172: instruction <= 32'h8fb2000c;
|
||||
20'd173: instruction <= 32'h8fb30010;
|
||||
20'd174: instruction <= 32'h8fbf0014;
|
||||
20'd175: instruction <= 32'h23bd0014;
|
||||
20'd176: instruction <= 32'h03e00008;
|
||||
20'd177: instruction <= 32'h23bdfff4;
|
||||
20'd178: instruction <= 32'hafb00004;
|
||||
20'd179: instruction <= 32'hafb10008;
|
||||
20'd180: instruction <= 32'hafbf000c;
|
||||
20'd181: instruction <= 32'h3c104000;
|
||||
20'd182: instruction <= 32'h22100064;
|
||||
20'd183: instruction <= 32'h00054080;
|
||||
20'd184: instruction <= 32'h02089020;
|
||||
20'd185: instruction <= 32'h8e520000;
|
||||
20'd186: instruction <= 32'h20b1ffff;
|
||||
20'd187: instruction <= 32'h02244022;
|
||||
20'd188: instruction <= 32'h05000006;
|
||||
20'd189: instruction <= 32'h00114080;
|
||||
20'd190: instruction <= 32'h02084020;
|
||||
20'd191: instruction <= 32'h8d090000;
|
||||
20'd192: instruction <= 32'had090004;
|
||||
20'd193: instruction <= 32'h2231ffff;
|
||||
20'd194: instruction <= 32'h080000bb;
|
||||
20'd195: instruction <= 32'h00044080;
|
||||
20'd196: instruction <= 32'h02084020;
|
||||
20'd197: instruction <= 32'had120000;
|
||||
20'd198: instruction <= 32'h8fb00004;
|
||||
20'd199: instruction <= 32'h8fb10008;
|
||||
20'd200: instruction <= 32'h8fbf000c;
|
||||
20'd201: instruction <= 32'h23bd000c;
|
||||
20'd202: instruction <= 32'h03e00008;
|
||||
419
24sort_nums_no_init_evaluation.asm
Normal file
419
24sort_nums_no_init_evaluation.asm
Normal file
@@ -0,0 +1,419 @@
|
||||
.text
|
||||
lui $s0, 0x1001
|
||||
addi $s0, $s0, 0x60
|
||||
addi $s1, $zero, 47
|
||||
sw $s1, 0($s0)
|
||||
addi $s1, $zero, 0x22c
|
||||
sw $s1, 4($s0)
|
||||
addi $s1, $zero, 0xaa4
|
||||
sw $s1, 8($s0)
|
||||
addi $s1, $zero, 0xe87
|
||||
sw $s1, 12($s0)
|
||||
addi $s1, $zero, 0xf95
|
||||
sw $s1, 16($s0)
|
||||
addi $s1, $zero, 0x124c
|
||||
sw $s1, 20($s0)
|
||||
addi $s1, $zero, 0x18d0
|
||||
sw $s1, 24($s0)
|
||||
addi $s1, $zero, 0x1a04
|
||||
sw $s1, 28($s0)
|
||||
addi $s1, $zero, 0x1c49
|
||||
sw $s1, 32($s0)
|
||||
addi $s1, $zero, 0x2137
|
||||
sw $s1, 36($s0)
|
||||
addi $s1, $zero, 0x2197
|
||||
sw $s1, 40($s0)
|
||||
addi $s1, $zero, 0x260b
|
||||
sw $s1, 44($s0)
|
||||
addi $s1, $zero, 0x2cc7
|
||||
sw $s1, 48($s0)
|
||||
addi $s1, $zero, 0x2e07
|
||||
sw $s1, 52($s0)
|
||||
addi $s1, $zero, 0x2f2b
|
||||
sw $s1, 56($s0)
|
||||
addi $s1, $zero, 0x3a27
|
||||
sw $s1, 60($s0)
|
||||
addi $s1, $zero, 0x3b9f
|
||||
sw $s1, 64($s0)
|
||||
addi $s1, $zero, 0x4227
|
||||
sw $s1, 68($s0)
|
||||
addi $s1, $zero, 0x4786
|
||||
sw $s1, 72($s0)
|
||||
addi $s1, $zero, 0x5e55
|
||||
sw $s1, 76($s0)
|
||||
addi $s1, $zero, 0x5f99
|
||||
sw $s1, 80($s0)
|
||||
addi $s1, $zero, 0x64ca
|
||||
sw $s1, 84($s0)
|
||||
addi $s1, $zero, 0x6e15
|
||||
sw $s1, 88($s0)
|
||||
addi $s1, $zero, 0x7345
|
||||
sw $s1, 92($s0)
|
||||
addi $s1, $zero, 0x76ee
|
||||
sw $s1, 96($s0)
|
||||
addi $s1, $zero, 0x7f32
|
||||
sw $s1, 100($s0)
|
||||
addi $s1, $zero, 0x8027
|
||||
sw $s1, 104($s0)
|
||||
addi $s1, $zero, 0x80be
|
||||
sw $s1, 108($s0)
|
||||
addi $s1, $zero, 0x9213
|
||||
sw $s1, 112($s0)
|
||||
addi $s1, $zero, 0x9477
|
||||
sw $s1, 116($s0)
|
||||
addi $s1, $zero, 0x9776
|
||||
sw $s1, 120($s0)
|
||||
addi $s1, $zero, 0x9d7d
|
||||
sw $s1, 124($s0)
|
||||
addi $s1, $zero, 0x9f23
|
||||
sw $s1, 128($s0)
|
||||
addi $s1, $zero, 0xa5e5
|
||||
sw $s1, 132($s0)
|
||||
addi $s1, $zero, 0xaa22
|
||||
sw $s1, 136($s0)
|
||||
addi $s1, $zero, 0xaaf5
|
||||
sw $s1, 140($s0)
|
||||
addi $s1, $zero, 0xabb3
|
||||
sw $s1, 144($s0)
|
||||
addi $s1, $zero, 0xc308
|
||||
sw $s1, 148($s0)
|
||||
addi $s1, $zero, 0xc5a5
|
||||
sw $s1, 152($s0)
|
||||
addi $s1, $zero, 0xc8c3
|
||||
sw $s1, 156($s0)
|
||||
addi $s1, $zero, 0xc94d
|
||||
sw $s1, 160($s0)
|
||||
addi $s1, $zero, 0xd87c
|
||||
sw $s1, 164($s0)
|
||||
addi $s1, $zero, 0xd9ca
|
||||
sw $s1, 168($s0)
|
||||
addi $s1, $zero, 0xe060
|
||||
sw $s1, 172($s0)
|
||||
addi $s1, $zero, 0xe08b
|
||||
sw $s1, 176($s0)
|
||||
addi $s1, $zero, 0xe0d8
|
||||
sw $s1, 180($s0)
|
||||
addi $s1, $zero, 0xe996
|
||||
sw $s1, 184($s0)
|
||||
addi $s1, $zero, 0xf7fe
|
||||
sw $s1, 188($s0)
|
||||
|
||||
# initialize $sp
|
||||
lui $sp, 0x1001
|
||||
addi $sp, $sp, 0x7fc
|
||||
|
||||
# load digit to mem
|
||||
lui $s0, 0x1001
|
||||
addi $s0, $s0, 0x20
|
||||
#0
|
||||
addi $s1, $zero, 0x3f
|
||||
sw $s1, 0($s0)
|
||||
#1
|
||||
addi $s1, $zero, 0x6
|
||||
sw $s1, 4($s0)
|
||||
#2
|
||||
addi $s1, $zero, 0x5b
|
||||
sw $s1, 8($s0)
|
||||
#3
|
||||
addi $s1, $zero, 0x4f
|
||||
sw $s1, 12($s0)
|
||||
#4
|
||||
addi $s1, $zero, 0x66
|
||||
sw $s1, 16($s0)
|
||||
#5
|
||||
addi $s1, $zero, 0x6d
|
||||
sw $s1, 20($s0)
|
||||
#6
|
||||
addi $s1, $zero, 0x7d
|
||||
sw $s1, 24($s0)
|
||||
#7
|
||||
addi $s1, $zero, 0x7
|
||||
sw $s1, 28($s0)
|
||||
#8
|
||||
addi $s1, $zero, 0x7f
|
||||
sw $s1, 32($s0)
|
||||
#9
|
||||
addi $s1, $zero, 0x6f
|
||||
sw $s1, 36($s0)
|
||||
#A
|
||||
addi $s1, $zero, 0x77
|
||||
sw $s1, 40($s0)
|
||||
#B
|
||||
addi $s1, $zero, 0x7c
|
||||
sw $s1, 44($s0)
|
||||
#C
|
||||
addi $s1, $zero, 0x58
|
||||
sw $s1, 48($s0)
|
||||
#D
|
||||
addi $s1, $zero, 0x5e
|
||||
sw $s1, 52($s0)
|
||||
#E
|
||||
addi $s1, $zero, 0x79
|
||||
sw $s1, 56($s0)
|
||||
#F
|
||||
addi $s1, $zero, 0x71
|
||||
sw $s1, 60($s0)
|
||||
|
||||
main:
|
||||
#jal disp_num_in_mem
|
||||
|
||||
lui $t0, 0x1001
|
||||
lw $a0, 0x60($t0)
|
||||
jal insertion_sort
|
||||
end:
|
||||
#jal disp_num_in_mem
|
||||
j end
|
||||
|
||||
disp_num_in_mem:
|
||||
addi $sp, $sp, -20
|
||||
sw $ra, 4($sp)
|
||||
sw $s0, 8($sp)
|
||||
sw $s1, 12($sp)
|
||||
sw $s2, 16($sp)
|
||||
sw $s3, 20($sp)
|
||||
|
||||
lui $s0, 0x1001
|
||||
# s1 = 0x10010010
|
||||
addi $s1, $s0, 0x10
|
||||
# s0 = 0x10010060
|
||||
addi $s0, $s0, 0x60
|
||||
addi $s2, $zero, 0
|
||||
# addi $s3, $zero, 20
|
||||
lw $s3, 0($s0) # s3 is the total count
|
||||
addi $s0, $s0, 4
|
||||
display_single_number:
|
||||
sll $t0, $s2, 2
|
||||
add $t0, $s0, $t0
|
||||
lw $a0, 0($t0)
|
||||
addi $a1, $s1, 0
|
||||
jal display_number
|
||||
|
||||
addi $s2, $s2, 1
|
||||
sub $t0, $s3, $s2
|
||||
bgtz $t0, display_single_number
|
||||
|
||||
|
||||
jal display_empty
|
||||
|
||||
lw $ra, 4($sp)
|
||||
lw $s0, 8($sp)
|
||||
lw $s1, 12($sp)
|
||||
lw $s2, 16($sp)
|
||||
lw $s3, 20($sp)
|
||||
addi $sp, $sp, 20
|
||||
jr $ra
|
||||
|
||||
# ------------------------------------------------------
|
||||
|
||||
# a0 is the number to be displayed, a1 is the bcd control addr
|
||||
display_number:
|
||||
addi $sp, $sp, -32
|
||||
sw $ra, 4($sp)
|
||||
sw $s0, 8($sp)
|
||||
sw $s1, 12($sp)
|
||||
sw $s2, 16($sp)
|
||||
sw $s3, 20($sp)
|
||||
sw $s4, 24($sp)
|
||||
sw $s5, 28($sp)
|
||||
sw $s6, 32($sp)
|
||||
|
||||
# s0 is the number to be displayed
|
||||
addi $s0, $a0, 0
|
||||
|
||||
# s1 is the bcd_control addr
|
||||
addi $s1, $a1, 0
|
||||
|
||||
# s2 is the base addr for display digit
|
||||
lui $s2, 0x1001
|
||||
addi $s2, $s2, 0x20
|
||||
|
||||
# s3 is the counter for a complete scan of 4 digit
|
||||
# addi $s3, $zero, 0x17c4
|
||||
addi $s3, $zero, 0xbe2
|
||||
all_digit_scan_loop:
|
||||
# s4 is the num being shifted gradually
|
||||
addi $s4, $s0, 0
|
||||
# s6 is the enable digit
|
||||
addi $s6, $zero, 0x100
|
||||
|
||||
addi $s5, $zero, 4
|
||||
single_digit_loop:
|
||||
# get a digit
|
||||
andi $t0, $s4, 0xf
|
||||
# digit * 4 is the memory shift
|
||||
sll $t0, $t0, 2
|
||||
add $t0, $s2, $t0
|
||||
lw $t0, 0($t0)
|
||||
or $t0, $t0, $s6
|
||||
sw $t0, 0($s1)
|
||||
|
||||
srl $s4, $s4, 4
|
||||
sll $s6, $s6, 1
|
||||
|
||||
addi $t0, $zero, 0x400
|
||||
wait_time_loop:
|
||||
addi $t0, $t0, -1
|
||||
bgtz $t0, wait_time_loop
|
||||
|
||||
addi $s5, $s5, -1
|
||||
bgtz $s5, single_digit_loop
|
||||
# end of single digit loop
|
||||
|
||||
# ** depends on the clock **
|
||||
# four digit, 328.68us.
|
||||
# 1s / 328.68us = 3042 = (be2)hex
|
||||
|
||||
addi $s3, $s3, -1
|
||||
bgtz $s3, all_digit_scan_loop
|
||||
|
||||
lw $ra, 4($sp)
|
||||
lw $s0, 8($sp)
|
||||
lw $s1, 12($sp)
|
||||
lw $s2, 16($sp)
|
||||
lw $s3, 20($sp)
|
||||
lw $s4, 24($sp)
|
||||
lw $s5, 28($sp)
|
||||
lw $s6, 32($sp)
|
||||
addi $sp, $sp, 32
|
||||
jr $ra
|
||||
|
||||
display_empty:
|
||||
lui $t0, 0x1001
|
||||
addi $t0, $t0, 0x10
|
||||
sw $zero, 0($t0)
|
||||
|
||||
lui $t0, 0x100
|
||||
display_empty_wait_loop:
|
||||
addi $t0, $t0, -1
|
||||
bgtz $t0, display_empty_wait_loop
|
||||
jr $ra
|
||||
|
||||
# a0 is the total number of numbers needed to be sorted
|
||||
insertion_sort:
|
||||
addi $sp, $sp, -12
|
||||
sw $ra, 4($sp)
|
||||
sw $s0, 8($sp)
|
||||
sw $s1, 12($sp)
|
||||
|
||||
# la $t0, num_N
|
||||
# lw $s0, 0($t0) # n in s0
|
||||
addi $s0, $a0, 0
|
||||
|
||||
# li $s1, 1 # i in s1
|
||||
addi $s1, $zero, 1
|
||||
item_loop:
|
||||
# bge $s1, $s0, done_item_loop # if i >= n, done loop
|
||||
sub $t0, $s0, $s1
|
||||
blez $t0, done_item_loop
|
||||
|
||||
li $a0, 0
|
||||
addi $a1, $s1, -1
|
||||
move $a2, $s1
|
||||
jal binary_search
|
||||
|
||||
move $a0, $v0
|
||||
move $a1, $s1
|
||||
jal insert
|
||||
|
||||
addi $s1, $s1, 1 # i ++
|
||||
j item_loop
|
||||
done_item_loop:
|
||||
|
||||
lw $ra, 4($sp)
|
||||
lw $s0, 8($sp)
|
||||
lw $s1, 12($sp)
|
||||
addi $sp, $sp, 12
|
||||
jr $ra
|
||||
|
||||
binary_search: # a0: left, a1: right, a2: i
|
||||
addi $sp, $sp, -20
|
||||
sw $s0, 4($sp)
|
||||
sw $s1, 8($sp)
|
||||
sw $s2, 12($sp)
|
||||
sw $s3, 16($sp)
|
||||
sw $ra, 20($sp)
|
||||
|
||||
# ble $a0, $a1, in_boundary_binary_search # left <= right, in normal position
|
||||
sub $t0, $a0, $a1
|
||||
blez $t0, in_boundary_binary_search
|
||||
|
||||
# move $v0, $a0 # now in boundary condition
|
||||
add $v0, $a0, $zero
|
||||
|
||||
j done_binary_search
|
||||
|
||||
in_boundary_binary_search:
|
||||
move $s0, $a0 # in normal situation
|
||||
move $s1, $a1
|
||||
move $s2, $a2
|
||||
add $s3, $s0, $s1 # s3 = mid = (left + right) >> 1
|
||||
srl $s3, $s3, 1
|
||||
# jal add_compare_count
|
||||
|
||||
# la $t0, num_buff
|
||||
lui $t0, 0x1001
|
||||
addi $t0, $t0, 0x64
|
||||
|
||||
sll $t1, $s3, 2
|
||||
add $t1, $t1, $t0
|
||||
lw $t1, 0($t1) # t1 = v[mid]
|
||||
sll $t2, $s2, 2
|
||||
add $t2, $t2, $t0
|
||||
lw $t2, 0($t2) # t2 = v[n]
|
||||
# ble $t1, $t2, binary_search_right # v[mid] <= v[n], jump to 'else'
|
||||
sub $t0, $t1, $t2
|
||||
blez $t0, binary_search_right
|
||||
binary_search_left:
|
||||
addi $a1, $s3, -1
|
||||
jal binary_search
|
||||
j done_binary_search
|
||||
binary_search_right:
|
||||
addi $a0, $s3, 1
|
||||
jal binary_search
|
||||
done_binary_search:
|
||||
lw $s0, 4($sp)
|
||||
lw $s1, 8($sp)
|
||||
lw $s2, 12($sp)
|
||||
lw $s3, 16($sp)
|
||||
lw $ra, 20($sp)
|
||||
addi $sp, $sp, 20
|
||||
jr $ra
|
||||
|
||||
insert: # $a0: int k, $a1: int n
|
||||
addi $sp, $sp, -12
|
||||
sw $s0, 4($sp)
|
||||
sw $s1, 8($sp)
|
||||
sw $ra, 12($sp)
|
||||
|
||||
# la $s0, num_buff # s0 = &v[0]
|
||||
lui $s0, 0x1001
|
||||
addi $s0, $s0, 0x64
|
||||
|
||||
sll $t0, $a1, 2
|
||||
add $s2, $s0, $t0
|
||||
lw $s2, 0($s2) # s2 = tmp = 'pivot' = v[n]
|
||||
|
||||
addi $s1, $a1, -1 # s1 = i = n - 1
|
||||
|
||||
insert_loop:
|
||||
# blt $s1, $a0, done_insert_loop # i < k, done loop
|
||||
sub $t0, $s1, $a0
|
||||
bltz $t0, done_insert_loop
|
||||
|
||||
sll $t0, $s1, 2
|
||||
add $t0, $s0, $t0 # t0 = &v[i]
|
||||
lw $t1, 0($t0)
|
||||
sw $t1, 4($t0)
|
||||
|
||||
addi $s1, $s1, -1 # i--
|
||||
j insert_loop
|
||||
done_insert_loop:
|
||||
sll $t0, $a0, 2
|
||||
add $t0, $s0, $t0
|
||||
sw $s2, 0($t0) # t0 = &v[k]
|
||||
|
||||
lw $s0, 4($sp)
|
||||
lw $s1, 8($sp)
|
||||
lw $ra, 12($sp)
|
||||
addi $sp, $sp, 12
|
||||
jr $ra
|
||||
203
24sort_nums_no_init_mars.txt
Normal file
203
24sort_nums_no_init_mars.txt
Normal file
@@ -0,0 +1,203 @@
|
||||
3c1d4000
|
||||
23bd07fc
|
||||
3c104000
|
||||
22100020
|
||||
2011003f
|
||||
ae110000
|
||||
20110006
|
||||
ae110004
|
||||
2011005b
|
||||
ae110008
|
||||
2011004f
|
||||
ae11000c
|
||||
20110066
|
||||
ae110010
|
||||
2011006d
|
||||
ae110014
|
||||
2011007d
|
||||
ae110018
|
||||
20110007
|
||||
ae11001c
|
||||
2011007f
|
||||
ae110020
|
||||
2011006f
|
||||
ae110024
|
||||
20110077
|
||||
ae110028
|
||||
2011007c
|
||||
ae11002c
|
||||
20110058
|
||||
ae110030
|
||||
2011005e
|
||||
ae110034
|
||||
20110079
|
||||
ae110038
|
||||
20110071
|
||||
ae11003c
|
||||
3c084000
|
||||
8d040060
|
||||
0c000076
|
||||
0c000029
|
||||
08000027
|
||||
23bdffec
|
||||
afbf0004
|
||||
afb00008
|
||||
afb1000c
|
||||
afb20010
|
||||
afb30014
|
||||
3c104000
|
||||
22110010
|
||||
22100060
|
||||
20120000
|
||||
8e130000
|
||||
22100004
|
||||
00124080
|
||||
02084020
|
||||
8d040000
|
||||
22250000
|
||||
0c000045
|
||||
22520001
|
||||
02724022
|
||||
1d00fff8
|
||||
0c00006f
|
||||
8fbf0004
|
||||
8fb00008
|
||||
8fb1000c
|
||||
8fb20010
|
||||
8fb30014
|
||||
23bd0014
|
||||
03e00008
|
||||
23bdffe0
|
||||
afbf0004
|
||||
afb00008
|
||||
afb1000c
|
||||
afb20010
|
||||
afb30014
|
||||
afb40018
|
||||
afb5001c
|
||||
afb60020
|
||||
20900000
|
||||
20b10000
|
||||
3c124000
|
||||
22520020
|
||||
20130be2
|
||||
22140000
|
||||
20160100
|
||||
20150004
|
||||
3288000f
|
||||
00084080
|
||||
02484020
|
||||
8d080000
|
||||
01164025
|
||||
ae280000
|
||||
0014a102
|
||||
0016b040
|
||||
20080400
|
||||
2108ffff
|
||||
1d00fffe
|
||||
22b5ffff
|
||||
1ea0fff3
|
||||
2273ffff
|
||||
1e60ffee
|
||||
8fbf0004
|
||||
8fb00008
|
||||
8fb1000c
|
||||
8fb20010
|
||||
8fb30014
|
||||
8fb40018
|
||||
8fb5001c
|
||||
8fb60020
|
||||
23bd0020
|
||||
03e00008
|
||||
3c084000
|
||||
21080010
|
||||
ad000000
|
||||
3c080100
|
||||
2108ffff
|
||||
1d00fffe
|
||||
03e00008
|
||||
23bdfff4
|
||||
afbf0004
|
||||
afb00008
|
||||
afb1000c
|
||||
20900000
|
||||
20110001
|
||||
02114022
|
||||
19000009
|
||||
24040000
|
||||
2225ffff
|
||||
00113021
|
||||
0c00008c
|
||||
00022021
|
||||
00112821
|
||||
0c0000b1
|
||||
22310001
|
||||
0800007c
|
||||
8fbf0004
|
||||
8fb00008
|
||||
8fb1000c
|
||||
23bd000c
|
||||
03e00008
|
||||
23bdffec
|
||||
afb00004
|
||||
afb10008
|
||||
afb2000c
|
||||
afb30010
|
||||
afbf0014
|
||||
00854022
|
||||
19000002
|
||||
00801020
|
||||
080000aa
|
||||
00048021
|
||||
00058821
|
||||
00069021
|
||||
02119820
|
||||
00139842
|
||||
3c084000
|
||||
21080064
|
||||
00134880
|
||||
01284820
|
||||
8d290000
|
||||
00125080
|
||||
01485020
|
||||
8d4a0000
|
||||
012a4022
|
||||
19000003
|
||||
2265ffff
|
||||
0c00008c
|
||||
080000aa
|
||||
22640001
|
||||
0c00008c
|
||||
8fb00004
|
||||
8fb10008
|
||||
8fb2000c
|
||||
8fb30010
|
||||
8fbf0014
|
||||
23bd0014
|
||||
03e00008
|
||||
23bdfff4
|
||||
afb00004
|
||||
afb10008
|
||||
afbf000c
|
||||
3c104000
|
||||
22100064
|
||||
00054080
|
||||
02089020
|
||||
8e520000
|
||||
20b1ffff
|
||||
02244022
|
||||
05000006
|
||||
00114080
|
||||
02084020
|
||||
8d090000
|
||||
ad090004
|
||||
2231ffff
|
||||
080000bb
|
||||
00044080
|
||||
02084020
|
||||
ad120000
|
||||
8fb00004
|
||||
8fb10008
|
||||
8fbf000c
|
||||
23bd000c
|
||||
03e00008
|
||||
35
Signals.md
Normal file
35
Signals.md
Normal file
@@ -0,0 +1,35 @@
|
||||
| | `PCJump` | `IsBranch` | `IsLoadWord` | `Writera` | `raAddrSrc` | `RegWr` | `WBSrc` | `MemWrite` | `ALUFunct` | `ALUSrc1` | `ALUSrc2` | `RegWriteDstSrc` | `ExtOp` | Opcode(hex) | Funct(hex) |
|
||||
| ------: | :------: | :--------: | :----------: | :-------: | :---------: | :-----: | :-----: | :--------: | :---------------: | :-------: | :-------: | :--------------: | :------------: | :---------: | :--------: |
|
||||
| `lw` | 00 | 0 | 1 | 0 | X | 1 | 1 | 0 | add(`00010`)2 | 0 | 1 | 0 | signed(`00`) | 23 | - |
|
||||
| `sw` | 00 | 0 | 0 | 0 | X | 0 | X | 1 | add(`00010`)2 | 0 | 1 | X | signed(`00`) | 2b | - |
|
||||
| `lui` | 00 | 0 | 0 | 0 | X | 1 | 0 | 0 | add(`00010`)2 | 0 | 1 | 0 | lui(`1X`) | f | - |
|
||||
| `add` | 00 | 0 | 0 | 0 | X | 1 | 0 | 0 | add(`00010`)2 | 0 | 0 | 1 | X | 0 | 20 |
|
||||
| `addu` | 00 | 0 | 0 | 0 | X | 1 | 0 | 0 | add(`00010`)2 | 0 | 0 | 1 | X | 0 | 21 |
|
||||
| `sub` | 00 | 0 | 0 | 0 | X | 1 | 0 | 0 | sub(`00110`)6 | 0 | 0 | 1 | X | 0 | 22 |
|
||||
| `subu` | 00 | 0 | 0 | 0 | X | 1 | 0 | 0 | sub(`00110`)6 | 0 | 0 | 1 | X | 0 | 23 |
|
||||
| `addi` | 00 | 0 | 0 | 0 | X | 1 | 0 | 0 | add(`00010`)2 | 0 | 1 | 0 | signed(`00`) | 8 | - |
|
||||
| `addiu` | 00 | 0 | 0 | 0 | X | 1 | 0 | 0 | add(`00010`)2 | 0 | 1 | 0 | signed(`00`) | 9 | - |
|
||||
| `mul` | 00 | 0 | 0 | 0 | X | 1 | 0 | 0 | mul(`11010`)26 | 0 | 0 | 1 | X | 0 | 18 |
|
||||
| `and` | 00 | 0 | 0 | 0 | X | 1 | 0 | 0 | and(`00000`)0 | 0 | 0 | 1 | X | 0 | 24 |
|
||||
| `or` | 00 | 0 | 0 | 0 | X | 1 | 0 | 0 | or(`00001`)1 | 0 | 0 | 1 | X | 0 | 25 |
|
||||
| `xor` | 00 | 0 | 0 | 0 | X | 1 | 0 | 0 | xor(`01101`)13 | 0 | 0 | 1 | X | 0 | 26 |
|
||||
| `nor` | 00 | 0 | 0 | 0 | X | 1 | 0 | 0 | nor(`01100`)12 | 0 | 0 | 1 | X | 0 | 27 |
|
||||
| `andi` | 00 | 0 | 0 | 0 | X | 1 | 0 | 0 | and(`00000`)0 | 0 | 1 | 0 | unsigned(`01`) | c | - |
|
||||
| `ori` | 00 | 0 | 0 | 0 | X | 1 | 0 | 0 | or(`00001`)1 | 0 | 1 | 0 | unsigned(`01`) | d | - |
|
||||
| `sll` | 00 | 0 | 0 | 0 | X | 1 | 0 | 0 | sll(`10000`)16 | 1 | 0 | 1 | X | 0 | 00 |
|
||||
| `srl` | 00 | 0 | 0 | 0 | X | 1 | 0 | 0 | srl(`11000`)24 | 1 | 0 | 1 | X | 0 | 02 |
|
||||
| `sra` | 00 | 0 | 0 | 0 | X | 1 | 0 | 0 | sra(`11001`)25 | 1 | 0 | 1 | X | 0 | 03 |
|
||||
| `slt` | 00 | 0 | 0 | 0 | X | 1 | 0 | 0 | slt(`00111`)7 | 0 | 0 | 1 | X | 0 | 2a |
|
||||
| `sltu` | 00 | 0 | 0 | 0 | X | 1 | 0 | 0 | sltu(`01000`)8 | 0 | 0 | 1 | X | 0 | 2b |
|
||||
| `slti` | 00 | 0 | 0 | 0 | X | 1 | 0 | 0 | slt(`00111`)7 | 0 | 1 | 0 | signed(`00`) | a | - |
|
||||
| `sltiu` | 00 | 0 | 0 | 0 | X | 1 | 0 | 0 | sltu(`01000`)8 | 0 | 1 | 0 | signed(`00`) | b | - |
|
||||
| `beq` | 00 | 1 | 0 | 0 | X | 0 | X | 0 | eq(`10001`)17 | 0 | 0 | X | X | 4 | - |
|
||||
| `bne` | 00 | 1 | 0 | 0 | X | 0 | X | 0 | neq(`10010`)18 | 0 | 0 | X | X | 5 | - |
|
||||
| `blez` | 00 | 1 | 0 | 0 | X | 0 | X | 0 | le/ngt(`10101`)21 | 0 | 0 | X | X | 6 | - |
|
||||
| `bgtz` | 00 | 1 | 0 | 0 | X | 0 | X | 0 | gt(`10011`)19 | 0 | 0 | X | X | 7 | - |
|
||||
| `bltz` | 00 | 1 | 0 | 0 | X | 0 | X | 0 | lt(`10100`)20 | 0 | 0 | X | X | 1 | - |
|
||||
| `j` | 01 | 0 | 0 | 0 | X | 0 | X | 0 | X | X | X | X | X | 2 | - |
|
||||
| `jal` | 01 | 0 | 0 | 1 | 0 | 0 | X | 0 | X | X | X | X | X | 3 | - |
|
||||
| `jr` | 1X | 0 | 0 | 0 | X | 0 | X | 0 | X | X | X | X | X | 0 | 08 |
|
||||
| `jalr` | 1X | 0 | 0 | 1 | 1 | 0 | X | 0 | X | X | X | X | X | 0 | 09 |
|
||||
| `nop` | 00 | 0 | 0 | 0 | X | 0 | X | 0 | X | X | X | X | X | 0 | 00 |
|
||||
139
create_random_num.py
Normal file
139
create_random_num.py
Normal file
@@ -0,0 +1,139 @@
|
||||
import random
|
||||
|
||||
total_count = random.randint(5, 50)
|
||||
total_count = 20
|
||||
# total_count = 47
|
||||
# total_count = 20
|
||||
numbers = list()
|
||||
|
||||
for _ in range(total_count):
|
||||
numbers.append(random.randint(0, 65535))
|
||||
|
||||
numbers = [
|
||||
0x41A8,
|
||||
0x3AF2,
|
||||
0xACDA,
|
||||
0xC0B2,
|
||||
0xB783,
|
||||
0xDAC9,
|
||||
0x8ED9,
|
||||
0x9FF,
|
||||
0x2F44,
|
||||
0x44E,
|
||||
0x9899,
|
||||
0x3C56,
|
||||
0x128D,
|
||||
0xDBE3,
|
||||
0xD4B4,
|
||||
0x3748,
|
||||
0x3918,
|
||||
0x4112,
|
||||
0xC399,
|
||||
0x4955
|
||||
]
|
||||
|
||||
# numbers = [
|
||||
# 0x4B8D,
|
||||
# 0x2307,
|
||||
# 0xFAE0,
|
||||
# 0x7815,
|
||||
# 0xC105,
|
||||
# 0x84F0,
|
||||
# 0xDB6,
|
||||
# 0xF21D,
|
||||
# 0xE97A,
|
||||
# 0xA3B6,
|
||||
# 0x8466,
|
||||
# 0x3A25,
|
||||
# 0x5DF,
|
||||
# 0xD2DE,
|
||||
# 0xBA7A,
|
||||
# 0x7809,
|
||||
# 0xF6A8,
|
||||
# 0x361D,
|
||||
# 0x3ADB,
|
||||
# 0x969A,
|
||||
# ]
|
||||
|
||||
# numbers = [
|
||||
# 0x022C,
|
||||
# 0x0AA4,
|
||||
# 0x0E87,
|
||||
# 0x0F95,
|
||||
# 0x124C,
|
||||
# 0x18D0,
|
||||
# 0x1A04,
|
||||
# 0x1C49,
|
||||
# 0x2137,
|
||||
# 0x2197,
|
||||
# 0x260B,
|
||||
# 0x2CC7,
|
||||
# 0x2E07,
|
||||
# 0x2F2B,
|
||||
# 0x3A27,
|
||||
# 0x3B9F,
|
||||
# 0x4227,
|
||||
# 0x4786,
|
||||
# 0x5E55,
|
||||
# 0x5F99,
|
||||
# 0x64CA,
|
||||
# 0x6E15,
|
||||
# 0x7345,
|
||||
# 0x76EE,
|
||||
# 0x7F32,
|
||||
# 0x8027,
|
||||
# 0x80BE,
|
||||
# 0x9213,
|
||||
# 0x9477,
|
||||
# 0x9776,
|
||||
# 0x9D7D,
|
||||
# 0x9F23,
|
||||
# 0xA5E5,
|
||||
# 0xAA22,
|
||||
# 0xAAF5,
|
||||
# 0xABB3,
|
||||
# 0xC308,
|
||||
# 0xC5A5,
|
||||
# 0xC8C3,
|
||||
# 0xC94D,
|
||||
# 0xD87C,
|
||||
# 0xD9CA,
|
||||
# 0xE060,
|
||||
# 0xE08B,
|
||||
# 0xE0D8,
|
||||
# 0xE996,
|
||||
# 0xF7FE,
|
||||
# ]
|
||||
|
||||
with open("gen_num.txt", "w") as fl:
|
||||
fl.writelines(["0x%04X\n" % x for x in numbers])
|
||||
|
||||
with open("gen_num_asm.txt", "w") as fl:
|
||||
fl.write(
|
||||
"""lui $s0, 0x4000\naddi $s0, $s0, 0x60\naddi $s1, $zero, %d\nsw $s1, 0($s0)\n"""
|
||||
% (total_count)
|
||||
)
|
||||
for idx, num in enumerate(numbers):
|
||||
fl.write("addi $s1, $zero, %s\nsw $s1, %d($s0)\n" % (hex(num), 4 * (idx + 1)))
|
||||
|
||||
with open("gen_num_data_mem.txt", "w") as fl:
|
||||
fl.write(
|
||||
"""for (i = StartAddressInWord; i < 24 + StartAddressInWord; i = i + 1) begin
|
||||
memory_data[i] <= 32'h00000000;
|
||||
end
|
||||
for (
|
||||
i = %d + StartAddressInWord; i < MEM_SIZE_IN_WORD + StartAddressInWord; i = i + 1
|
||||
) begin
|
||||
memory_data[i] <= 32'h00000000;
|
||||
end
|
||||
"""
|
||||
% (24 + total_count + 1)
|
||||
)
|
||||
fl.write("memory_data[StartAddressInWord + 24] <= 32'h%08X;\n" % total_count)
|
||||
for idx, num in enumerate(numbers):
|
||||
fl.write(
|
||||
"memory_data[StartAddressInWord + %d] <= 32'h%08X;\n" % (idx + 25, num)
|
||||
)
|
||||
|
||||
with open("gen_num_sorted.txt", "w") as fl:
|
||||
fl.writelines(["0x%04X\n" % x for x in sorted(numbers)])
|
||||
20
gen_num.txt
Normal file
20
gen_num.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
0x41A8
|
||||
0x3AF2
|
||||
0xACDA
|
||||
0xC0B2
|
||||
0xB783
|
||||
0xDAC9
|
||||
0x8ED9
|
||||
0x09FF
|
||||
0x2F44
|
||||
0x044E
|
||||
0x9899
|
||||
0x3C56
|
||||
0x128D
|
||||
0xDBE3
|
||||
0xD4B4
|
||||
0x3748
|
||||
0x3918
|
||||
0x4112
|
||||
0xC399
|
||||
0x4955
|
||||
44
gen_num_asm.txt
Normal file
44
gen_num_asm.txt
Normal file
@@ -0,0 +1,44 @@
|
||||
lui $s0, 0x4000
|
||||
addi $s0, $s0, 0x60
|
||||
addi $s1, $zero, 20
|
||||
sw $s1, 0($s0)
|
||||
addi $s1, $zero, 0x41a8
|
||||
sw $s1, 4($s0)
|
||||
addi $s1, $zero, 0x3af2
|
||||
sw $s1, 8($s0)
|
||||
addi $s1, $zero, 0xacda
|
||||
sw $s1, 12($s0)
|
||||
addi $s1, $zero, 0xc0b2
|
||||
sw $s1, 16($s0)
|
||||
addi $s1, $zero, 0xb783
|
||||
sw $s1, 20($s0)
|
||||
addi $s1, $zero, 0xdac9
|
||||
sw $s1, 24($s0)
|
||||
addi $s1, $zero, 0x8ed9
|
||||
sw $s1, 28($s0)
|
||||
addi $s1, $zero, 0x9ff
|
||||
sw $s1, 32($s0)
|
||||
addi $s1, $zero, 0x2f44
|
||||
sw $s1, 36($s0)
|
||||
addi $s1, $zero, 0x44e
|
||||
sw $s1, 40($s0)
|
||||
addi $s1, $zero, 0x9899
|
||||
sw $s1, 44($s0)
|
||||
addi $s1, $zero, 0x3c56
|
||||
sw $s1, 48($s0)
|
||||
addi $s1, $zero, 0x128d
|
||||
sw $s1, 52($s0)
|
||||
addi $s1, $zero, 0xdbe3
|
||||
sw $s1, 56($s0)
|
||||
addi $s1, $zero, 0xd4b4
|
||||
sw $s1, 60($s0)
|
||||
addi $s1, $zero, 0x3748
|
||||
sw $s1, 64($s0)
|
||||
addi $s1, $zero, 0x3918
|
||||
sw $s1, 68($s0)
|
||||
addi $s1, $zero, 0x4112
|
||||
sw $s1, 72($s0)
|
||||
addi $s1, $zero, 0xc399
|
||||
sw $s1, 76($s0)
|
||||
addi $s1, $zero, 0x4955
|
||||
sw $s1, 80($s0)
|
||||
29
gen_num_data_mem.txt
Normal file
29
gen_num_data_mem.txt
Normal file
@@ -0,0 +1,29 @@
|
||||
for (i = StartAddressInWord; i < 24 + StartAddressInWord; i = i + 1) begin
|
||||
memory_data[i] <= 32'h00000000;
|
||||
end
|
||||
for (
|
||||
i = 45 + StartAddressInWord; i < MEM_SIZE_IN_WORD + StartAddressInWord; i = i + 1
|
||||
) begin
|
||||
memory_data[i] <= 32'h00000000;
|
||||
end
|
||||
memory_data[StartAddressInWord + 24] <= 32'h00000014;
|
||||
memory_data[StartAddressInWord + 25] <= 32'h000041A8;
|
||||
memory_data[StartAddressInWord + 26] <= 32'h00003AF2;
|
||||
memory_data[StartAddressInWord + 27] <= 32'h0000ACDA;
|
||||
memory_data[StartAddressInWord + 28] <= 32'h0000C0B2;
|
||||
memory_data[StartAddressInWord + 29] <= 32'h0000B783;
|
||||
memory_data[StartAddressInWord + 30] <= 32'h0000DAC9;
|
||||
memory_data[StartAddressInWord + 31] <= 32'h00008ED9;
|
||||
memory_data[StartAddressInWord + 32] <= 32'h000009FF;
|
||||
memory_data[StartAddressInWord + 33] <= 32'h00002F44;
|
||||
memory_data[StartAddressInWord + 34] <= 32'h0000044E;
|
||||
memory_data[StartAddressInWord + 35] <= 32'h00009899;
|
||||
memory_data[StartAddressInWord + 36] <= 32'h00003C56;
|
||||
memory_data[StartAddressInWord + 37] <= 32'h0000128D;
|
||||
memory_data[StartAddressInWord + 38] <= 32'h0000DBE3;
|
||||
memory_data[StartAddressInWord + 39] <= 32'h0000D4B4;
|
||||
memory_data[StartAddressInWord + 40] <= 32'h00003748;
|
||||
memory_data[StartAddressInWord + 41] <= 32'h00003918;
|
||||
memory_data[StartAddressInWord + 42] <= 32'h00004112;
|
||||
memory_data[StartAddressInWord + 43] <= 32'h0000C399;
|
||||
memory_data[StartAddressInWord + 44] <= 32'h00004955;
|
||||
20
gen_num_sorted.txt
Normal file
20
gen_num_sorted.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
0x044E
|
||||
0x09FF
|
||||
0x128D
|
||||
0x2F44
|
||||
0x3748
|
||||
0x3918
|
||||
0x3AF2
|
||||
0x3C56
|
||||
0x4112
|
||||
0x41A8
|
||||
0x4955
|
||||
0x8ED9
|
||||
0x9899
|
||||
0xACDA
|
||||
0xB783
|
||||
0xC0B2
|
||||
0xC399
|
||||
0xD4B4
|
||||
0xDAC9
|
||||
0xDBE3
|
||||
Reference in New Issue
Block a user