URL
https://opencores.org/ocsvn/mips789/mips789/trunk
Subversion Repositories mips789
Compare Revisions
- This comparison shows the changes necessary to convert path
/mips789/tags/arelease/bench/cal_PI
- from Rev 36 to Rev 51
- ↔ Reverse comparison
Rev 36 → Rev 51
/cal_pi.c
0,0 → 1,55
/****************************************************************** |
* * |
* Author: Liwei * |
* * |
* This file is part of the "mips789" project. * |
* Downloaded from: * |
* http://www.opencores.org/pdownloads.cgi/list/mips789 * |
* * |
* If you encountered any problem, please contact me via * |
* Email:mcupro@opencores.org or mcupro@163.com * |
* * |
******************************************************************/ |
|
|
|
#include "..\..\clib\dvc_lib.h" |
|
void print_num(unsigned long num) |
{ |
unsigned long digit,offset ; |
for(offset=1000;offset;offset/=10) |
{ |
digit=num/offset ; |
uart0_putc('0'+digit); |
num-=digit*offset ; |
} |
} |
|
long a=10000,b=0,c=56,d=0,e=0,f[57]={0},g=0 ; |
|
void cal_PI(void) |
{ |
uart0_putstr("\nPI = "); |
a=10000 ; |
b=0 ; |
c=56 ; |
d=0 ; |
e=0 ; |
g=0 ; |
for(;b-c;)f[b++]=a/5 ; |
for(;d=0,g=c*2;c-=14,print_num(e+d/a),e=d%a) |
for(b=c;d+=f[b]*a,f[b]=d%--g,d/=g--,--b;d*=b); |
uart0_putc('\n'); |
} |
|
main2() |
{ |
|
while(1) |
{ |
uart0_putstr("Hello CPU World ,this is MIPS789..."); |
cal_PI(); |
} |
|
} |
/cal_PI.bat
0,0 → 1,18
path; |
path=..\..\gccmips_elf |
del *.axf |
del *.txt |
as -o boot.o ..\plasmaboot.asm |
gcc -O2 -O -Wall -c -s ..\..\clib\dvc_lib.c |
gcc -O2 -O -Wall -c -s cal_pi.c |
|
ld.exe -Ttext 0 -eentry -Map test.map -s -N -o test.axf boot.o dvc_lib.o cal_pi.o |
|
objdump.exe --disassemble test.axf > list.txt |
|
convert_sp |
gensim |
genmif |
copy *.mif ..\..\quartus2\*.mif |
#copy *.v ..\MODELSIM\*.v |
#ser_dld 9600 COM1 N |
/clean.bat
0,0 → 1,10
del *.bak |
del *.map |
del *.o |
del *.exe |
del *.axf |
del *.txt |
del *.bin |
del sim_ram.v |
del *.mif |
del transcript |
/PI.GIF
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
PI.GIF
Property changes :
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: pi.bmp
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: pi.bmp
===================================================================
--- pi.bmp (nonexistent)
+++ pi.bmp (revision 51)
pi.bmp
Property changes :
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property