Design an ASM chart which reads a stream of 50 unsigned byte
Design an ASM chart which reads a stream of 50 unsigned bytes (8 bits) in sequentially. The ASM will remember the largest value and the position of this value. For example: The output of such an algorithm would be 121 and 8. For the algorithm to begin a Start signal needs to be provided and a Ready signal would be asserted high when all bytes have been scanned. To load and check the next byte a signal Next_Data will be asserted high.
Solution
The algorithm is as below:
S1. Let the first value denoted by x(1) be the largest value an the position is i=1.
S2. Compare this lagest value with (i+1)th, (i+2)th and so on all remaining values. As soon as we find any x(j) > x(i), RESET largest value = x(j) and i=j and position=j. If there is no x(j) > x(i), x(i) is the largest value.
S3. Go back to S2 with the new value of largest value, i and position.
At the end of the end of the 50th cycle, the above algorithm return the largest value and its position in S2.
