6. (8 points) Consider the following algorithm (given in pseudocode with numbered lines). p_i and go_i are external inputs and q_o is the output.
a) Draw an FSM that implements this algorithm. Label the FSM states with the line number.
(b) Draw a datapath for the FSM that you drew for part (a).
(c) Draw a state transition diagram for the controller.
0: int p, q;
5: while(p){
1: while1{
6: q = p * q;
2: while(!go_i);
7: p = p - 1;
3: p = p_i;
8: }
4: q = 1;
}
b = 0b6