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

Subversion Repositories eco32

[/] [eco32/] [tags/] [eco32-0.26/] [fp/] [implementation/] [mmix/] [harm.mms] - Diff between revs 15 and 270

Only display areas with differences | Details | Blame | View Log

Rev 15 Rev 270
* Sum of Rounded Harmonic Series
* Sum of Rounded Harmonic Series
MaxN IS 10
MaxN IS 10
a GREG % Accumulator
a GREG % Accumulator
c GREG % $2\cdot10^n$
c GREG % $2\cdot10^n$
d GREG % Divisor or digit
d GREG % Divisor or digit
r GREG % Scaled reciprocal
r GREG % Scaled reciprocal
s GREG % Scaled sum
s GREG % Scaled sum
m GREG % $m_k$
m GREG % $m_k$
mm GREG % $m_{k+1}$
mm GREG % $m_{k+1}$
nn GREG % $n-\.{MaxN}$
nn GREG % $n-\.{MaxN}$
     LOC Data_Segment
     LOC Data_Segment
dec  GREG @+3 % decimal point loc
dec  GREG @+3 % decimal point loc
     BYTE "   ."
     BYTE "   ."
%    LOC  @+MaxN+6
%    LOC  @+MaxN+6
     LOC #100
     LOC #100
Main NEG nn,MaxN-1
Main NEG nn,MaxN-1
     SET c,20
     SET c,20
1H   SET m,1
1H   SET m,1
     SR  s,c,1
     SR  s,c,1
     JMP 2F
     JMP 2F
3H   SUB a,c,1
3H   SUB a,c,1
     SL  d,r,1
     SL  d,r,1
     SUB d,d,1
     SUB d,d,1
     DIV mm,a,d
     DIV mm,a,d
4H   SUB a,mm,m
4H   SUB a,mm,m
     MUL a,r,a
     MUL a,r,a
     ADD s,s,a
     ADD s,s,a
     SET m,mm
     SET m,mm
2H   ADD a,c,m
2H   ADD a,c,m
     2ADDU d,m,2
     2ADDU d,m,2
     DIV r,a,d
     DIV r,a,d
     PBNZ r,3B
     PBNZ r,3B
5H   ADD a,nn,MaxN+1
5H   ADD a,nn,MaxN+1
     SET d,#a
     SET d,#a
     JMP 7F
     JMP 7F
6H   DIV s,s,10
6H   DIV s,s,10
     GET d,rR
     GET d,rR
     INCL d,'0'
     INCL d,'0'
7H   STB d,dec,a
7H   STB d,dec,a
     SUB a,a,1
     SUB a,a,1
     BZ  a,@-4
     BZ  a,@-4
     PBNZ s,6B
     PBNZ s,6B
8H   SUB $255,dec,3
8H   SUB $255,dec,3
     TRAP 0,Fputs,StdOut
     TRAP 0,Fputs,StdOut
9H   INCL nn,1
9H   INCL nn,1
     MUL  c,c,10
     MUL  c,c,10
     PBNP nn,1B
     PBNP nn,1B
 
 

powered by: WebSVN 2.1.0

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