Professional Documents
Culture Documents
March 2015
Memories
Unique address
Storing m bits of data
Similar to a collection of
registers.
Address
I
I
Unsigned coding
Address bits: n 2n
locations
m bits
0
1
2
3
4
5
6
7
2n-2
2n-1
Memory Units
I
I
128K 8-bit
64K 16-bit
32K 32-bit
16K 64-bit
Elementary Memory
I
Address Inputs
I
Data In
I
d in(m 1..0)
Data Out
I
a(n 1..0)
d out(m 1..0)
Control Signals
I
I
en (enable)
wr (write)
a(n-1)
a(n-2)
a(1)
a(0)
d_in(m-1)
d_in(m-2)
d_in(1)
d_in(0)
wr
en
d_out(m-1)
d_out(m-2)
d_out(1)
d_out(0)
process ( addr , wr , en )
begin
if en = 1 then
if wr = 1 then
data ( to_integer ( addr )) <= d_in ;
end if ;
d_out <= data ( to_integer ( addr ));
else
d_out <= ( others = > Z );
end if ;
end process ;
Memory Types
I
Random-Access Memory
(RAM)
I
I
Not clocked:
Asynchronous SRAM
Clocked: Synchronous
SRAM (SSRAM)
Non Volatile
Can Read only
Synchronous or
Asynchronous
Combinational function
Flash RAM
I
I
Non volatile
Read (fast) and write
(slow)
Limited number of write
(erase) cycles
Bidirectional Ports
I
I
I
+1
Master is writing on d
I
I
Master / Slave
I
Master is reading
I
I
clk
wr
Testbench
sig_gen : process
begin
wr <= 1 ;
d <= x " 1 " ;
wait for 10 ns ;
wr <= 0 ;
d <=( others = > Z );
wait for 10 ns ;
wr <= 1 ;
d <= x " F " ;
wait for 10 ns ;
wr <= 0 ;
d <=( others = > Z );
-- @0 ns
-- Master writes -> Slave reads
-- Master drives data , slave drives Z
-- @10 ns
-- Slave writes -> Master reads
-- Master drives Z , slave drives data
-- @20 ns
-- @30 ns
n
I
Writing
I
I
Output port: Z
Input port: senses d
d_out
d_in
Reading
I
I
Bidirectional Port d
wr
en
is
inout s t d _ l o g i c _ v e c t o r (7 downto 0);
in std_logic ;
in unsigned (3 downto 0));
Testbench
sig_gen : process
begin
-- @ 0 ns
en <= 1 ; addr <= " 0000 " ; wr <= 1 ;
wait for 10 ns ; -- @ 10 ns
wr <= 0 ;
wait for 10 ns ; -- @ 20 ns
en <= 0 ;
wait for 10 ns ; -- @ 30 ns
en <= 1 ; addr <= " 0010 " ;
wait for 10 ns ; -- 40 ns
wr <= 1 ;
wait for 10 ns ; -- 50 ns
addr <= " 0001 " ;
wait for 10 ns ; -- 60 ns
wait ;
end process sig_gen ;