|
Dear all
$ x$ t$ H( [- `( e% j' t小弟最近用VHDL在power pc平台上第一次設計一顆CPLD去控制整塊板子,6 m0 r, l/ b0 o+ N o4 k
裡面包含的功能有power/reset/LED control, hardware watchdog,' C1 ^9 E$ A; B7 |
slide switch/push button detect, CPLD to CPU interrupt event,- q4 T/ Q! ^3 G1 `6 ]; g
CPU read/write CPLD register這些功能,0 w- \4 J& w, f' r0 @+ b
在開發時,為了能夠快速的看一些裡面定義signal的狀態,+ i" Z- O7 D# u! d1 d M+ G* _
就在外面接了7顆chip type LED做debug用,1 m4 L) T3 A7 x1 W3 p# d
而這7顆LED是拿來看slide switch/push button以及interrupt狀態,9 x6 W5 D( D: X: C. B1 f& }0 y
而slide switch/push button只要有動作都會發interrupt給CPU,
E9 r+ r4 E# L! w7 i4 M1 P這些功能都一一完成並且「各別」驗證後,才全部組合在同一個.vhd檔,% k, T. [* G" V; ?! a0 t& x
而slide switch/push button的interrupt event "AND"起來後,% d% i" [; ~2 } k
再指到CPLD nINT pin,如 nINT <= nSLIDE_INT and nPUSH_INT;9 \9 p2 {- {# i' `& f
只要這兩個功能的process同時compile,nINT在high or low level,
8 L+ j7 X9 f2 c有機會發生抖動,或是有時會發生無法將nSLIDE_INT or nPUSH_INT拉high或low,
0 Z1 @9 q6 l" ?0 w. R1 J9 m" K但各別把各自的process mark起來不compile就會正常,
" [0 X) k; k% A在修改code以後,已經有解決這問題或應該算是改善吧,
0 |7 X) u$ }) Z3 \, [) p: t因為更重要的問題來了,我把debug LED拿掉,
* a8 j) T" x: Q: Q8 }這兩個要發給CPU的interrupt功能就出問題,
; O0 h& v( H a4 y. u只要把debug LED的東西留在code裡面,就正常了,2 y% [5 U+ Z1 h7 W
不知道板上個各位前輩有遇過這樣的問題嗎?) w* r. ^$ L6 h) p( a
* b4 Z# @/ d5 `6 X, s1 ^
example:6 m$ e. |/ G! |1 l
......
% D. o1 Z( k# X+ B1 g$ K( W& hport(8 G) Y3 {$ G) ]* b/ {% v: d( M
nINT : std_logig;& r) K* Q5 b+ `( V: ?3 [" m
LED_S : std_logic;- [- x9 o# G4 C/ }# L
LED_P : std_logic: d$ b' t; F' k& H
);( [; q7 T5 @0 g: |% T# V
......4 r/ y) C- C' a0 R" Z& ?
signal nSLIDE_INT, nPUSH_INT, LED_INT, LED_SLIDE, LED_PUSH : std_logic;
9 f8 ~ j# ?- q# |( l( @ v% ?......9 ?' s1 e( t/ b, `1 p
begin! x/ T6 F+ V2 z* ]. S
nINT <= nSLIDE_INT and nPUSH_INT;- M ?0 V+ a0 h8 t8 D/ l
LED_INT <= LED_SLIDE and LED_PUSH;
4 S7 \$ f X3 }* p$ N) b+ rLED_SLIDE <= nSLIDE_INT;& N7 n: z, L' ?) l* }
LED_PUSH <= nPUSH_INT;
3 W/ {( v9 i, D: x0 z......
# u- l6 M( `1 t9 m1 l0 `(包含的process如下)3 v q/ C. F( H+ L9 M
power control process3 Y: J) N( _6 E
reset control process
' _1 \5 E% [' ?3 v8 Bwatchdog process/ y; l X; Q* M7 b$ q+ Z. Z1 K) d6 J
read process
! a. r, C0 x6 M) s( Q8 c# f5 b/ ]write process& \ B- F/ Z' j. ~( N4 \0 T
slide switch detect and de-bouncing process/ m, q# t0 l/ T, u. ]" m9 h8 l" a
push button detect process( A5 m. J0 H) [7 z
slide switch interrupt event process+ r9 J" F0 c3 x- t
push button interrupt event process* |4 b1 J9 }9 r$ ?7 ~4 A7 Q
......* y7 m$ |! N$ Q4 X) _
1 m/ g" [% ~8 p3 ?6 I
現在的code上面的寫法已經正常,0 B8 h% A" E( q) S5 L8 \- f
但是只要把這三行都mark起來,
8 D% o. r |% O* MLED_INT <= LED_SLIDE and LED_PUSH;
0 f# y; r. E8 N! S" HLED_SLIDE <= nSLIDE_INT;
* P; `1 X: p0 `1 D. }* t% ILED_PUSH <= nPUSH_INT;
1 Z* y) L( x, X$ k6 D' u# X: u整個code動作就不正常了!7 C- _2 x9 L4 t: u' A
我是用Altera EPM570 -5ns那顆來做,
8 q# q g6 j2 K7 S2 ~0 ~2 o不知道說這麼多有沒有表達清楚,其實有很多問題想請教,
* P( ?5 e7 F; S6 K! ], g不過還是希望能夠先把這問題解決!
1 [/ i# b. S5 o' o( N* k2 I5 s9 q希望各位能給小弟一些建議,謝謝! |
|