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

Subversion Repositories eco32

[/] [eco32/] [trunk/] [fp/] [implementation/] [mmix/] [saddle2.mms] - Blame information for rev 133

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

Line No. Rev Author Line
1 15 hellwig
* Exercise 1.3.2'--18, Solution 2
2
      LOC #100
3
t IS $255
4
a00 GREG Data_Segment
5
a10 GREG Data_Segment+8
6
a20 GREG Data_Segment+8*2
7
ij  GREG  % element index
8
ii  GREG  % row index times 8
9
j   GREG  % column index
10
x   GREG  % current maximum
11
y   GREG  % current element
12
z   GREG  % current min max
13
ans IS $0 % return register
14
Phase1 SET j,8 Start at column 8.
15
       SET z,1000  $\.z\gets\infty$ (more or less).
16
3H     ADD ij,j,9*8-2*8
17
       LDB x,a20,ij
18
1H     LDB y,a10,ij
19
       CMP t,x,y    Is x
20
       CSN x,t,y   If so, update the maximum.
21
2H     SUB ij,ij,8  Move up one.
22
       PBP ij,1B
23
       STB x,a10,ij Store column maximum.
24
       CMP t,x,z    Is x
25
       CSN z,t,x   If so, update the min max.
26
       SUB  j,j,1   Move left a column.
27
       PBP  j,3B
28
Phase2 SET  ii,9*8-8 At this point $\.z=\min_jC(j)$
29
3H     ADD  ij,ii,8  Prepare to search a row.
30
       SET  j,8
31
1H     LDB  x,a10,ij
32
       SUB  t,z,x    Is $\.z>a_{ij}$?
33
       PBP  t,No     No saddle in this row
34
       PBN  t,2F
35
       LDB  x,a00,j  Is $a_{ij}=C(j)$?
36
       CMP  t,x,z
37
       CSZ  ans,t,ij If so, remember a possible saddle point.
38
2H     SUB  j,j,1    Move left in row.
39
       SUB  ij,ij,1
40
       PBP  j,1B
41
       LDA  ans,a10,ans  A saddle point was found here.
42
       POP  1,0
43
No     SUB  ii,ii,8
44
       PBP  ii,3B     Try another row.
45
       SET  ans,0
46
       POP  1,0     $\.{ans} = 0$; no saddle.\quad\slug
47
 
48
aaaa   GREG 6364136223846793005  C E Haynes's multiplier
49
Main   SET  ij,9*8      assume that $1 = seed
50
1H     MULU $1,$1,aaaa
51
       INCL $1,1
52
       MULU x,$1,5
53
       GET  x,rH
54
       SUB  x,x,2
55
       STB  x,a10,ij
56
       SUB  ij,ij,1
57
       PBP  ij,1B
58
       PUSHJ 2,Phase1
59
       JMP  Main

powered by: WebSVN 2.1.0

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