User`s manual
43 rd <= 1; //we can’t read data
44 state <= WAIT;
45 end
46 else
47 if(~hold)
48 begin
49 newout <= 0;
50 case(state)
51 WAIT:
52 if(~rxf) //if rxf is low and nobody’s asking us to wait then there is data waiting for us
53 begin
54 rd <= 1; //so ask for it
55 state <= WAIT2; //and start waiting for it
56 end
57
58 WAIT2:
59 if(~rxf) //double check
60 begin
61 rd <= 1;
62 state <= WAIT3;
63 end
64 else
65 state <= WAIT;
66
67 WAIT3:
68 if(~rxf) //and triple check (should only need one, but oh well...)
69 begin
70 rd <= 0;
71 state <= DATA_COMING;
72 end
73 else
74 state <= WAIT;
75
76 DATA_COMING: //once rd goes low we gotta wait a bit for the data to stabilize
77 state <= DATA_COMING_2;
78
79 DATA_COMING_2:
80 state <= DATA_COMING_3;
81
82 DATA_COMING_3:
83 state <= DATA_HERE;
84
85 DATA_HERE:
86 begin
87 out <= data; //the data is valid by now so read it
88 state <= DATA_LEAVING;
86