From 075b0997b72346468dc9f78938a711f763353571 Mon Sep 17 00:00:00 2001 From: astoria-d Date: Sat, 13 Aug 2016 12:15:47 +0900 Subject: [PATCH] ram/rom garbage data eliminated. --- de1_nes/mem/prg_rom.vhd | 9 +++++++-- de1_nes/mem/ram.vhd | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/de1_nes/mem/prg_rom.vhd b/de1_nes/mem/prg_rom.vhd index 234903d..90e524f 100644 --- a/de1_nes/mem/prg_rom.vhd +++ b/de1_nes/mem/prg_rom.vhd @@ -73,17 +73,22 @@ signal p_rom : rom_array := rom_fill; --attribute ram_init_file : string; --attribute ram_init_file of p_rom : signal is "sample1-prg.hex"; +signal wk_data : std_logic_vector (dbus_size - 1 downto 0); + begin p : process (clk) begin if (rising_edge(clk)) then if (ce_n = '0') then - data <= p_rom(conv_integer(addr)); + wk_data <= p_rom(conv_integer(addr)); else - data <= (others => 'Z'); + wk_data <= (others => 'Z'); end if; end if; end process; + + data <= wk_data when ce_n = '0' else + (others => 'Z'); end rtl; diff --git a/de1_nes/mem/ram.vhd b/de1_nes/mem/ram.vhd index d51d843..bcc1289 100644 --- a/de1_nes/mem/ram.vhd +++ b/de1_nes/mem/ram.vhd @@ -26,6 +26,8 @@ signal work_ram : ram_array := (others => (others => '0')); constant RAM_TAOE : time := 25 ns; --OE access time constant RAM_TOH : time := 10 ns; --write data hold time +signal wk_d_io : std_logic_vector (dbus_size - 1 downto 0); + begin p_write : process (clk) begin @@ -40,12 +42,15 @@ begin begin if (rising_edge(clk)) then if (ce_n= '0' and we_n = '1' and oe_n = '0') then - d_io <= work_ram(conv_integer(addr)); + wk_d_io <= work_ram(conv_integer(addr)); else - d_io <= (others => 'Z'); + wk_d_io <= (others => 'Z'); end if; end if; end process; + + d_io <= wk_d_io when ce_n= '0' and we_n = '1' and oe_n = '0' else + (others => 'Z'); end rtl; ----------------------------------------------------- -- 2.11.0