MIDDLEAPPROX 1.6.2024


This JAVA 1.8 application creates an AstroChip chip definition, which approximates the middle of a set of integer numbers. Therefore the biggest and the smallest number in the set are calculated, added and divided by 2. Every number is compared parallel with every other number. Then the smallest number and the biggest number are calculated with an OR tree and an AND tree. If two numbers or more numbers have got the biggest or the smallest value, one value is taken. The biggest and the smallest number are added with an integer adder and shifted one binary digit to the right for the division. The whole procedure is very fast.
The usage of the chip definition creator is:
java MiddleApprox outputfile.txt n m
You can change the filename outputnamer.txt.
The number n is the set size as integer number.
The number m is the integer length of the set members in bits.

You find the values of the set members in outputfile.txt: cixj.
If there are four numbers with to binary digits, you find
CONSTANT c0x0 0;
CONSTANT c0x1 0;
CONSTANT c1x0 0;
CONSTANT c1x1 0;
CONSTANT c2x0 0;
CONSTANT c2x1 0;
CONSTANT c3x0 0;
CONSTANT c3x1 0;
in the MODULE main in outputfile.txt.
(c0x0,c0x1) is the first number.
c0x0 is the most significant bit.
(c1x0,c1x1) is the second number.
c0x1 is the least significant bit of the second number.