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

Subversion Repositories mips_enhanced

[/] [mips_enhanced/] [trunk/] [grlib-gpl-1.0.19-b3188/] [lib/] [gaisler/] [sim/] [ahbrep.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dimamali
------------------------------------------------------------------------------
2
--  This file is a part of the GRLIB VHDL IP LIBRARY
3
--  Copyright (C) 2003, Gaisler Research
4
--
5
--  This program is free software; you can redistribute it and/or modify
6
--  it under the terms of the GNU General Public License as published by
7
--  the Free Software Foundation; either version 2 of the License, or
8
--  (at your option) any later version.
9
--
10
--  This program is distributed in the hope that it will be useful,
11
--  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
--  GNU General Public License for more details.
14
--
15
--  You should have received a copy of the GNU General Public License
16
--  along with this program; if not, write to the Free Software
17
--  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
18
-----------------------------------------------------------------------------
19
-- Entity:      ahbrep
20
-- File:        ahbrep.vhd
21
-- Author:      Jiri Gaisler - Gaisler Reserch
22
-- Description: Test report module with AHB interface
23
------------------------------------------------------------------------------
24
 
25
library ieee;
26
use ieee.std_logic_1164.all;
27
library gaisler;
28
use gaisler.sim.all;
29
library grlib;
30
use grlib.stdlib.all;
31
use grlib.stdio.all;
32
use grlib.devices.all;
33
use grlib.amba.all;
34
 
35
use std.textio.all;
36
 
37
entity ahbrep is
38
  generic (
39
    hindex  : integer := 0;
40
    haddr   : integer := 0;
41
    hmask   : integer := 16#fff#;
42
    halt    : integer := 1);
43
  port (
44
    rst     : in  std_ulogic;
45
    clk     : in  std_ulogic;
46
    ahbsi   : in  ahb_slv_in_type;
47
    ahbso   : out ahb_slv_out_type
48
  );
49
end;
50
 
51
architecture rtl of ahbrep is
52
 
53
constant abits : integer := 31;
54
 
55
constant hconfig : ahb_config_type := (
56
 
57
  4 => ahb_membar(haddr, '0', '0', hmask),
58
  others => zero32);
59
 
60
 
61
type reg_type is record
62
  hwrite : std_ulogic;
63
  hsel   : std_ulogic;
64
  haddr  : std_logic_vector(31 downto 0);
65
  htrans : std_logic_vector(1 downto 0);
66
end record;
67
 
68
signal r, rin : reg_type;
69
 
70
begin
71
 
72
  ahbso.hresp   <= "00";
73
  ahbso.hsplit  <= (others => '0');
74
  ahbso.hirq    <= (others => '0');
75
  ahbso.hcache  <= '1';
76
  ahbso.hconfig <= hconfig;
77
  ahbso.hindex  <= hindex;
78
  ahbso.hready  <= '1';
79
 
80
  log : process(clk, ahbsi )
81
  variable errno, errcnt, subtest, vendorid, deviceid : integer;
82
  variable addr : std_logic_vector(21 downto 2);
83
  variable v : reg_type;
84
  begin
85
  if falling_edge(clk) then
86
    if (ahbsi.hready = '1') then
87
      v.haddr := ahbsi.haddr; v.hsel := ahbsi.hsel(hindex);
88
      v.hwrite := ahbsi.hwrite; v.htrans := ahbsi.htrans;
89
    end if;
90
    if (r.hsel and r.htrans(1) and r.hwrite and rst) = '1' then
91
      case r.haddr(7 downto 2) is
92
      when "000000" =>
93
        vendorid := conv_integer(ahbsi.hwdata(31 downto 24));
94
        deviceid := conv_integer(ahbsi.hwdata(23 downto 12));
95
        print(iptable(vendorid).device_table(deviceid));
96
      when "000001" =>
97
        errno := conv_integer(ahbsi.hwdata(15 downto 0));
98
        if  (halt = 1) then
99
          assert false
100
          report "test failed, error (" & tost(errno) & ")"
101
          severity failure;
102
        else
103
          assert false
104
          report "test failed, error (" & tost(errno) & ")"
105
          severity warning;
106
        end if;
107
      when "000010" =>
108
        subtest := conv_integer(ahbsi.hwdata(7 downto 0));
109
        if vendorid = VENDOR_GAISLER then
110
          case deviceid is
111
          when GAISLER_LEON3 => leon3_subtest(subtest);
112
          when GAISLER_FTMCTRL => mctrl_subtest(subtest);
113
          when GAISLER_GPTIMER => gptimer_subtest(subtest);
114
          when GAISLER_LEON3DSU => dsu3_subtest(subtest);
115
          when GAISLER_SPW => spw_subtest(subtest);
116
          when GAISLER_SPICTRL => spictrl_subtest(subtest);
117
          when GAISLER_I2CMST => i2cmst_subtest(subtest);
118
          when GAISLER_UHCI => uhc_subtest(subtest);
119
          when GAISLER_EHCI => ehc_subtest(subtest);
120
          when GAISLER_IRQMP => irqmp_subtest(subtest);
121
          when GAISLER_SPIMCTRL => spimctrl_subtest(subtest);
122
          when GAISLER_SVGACTRL => svgactrl_subtest(subtest);
123
          when others =>
124
            print ("  subtest " & tost(subtest));
125
          end case;
126
        elsif vendorid = VENDOR_ESA then
127
          case deviceid is
128
          when ESA_LEON2 => leon3_subtest(subtest);
129
          when ESA_MCTRL => mctrl_subtest(subtest);
130
          when ESA_TIMER => gptimer_subtest(subtest);
131
          when others =>
132
            print ("subtest " & tost(subtest));
133
          end case;
134
        else
135
          print ("subtest " & tost(subtest));
136
        end if;
137
      when "000100" =>
138
        print ("");
139
        print ("**** GRLIB system test starting ****");
140
        errcnt := 0;
141
      when "000101" =>
142
        if errcnt = 0 then
143
          print ("Test passed, halting with IU error mode");
144
        elsif errcnt = 1 then
145
          print ("1 error detected, halting with IU error mode");
146
        else
147
          print (tost(errcnt) & " errors detected, halting with IU error mode");
148
        end if;
149
        print ("");
150
      when others =>
151
      end case;
152
    end if;
153
  end if;
154
  rin <= v;
155
  end process;
156
 
157
  reg : process (clk)
158
  begin
159
    if rising_edge(clk) then r <= rin; end if;
160
  end process;
161
 
162
-- pragma translate_off
163
    bootmsg : report_version
164
    generic map ("testmod" & tost(hindex) & ": Test report module");
165
-- pragma translate_on
166
end;

powered by: WebSVN 2.1.0

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