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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.6/] [rtl/] [vlib/] [rbus/] [rb_mon.vhd] - Blame information for rev 27

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 17 wfjm
-- $Id: rb_mon.vhd 444 2011-12-25 10:04:58Z mueller $
2 2 wfjm
--
3 13 wfjm
-- Copyright 2007-2011 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4 2 wfjm
--
5
-- This program is free software; you may redistribute and/or modify it under
6
-- the terms of the GNU General Public License as published by the Free
7
-- Software Foundation, either version 2, or at your option any later version.
8
--
9
-- This program is distributed in the hope that it will be useful, but
10
-- WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
11
-- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12
-- for complete details.
13
--
14
------------------------------------------------------------------------------
15 9 wfjm
-- Module Name:    rb_mon - sim
16
-- Description:    rbus monitor (for tb's)
17 2 wfjm
--
18
-- Dependencies:   -
19
-- Test bench:     -
20 13 wfjm
-- Tool versions:  xst 8.2, 9.1, 9.2, 12.1, 13.1; ghdl 0.18-0.29
21 9 wfjm
--
22 2 wfjm
-- Revision History: 
23
-- Date         Rev Version  Comment
24 17 wfjm
-- 2011-12-23   444   3.1    CLK_CYCLE now integer
25 13 wfjm
-- 2011-11-19   427   3.0.1  now numeric_std clean
26 9 wfjm
-- 2010-12-22   346   3.0    renamed rritb_rbmon -> rb_mon
27 2 wfjm
-- 2010-06-05   301   2.1.1  renamed _rpmon -> _rbmon
28
-- 2010-06-03   299   2.1    new init encoding (WE=0/1 int/ext)
29
-- 2010-05-02   287   2.0.1  rename RP_STAT->RB_STAT,AP_LAM->RB_LAM
30
--                           drop RP_IINT signal from interfaces
31
-- 2008-08-24   162   2.0    with new rb_mreq/rb_sres interface
32
-- 2008-03-24   129   1.2.1  CLK_CYCLE now 31 bits
33
-- 2007-12-23   105   1.2    added AP_LAM display
34
-- 2007-11-24    98   1.1    added RP_IINT support
35
-- 2007-08-27    76   1.0    Initial version 
36
------------------------------------------------------------------------------
37
 
38
library ieee;
39
use ieee.std_logic_1164.all;
40 13 wfjm
use ieee.numeric_std.all;
41 2 wfjm
use ieee.std_logic_textio.all;
42
use std.textio.all;
43
 
44
use work.slvtypes.all;
45
use work.simlib.all;
46 9 wfjm
use work.rblib.all;
47 2 wfjm
 
48 9 wfjm
entity rb_mon is                        -- rbus monitor (for tb's)
49 2 wfjm
  generic (
50
    DBASE : positive :=  2);            -- base for writing data values
51
  port (
52
    CLK  : in slbit;                    -- clock
53 17 wfjm
    CLK_CYCLE : in integer := 0;        -- clock cycle number
54 2 wfjm
    ENA  : in slbit := '1';             -- enable monitor output
55
    RB_MREQ : in rb_mreq_type;          -- rbus: request
56
    RB_SRES : in rb_sres_type;          -- rbus: response
57
    RB_LAM : in slv16 := (others=>'0'); -- rbus: look at me
58
    RB_STAT : in slv3                   -- rbus: status flags
59
  );
60 9 wfjm
end rb_mon;
61 2 wfjm
 
62
 
63 9 wfjm
architecture sim of rb_mon is
64 2 wfjm
 
65
begin
66
 
67 9 wfjm
  proc_moni: process
68 2 wfjm
    variable oline : line;
69
    variable nhold : integer := 0;
70
    variable data : slv16 := (others=>'0');
71
    variable tag : string(1 to 8) := (others=>' ');
72
    variable err : slbit := '0';
73
 
74
    procedure write_data(L: inout line;
75
                         tag: in string;
76
                         data: in slv16;
77
                         nhold: in integer := 0;
78
                         cond: in boolean := false;
79
                         ctxt: in string := " ") is
80
    begin
81
      writetimestamp(L, CLK_CYCLE, tag);
82
      write(L, RB_MREQ.addr, right, 10);
83
      write(L, string'(" "));
84
      writegen(L, data, right, 0, DBASE);
85
      write(L, RB_STAT, right, 4);
86
      if nhold > 0 then
87
        write(L, string'("  nhold="));
88
        write(L, nhold);
89
      end if;
90
      if cond then
91
        write(L, ctxt);
92
      end if;
93
      writeline(output, L);
94
    end procedure write_data;
95
 
96
  begin
97
 
98
    loop
99
 
100
      if ENA = '0' then                 -- if disabled
101
        wait until ENA='1';             -- stall process till enabled
102
      end if;
103
 
104 13 wfjm
      wait until rising_edge(CLK);      -- check at end of clock cycle
105 2 wfjm
 
106 9 wfjm
      if RB_MREQ.aval='1' and (RB_MREQ.re='1' or RB_MREQ.we='1') then
107 2 wfjm
        if RB_SRES.err = '1' then
108
          err := '1';
109
        end if;
110
        if RB_SRES.busy = '1' then
111
          nhold := nhold + 1;
112
        else
113 9 wfjm
          data := (others=>'0');
114
          tag  := ": ????  ";
115
          if RB_MREQ.re = '1' then
116
            data := RB_SRES.dout;
117
            tag  :=  ": rbre  ";
118 2 wfjm
          end if;
119 9 wfjm
          if RB_MREQ.we = '1' then
120
            data := RB_MREQ.din;
121
            tag  :=  ": rbwe  ";
122
          end if;
123 2 wfjm
 
124
          write_data(oline, tag, data, nhold, err='1', "  ERR='1'");
125
          nhold := 0;
126
        end if;
127
 
128
      else
129
        if nhold > 0 then
130
          write_data(oline, tag, data, nhold, true, "  TIMEOUT");
131
        end if;
132
        nhold := 0;
133
        err := '0';
134
      end if;
135
 
136
      if RB_MREQ.init = '1' then                     -- init
137
        if RB_MREQ.we = '1' then
138
          write_data(oline, ": rbini ", RB_MREQ.din);  -- external
139
        else
140
          write_data(oline, ": rbint ", RB_MREQ.din);  -- internal
141
        end if;
142
      end if;
143
 
144
      if unsigned(RB_LAM) /= 0 then
145
        write_data(oline, ": rblam ", RB_LAM, 0, true, "  RB_LAM active");
146
      end if;
147
 
148
    end loop;
149 9 wfjm
  end process proc_moni;
150 2 wfjm
 
151
end sim;

powered by: WebSVN 2.1.0

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