Line 46... |
Line 46... |
reset : in std_logic;
|
reset : in std_logic;
|
uart_write : out std_logic;
|
uart_write : out std_logic;
|
uart_read : in std_logic;
|
uart_read : in std_logic;
|
|
|
address : out std_logic_vector(31 downto 2);
|
address : out std_logic_vector(31 downto 2);
|
|
byte_we : out std_logic_vector(3 downto 0);
|
data_write : out std_logic_vector(31 downto 0);
|
data_write : out std_logic_vector(31 downto 0);
|
data_read : in std_logic_vector(31 downto 0);
|
data_read : in std_logic_vector(31 downto 0);
|
write_byte_enable : out std_logic_vector(3 downto 0);
|
|
mem_pause_in : in std_logic;
|
mem_pause_in : in std_logic;
|
|
|
gpio0_out : out std_logic_vector(31 downto 0);
|
gpio0_out : out std_logic_vector(31 downto 0);
|
gpioA_in : in std_logic_vector(31 downto 0));
|
gpioA_in : in std_logic_vector(31 downto 0));
|
end component; --plasma
|
end component; --plasma
|
Line 61... |
Line 61... |
signal we_n_next : std_logic;
|
signal we_n_next : std_logic;
|
signal we_n_reg : std_logic;
|
signal we_n_reg : std_logic;
|
signal mem_address : std_logic_vector(31 downto 2);
|
signal mem_address : std_logic_vector(31 downto 2);
|
signal data_write : std_logic_vector(31 downto 0);
|
signal data_write : std_logic_vector(31 downto 0);
|
signal data_reg : std_logic_vector(31 downto 0);
|
signal data_reg : std_logic_vector(31 downto 0);
|
signal write_byte_enable : std_logic_vector(3 downto 0);
|
signal byte_we : std_logic_vector(3 downto 0);
|
signal mem_pause_in : std_logic;
|
signal mem_pause_in : std_logic;
|
|
|
begin --architecture
|
begin --architecture
|
--Divide 50 MHz clock by two
|
--Divide 50 MHz clock by two
|
clk_div: process(reset, clk_in, clk_reg, we_n_next)
|
clk_div: process(reset, clk_in, clk_reg, we_n_next)
|
Line 89... |
Line 89... |
ram_address <= mem_address(31 downto 2);
|
ram_address <= mem_address(31 downto 2);
|
ram_we_n <= we_n_reg;
|
ram_we_n <= we_n_reg;
|
|
|
--For Xilinx Spartan-3 Starter Kit
|
--For Xilinx Spartan-3 Starter Kit
|
ram_control:
|
ram_control:
|
process(clk_reg, mem_address, write_byte_enable, data_write)
|
process(clk_reg, mem_address, byte_we, data_write)
|
begin
|
begin
|
if mem_address(30 downto 28) = "001" then --RAM
|
if mem_address(30 downto 28) = "001" then --RAM
|
ram_ce1_n <= '0';
|
ram_ce1_n <= '0';
|
ram_ce2_n <= '0';
|
ram_ce2_n <= '0';
|
if write_byte_enable = "0000" then --read
|
if byte_we = "0000" then --read
|
ram_data <= (others => 'Z');
|
ram_data <= (others => 'Z');
|
ram_ub1_n <= '0';
|
ram_ub1_n <= '0';
|
ram_lb1_n <= '0';
|
ram_lb1_n <= '0';
|
ram_ub2_n <= '0';
|
ram_ub2_n <= '0';
|
ram_lb2_n <= '0';
|
ram_lb2_n <= '0';
|
Line 108... |
Line 108... |
if clk_reg = '1' then
|
if clk_reg = '1' then
|
ram_data <= (others => 'Z');
|
ram_data <= (others => 'Z');
|
else
|
else
|
ram_data <= data_write;
|
ram_data <= data_write;
|
end if;
|
end if;
|
ram_ub1_n <= not write_byte_enable(3);
|
ram_ub1_n <= not byte_we(3);
|
ram_lb1_n <= not write_byte_enable(2);
|
ram_lb1_n <= not byte_we(2);
|
ram_ub2_n <= not write_byte_enable(1);
|
ram_ub2_n <= not byte_we(1);
|
ram_lb2_n <= not write_byte_enable(0);
|
ram_lb2_n <= not byte_we(0);
|
we_n_next <= '0';
|
we_n_next <= '0';
|
ram_oe_n <= '1';
|
ram_oe_n <= '1';
|
end if;
|
end if;
|
else
|
else
|
ram_data <= (others => 'Z');
|
ram_data <= (others => 'Z');
|
Line 138... |
Line 138... |
reset => reset,
|
reset => reset,
|
uart_write => uart_write,
|
uart_write => uart_write,
|
uart_read => uart_read,
|
uart_read => uart_read,
|
|
|
address => mem_address,
|
address => mem_address,
|
|
byte_we => byte_we,
|
data_write => data_write,
|
data_write => data_write,
|
data_read => data_reg,
|
data_read => data_reg,
|
write_byte_enable => write_byte_enable,
|
|
mem_pause_in => mem_pause_in,
|
mem_pause_in => mem_pause_in,
|
|
|
gpio0_out => gpio0_out,
|
gpio0_out => gpio0_out,
|
gpioA_in => gpioA_in);
|
gpioA_in => gpioA_in);
|
|
|