|
請教各位前輩一下:* E$ Z" e6 f. G7 w
小弟目前要在 t5 的狀態機下做六次的話,1 k4 w2 \6 N* o" Y
讓它在t6 的地方判斷,如果大於六就做 t7,
6 ^; Z" t1 `. {4 G5 K9 c不然就一直跳回 t5,這種寫法是否有誤呀?9 |5 M/ v2 M9 S: D+ |; E% c
因為他一直狂讀n筆資料進來,不受我的t6控制?
8 i. p- ?; V% t5 |# y, h. e9 D1 B! T& Q, [2 Z- e
麻請前輩們不吝指導一下,這個問題困擾小弟好久了,
7 k; }% O, w/ m& H' T試了好多天,都是一樣的結果,感謝再感謝。
2 u& c: n+ l: y0 O+ }+ @$ [" `( {' D5 i0 s" [! d L
when t5 => -- read LSB (lo-byte), send acknowledge, sent stop- V$ Y/ f9 A0 B2 s! X# K
if (cmd_ack = '1') then I( \# A1 {) E% {
nxt_state :=t6;7 h) e4 E' t3 S) m! F2 Z/ j
if (lack = '1') then
. S2 _$ A( A+ L ierr := '1'; -- no acknowledge received from last command, expected ACK( f" T* j' u" h5 ?. {; }) }! {& G
end if;; @3 r7 l: z F$ f
istart := '0';
2 P0 H7 i# O! K3 o iread := '1';. h2 D. U" w% E& K$ j
iwrite := '0';
2 W8 m! G' B+ w4 Z& } iack := '0'; --NACK4 ?; w5 t' Q G1 e* h7 x7 b; ^
istop := '0';
6 O4 _% m2 Y Z: O5 c END IF;
9 \* u/ t9 z$ C; m5 c( q when t6 => ' j1 K! g- L% Q' Q# M- F
if (counter_i >= 6) then3 M- K1 u4 u3 @5 Z0 p/ a; k
counter_i <= 0;
8 O( j1 ^+ Y1 M; n- [3 N) ` nxt_state :=t7; 6 h' f7 J4 Q5 q, E
else $ A; `+ ]' F& D3 v- a4 `9 t
counter_i <= counter_i + 1 ;
( x, G2 p* H! S7 a9 \ end if; `6 q U4 e! K/ [1 P- o I
if (counter_i < 6 ) then ; s; L, G: ?9 p2 U
nxt_state := t5;. ]2 }3 e% n$ y3 j. b
end if;
* @0 j! I" Z% D* o P5 o
8 O5 F5 {; H8 [ when t7 => -- read LSB (lo-byte), send acknowledge, sent stop. E) N! b2 f* M) ?
istart := '0';
$ X2 e/ Q" S- B; v iread := '1';( H& x1 a T& c1 W3 H& c! q0 J
iwrite := '0';9 H; L s$ B# ?0 Q" C! G- l
iack := '1'; --NACK* q% g6 v: H& ]4 i
istop := '1'; 5 E, p. m: R9 u; @6 V- Y
istore_dout := '1'; |
|