OpenCores
URL https://opencores.org/ocsvn/System09/System09/trunk

Subversion Repositories System09

[/] [System09/] [trunk/] [rtl/] [Cyclone2/] [wb_lpm_rom.vhd] - Blame information for rev 169

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 116 dilbert57
--===========================================================================--
2
--
3
--  S Y N T H E Z I A B L E    Altera LPM_ROM / WISHBONE interface
4
--
5
--  www.OpenCores.Org - August 2003
6
--  This core adheres to the GNU public license  
7
--
8
-- File name      : wb_lpm_rom.vhd
9
--
10
-- Purpose        : Implements a WISHBONE compatble interface
11
--                  for the Altera LPM_ROM
12
--
13
-- Dependencies   : ieee.Std_Logic_1164
14
--                  ieee.std_logic_unsigned
15
--                                                                      work.lpm_components (Altera's 220PACK.vhd)
16
--
17
-- Author         : Michael L. Hasenfratz Sr.
18
--
19
--===========================================================================----
20
--
21
-- Revision History:
22
--
23
-- Date:          Revision         Author
24
--===========================================================================--
25
-- 1 Aug 2003       0.1              Michael L. Hasenfratz Sr.
26
--      Created
27
--
28
 
29
library ieee;
30
use ieee.std_logic_1164.all;
31
use ieee.std_logic_unsigned.all;
32
 
33
library lpm;
34
use     lpm.lpm_components.all;
35
 
36
entity wb_lpm_rom is
37
        generic (
38
                LPM_WIDTH       :               positive        range 1 to 64 := 8;                             -- data bits WIDE
39
                LPM_WIDTHAD :   positive        range 1 to 32   := 8;                           -- address bits;
40
                LPM_FILE :              string  := "my_rom"                                                                     -- ROM Data File
41
        );
42
        port (
43
          DAT_O :      out std_logic_vector(LPM_WIDTH-1 downto 0);
44
                ADR_I :      in  std_logic_vector(LPM_WIDTHAD-1 downto 0);
45
                SEL_I :      in  std_logic_vector((LPM_WIDTH/8)-1 downto 0);
46
                STB_I :      in  std_logic;             -- VMA (Valid Memory Access)
47
                CYC_I :      in  std_logic;             -- CYC in progress
48
                ACK_O :      out std_logic;             -- Data ready
49
                CLK_I :      in  std_logic;             -- System Clock
50
                RST_I :      in  std_logic              -- Reset
51
        );
52
end;
53
 
54
architecture bhv_wb_lpm_rom of wb_lpm_rom is
55
 
56
        signal  iack :                  std_logic;              -- Internal ACK
57
        signal  isel :                  std_logic;              -- device selected
58
 
59
begin
60
 
61
---------------------------------------------------------
62
--      Instantiate the ROM interface
63
---------------------------------------------------------
64
rom0 : LPM_ROM
65
        generic map (
66
                LPM_WIDTH                                                               => LPM_WIDTH,
67
                LPM_WIDTHAD                                                     => LPM_WIDTHAD,
68
    LPM_OUTDATA                                                 => "UNREGISTERED",
69
                LPM_FILE                                                                => LPM_FILE
70
        )
71
        port map (
72
          Q                             => DAT_O,
73
                ADDRESS => ADR_I,
74
                INCLOCK => CLK_I
75
        );
76
 
77
---------------------------------------------------------
78
--      Interconnections
79
---------------------------------------------------------
80
 
81
        ACK_O   <= isel and iack;
82
 
83
-- Selection
84
romsel : process(SEL_I, CYC_I, STB_I)
85
        variable        vsel :  std_logic;
86
        begin
87
                vsel    := '0';
88
                for ndx in SEL_I'RANGE loop
89
                        vsel                    := vsel or SEL_I(ndx);
90
                end loop;
91
                isel            <= vsel and CYC_I and STB_I;
92
        end process;
93
 
94
-- Read Acknowledge
95
rdack : process(RST_I, CLK_I)
96
        begin
97
                if CLK_I'EVENT and CLK_I = '1' then
98
                        if RST_I = '1' then
99
                                iack            <= '0';
100
                        elsif iack = '1' then
101
                                iack    <= '0';
102
                        else
103
                                iack    <= isel;
104
                        end if;
105
                end if;
106
        end process;
107
 
108
end bhv_wb_lpm_rom;
109
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.