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/] [work/] [debug/] [grtestmod.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
 
20
-- pragma translate_off
21
 
22
library ieee;
23
use ieee.std_logic_1164.all;
24
library gaisler;
25
use gaisler.sim.all;
26
library grlib;
27
use grlib.stdlib.all;
28
use grlib.stdio.all;
29
use grlib.devices.all;
30
 
31
use std.textio.all;
32
 
33
entity grtestmod is
34
  generic (halt : integer := 0);
35
  port (
36
    resetn      : in  std_ulogic;
37
    clk         : in  std_ulogic;
38
    errorn      : in std_ulogic;
39
    address     : in std_logic_vector(21 downto 2);
40
    data        : inout std_logic_vector(31 downto 0);
41
    iosn        : in std_ulogic;
42
    oen         : in std_ulogic;
43
    writen      : in std_ulogic;
44
    brdyn       : out  std_ulogic := '1'
45
 );
46
 
47
end;
48
 
49
architecture sim of grtestmod is
50
subtype msgtype is string(1 to 40);
51
constant ntests : integer := 2;
52
type msgarr is array (0 to ntests) of msgtype;
53
constant msg : msgarr := (
54
    "*** Starting GRLIB system test ***      ", -- 0
55
    "Test completed OK, halting simulation   ", -- 1
56
    "Test FAILED                             "  -- 2
57
);
58
 
59
signal ior, iow : std_ulogic;
60
 
61
begin
62
 
63
  ior <= iosn or oen;
64
  iow <= iosn or writen;
65
 
66
  data <= (others => 'Z');
67
 
68
  log : process(ior, iow, clk)
69
  variable errno, errcnt, subtest, vendorid, deviceid : integer;
70
  variable addr : std_logic_vector(21 downto 2);
71
  variable ldata : std_logic_vector(31 downto 0);
72
  begin
73
    if rising_edge(clk) then
74
      addr := to_X01(address);
75
      ldata := to_X01(data);
76
    end if;
77
    if falling_edge (ior) then
78
      brdyn <= '1', '0' after 100 ns;
79
    elsif rising_edge (ior) then
80
      brdyn <= '1';
81
    elsif falling_edge(iow) then
82
      brdyn <= '1', '0' after 100 ns;
83
    elsif rising_edge(iow) then
84
      brdyn <= '1';
85
--      addr := to_X01(address);
86
      case addr(7 downto 2) is
87
      when "000000" =>
88
        vendorid := conv_integer(ldata(31 downto 24));
89
        deviceid := conv_integer(ldata(23 downto 12));
90
        print(iptable(vendorid).device_table(deviceid));
91
      when "000001" =>
92
        errno := conv_integer(ldata(15 downto 0));
93
        if  (halt = 0) then
94
          assert false
95
          report "test failed, error (" & tost(errno) & ")"
96
          severity failure;
97
        else
98
          assert false
99
          report "test failed, error (" & tost(errno) & ")"
100
          severity warning;
101
        end if;
102
      when "000010" =>
103
        subtest := conv_integer(ldata(7 downto 0));
104
        if vendorid = VENDOR_GAISLER then
105
          case deviceid is
106
          when GAISLER_LEON3 => leon3_subtest(subtest);
107
          when GAISLER_FTMCTRL => mctrl_subtest(subtest);
108
          when GAISLER_GPTIMER => gptimer_subtest(subtest);
109
          when GAISLER_LEON3DSU => dsu3_subtest(subtest);
110
          when GAISLER_SPW => spw_subtest(subtest);
111
          when GAISLER_SPICTRL => spictrl_subtest(subtest);
112
          when GAISLER_I2CMST => i2cmst_subtest(subtest);
113
          when GAISLER_UHCI => uhc_subtest(subtest);
114
          when GAISLER_EHCI => ehc_subtest(subtest);
115
          when GAISLER_IRQMP => irqmp_subtest(subtest);
116
          when GAISLER_SPIMCTRL => spimctrl_subtest(subtest);
117
          when GAISLER_SVGACTRL => svgactrl_subtest(subtest);
118
          when others =>
119
            print ("  subtest " & tost(subtest));
120
          end case;
121
        elsif vendorid = VENDOR_ESA then
122
          case deviceid is
123
          when ESA_LEON2 => leon3_subtest(subtest);
124
          when ESA_MCTRL => mctrl_subtest(subtest);
125
          when ESA_TIMER => gptimer_subtest(subtest);
126
          when others =>
127
            print ("subtest " & tost(subtest));
128
          end case;
129
        else
130
          print ("subtest " & tost(subtest));
131
        end if;
132
      when "000100" =>
133
        print ("");
134
        print ("**** GRLIB system test starting ****");
135
        errcnt := 0;
136
      when "000101" =>
137
        if errcnt = 0 then
138
          print ("Test passed, halting with IU error mode");
139
        elsif errcnt = 1 then
140
          print ("1 error detected, halting with IU error mode");
141
        else
142
          print (tost(errcnt) & " errors detected, halting with IU error mode");
143
        end if;
144
        print ("");
145
      when others =>
146
      end case;
147
    end if;
148
  end process;
149
end;
150
 
151
-- pragma translate_on

powered by: WebSVN 2.1.0

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