|
Dear all9 r8 [% _7 V( B6 m9 `) w
小弟最近用VHDL在power pc平台上第一次設計一顆CPLD去控制整塊板子,
2 H# h: p# q- [2 o裡面包含的功能有power/reset/LED control, hardware watchdog,; h4 d; _- P. X2 Z |7 C
slide switch/push button detect, CPLD to CPU interrupt event,$ ?( R6 ?3 ? t o1 @
CPU read/write CPLD register這些功能,
) d* N4 N- o7 h, ~在開發時,為了能夠快速的看一些裡面定義signal的狀態,
% L$ l. @9 @" L0 Z就在外面接了7顆chip type LED做debug用,
- ?: s, {; ]. } R6 \而這7顆LED是拿來看slide switch/push button以及interrupt狀態,
! ], n3 J# I* p$ z* {# q/ I而slide switch/push button只要有動作都會發interrupt給CPU,% B1 p- T. \- ~0 K3 Y' e2 {9 P( x# W
這些功能都一一完成並且「各別」驗證後,才全部組合在同一個.vhd檔,
/ h* G0 s7 a9 y- t而slide switch/push button的interrupt event "AND"起來後, D) E4 y2 @6 `% l8 E* _
再指到CPLD nINT pin,如 nINT <= nSLIDE_INT and nPUSH_INT;
, Y, o0 b. T8 w. Y" j0 U& [只要這兩個功能的process同時compile,nINT在high or low level,$ r" q2 b$ g i# z7 D6 }
有機會發生抖動,或是有時會發生無法將nSLIDE_INT or nPUSH_INT拉high或low,& z% c9 J' N- x, o5 Z
但各別把各自的process mark起來不compile就會正常,' B( p6 K# |6 p: \7 o
在修改code以後,已經有解決這問題或應該算是改善吧,( W8 n W* s p; r
因為更重要的問題來了,我把debug LED拿掉,6 g% X' E- L3 W' @; Q0 A8 j% a$ a9 v" u
這兩個要發給CPU的interrupt功能就出問題,
* m; ~: h* s' ]1 O) [+ X" {$ F! U只要把debug LED的東西留在code裡面,就正常了,1 _' q$ L9 a% U
不知道板上個各位前輩有遇過這樣的問題嗎?
2 e5 i/ O; R. J) f1 E1 C" i
) }! ?" l m$ u! t% c+ vexample:+ O" U! o% \- _6 Y0 K
......2 x, [/ q6 p1 k9 A* u9 Z
port(
0 e# w% H# Z' h) JnINT : std_logig; f' E6 h$ S* u4 R2 d
LED_S : std_logic;
/ Y' F/ k# H A" ^LED_P : std_logic
i: n' \8 m; U);
' Y$ N$ w. E/ t- R: z......: H' C- @5 J! O5 C: M7 L+ |; J
signal nSLIDE_INT, nPUSH_INT, LED_INT, LED_SLIDE, LED_PUSH : std_logic;
; o, g1 t# v# |$ P# W......8 k0 g' u# A M: }5 m
begin
6 P, L6 T, x3 y( R2 L, @8 XnINT <= nSLIDE_INT and nPUSH_INT;9 o, N3 G* Q, p7 H- z
LED_INT <= LED_SLIDE and LED_PUSH;
' R# s0 U, ?2 A: @$ WLED_SLIDE <= nSLIDE_INT;5 T+ x; D: c; @0 Z* ^6 @
LED_PUSH <= nPUSH_INT;3 f! k( n) m& x! d( T- C2 j9 f# Y
......
. p! X. F! V. C+ ]. H7 g8 {, i(包含的process如下)
/ u' Z+ U. j1 v& Ipower control process
, k! z' R6 g" S: u/ u0 l" Xreset control process* G9 p8 j4 [( i& `* w: q9 _
watchdog process
5 n- D2 S6 D; s9 M: K( y: tread process
. f8 u9 R# [ v) ?0 ~" dwrite process
7 K% r* ^3 s" R4 m& |slide switch detect and de-bouncing process
9 H# s0 d' g; [; bpush button detect process+ \4 N' ~/ H' b
slide switch interrupt event process
: u+ u2 O' D, d3 V2 h( ]9 npush button interrupt event process( ^/ K" t: A# g9 V
......! |. `9 o9 G! t/ s9 ?. [. c( P
, C% W) B% I; m1 C8 a3 s; e/ d現在的code上面的寫法已經正常,
: O. \+ M) y$ i但是只要把這三行都mark起來,1 U) P, z* U( }* ?/ _( o; S, R9 B
LED_INT <= LED_SLIDE and LED_PUSH;
: m) y/ B" c" `& XLED_SLIDE <= nSLIDE_INT;4 k6 r7 _9 u& }( C; t& J2 r
LED_PUSH <= nPUSH_INT;2 n0 T7 C* O# x! b
整個code動作就不正常了!- C$ I/ k P* f6 G3 Q* N6 k
我是用Altera EPM570 -5ns那顆來做," e' T) b i' ]
不知道說這麼多有沒有表達清楚,其實有很多問題想請教,
% I9 v7 b# F7 A3 J不過還是希望能夠先把這問題解決!
1 Z* r& W9 K- [" [希望各位能給小弟一些建議,謝謝! |
|