|
6#
樓主 |
發表於 2009-1-10 22:13:00
|
只看該作者
- FWRITE: process (CLR, WCLK)+ V* \3 z! A( t, ]' n. E( c( e. g
- begin
( r# [) V, D5 [, N- u - if CLR = '1' then
4 m9 {: z8 @3 J1 m% _, o h - for INDEX in fmax downto 0 loop5 J- i5 ?# L; B; N# Y
- fifo_array(INDEX) <= (others => '0');
# }& w( ^) L& z - end loop;
' S2 ]3 R( h1 [; i Y - WR_PTR <= 0;
3 G+ |6 O* R4 ?2 j - elsif rising_edge(WCLK) then) X( p5 r2 q1 {% p0 A V1 H+ q
- if WE = '1' and count<depth then3 `6 B) i# T% E" i8 I& A
- fifo_array(WR_PTR) <= DATA;( H0 b: e8 u8 ]4 w s
- -- move pointer% h0 |5 G. l$ n1 Z; X
- if WR_PTR=fmax then
" o, m/ h, o( F1 ?/ a! S) [ - WR_PTR <= 0; , s j, ? z& V& o U
- else WR_PTR <= WR_PTR + 1;
5 J5 S; J+ M3 b' N9 a) ~: v# Y - end if;
% [, o) O/ M# u& P - end if;
$ p& d! L* q; J - end if;/ k1 f/ ~! F" n* Y" b3 F
- end process;$ P! \) l: \- d4 \9 }
- FREAD: process (CLR, RCLK)
0 t- Q; d" g8 W6 J2 b: N; M) e - begin
' j" [8 R% H% ^( M+ O; R - if CLR = '1' then
2 U/ d8 N% p! l* ]3 { - RD_PTR <= 0;) V) K) }* R4 Y
- elsif falling_edge(RCLK) then0 @+ I5 {2 i% ~. `( V% ?
- if RE = '1' and count>0 then" f4 y6 ^4 n$ Q! y* q
- Q <= fifo_array(RD_PTR);
/ g" X$ \) d; f0 x' Q0 V - -- move pointer
( U- ~; p6 L$ ?/ V3 W/ W# f - if RD_PTR=fmax then
2 P$ q. J" x' Z+ l* L$ ` - RD_PTR <= 0; 1 e9 @5 ?$ h6 t
- else RD_PTR <= RD_PTR + 1;
. `- o6 C9 w9 c: D - end if;* w9 q- ^! e v' T3 P1 J; i
- end if;
. ]) r- L1 ?* E, ?/ Y - end if;) o/ u* g% R, o9 p3 c- _' e) W
- end process;
: x! Z; U( |( c3 z2 Z" Q - end architecture;
複製代碼 |
|