OpenCores
URL https://opencores.org/ocsvn/eco32/eco32/trunk

Subversion Repositories eco32

[/] [eco32/] [trunk/] [fp/] [implementation/] [mmix/] [fibsub.mms] - Blame information for rev 64

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 15 hellwig
* Fibonacci subroutines (exercise 1.4.1--13)
2
 
3
    LOC #100
4
Fib CMP   $1,$0,2
5
    PBN   $1,1F
6
    GET   $1,rJ
7
    SUB   $3,$0,1
8
    PUSHJ $2,Fib   $2=F_{n-1}
9
    SUB   $4,$0,2
10
    PUSHJ $3,Fib   $3=F_{n-2}
11
    ADDU  $0,$2,$3
12
    PUT   rJ,$1
13
1H  POP   1,0
14
 
15
Fib1 CMP  $1,$0,2
16
     BN   $1,1F
17
     SUB  $2,$0,1
18
     SET  $0,1
19
     SET  $1,0
20
2H   ADDU $0,$0,$1  repeated n-1 times
21
     SUBU $1,$0,$1
22
     SUB  $2,$2,1
23
     PBNZ $2,2B
24
1H   POP  1,0
25
 
26
Fib2 CMP  $1,$0,1
27
     BNP  $1,1F
28
     SUB  $2,$0,1
29
     SET  $0,0
30
2H   ADDU $0,$0,$1
31
     ADDU $1,$0,$1
32
     SUB  $2,$2,2
33
     PBP  $2,2B
34
     CSZ  $0,$2,$1
35
1H   POP  1,0
36
 
37
Main SET   $1,5
38
     PUSHJ $0,Fib
39
     SET   $1,5
40
     PUSHJ $0,Fib1
41
     SET   $1,5
42
     PUSHJ $0,Fib2
43
     SET   $1,6
44
     PUSHJ $0,Fib2

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.