Hades logo    Hades applet banner

TAMS / Java / Hades / applets (print version): contents | previous | next

D*CORE Sieve of Eratosthenes

D*CORE Sieve of Eratosthenes screenshot

Description

The full D*CORE system with all processor components (control-unit, datapath, PC-logic) on the left, the memory interface (MAR,MDR,MDR) in the center, and the memories (RAM,ROM) on the right. Additionally, a parallel-interface terminal allows demonstrating I/O operations.

As shown here, the hardware of the microprocessor system is complete with example microcode and an example application program, namely the famous Sieve-of-Eratosthenes algorithm that calculates a table of prime numbers. Note that the hardware has been slightly modified to ensure that the microcode cannot readily be reused for our T3/computer-architecture labs...

The program first prints a welcome message to the terminal. It then enters the sieve algorithm, which is configured to use a table of size 256 starting at memory address 0x8100. The first loop of the algorithm is used to initialize the memory with a marker value that indicates a prime number; we use the value 0xcccc because it is easy to spot in the memory editor. Unless you change the input clock frequency, the program needs about two minutes to calculate the sieve after the welcome message is printed. Therefore, you should now open the RAM memory editor and watch how the sieve array is filled during the execution of the program.

The second loop of the algorithm marks all even numbers as non-prime by storing the value 2 into the corresponding sieve elements. The following nested loops then continue this process for all odd numbers up to the sieve size. As a result of this, every location in the sieve is marked by the greatest divisor found so far. Once both loops have reached their end values, all prime numbers in the sieve retain their marker value (here 0xcccc).

The final part of the program consists of another loop that prints the final sieve as a matrix of '.' (non-prime) and '*' (prime) characters.

Click the reset switch to reset the microprogram sequencer, then click the clock switch to generate single clocks for the processor hardware or use the clk-select switch for automatic clocking via the clock-generator. Watch the processor operation.

Further information:

For details, check the course material (in German) on our webserver.

Run the applet | Run the editor (via Webstart)


Impressum | 30.11.06
http://tams.informatik.uni-hamburg.de/applets/hades/webdemos/60-dcore/t3/sieve_print.html