Files
vhdl/lib/CPUs/MIPS/sim/asm/fibonacci.s
jens cd2640e9c6 Initial revision
Committed on the Free edition of March Hare Software CVSNT Server.
Upgrade to CVS Suite for more features and support:
http://march-hare.com/cvsnt/


git-svn-id: http://moon:8086/svn/vhdl/trunk@986 cc03376c-175c-47c8-b038-4cd826a8556b
2013-07-24 18:13:16 +00:00

556 lines
7.6 KiB
ArmAsm

.file 1 "fibonacci.c"
.set nobopt
.text
.align 2
.globl fibonacci
.ent fibonacci
fibonacci:
.frame $sp,0,$31 # vars= 0, regs= 0/0, args= 0, gp= 0
.mask 0x00000000,0
.fmask 0x00000000,0
li $8,2 # 0x2
slt $2,$8,$7
sw $4,0($6)
.set noreorder
.set nomacro
beq $2,$0,$L7
sw $5,4($6)
.set macro
.set reorder
addiu $6,$6,8
$L5:
lw $2,-8($6)
lw $3,-4($6)
addiu $8,$8,1
addu $2,$2,$3
slt $4,$8,$7
sw $2,0($6)
.set noreorder
.set nomacro
bne $4,$0,$L5
addiu $6,$6,4
.set macro
.set reorder
$L7:
.set noreorder
.set nomacro
j $31
move $2,$8
.set macro
.set reorder
.end fibonacci
.align 2
.globl test_func
.ent test_func
test_func:
.frame $sp,0,$31 # vars= 0, regs= 0/0, args= 0, gp= 0
.mask 0x00000000,0
.fmask 0x00000000,0
lbu $2,7($4)
lbu $3,6($4)
sll $2,$2,8
or $2,$2,$3
sll $2,$2,16
sra $2,$2,16
li $3,-2147483648 # 0xffffffff80000000
.set noreorder
.set nomacro
j $31
sw $2,0($3)
.set macro
.set reorder
.end test_func
.align 2
.globl sein
.ent sein
sein:
.frame $sp,0,$31 # vars= 0, regs= 0/0, args= 0, gp= 0
.mask 0x00000000,0
.fmask 0x00000000,0
li $2,-2147483648 # 0xffffffff80000000
ori $4,$2,0x4
ori $3,$2,0x8
$L11:
lbu $2,0($3)
andi $2,$2,0x10
beq $2,$0,$L11
lbu $2,0($4)
sll $2,$2,24
.set noreorder
.set nomacro
j $31
sra $2,$2,24
.set macro
.set reorder
.end sein
.align 2
.globl saus
.ent saus
saus:
.frame $sp,0,$31 # vars= 0, regs= 0/0, args= 0, gp= 0
.mask 0x00000000,0
.fmask 0x00000000,0
li $2,-2147483648 # 0xffffffff80000000
sll $4,$4,24
sra $4,$4,24
ori $5,$2,0x4
ori $3,$2,0x8
$L14:
lbu $2,0($3)
andi $2,$2,0x2
bne $2,$0,$L14
sb $4,0($5)
j $31
.end saus
.align 2
.globl sputs
.ent sputs
sputs:
.frame $sp,32,$31 # vars= 0, regs= 3/0, args= 16, gp= 0
.mask 0x80030000,-8
.fmask 0x00000000,0
addiu $sp,$sp,-32
sw $17,20($sp)
sw $16,16($sp)
sw $31,24($sp)
move $16,$4
lb $4,0($4)
.set noreorder
.set nomacro
j $L22
move $17,$16
.set macro
.set reorder
$L23:
.set noreorder
.set nomacro
jal saus
addiu $16,$16,1
.set macro
.set reorder
lb $4,0($16)
$L22:
.set noreorder
.set nomacro
bne $4,$0,$L23
subu $2,$16,$17
.set macro
.set reorder
lw $31,24($sp)
lw $17,20($sp)
lw $16,16($sp)
.set noreorder
.set nomacro
j $31
addiu $sp,$sp,32
.set macro
.set reorder
.end sputs
.align 2
.globl print_word
.ent print_word
print_word:
.frame $sp,32,$31 # vars= 0, regs= 3/0, args= 16, gp= 0
.mask 0x80030000,-8
.fmask 0x00000000,0
addiu $sp,$sp,-32
sw $17,20($sp)
sw $16,16($sp)
sw $31,24($sp)
move $16,$4
li $17,7 # 0x7
srl $3,$16,28
$L33:
sltu $2,$3,10
addiu $17,$17,-1
sll $16,$16,4
.set noreorder
.set nomacro
bne $2,$0,$L29
addiu $4,$3,48
.set macro
.set reorder
addiu $4,$3,55
$L29:
jal saus
.set noreorder
.set nomacro
bgez $17,$L33
srl $3,$16,28
.set macro
.set reorder
lw $31,24($sp)
lw $17,20($sp)
lw $16,16($sp)
.set noreorder
.set nomacro
j $31
addiu $sp,$sp,32
.set macro
.set reorder
.end print_word
.section .sdata,"aw",@progbits
.align 2
$LC0:
.word 305419896
.word 1431677610
.section .rodata.str1.4,"aMS",@progbits,1
.align 2
$LC2:
.ascii "MIPS R3000 CPU\r\n"
.ascii "Ready\r\n\000"
.section .sdata
.align 2
$LC1:
.byte 13
.4byte -10862655
.byte 30
.half 3847
.text
.align 2
.globl main
.ent main
main:
.frame $sp,536,$31 # vars= 480, regs= 10/0, args= 16, gp= 0
.mask 0xc0ff0000,-4
.fmask 0x00000000,0
lw $2,$LC0
addiu $sp,$sp,-536
lw $3,$LC0+4
sw $2,416($sp)
lw $2,$LC2
lwl $4,$LC1+3
lwl $5,$LC1+7
sw $3,420($sp)
sw $2,432($sp)
lw $3,$LC2+4
lw $2,$LC2+8
lwr $5,$LC1+4
lwr $4,$LC1
sw $3,436($sp)
sw $2,440($sp)
lw $3,$LC2+12
lw $2,$LC2+16
sw $31,532($sp)
sw $5,428($sp)
sw $23,524($sp)
sw $22,520($sp)
sw $21,516($sp)
sw $20,512($sp)
sw $18,504($sp)
sw $17,500($sp)
sw $16,496($sp)
sw $4,424($sp)
sw $3,444($sp)
sw $fp,528($sp)
sw $19,508($sp)
sw $2,448($sp)
lw $3,$LC2+20
li $23,-2147483648 # 0xffffffff80000000
ori $7,$23,0x9
sw $3,452($sp)
ori $6,$23,0x8
li $3,85
addiu $16,$sp,432
li $2,53
sb $2,0($7)
move $4,$16
sb $3,0($6)
li $2,-1431699456 # 0xffffffffaaaa0000
sw $0,456($sp)
sw $0,460($sp)
sw $0,464($sp)
sw $0,468($sp)
sw $0,472($sp)
sw $0,476($sp)
sw $0,480($sp)
sw $0,484($sp)
ori $20,$2,0xaaaa
.set noreorder
.set nomacro
jal strlen
addiu $18,$sp,456
.set macro
.set reorder
move $6,$2
move $5,$16
.set noreorder
.set nomacro
jal memcpy
move $4,$18
.set macro
.set reorder
li $4,426770432 # 0x19700000
.set noreorder
.set nomacro
jal srand
ori $4,$4,0x1031
.set macro
.set reorder
move $22,$0
move $17,$0
addiu $21,$sp,16
$L38:
addu $16,$21,$17
.set noreorder
.set nomacro
jal sein
addiu $17,$17,1
.set macro
.set reorder
sltu $3,$17,31
.set noreorder
.set nomacro
bne $3,$0,$L38
sb $2,440($16)
.set macro
.set reorder
.set noreorder
.set nomacro
jal sputs
move $4,$18
.set macro
.set reorder
.set noreorder
.set nomacro
jal test_func
addiu $4,$sp,424
.set macro
.set reorder
li $fp,100 # 0x64
move $18,$0
move $17,$0
$L54:
move $2,$21
li $6,99 # 0x63
$L47:
addiu $6,$6,-1
sw $20,0($2)
.set noreorder
.set nomacro
bgez $6,$L47
addiu $2,$2,4
.set macro
.set reorder
xor $2,$20,$17
addiu $16,$17,1
addiu $2,$2,-1
move $5,$16
addiu $6,$sp,16
li $7,100 # 0x64
move $4,$17
.set noreorder
.set nomacro
jal fibonacci
sll $20,$2,1
.set macro
.set reorder
li $7,2 # 0x2
addiu $5,$21,8
.set noreorder
.set nomacro
j $L52
li $6,97 # 0x61
.set macro
.set reorder
$L50:
bltz $6,$L65
$L52:
lw $2,0($5)
lw $3,-4($5)
lw $4,-8($5)
subu $2,$2,$3
addiu $6,$6,-1
.set noreorder
.set nomacro
bne $4,$2,$L50
addiu $5,$5,4
.set macro
.set reorder
.set noreorder
.set nomacro
bgez $6,$L52
addiu $7,$7,1
.set macro
.set reorder
$L65:
beq $7,$fp,$L66
$L43:
slt $2,$16,1000
.set noreorder
.set nomacro
bne $2,$0,$L54
move $17,$16
.set macro
.set reorder
li $2,1000 # 0x3e8
.set noreorder
.set nomacro
bne $18,$2,$L55
li $3,1073676288 # 0x3fff0000
.set macro
.set reorder
ori $3,$3,0xffff
and $2,$22,$3
sw $2,0($23)
addiu $22,$22,1
subu $16,$0,$22
$L67:
.set noreorder
.set nomacro
jal rand
andi $17,$16,0x8
.set macro
.set reorder
sll $17,$17,28
xor $17,$17,$2
mult $16,$17
mflo $18
mfhi $19
.set noreorder
.set nomacro
jal print_word
move $4,$16
.set macro
.set reorder
.set noreorder
.set nomacro
jal saus
li $4,32 # 0x20
.set macro
.set reorder
.set noreorder
.set nomacro
jal saus
li $4,120 # 0x78
.set macro
.set reorder
.set noreorder
.set nomacro
jal saus
li $4,32 # 0x20
.set macro
.set reorder
.set noreorder
.set nomacro
jal print_word
move $4,$17
.set macro
.set reorder
.set noreorder
.set nomacro
jal saus
li $4,32 # 0x20
.set macro
.set reorder
.set noreorder
.set nomacro
jal saus
li $4,61 # 0x3d
.set macro
.set reorder
.set noreorder
.set nomacro
jal saus
li $4,32 # 0x20
.set macro
.set reorder
.set noreorder
.set nomacro
jal print_word
sra $4,$19,0
.set macro
.set reorder
.set noreorder
.set nomacro
jal print_word
move $4,$18
.set macro
.set reorder
.set noreorder
.set nomacro
jal saus
li $4,13 # 0xd
.set macro
.set reorder
.set noreorder
.set nomacro
jal saus
li $4,10 # 0xa
.set macro
.set reorder
move $18,$0
.set noreorder
.set nomacro
j $L54
move $17,$0
.set macro
.set reorder
$L66:
.set noreorder
.set nomacro
j $L43
addiu $18,$18,1
.set macro
.set reorder
$L55:
li $2,1073741824 # 0x40000000
or $2,$22,$2
li $4,88 # 0x58
.set noreorder
.set nomacro
jal saus
sw $2,0($23)
.set macro
.set reorder
.set noreorder
.set nomacro
j $L67
subu $16,$0,$22
.set macro
.set reorder
.end main