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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [processor/] [VHDL/] [ext_modules/] [ext_watchpoint/] [ext_watchpoint.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
-------------------------------------------------------------------------------
20
-- Title      : Template for Extension Module
21
-- Project    : SCARTS - Scalable Processor for Embedded Applications in
22
--              Realtime Environment
23
-------------------------------------------------------------------------------
24
-- File       : ext_watchpoint.vhd
25
-- Author     : Martin Delvai
26
-- Company    : TU Wien - Institut fr Technische Informatik
27
-- Created    : 2007/04/16
28
-- Last update: 2011-03-17
29
-- Platform   : Linux
30
-------------------------------------------------------------------------------
31
-- Description:
32
-------------------------------------------------------------------------------
33
-- Copyright (c) 2007 
34
-------------------------------------------------------------------------------
35
-- Revisions  :
36
-- Date        Version  Author  Description
37
-- 2007-04-16  1.0      delvai  Created
38
-------------------------------------------------------------------------------
39
 
40
library ieee;
41
use ieee.std_logic_1164.all;
42
use ieee.numeric_std.all;
43
 
44
use work.scarts_core_pkg.all;
45
use work.scarts_pkg.all;
46
use work.pkg_watchpoint.all;
47
 
48
 
49
architecture behaviour of ext_watchpoint is
50
 
51
subtype BYTE is std_logic_vector(7 downto 0);
52
type register_set is array (0 to 31) of BYTE;
53
 
54
 
55
constant CONFIGREG_CUST : integer := 3;
56
constant REG_ACCESS_ADDR : integer := 4; -- to 7
57
constant REG_ADDR0 : integer := 8;
58
constant REG_MASK0 : integer := 12;
59
 
60
 
61
constant C_CONF_R0     : integer := 0;
62
constant C_CONF_W0     : integer := 1;
63
constant C_CONF_R1     : integer := 2;
64
constant C_CONF_W1     : integer := 3;
65
constant C_CONF_R2     : integer := 4;
66
constant C_CONF_W2     : integer := 5;
67
 
68
 
69
 
70
type reg_type is record
71
  ifacereg  : register_set;
72
end record;
73
 
74
 
75
signal r, r_next : reg_type;
76
signal rstint : std_ulogic;
77
 
78
 
79
begin
80
 
81
 
82
comb : process(r, exti, extsel, hi_addr, read_en)
83
  variable v : reg_type;
84
  variable index: integer range 7 downto 0;
85
  variable dummy_addr:std_logic_vector(31 downto 0);
86
  variable access_addr, addr, mask: std_logic_vector(WORD_W-1 downto 0);
87
begin
88
  -- Default Values
89
  v := r;
90
  index := to_integer(unsigned(exti.addr(4 downto 2)));
91
    --schreiben
92
    if ((extsel = '1') and (exti.write_en = '1')) then
93
      case exti.addr(4 downto 2) is
94
        when "000" =>
95
          if ((exti.byte_en(0) = '1') or (exti.byte_en(1) = '1')) then
96
            v.ifacereg(STATUSREG)(STA_INT) := '1';
97
            v.ifacereg(CONFIGREG)(CONF_INTA) :='0';
98
          else
99
            if ((exti.byte_en(2) = '1')) then
100
              v.ifacereg(2) := exti.data(23 downto 16);
101
            end if;
102
            if ((exti.byte_en(3) = '1')) then
103
              v.ifacereg(3) := exti.data(31 downto 24);
104
            end if;
105
          end if;
106
        when others =>
107
          if ((exti.byte_en(0) = '1')) then
108
            v.ifacereg(index*4) := exti.data(7 downto 0);
109
          end if;
110
          if ((exti.byte_en(1) = '1')) then
111
            v.ifacereg(index*4+1) := exti.data(15 downto 8);
112
          end if;
113
          if ((exti.byte_en(2) = '1')) then
114
            v.ifacereg(index*4+2) := exti.data(23 downto 16);
115
          end if;
116
          if ((exti.byte_en(3) = '1')) then
117
            v.ifacereg(index*4+3) := exti.data(31 downto 24);
118
          end if;
119
        --when others =>
120
          --null;
121
      end case;
122
    end if;
123
 
124
    --auslesen
125
    exto.data <= (others => '0');
126
    if ((extsel = '1') and (exti.write_en = '0')) then
127
      case exti.addr(4 downto 2) is
128
        when "000" =>
129
          exto.data <= r.ifacereg(3) & r.ifacereg(2) & r.ifacereg(1) & r.ifacereg(0);
130
        when "001" =>
131
          if (r.ifacereg(CONFIGREG)(CONF_ID) = '1') then
132
            exto.data <= MODULE_VER & MODULE_ID;
133
          else
134
            exto.data <= r.ifacereg(index*4+3) & r.ifacereg(index*4+2)
135
                & r.ifacereg(index*4+1) & r.ifacereg(index*4);
136
          end if;
137
        when others =>
138
            exto.data <= r.ifacereg(index*4+3) & r.ifacereg(index*4+2)
139
                & r.ifacereg(index*4+1) & r.ifacereg(index*4);
140
      end case;
141
    end if;
142
 
143
 
144
    --berechnen der neuen status flags
145
    v.ifacereg(STATUSREG)(STA_LOOR) := r.ifacereg(CONFIGREG)(CONF_LOOW);
146
    v.ifacereg(STATUSREG)(STA_FSS) := '0';
147
    v.ifacereg(STATUSREG)(STA_RESH) := '0';
148
    v.ifacereg(STATUSREG)(STA_RESL) := '0';
149
    v.ifacereg(STATUSREG)(STA_BUSY) := '0';
150
    v.ifacereg(STATUSREG)(STA_ERR) := '0';
151
    v.ifacereg(STATUSREG)(STA_RDY) := '1';
152
 
153
    -- Output soll Defaultmassig auf eingeschalten sie 
154
    v.ifacereg(CONFIGREG)(CONF_OUTD) := '1';
155
 
156
    --soft- und hard-reset vereinen
157
    rstint <= not RST_ACT;
158
    if exti.reset = RST_ACT or r.ifacereg(CONFIGREG)(CONF_SRES) = '1' then
159
      rstint <= RST_ACT;
160
    end if;
161
 
162
    --Interrupt Behandlung 
163
    if r.ifacereg(CONFIGREG)(CONF_INTA) = '1' then
164
      v.ifacereg(STATUSREG)(STA_INT)   := '0';
165
      v.ifacereg(CONFIGREG)(CONF_INTA) := '0';
166
    end if;
167
 
168
    exto.intreq <= r.ifacereg(STATUSREG)(STA_INT);
169
 
170
  -- Module Specific part
171
        access_addr := hi_addr & exti.addr;
172
 
173
    for i in 2 downto 0 loop
174
            if WORD_CFG_C = 1 then
175
                        addr := r.ifacereg(REG_ADDR0+i*8+1) & r.ifacereg(REG_ADDR0+i*8);
176
                        mask := r.ifacereg(REG_MASK0+i*8+1) & r.ifacereg(REG_MASK0+i*8);
177
                else
178
                        addr := r.ifacereg(REG_ADDR0+i*8+3) & r.ifacereg(REG_ADDR0+i*8+2)
179
                                        & r.ifacereg(REG_ADDR0+i*8+1) & r.ifacereg(REG_ADDR0+i*8);
180
                        mask := r.ifacereg(REG_MASK0+i*8+3) & r.ifacereg(REG_MASK0+i*8+2)
181
                                        & r.ifacereg(REG_MASK0+i*8+1) & r.ifacereg(REG_MASK0+i*8);
182
                end if;
183
 
184
                if ((access_addr or mask) = (addr or mask)) then
185
                        if (read_en = '1' and r.ifacereg(CONFIGREG_CUST)(C_CONF_R0 + i*2) = '1')
186
                                or (exti.write_en = '1' and r.ifacereg(CONFIGREG_CUST)(C_CONF_W0 + i*2) = '1')
187
                        then
188
                                v.ifacereg(STATUSREG)(STA_INT) := '1';
189
                                v.ifacereg(REG_ACCESS_ADDR) := access_addr(7 downto 0);
190
                                v.ifacereg(REG_ACCESS_ADDR+1) := access_addr(15 downto 8);
191
                                v.ifacereg(REG_ACCESS_ADDR+2) := access_addr(23 downto 16);
192
                                v.ifacereg(REG_ACCESS_ADDR+3) := access_addr(31 downto 24);
193
                        end if;
194
        end if;
195
        end loop;
196
--   end process mod_specific;
197
 
198
  r_next <= v;
199
end process;
200
 
201
 
202
 
203
-- Synchronous process 
204
  reg : process(clk)
205
  begin
206
    if rising_edge(clk) then
207
      if rstint = RST_ACT then
208
        r.ifacereg <= (others => (others => '0'));
209
      else
210
        r <= r_next;
211
      end if;
212
    end if;
213
  end process;
214
 
215
 
216
 
217
 
218
end behaviour;

powered by: WebSVN 2.1.0

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