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

Subversion Repositories core_arm

[/] [core_arm/] [trunk/] [vhdl/] [sparc/] [ahbstat.vhd] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 tarookumic
 
2
 
3
 
4
 
5
----------------------------------------------------------------------------
6
--  This file is a part of the LEON VHDL model
7
--  Copyright (C) 1999  European Space Agency (ESA)
8
--
9
--  This library is free software; you can redistribute it and/or
10
--  modify it under the terms of the GNU Lesser General Public
11
--  License as published by the Free Software Foundation; either
12
--  version 2 of the License, or (at your option) any later version.
13
--
14
--  See the file COPYING.LGPL for the full details of the license.
15
 
16
 
17
-----------------------------------------------------------------------------
18
-- Entity:      ahbstat
19
-- File:        ahbstat.vhd
20
-- Author:      Jiri Gaisler - ESA/ESTEC
21
-- Description: AHB status register. Latches the address and bus
22
--              parameters when an error is signalled on the AHB bus.
23
------------------------------------------------------------------------------
24
 
25
library IEEE;
26
use IEEE.std_logic_1164.all;
27
use work.leon_config.all;
28
use work.leon_iface.all;
29
use work.amba.all;
30
 
31
entity ahbstat is
32
  port (
33
    rst    : in  std_logic;
34
    clk    : in  clk_type;
35
    ahbmi  : in  ahb_mst_in_type;
36
    ahbsi  : in  ahb_slv_in_type;
37
    apbi   : in  apb_slv_in_type;
38
    apbo   : out apb_slv_out_type;
39
    ahbsto : out ahbstat_out_type
40
 
41
  );
42
end;
43
 
44
architecture rtl of ahbstat is
45
 
46
type memstattype is record
47
  hsize            : std_logic_vector(2 downto 0);
48
  hmaster          : std_logic_vector(3 downto 0);
49
  address          : std_logic_vector(31 downto 0);  -- failed address
50
  read             : std_logic;
51
  newerr           : std_logic;
52
  ahberr           : std_logic;
53
  hresp            : std_logic_vector(1 downto 0);
54
end record;
55
 
56
signal r, rin : memstattype;
57
 
58
 
59
begin
60
 
61
 
62
  ctrl : process(rst, ahbmi, ahbsi, apbi, r)
63
 
64
  variable v : memstattype;
65
  variable regsd : std_logic_vector(31 downto 0);   -- data from registers
66
 
67
 
68
  begin
69
 
70
    v := r; regsd := (others => '0');
71
 
72
    case apbi.paddr(2 downto 2) is
73
    when "1" => regsd := r.address;
74
    when "0" =>
75
          regsd := "00000000000000000000000" &  r.newerr & r.read &
76
                   r.hmaster & r.hsize  ;
77
 
78
    when others => regsd := (others => '-');
79
    end case;
80
 
81
    apbo.prdata <= regsd;
82
 
83
    if (apbi.psel and apbi.penable and apbi.pwrite) = '1' then
84
      case apbi.paddr(2 downto 2) is
85
      when "1" => v.address := apbi.pwdata;
86
      when "0" =>
87
 
88
        v.newerr  := apbi.pwdata(8);
89
        v.read    := apbi.pwdata(7);
90
        v.hmaster := apbi.pwdata(6 downto 3);
91
        v.hsize   := apbi.pwdata(2 downto 0);
92
      when others => null;
93
      end case;
94
 
95
    end if;
96
 
97
    v.hresp := ahbmi.hresp;
98
 
99
    if (ahbsi.hready = '1') then
100
 
101
      if (r.newerr = '0') then
102
        if (r.hresp = HRESP_ERROR) then v.newerr := '1';
103
        else
104
          v.hmaster := ahbsi.hmaster; v.address := ahbsi.haddr;
105
          v.read := not ahbsi.hwrite; v.hsize := ahbsi.hsize;
106
        end if;
107
      end if;
108
      v.hresp := HRESP_OKAY;
109
    end if;
110
 
111
    if rst = '0' then
112
      v.newerr := '0'; v.hresp := HRESP_OKAY;
113
    end if;
114
 
115
    v.ahberr := v.newerr and not r.newerr;
116
 
117
    rin <= v;
118
    ahbsto.ahberr <= r.ahberr;
119
 
120
  end process;
121
 
122
 
123
  memstatregs : process(clk)
124
  begin if rising_edge(clk) then r <= rin; end if; end process;
125
 
126
 
127
 
128
end;
129
 
130
 

powered by: WebSVN 2.1.0

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