VHDL Memory Models: EL 310 Erkay Savaş Sabancı University
VHDL Memory Models: EL 310 Erkay Savaş Sabancı University
VHDL Memory Models: EL 310 Erkay Savaş Sabancı University
Memory Models
EL 310
Erkay Sava
Sabanc University
1
ROM
library ieee;
use ieee.std_logic_1164.all;
entity rom16x8 is
port(address: in integer range 0 to 15;
data: out std_ulogic_vector(7 downto 0));
end entity;
architecture sevenseg of rom16x8 is
type rom_array is array (0 to 15) of std_ulogic_vector (7
downto 0);
constant rom: rom_array := ( 11111011, 00010010,
10011011, 10010011, 01011011, 00111010,
11111011, 00010010, 10100011, 10011010,
01111011, 00010010, 10101001, 00110110,
11011011, 01010010);
begin
data <= rom(address);
end architecture;
2
Static RAM
Address
CS
OE
n
Static RAM
2n word of
m bits
m
Data input/output
WE
CS - when asserted low, memory read and write operations are possible.
OE - when asserted low, memory output is enabled onto an external bus
WE - when asserted low, memory can be written
3
D
G
data_out
OE
WE
Mode
I/O pins
not
high-Z
selected
output
high-Z
disabled
read
data_out
write
data_in
A4
I/O7
I/O0
Row
Decoder
input
data
control
Memory Matrix
128 x 128
Column I/O
Column Decoder
A3 A2 A1 A0
OE
WE
CS
6
Adress
tOH
dout
tAA
tOH
data valid
The address must be stable for the read cycle time, tRC
After the address changes, the old data remains at the
output for a time tOH
Then there is a transition period during which the data
may change (cross-hatching section)
The new data is stable at the memory after the address access
time tAA
7
CS
tACS
tCHZ
tCLZ
dout
data valid
address
tCW
tWR
CS
tAW
WE
tAS
tWP
tOW
tWHZ
dout
tDW
din
tDH
valid data
9
Adress
tCW
tAS
tWR
CS
tAW
WE
high - Z
dout
tDW
din
tDH
new data
10
11
Symbol
61162-2
43258A-25
min
max
min
max
tRC
120
25
tAA
120
25
tACS
120
25
tCLZ
10
tOE
80
12
tOLZ
10
tCHZ
10
40
10
tOHZ
10
40
10
tOH
10
12
Symbol
61162-2
43258A-25
min
max
min
max
tWC
120
25
tCW
70
15
tAW
105
15
tAS
tWP
70
15
tWR
tWHZ
10
35
10
tDW
35
12
tDH
tOW
10
13
14
18
20
Dynamic RAM
library ieee;
use ieee.std_logic_1164.all;
entity dram1024 is
port(address: in integer range 0 to 2**5-1;
data: inout std_ulogic_vector(7 downto 0);
RAS, CAS, WE: in std_ulogic);
end entity;
22
Dynamic RAM
architecture beh of dram1024 is
begin
p0: process(RAS, CAS, WE) is
type dram_array is array (0 to 2**10-1) of
std_ulogic_vector (7 downto 0);
variable row_address: integer range 0 to 2**5-1;
variable mem_address: integer range 0 to 2**10-1;
variable mem: dram_array;
begin
...
end process p0;
end architecture;
23
Dynamic RAM
architecture beh of dram1024 is
begin
p0: process(RAS, CAS, WE) is
begin
data <= (others => Z);
if falling_edge(RAS) then row_address := address;
elsif falling_edge(CAS) then
mem_address := row_address*2**5 + address;
if RAS = 0 and WE = 0 then
mem(mem_address) := data;
end if;
if CAS = 0 and RAS = 0 and WE = 1 then
data <= mem(mem_address);
end if;
end process p0;
end architecture;
24