TAMS / Java / Hades / applets: contents | previous | next | ||||
Hades Applets contents visual index introduction std_logic_1164 gatelevel circuits delay models flipflops adders and arithm... counters LFSR and selftest memories programmable logic state-machine editor misc. demos I/O and displays DCF-77 clock relays (switch-le... CMOS circuits (sw... RTLIB logic RTLIB registers Prima processor D*CORE MicroJava Pic16 cosimulation Mips R3000 cosimu... TinyMips int... TinyMips Sieve TinyMips stack TinyMips mul... TinyMips loa... TinyMips mul... TinyMips wit... TinyMips UAR... TinyMips UAR... TinyMips int... TinyMips int... Mips fast Sieve TinyMips wit... Mips - game ... Mips prime n... Intel MCS4 (i4004) image processing ... [Sch04] Codeumsetzer [Sch04] Addierer [Sch04] Flipflops [Sch04] Schaltwerke [Sch04] RALU, Min... [Fer05] State-Mac... [Fer05] PIC16F84/... [Fer05] Miscellan... [Fer05] Femtojava FreeTTS | Mips R3051: prime numbers (1024 elements)
Circuit Description
This applet demonstrates yet another simple algorithm to calculate
prime numbers.
Detected prime numbers are stored in an array starting at
program address 0x00000400,
corresponding to memory component address 0x0100.
FIXME: This needs to be updated. Sorry. #include "initcode.h" void prim(int max, int startadr) { int prim, teiler, *adr, teilt; adr = (void*) startadr; *adr = 2; for (prim = 3; prim < max; prim += 2) { teiler = 3; teilt = 0; while (teiler * teiler <= prim) { if (prim % teiler == 0) { teilt = 1; teiler = prim; } else { teiler += 2; } } if (teilt == 0) { adr++; *adr = prim; } } } void waitloop( void ) { int i, *ptr; ptr = (void*) (0x0400 - 32); for( i=0;; i++ ) { *(ptr) = i; } } int main(void) { prim(0x400, 0x400); waitloop(); }
| |||
Print version | Run this demo in the Hades editor (via Java WebStart) | ||||
Usage | FAQ | About | License | Feedback | Tutorial (PDF) | Referenzkarte (PDF, in German) | ||||
Impressum | http://tams.informatik.uni-hamburg.de/applets/hades/webdemos/76-mips/65-prim/prim.html |