|
徵求記憶體6-bit data in 64個字組,不過不要用陣列的方式,很感謝大家提共意見,不過都不是實際記憶體電路的VHDL,我想要的是一個column decoder,一個row decorder,使用port map latch 64個,輸出要使用三態閘,個人想法如下:& b8 M' E. j7 a$ n+ B% n" R
LIBRARY ieee;
5 `. |) l2 L Q& M- {5 qUSE ieee.std_logic_1164.all;, i* B- N" u- ^& C/ L% P
USE ieee.std_logic_arith.all;
& t7 d# j- _/ F/ ^% g- ]4 n. W0 x. e" G B1 t
ENTITY memory_64 IS
6 h$ k+ O% p) @$ H PORT(
/ _% l- c! m+ r! O. b mem_in : IN std_logic_vector ( 5 DOWNTO 0 );3 D2 H" c- d5 u$ S0 C7 F
mem_out : OUT std_logic_vector ( 5 DOWNTO 0 );
8 j. o- v- g& ]7 p* ? clr_l : IN std_logic;7 y' L4 l, r$ ? |, c
mem_addr : IN std_logic_vector ( 5 DOWNTO 0 )/ x$ B3 }4 L# V+ D
);; U. x5 q5 a4 B" [# m
8 N$ S* G/ ~" A! }* C
-- Declarations
' A8 S) B$ n3 r3 b( j
9 ?6 A5 P' d# x9 TEND memory_64 ;
% k' n/ f" ?4 H- s6 X3 w# y
0 g9 L: n# ~% B' U- n2 }6 Y--8 U+ P% g3 t' h$ {
ARCHITECTURE arch OF memory_64 IS
$ b v- w& ^. [) d, V" |4 |) H/ _-- column decoder
" D! c# n' y) r; ]3 [1 `! Wcomponent mem_coldec1 Q8 y+ D( a# k9 s* Q; P
PORT( $ L' A) d6 y. c$ z- n
col_addr : IN std_logic_vector ( 2 DOWNTO 0 );
7 f: H' c2 ^" y; X+ r8 G col_sel : OUT std_logic_vector ( 7 DOWNTO 0 )- s) ?1 Z/ B1 R4 e8 I" l; F, A
);
7 l/ P' y: w* ~+ ^8 J; iend component;
. x6 G6 x A7 Z! v" V/ ]: [9 {-- row decoder
) M$ u# O% [7 k& m5 N- a$ S, [' Dcomponent mem_rowdec3 m) t, D7 D( t+ _8 O6 a$ c
PORT(
+ q- V" y# }( R% h1 e2 B9 y row_addr : IN std_logic_vector ( 2 DOWNTO 0 );/ O6 T; h/ k( Z8 v r) d _
row_sel : OUT std_logic_vector ( 7 DOWNTO 0 )
~4 C! t% \. A) I9 A/ ~* t7 ^3 W );; d/ c, \9 Y) O: y; _7 n
end component; . b7 u8 M% F% _- E) [8 I
-- latch array
7 w6 k1 d c. W/ N5 t' l- |. l: ^8 Ncomponent latch_cell
0 N# G$ `' {/ a2 O; i, c) C- e$ U PORT( $ D1 O7 b7 y' `" x( m# t! l
clr_l : IN std_logic;
9 p6 A# r! I5 i' {, r; G col_sel : IN std_logic;
' S" C, a* |9 w$ O2 t" t9 x row_sel : IN std_logic; 0 e$ F+ u+ g" \" X8 J
data_in : IN std_logic_vector ( 5 DOWNTO 0 );
; c/ k. l6 r% C* U( R$ Z data_out : OUT std_logic_vector ( 5 DOWNTO 0 )
: w# `; a# j( m5 b; Q& E8 R );
, @- P5 W( Z1 ]" _2 Send component; ; O: p0 v# ?: n) R# ]4 P
7 y7 r( a; ? K2 d3 Zsignal smem_out : std_logic_vector ( 5 downto 0 );3 g' P, {" I! C3 t5 T* z
signal scol_sel,srow_sel : std_logic_vector( 7 downto 0 );
( R' z8 T; W7 r. ~; rBEGIN' }8 z6 n9 N2 d8 [2 y8 k
u_0 : mem_coldec port map(mem_addr( 5 downto 3 ),scol_sel);
2 M5 n1 `: b5 f4 s2 n! }* A; S4 v u_1 : mem_rowdec port map(mem_addr( 2 downto 0 ),srow_sel);4 ^& q# T' l/ u+ k# D; l( t0 A" z
g0 : for i in 7 downto 0 generate -- column generate
5 u1 w( D0 Q1 H; Q+ Q g1 : for j in 7 downto 0 generate -- row generate- D8 ]; ]5 Z- D' Z6 _' e' j
u_2 : latch_cell9 X( U/ F! n% I5 e8 _
port map(
; r. A% y1 R. Q1 l" c9 ?% ^ col_sel => col_sel(j),
0 e" G2 d# j& f! ]( z row_sel => srow_sel(i),: n T# m0 a) N1 F3 N B4 l6 f/ x
data_in => mem_in," _" m+ x9 h) B! f @
data_out => mem_out(i)
6 {: m9 _4 C( q0 n3 w5 U5 D; L );; C/ ~. H9 z# W$ W, d
end generate;
9 H; x) T1 n" [' o; h. @- }- F end generate;. M( L2 R3 S c$ N. }
END ARCHITECTURE arch;
& C; |6 L: {/ r2 `5 ^8 R6 U不過模擬很久,始終沒辦法寫進我想要寫的位址,試寫了很久,但是始終寫不出來,所以請大家幫個忙,不然那些範例網路上都有,有點急,請大家廣發建議,感謝大家! |
|