|
Dear all7 J. _& {. ]; W
小弟最近用VHDL在power pc平台上第一次設計一顆CPLD去控制整塊板子,2 A X$ n/ Q2 v% }: c" x
裡面包含的功能有power/reset/LED control, hardware watchdog,
, S* u( H9 e9 `$ E% }7 uslide switch/push button detect, CPLD to CPU interrupt event,
?/ Q* _$ X9 i9 s$ hCPU read/write CPLD register這些功能,
" s Q; f2 J3 n/ `; K2 e. u在開發時,為了能夠快速的看一些裡面定義signal的狀態,
2 d! f# M; v0 Y$ o8 f就在外面接了7顆chip type LED做debug用,3 i6 }3 n- E; l7 {# k3 g
而這7顆LED是拿來看slide switch/push button以及interrupt狀態,7 ~' h" \9 u0 v. o8 c; B" |; V S
而slide switch/push button只要有動作都會發interrupt給CPU,
* z/ m7 @- N5 |( V; n這些功能都一一完成並且「各別」驗證後,才全部組合在同一個.vhd檔,
7 ]3 \8 t! O! c! H. |& Z& r4 {$ I( p而slide switch/push button的interrupt event "AND"起來後,8 f# d0 C, ?; t0 p) }5 G
再指到CPLD nINT pin,如 nINT <= nSLIDE_INT and nPUSH_INT;: n2 I, G! I6 ^2 P
只要這兩個功能的process同時compile,nINT在high or low level,
& v& g- A- B$ d有機會發生抖動,或是有時會發生無法將nSLIDE_INT or nPUSH_INT拉high或low,; G. M# C$ Z4 B: v3 t( F
但各別把各自的process mark起來不compile就會正常,
& M8 A, \9 V9 \% D5 l在修改code以後,已經有解決這問題或應該算是改善吧,/ F0 t" u+ @, C* U1 \
因為更重要的問題來了,我把debug LED拿掉," d, M2 r& n, p& _; h7 e" I# c
這兩個要發給CPU的interrupt功能就出問題,
! \. a/ }4 ~9 \; N& J只要把debug LED的東西留在code裡面,就正常了,
& x4 K) C: Q' R9 a, i不知道板上個各位前輩有遇過這樣的問題嗎?/ ~5 q% Y& }6 T. H5 P/ L# ?
% O& r* f, _2 _" F4 bexample:/ t e% [3 `/ t, P& A M2 I
......7 x$ [9 R: M! E0 t- ~
port(
* u# R# R! ]( ~nINT : std_logig;
6 a R' q6 f- D; K+ X$ l$ E: {$ Y$ eLED_S : std_logic;4 y, @. ^; K3 z8 i
LED_P : std_logic4 ~/ T- J; b, m. b4 Q" T" H
);
9 k# a9 i& [$ x$ Y2 B......
5 S1 u( V9 J6 z: H6 Osignal nSLIDE_INT, nPUSH_INT, LED_INT, LED_SLIDE, LED_PUSH : std_logic;
) x/ j: Y% ~: \; p......
( m& u/ ]9 @; K' wbegin1 z* E1 |2 B3 [& y) N: @) K
nINT <= nSLIDE_INT and nPUSH_INT;
3 k9 i7 f# X+ G( Q# k8 o; r; K' bLED_INT <= LED_SLIDE and LED_PUSH;
' M6 c' h6 ?5 `4 L; L. VLED_SLIDE <= nSLIDE_INT;
, Z/ i$ O3 i( D* e, z6 ?4 zLED_PUSH <= nPUSH_INT;( d0 c0 G( o; w
......
" x3 f/ B' x. i: J% t9 M(包含的process如下)" J3 |6 k w$ s) C
power control process
+ F( g, _# B0 ?, O. J; _! yreset control process9 F* J+ j: A# _/ s" e
watchdog process
+ i, c% y# i* m7 N& X& H/ ?- c5 `# [read process
* P7 f. ?6 t$ x J) v0 Gwrite process. {* N; t9 l7 [; n; u3 m A
slide switch detect and de-bouncing process8 f, b9 j1 j# ~
push button detect process* c T+ @# R2 S$ i8 p
slide switch interrupt event process
5 n* w0 F* R4 M- x+ spush button interrupt event process5 K3 s2 A0 l1 @) \# N
......
0 w" |5 Y9 p8 Z
6 O& H% O; G) Q S, g* x) c現在的code上面的寫法已經正常,3 {! `3 f( w2 w0 x' @6 E- W
但是只要把這三行都mark起來,- N9 V& b1 @# _' X/ P# x
LED_INT <= LED_SLIDE and LED_PUSH;
( Y, \/ |5 G4 u; xLED_SLIDE <= nSLIDE_INT;
2 @5 d! |) ~3 m/ c" ZLED_PUSH <= nPUSH_INT;
; h, |" x: r4 X( ]$ h整個code動作就不正常了!, ]* m5 U1 S$ e$ C) k
我是用Altera EPM570 -5ns那顆來做,
6 |' v# b- v& i7 X, v不知道說這麼多有沒有表達清楚,其實有很多問題想請教,
& D y) Y: n& |1 C4 K( e" q# X' f不過還是希望能夠先把這問題解決!
+ L7 m! y$ R: g5 D/ `5 T希望各位能給小弟一些建議,謝謝! |
|