Advertisement
rommik

(NEW)dvb_s2x_RAM.vhd

Dec 19th, 2019
584
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 1.47 KB | None | 0 0
  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use std.textio.all;
  4. use ieee.numeric_std.all;
  5.  
  6. entity dvb_s2x_RAM is
  7.     Port(
  8.         clk       : in std_logic;                              
  9.         res       : in std_logic;    
  10.         WE        : in std_logic;                    -- Write enable              
  11.         address   : in std_logic_vector(15 downto 0);
  12.         in_data   : in std_logic_vector(0 downto 0);
  13.         out_data  : out std_logic_vector(0 downto 0));        
  14. end entity;
  15.  
  16.  
  17. architecture Behavioral of dvb_s2x_RAM is
  18.  
  19. signal out_high : std_logic_vector(0 downto 0) := (others => '0');                                      
  20. --signal read_en  : std_logic := '1';                                        -- Output register enable
  21.  
  22. type ram_type is array (64805 downto 0) of std_logic_vector(0 downto 0);   -- 2D Array Declaration for RAM signal
  23.      
  24. signal RAM_data : std_logic_vector(0 downto 0);
  25. signal RAM      : ram_type := (others => (others => '0'));
  26.  
  27. begin
  28.  
  29. process(clk)
  30. begin
  31.     if(rising_edge(clk)) then
  32.         if(WE = '1') then
  33.             RAM(to_integer(unsigned(address))) <= in_data;
  34.         end if;
  35.         RAM_data <= RAM(to_integer(unsigned(address)));
  36.     end if;
  37. end process;
  38.  
  39.  
  40. process(clk)
  41. begin
  42.     if(rising_edge(clk)) then
  43.         if(res = '1') then
  44.             out_high <= (others => '0');
  45.         else
  46.             out_high <= RAM_data;
  47.         end if;
  48.     end if;
  49. end process;
  50. out_data <= out_high;
  51.  
  52. end architecture;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement