|
請教各位前輩一下:
; C) x( C0 _3 K7 W1 _$ \小弟目前要在 t5 的狀態機下做六次的話,! L" B( B% T+ }$ O: \. T' Q
讓它在t6 的地方判斷,如果大於六就做 t7,5 S5 y* f' X! n5 L' ?0 y
不然就一直跳回 t5,這種寫法是否有誤呀?
$ u& \3 d# @) n( B因為他一直狂讀n筆資料進來,不受我的t6控制?9 n- W6 h% |8 M: N9 ^/ h I
4 O9 E0 i x" A7 f$ I麻請前輩們不吝指導一下,這個問題困擾小弟好久了,
0 I" d4 h' {0 `6 ?8 |$ |/ s; Q試了好多天,都是一樣的結果,感謝再感謝。
! ^2 b5 a: o: U; {% p* I- e1 R* l- r4 l( u# t# n- z
when t5 => -- read LSB (lo-byte), send acknowledge, sent stop9 e W% Z& {' v
if (cmd_ack = '1') then
; `! R. m; A, D4 K nxt_state :=t6;" z. a$ Q; v: `3 \3 c/ U8 X1 z
if (lack = '1') then3 L6 O9 N* P9 Y+ l) b6 M
ierr := '1'; -- no acknowledge received from last command, expected ACK
5 w ?. U- {2 K! ~6 D( J# g8 w* q end if;6 U& \6 u% I2 p& |2 n* m8 D8 U; I( U
istart := '0';
5 T( M+ t3 b/ ~, b' q9 z: @- e0 t$ ~ iread := '1';
( b. C) R/ \4 k) [6 {3 w7 z iwrite := '0';/ v+ o; f2 H8 l! m7 f% n
iack := '0'; --NACK
- c) }7 [" n: X' R* U* | istop := '0';( Q+ g c- D8 r
END IF; % I9 C' v7 l" o, W$ D, Y' N
when t6 => 5 n! R( x( x d
if (counter_i >= 6) then* B: l! @6 ^% S2 m$ C! p
counter_i <= 0;
7 Y4 P& K. w2 [, i# P) _% ? nxt_state :=t7;
3 x) M$ H- W, h6 F7 S else
( e/ w0 K B$ ? counter_i <= counter_i + 1 ; ( K- J% A) N3 \
end if;2 u' E; V$ A ^
if (counter_i < 6 ) then
; ~% W# t0 u! \ R9 w/ O nxt_state := t5;8 I! u9 F! S2 q+ K: n E6 A: L
end if;
/ U1 N& q @3 `) ]) n
3 ?" Q$ M! v' r% `1 C+ U when t7 => -- read LSB (lo-byte), send acknowledge, sent stop& |: n$ [$ H! \; w9 @- v. ?
istart := '0';" |6 [4 ~: V5 C3 ^9 z) N2 t" Z' O
iread := '1';( P/ m \% J6 c
iwrite := '0';# d# N7 v; s4 A
iack := '1'; --NACK
0 v# S$ z1 i+ ?9 ?5 G% i [ istop := '1'; 2 s# y' k0 t+ ]' p# I% t+ v; O
istore_dout := '1'; |
|