|
徵求記憶體6-bit data in 64個字組,不過不要用陣列的方式,很感謝大家提共意見,不過都不是實際記憶體電路的VHDL,我想要的是一個column decoder,一個row decorder,使用port map latch 64個,輸出要使用三態閘,個人想法如下:
- i5 h$ a; Z8 A+ v3 d/ PLIBRARY ieee;
: k" I9 j1 E7 A3 L9 gUSE ieee.std_logic_1164.all;1 P3 v, a6 @2 x, X7 l- U1 y4 j) V
USE ieee.std_logic_arith.all;
0 m2 p# W- q' E# r+ R) M1 k$ U5 [ L7 X
ENTITY memory_64 IS5 S( k2 }; m" ~+ l: s
PORT( 2 z/ f9 A0 m! M2 [9 v+ y
mem_in : IN std_logic_vector ( 5 DOWNTO 0 );
5 B0 F- w! h6 P mem_out : OUT std_logic_vector ( 5 DOWNTO 0 );
3 B; R I% v# ]7 O clr_l : IN std_logic;
& O- ~/ k/ \9 I- U mem_addr : IN std_logic_vector ( 5 DOWNTO 0 )
" K- N) o7 Y/ t" I* b0 u0 w4 z );
" w' X$ E9 @7 d E d/ n
- z; l9 y0 j7 n( k0 O-- Declarations* M* K1 Q& h; t; C" ^# D; j N+ Z
& j/ o& b# L3 OEND memory_64 ;# W" {) A7 n0 d. Q2 T
& \' t! U s1 W0 t* [' K3 s
--% P) j% u% j, n! b! D! t
ARCHITECTURE arch OF memory_64 IS
7 M0 a2 R$ a$ Y$ o4 }7 S-- column decoder9 o, O, Y5 Z! F: \1 J' Z3 D
component mem_coldec
* G7 ], y/ D, T6 T/ U4 r* P4 X. _ PORT(
( A0 J6 h0 B/ j5 o col_addr : IN std_logic_vector ( 2 DOWNTO 0 );
4 r9 D5 J9 f8 @8 X* R col_sel : OUT std_logic_vector ( 7 DOWNTO 0 )9 O2 F; {6 j4 y) ~% b9 E4 F% R
);
4 v- w* Q5 _2 V7 c9 a2 pend component;; e! c4 q2 _- R0 K
-- row decoder, \ ^8 S6 Z, M% J
component mem_rowdec$ t/ ^8 d6 g1 U$ C# o( V
PORT( 4 V# @: E( L% n1 b
row_addr : IN std_logic_vector ( 2 DOWNTO 0 );
/ f9 [7 g. c( m% a row_sel : OUT std_logic_vector ( 7 DOWNTO 0 )+ t$ F9 K( U: m6 }) ^
);
& k6 C0 { y9 |end component;
7 P: r8 w, c" ~# u: a o( A-- latch array 6 a, g, b* ^$ q0 m
component latch_cell
: e7 {! N' R7 ]$ R4 X9 T2 E1 F6 H9 h PORT( 0 G3 o/ _# N0 B3 u
clr_l : IN std_logic;
( G' F: x t, ?; d D2 Q col_sel : IN std_logic;, w6 d* K* i9 u1 b- R. o) ]! H
row_sel : IN std_logic;
8 G1 T# |' K+ y' Y data_in : IN std_logic_vector ( 5 DOWNTO 0 );% Z+ r& C! |+ [8 M$ b$ T
data_out : OUT std_logic_vector ( 5 DOWNTO 0 )" L" c0 ?, _! ?3 W0 k/ \ {
);
9 m+ H# H4 B# e! V$ Lend component; 4 }; @2 D2 J$ a# v
( A! n2 J- O: s) X s& A# H, G8 G* Asignal smem_out : std_logic_vector ( 5 downto 0 );
* Z$ O+ \8 Q$ ]0 F: M' Usignal scol_sel,srow_sel : std_logic_vector( 7 downto 0 );. E( ^ @7 o& F3 B
BEGIN W; C* p3 ^6 Q \* W, t( U# I
u_0 : mem_coldec port map(mem_addr( 5 downto 3 ),scol_sel);, g7 I6 ?1 b$ o3 v6 I
u_1 : mem_rowdec port map(mem_addr( 2 downto 0 ),srow_sel);2 [/ `$ p& P5 z9 |
g0 : for i in 7 downto 0 generate -- column generate
' h z1 K6 S# U1 V' }$ P g1 : for j in 7 downto 0 generate -- row generate
+ _& ^. ]8 B+ r7 H* \- O c u_2 : latch_cell
. |1 Z4 z: U a* F port map(! K% u# D3 R& H$ d1 r; J9 E
col_sel => col_sel(j),
W8 K. R% h4 h6 x9 j3 k5 s/ v: t row_sel => srow_sel(i),& @0 J" M, Z( G1 [, j9 C y% Z7 o
data_in => mem_in,, E: D! H+ H( J a% a
data_out => mem_out(i)$ W9 Y* g) d! J- c2 J7 y
);* d8 R1 b2 f. ~$ K
end generate;
7 k* k; ~" u2 E/ w6 E' V5 G0 K end generate;; I/ n: O! Y- o- q& [6 o+ Y/ X
END ARCHITECTURE arch;! L" I+ O1 `7 T
不過模擬很久,始終沒辦法寫進我想要寫的位址,試寫了很久,但是始終寫不出來,所以請大家幫個忙,不然那些範例網路上都有,有點急,請大家廣發建議,感謝大家! |
|