|
徵求記憶體6-bit data in 64個字組,不過不要用陣列的方式,很感謝大家提共意見,不過都不是實際記憶體電路的VHDL,我想要的是一個column decoder,一個row decorder,使用port map latch 64個,輸出要使用三態閘,個人想法如下:
/ S& |9 e' w+ G0 v! WLIBRARY ieee;
9 y$ [3 B* t+ v4 nUSE ieee.std_logic_1164.all;
0 p, p# x$ Y7 k5 k2 O3 XUSE ieee.std_logic_arith.all;) d" `! {9 m* E w% u8 s2 _$ `
( T+ A. s! k/ v" Z" vENTITY memory_64 IS
& V# }. N0 z, f3 G PORT( T- Z: J( S9 Y! Y8 {- K
mem_in : IN std_logic_vector ( 5 DOWNTO 0 );* b2 N. d+ q( k& I Y( n6 P* X) t
mem_out : OUT std_logic_vector ( 5 DOWNTO 0 );2 c; q* W( s( t5 ], s- Y! }
clr_l : IN std_logic;4 n5 Y; c6 J* K4 K& ` i v: K; Z
mem_addr : IN std_logic_vector ( 5 DOWNTO 0 )% }& Y: `% N# I5 O/ {
);
# H' O, T, \4 O4 m$ h$ Q9 f. S( V q! _
-- Declarations
. f( _; t; N5 L! t1 N7 w3 E/ g. S
4 J# e2 t& [' R8 X% z/ tEND memory_64 ;
4 j4 E* {3 m% F" p+ ?: a: E8 p7 l7 H% m" x; z
--! h, J+ |! V7 s5 p5 n$ m) s# z
ARCHITECTURE arch OF memory_64 IS3 F: L% R& B( D4 c0 N
-- column decoder3 G3 R) }1 x, c7 C
component mem_coldec! L: R9 ^! w. M( G/ S; I* ^
PORT( + T, i+ I/ e/ N: N1 n
col_addr : IN std_logic_vector ( 2 DOWNTO 0 );5 B1 c7 Y! l9 @
col_sel : OUT std_logic_vector ( 7 DOWNTO 0 )
# }2 `6 x2 u- S2 R! y );. M# X0 c7 N8 R$ R* R% L, S
end component;
^- Z1 g! u' m9 w1 c-- row decoder
5 j" M& A D! a( i5 |component mem_rowdec* a8 @" h) R% s) c) U" z
PORT( 3 [* I) [8 q# H2 u' n1 _* s+ Y. w' j
row_addr : IN std_logic_vector ( 2 DOWNTO 0 );( v5 b N8 Z# n; \3 t
row_sel : OUT std_logic_vector ( 7 DOWNTO 0 )
) H. f! g6 T' B, p5 L) v );
# x% R- a+ z1 l8 _: Fend component;
5 C, f* |! B( [4 ]5 G-- latch array
: p( T: v* @- i, ncomponent latch_cell
) U+ O" _" X$ n8 Y PORT( ' h+ A# P5 C4 t; h
clr_l : IN std_logic;
" w1 @+ Q I7 H2 C; [ col_sel : IN std_logic;
6 l0 n5 r ?8 m3 |; V( `; I' w row_sel : IN std_logic; . |) B. S" F$ N2 d: P) |' d. N
data_in : IN std_logic_vector ( 5 DOWNTO 0 );
5 }$ K5 d1 a/ `6 U data_out : OUT std_logic_vector ( 5 DOWNTO 0 )6 t8 f" `# M. o( Q) ^" d1 f
);
: `, z& g( U- Y9 G# m& X8 Cend component; 1 A5 [1 A8 s/ U
8 ^3 t4 w* a: a* \, P
signal smem_out : std_logic_vector ( 5 downto 0 );
$ y z% C% w: v9 N- tsignal scol_sel,srow_sel : std_logic_vector( 7 downto 0 );
: J# V$ |1 i& J2 p. E, i. A3 z PBEGIN
; i; {9 B& m6 C! m u_0 : mem_coldec port map(mem_addr( 5 downto 3 ),scol_sel);% J) S2 T) b7 ]! E( G" w+ [1 W
u_1 : mem_rowdec port map(mem_addr( 2 downto 0 ),srow_sel);: {$ r" _- M5 z3 G. n" }: l& J; V7 K
g0 : for i in 7 downto 0 generate -- column generate* s; Q, w$ u4 y; V+ M( @
g1 : for j in 7 downto 0 generate -- row generate% G2 x6 X6 @$ h5 n* ]2 C& J
u_2 : latch_cell$ C! N- P( y( v$ I; C
port map(8 g: ^9 r8 g$ F" N
col_sel => col_sel(j),% u+ n' L! s) ~
row_sel => srow_sel(i),7 L) c% C1 r' f' h. c$ m. {
data_in => mem_in,
/ F! B+ ~" [: N$ R1 ~& m data_out => mem_out(i)7 k B5 k* u' W. H1 l2 M( c
);
4 v+ m8 ~* X9 d' R E+ H" D/ ~ end generate; 0 ?5 }# l7 e- e3 C) G4 n: F! l
end generate;+ B! S: t8 }- z# Q1 `5 ?
END ARCHITECTURE arch;0 q$ A: e% w0 x2 o2 s# e! @6 W
不過模擬很久,始終沒辦法寫進我想要寫的位址,試寫了很久,但是始終寫不出來,所以請大家幫個忙,不然那些範例網路上都有,有點急,請大家廣發建議,感謝大家! |
|