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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [processor/] [VHDL/] [scarts_core/] [vectab.vhd] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 jlechner
-----------------------------------------------------------------------
2
-- This file is part of SCARTS.
3
-- 
4
-- SCARTS is free software: you can redistribute it and/or modify
5
-- it under the terms of the GNU General Public License as published by
6
-- the Free Software Foundation, either version 3 of the License, or
7
-- (at your option) any later version.
8
-- 
9
-- SCARTS is distributed in the hope that it will be useful,
10
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
11
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
-- GNU General Public License for more details.
13
-- 
14
-- You should have received a copy of the GNU General Public License
15
-- along with SCARTS.  If not, see <http://www.gnu.org/licenses/>.
16
-----------------------------------------------------------------------
17
 
18
 
19
library ieee;
20
use ieee.std_logic_1164.all;
21
use ieee.numeric_std.all;
22
 
23
use work.scarts_core_pkg.all;
24
use work.scarts_pkg.all;
25
 
26
entity scarts_vectab is
27
  generic (
28
    CONF : scarts_conf_type);
29
  port (
30
    clk         : in  std_ulogic;
31
    hold        : in  std_ulogic;
32
 
33
    data_in     : in  std_logic_vector(CONF.word_size-1 downto 0);
34
    interruptnr : in  std_logic_vector(EXCADDR_W-2 downto 0);
35
    trapnr      : in  std_logic_vector(EXCADDR_W-1 downto 0);
36
    wrvecnr     : in  std_logic_vector(EXCADDR_W-1 downto 0);
37
    intcmd      : in  std_ulogic;
38
    wrvecen     : in  std_ulogic;
39
 
40
    data_out    : out std_logic_vector(CONF.word_size-1 downto 0));
41
end scarts_vectab;
42
 
43
architecture behaviour of scarts_vectab is
44
 
45
subtype WORD is std_logic_vector(CONF.word_size-1 downto 0);
46
type ram_array is array (0 to EXCVECTAB_S-1) of WORD;
47
 
48
signal ram : ram_array := (others => (others => '0'));
49
 
50
signal raddr : std_logic_vector(EXCADDR_W-1 downto 0);
51
 
52
signal enable : std_ulogic;
53
 
54
begin
55
 
56
 
57
  comb : process(intcmd, interruptnr, trapnr)
58
  begin
59
 
60
    raddr <= (others => '0');
61
    if intcmd = EXC_ACT then
62
      raddr(EXCADDR_W-2 downto 0) <= interruptnr;
63
      raddr(EXCADDR_W-1) <= '1';
64
    else
65
      raddr <= trapnr;
66
    end if;
67
 
68
  end process;
69
 
70
  enable <= not hold;
71
 
72
  no_target_gen : if (CONF.tech = NO_TARGET) generate
73
    process(clk)
74
    begin
75
      if rising_edge(clk) then
76
        if (enable = '1') then
77
          if wrvecen = '1' then
78
            ram(to_integer(unsigned(wrvecnr))) <= data_in;
79
          end if;
80
        end if;
81
      end if;
82
    end process;
83
 
84
    process(clk)
85
    begin
86
      if rising_edge(clk) then
87
        if (enable = '1') then
88
          data_out <= ram(to_integer(unsigned(raddr)));
89
        end if;
90
      end if;
91
    end process;
92
  end generate;
93
 
94
--  xilinx_gen : if (CONF.tech = XILINX) generate
95
--    vectab_ram_inst: xilinx_vectab_ram
96
--      port map (
97
--        clk     => clk,
98
--        enable  => enable,
99
--        raddr   => raddr,
100
--        rdata   => data_in,
101
--        waddr   => wrvecnr,
102
--        wdata   => data_out,
103
--        wen     => wrvecen
104
--      );
105
--  end generate;
106
 
107
  altera_gen : if (CONF.tech = ALTERA) generate
108
    process(clk)
109
    begin
110
      if rising_edge(clk) then
111
        if (enable = '1') then
112
          if wrvecen = '1' then
113
            ram(to_integer(unsigned(wrvecnr))) <= data_in;
114
          end if;
115
        end if;
116
      end if;
117
    end process;
118
 
119
    process(clk)
120
    begin
121
      if rising_edge(clk) then
122
        if (enable = '1') then
123
          data_out <= ram(to_integer(unsigned(raddr)));
124
        end if;
125
      end if;
126
    end process;
127
  end generate;
128
 
129
end behaviour;

powered by: WebSVN 2.1.0

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