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

Subversion Repositories eco32

[/] [eco32/] [trunk/] [fp/] [implementation/] [mmix/] [primesfx.mms] - Blame information for rev 105

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

Line No. Rev Author Line
1 15 hellwig
% Example program ... Table of primes (floating point with sharper bound)
2
L      IS   500          The number of primes to find
3
t      IS   $255         Temporary storage
4
n      GREG
5
q      GREG
6
r      GREG
7
jj     GREG
8
kk     GREG
9
pk     GREG
10
mm     IS   kk
11
 
12
       LOC  Data_Segment
13
PRIME1 WYDE 2
14
       LOC  PRIME1+2*L
15
ptop   GREG @
16
j0     GREG PRIME1+2-@
17
BUF    OCTA
18
 
19
       LOC  #100
20
Main   SET  n,3
21
       SET  jj,j0
22
2H     STWU n,ptop,jj
23
       INCL jj,2
24
3H     BZ   jj,2F
25
4H     INCL n,2
26
5H     SET  kk,j0
27
fn    GREG 0
28
sqrtn GREG 0
29
      FLOT fn,n
30
      FSQRT sqrtn,fn
31
0H    GREG #3fffff0000000000
32
      FSUB  sqrtn,sqrtn,0B
33
6H     LDWU pk,ptop,kk
34
      FLOT t,pk
35
      FREM r,fn,t
36
       BZ   r,4B
37
7H    FCMP t,t,sqrtn
38
       BNN t,2B
39
8H     INCL kk,2
40
       JMP  6B
41
       GREG @
42
Title  BYTE "First Five Hundred Primes"
43
NewLn  BYTE #a,0
44
Blanks BYTE "   ",0
45
2H     LDA  t,Title
46
       TRAP 0,Fputs,StdOut
47
       NEG  mm,2
48
3H     ADD  mm,mm,j0
49
       LDA  t,Blanks
50
       TRAP 0,Fputs,StdOut
51
2H     LDWU pk,ptop,mm
52
0H     GREG #2030303030000000
53
       STOU 0B,BUF
54
       LDA  t,BUF+4
55
1H     DIV  pk,pk,10
56
       GET  r,rR
57
       INCL r,'0'
58
       STBU r,t,0
59
       SUB  t,t,1
60
       PBNZ pk,1B
61
       LDA  t,BUF
62
       TRAP 0,Fputs,StdOut
63
       INCL mm,2*L/10
64
       PBN  mm,2B
65
       LDA  t,NewLn
66
       TRAP 0,Fputs,StdOut
67
       CMP  t,mm,2*(L/10-1)
68
       PBNZ t,3B
69
       TRAP 0,Halt,0

powered by: WebSVN 2.1.0

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