URL
https://opencores.org/ocsvn/igor/igor/trunk
[/] [igor/] [trunk/] [processor/] [pl/] [addr_decoder.vhd] - Blame information for rev 4
Details |
Compare with Previous |
View Log
| Line No. |
Rev |
Author |
Line |
| 1 |
4 |
atypic |
library ieee;
|
| 2 |
|
|
use ieee.std_logic_1164.all;
|
| 3 |
|
|
use ieee.std_logic_unsigned.all;
|
| 4 |
|
|
use work.leval2_package.all;
|
| 5 |
|
|
|
| 6 |
|
|
entity addr_decoder is
|
| 7 |
|
|
port(
|
| 8 |
|
|
clk : in std_logic;
|
| 9 |
|
|
leval_addr : in std_logic_vector(ADDR_BITS - 1 downto 0);
|
| 10 |
|
|
avr_irq : out std_logic;
|
| 11 |
|
|
mem_wait : out std_logic;
|
| 12 |
|
|
mem_ce : out std_logic_vector(1 downto 0);
|
| 13 |
|
|
read_s : in std_logic;
|
| 14 |
|
|
write_s : in std_logic);
|
| 15 |
|
|
end entity;
|
| 16 |
|
|
|
| 17 |
|
|
-- PERIOD = 32.25 ns
|
| 18 |
|
|
-- MEMORY ACCESS LATENCY = 55 ns
|
| 19 |
|
|
-- WAIT 8 clock cycles
|
| 20 |
|
|
|
| 21 |
|
|
architecture rtl of addr_decoder is
|
| 22 |
|
|
signal t_count : integer := 0;
|
| 23 |
|
|
begin
|
| 24 |
|
|
timer : process(clk)
|
| 25 |
|
|
begin
|
| 26 |
|
|
if rising_edge(clk) then
|
| 27 |
|
|
-- increment timer while communicating with memory
|
| 28 |
|
|
if ((leval_addr < X"3FFFF00") and ((write_s or read_s) = '1')) then
|
| 29 |
|
|
if t_count < 8 then
|
| 30 |
|
|
t_count <= t_count + 1;
|
| 31 |
|
|
end if;
|
| 32 |
|
|
else -- reset timer otherwise
|
| 33 |
|
|
t_count <= 0;
|
| 34 |
|
|
end if;
|
| 35 |
|
|
end if;
|
| 36 |
|
|
end process timer;
|
| 37 |
|
|
|
| 38 |
|
|
-- set RDY flag low after 8 cycles
|
| 39 |
|
|
mem_wait <= '0' when t_count = 8 else '1';
|
| 40 |
|
|
|
| 41 |
|
|
-- set CE flag for memory based on address we're reading
|
| 42 |
|
|
mem_ce <= "10" when ((leval_addr < X"0080000") and ((write_s or read_s) = '1')) else
|
| 43 |
|
|
"01" when ((leval_addr < X"0100000") and ((write_s or read_s) = '1')) else "11";
|
| 44 |
|
|
--mem_ce <= '0' when ((leval_addr < X"3FFFF00") and ((write_s or read_s) = '1')) else '1';
|
| 45 |
|
|
|
| 46 |
|
|
-- set IRQ flag for AVR
|
| 47 |
|
|
avr_irq <= '0' when ((leval_addr >= X"3FFFF00") and ((write_s or read_s) = '1')) else '1';
|
| 48 |
|
|
|
| 49 |
|
|
end architecture;
|
© copyright 1999-2026
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.