wierd memory description

Guest
Hi

I described asynchronous memory (32bit wide, 2048 depth) like below,
and the behavior is not correct. The point of problem is shown below,,,
When we change into

DO <= RAM(CONV_INTEGER(address));

the behavior is okay......while I don't know exactly why:)
Thankyou for reading and help...

-------------------------------------------------
entity mem is
port( ce: in std_logic;
rw: in std_logic; -- read(0), write(1)
address: in std_logic_vector(31 downto 0);
DI: in std_logic_vector(31 downto 0);
DO: out std_logic_vector(31 downto 0));
end mem;

architecture arch of mem is
-- 32-bit words, word-addressable memory
constant depth : integer := 2048;
type mem1 is array (0 to depth) of reg32; -- 32 bit word
signal RAM : mem1;
signal adA_temp: reg32; -- temporaray signal

begin
-- ASYNCHRONOUS write
process(ce, rw, address)
begin
if ce='1' and rw='1' then
RAM(CONV_INTEGER(address)) <= DI;
end if;
end if;
end process;

-- ASYNCHRONOUS reading
process(ce, rw, address)
begin
if ce='1' and rw='0' then
adA_temp <= address; ----**** problem
DO <= RAM(CONV_INTEGER(adA_temp));
-- ** DO <= RAM(CONV_INTEGER(address));
end if;
end process;
end arch;
 
JEmoder...@yahoo.com wrote:
Hi

I described asynchronous memory (32bit wide, 2048 depth) like below,
and the behavior is not correct. The point of problem is shown below,,,
When we change into

DO <= RAM(CONV_INTEGER(address));

the behavior is okay......while I don't know exactly why:)
Thankyou for reading and help...

architecture arch of mem is
-- 32-bit words, word-addressable memory
constant depth : integer := 2048;
type mem1 is array (0 to depth) of reg32; -- 32 bit word
signal RAM : mem1;
signal adA_temp: reg32; -- temporaray signal
It might help us if you show us your definition of reg32.

-a
 
There is also a cycle delay introduced by using adA_temp, which takes
on junk value when the mem is read the first time.
 
Neo wrote:
There is also a cycle delay introduced by using adA_temp, which takes
on junk value when the mem is read the first time.
True, and adA_temp should be on the sensitivity list. Better yet, it
should be a variable.

-a
 

Welcome to EDABoard.com

Sponsor

Back
Top