|
Dear all
! R9 u! b" [; X8 |0 h小弟最近用VHDL在power pc平台上第一次設計一顆CPLD去控制整塊板子,
- {% g2 Z( a+ f/ @9 n4 H! F裡面包含的功能有power/reset/LED control, hardware watchdog,
* J" z* H8 q! ?- Uslide switch/push button detect, CPLD to CPU interrupt event,
O7 U! t: F n/ t) d, n7 q6 s fCPU read/write CPLD register這些功能,
! d4 w0 A) q* s+ y# o+ ^在開發時,為了能夠快速的看一些裡面定義signal的狀態,
1 S l" Y* \3 M/ j/ I就在外面接了7顆chip type LED做debug用,
1 c) [. u b; ?9 Y1 ^而這7顆LED是拿來看slide switch/push button以及interrupt狀態,$ O$ Y& d2 O% j( [/ A' I
而slide switch/push button只要有動作都會發interrupt給CPU,( V# |# U/ w1 n
這些功能都一一完成並且「各別」驗證後,才全部組合在同一個.vhd檔,
( l3 n9 L2 | z+ ~8 K而slide switch/push button的interrupt event "AND"起來後,
8 E! d! {0 Y3 f* p. c再指到CPLD nINT pin,如 nINT <= nSLIDE_INT and nPUSH_INT;; V2 ^/ s( U) P) I
只要這兩個功能的process同時compile,nINT在high or low level,
* \7 U* N9 V3 v! h有機會發生抖動,或是有時會發生無法將nSLIDE_INT or nPUSH_INT拉high或low,
, |6 R. D9 D' f- M" c b9 n2 a但各別把各自的process mark起來不compile就會正常,/ \4 O! X0 i7 p% T, d! @7 S
在修改code以後,已經有解決這問題或應該算是改善吧,3 A* {- z% L$ x2 ?' Q6 r; D: R
因為更重要的問題來了,我把debug LED拿掉,
) J) F% {9 C& x這兩個要發給CPU的interrupt功能就出問題,& s: Y1 V. p7 h" G) g0 h0 M
只要把debug LED的東西留在code裡面,就正常了,
. L( J8 F1 K6 `) m' F; C+ \不知道板上個各位前輩有遇過這樣的問題嗎?
+ X$ B* I+ H" N; Y: N" o Z2 o) w D( B* j0 O/ ~
example:% p q0 w4 a& H- N$ v7 l& L' T
......4 R# \7 ]3 s- l8 ]
port(
9 r4 k7 d7 b4 \5 g2 _, Q4 DnINT : std_logig;
( x1 n6 [1 l$ v3 n: @) m. p+ uLED_S : std_logic;
! c" m+ ^$ S* w, I) ~: v6 ~0 qLED_P : std_logic
| @, {; K/ k! }, H3 u" n5 J) M);; k N( P, j. m: f- `
......
* p# P8 g) k# Wsignal nSLIDE_INT, nPUSH_INT, LED_INT, LED_SLIDE, LED_PUSH : std_logic;
/ |6 ?0 R' Y o/ l0 F+ w' K b......
8 }7 }- o' g* T. D6 g3 lbegin
, g. ^3 S- ?8 l' e; WnINT <= nSLIDE_INT and nPUSH_INT;; T; r! u8 d) ~' {( s/ o, k% m7 p5 X
LED_INT <= LED_SLIDE and LED_PUSH;& a+ q, M- a" B& u& r) h
LED_SLIDE <= nSLIDE_INT;
; ]' h6 ~" P8 r5 f0 ALED_PUSH <= nPUSH_INT;
5 ?5 n# G/ f) t- B, Q9 w$ i......
% s( c F; G# R& B# S(包含的process如下)
1 y2 H: Z# A3 q: z$ m2 xpower control process) c; h% Z) G/ J! p a/ W0 G2 T1 \
reset control process
1 k# Q( W0 ~! W4 @watchdog process
$ o" |$ x' ~9 x4 t* c6 \7 ]read process
) m3 I0 O% ?. N5 l3 G. cwrite process
* P6 f% n. ?& {3 j2 |slide switch detect and de-bouncing process3 i# q; [+ q( v4 w2 v3 `
push button detect process$ S" M1 T8 T% N' i3 U$ l9 m
slide switch interrupt event process: x) m! K" |: ]# v
push button interrupt event process
; y& m8 _, P* s' I2 a......
- c, r7 h6 k" R5 [5 ?0 c4 ~4 [
# j0 O6 \% C8 o+ _3 u1 c7 o7 |現在的code上面的寫法已經正常,
4 e( a" |) P8 }但是只要把這三行都mark起來,
' w* U/ `- E% ~8 K* Y! XLED_INT <= LED_SLIDE and LED_PUSH;; F" n7 |4 [& C9 p4 Z1 e9 S
LED_SLIDE <= nSLIDE_INT;' }! g3 s# l* A" E0 I8 K; U
LED_PUSH <= nPUSH_INT;
8 l# ]1 m3 I, X; p, T, T5 w; u! J整個code動作就不正常了!7 f% j7 j; ~; e5 T1 B$ f
我是用Altera EPM570 -5ns那顆來做,
E- e% l. |: K* I2 r; Y0 b不知道說這麼多有沒有表達清楚,其實有很多問題想請教,) B1 Y! {! \' f3 ~0 m6 w3 a) k; _& I
不過還是希望能夠先把這問題解決!
( s" l9 Z8 j( h希望各位能給小弟一些建議,謝謝! |
|