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

Subversion Repositories eco32

[/] [eco32/] [trunk/] [fp/] [implementation/] [mmix/] [saddle1.mms] - Blame information for rev 198

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 1
2
      LOC #100
3
t IS $255
4
a00 GREG Data_Segment
5
a10 GREG Data_Segment+8
6
ij  IS $0  % element index and return register
7
j   GREG  % column index
8
k   GREG  % size of list of minima
9
x   GREG  % current minimum
10
y   GREG  % current element
11
Saddle SET  ij,9*8
12
RowMin SET  j,8
13
       LDB  x,a10,ij  Candidate for row minimum
14
2H     SET  k,0       Set list empty.
15
4H     INCL k,1
16
       STB  j,a00,k   Put column index in list.
17
1H     SUB  ij,ij,1    Go left one.
18
       SUB  j,j,1
19
       BZ   j,ColMax  Done with row?
20
3H     LDB  y,a10,ij
21
       SUB  t,x,y
22
       PBN  t,1B      Is \.x still minimum?
23
       SET  x,y
24
       PBP  t,2B      New minimum?
25
       JMP  4B        Remember another minimum.
26
ColMax LDB  $1,a00,k   Get column from list.
27
       ADD  j,$1,9*8-8
28
1H     LDB  y,a10,j
29
       CMP  t,x,y
30
       PBN  t,No        Is row min${}<{}$column element?
31
       SUB  j,j,8
32
       PBP  j,1B      Done with column?
33
Yes    ADD  ij,ij,$1  Yes; $\.{ij}\gets{}$index of saddle.
34
       LDA  ij,a10,ij
35
       POP  1,0
36
No     SUB  k,k,1     Is list empty?
37
       BP   k,ColMax  If not, try again.
38
       PBP  ij,RowMin Have all rows been tried?
39
       POP  1,0       Yes; $\$0=0$, no saddle.\quad\slug\endmmix
40
 
41
aaaa   GREG 6364136223846793005  C E Haynes's multiplier
42
Main   SET  ij,9*8      assume that $1 = seed
43
1H     MULU $1,$1,aaaa
44
       INCL $1,1
45
       MULU x,$1,5
46
       GET  x,rH
47
       SUB  x,x,2
48
       STB  x,a10,ij
49
       SUB  ij,ij,1
50
       PBP  ij,1B
51
       PUSHJ 2,Saddle
52
       JMP  Main

powered by: WebSVN 2.1.0

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