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

Subversion Repositories w11

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

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

Line No. Rev Author Line
1 2 wfjm
-- $Id: rritb_rbmon.vhd 314 2010-07-09 17:38:41Z mueller $
2
--
3
-- Copyright 2007-2010 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4
--
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
-- Module Name:    rritb_rbmon - sim
16
-- Description:    rritb: rri rbus monitor
17
--
18
-- Dependencies:   -
19
-- Test bench:     -
20
-- Tool versions:  xst 8.1, 8.2, 9.1, 9.2; ghdl 0.18-0.25
21
-- Revision History: 
22
-- Date         Rev Version  Comment
23
-- 2010-06-05   301   2.1.1  renamed _rpmon -> _rbmon
24
-- 2010-06-03   299   2.1    new init encoding (WE=0/1 int/ext)
25
-- 2010-05-02   287   2.0.1  rename RP_STAT->RB_STAT,AP_LAM->RB_LAM
26
--                           drop RP_IINT signal from interfaces
27
-- 2008-08-24   162   2.0    with new rb_mreq/rb_sres interface
28
-- 2008-03-24   129   1.2.1  CLK_CYCLE now 31 bits
29
-- 2007-12-23   105   1.2    added AP_LAM display
30
-- 2007-11-24    98   1.1    added RP_IINT support
31
-- 2007-08-27    76   1.0    Initial version 
32
------------------------------------------------------------------------------
33
 
34
library ieee;
35
use ieee.std_logic_1164.all;
36
use ieee.std_logic_arith.all;
37
use ieee.std_logic_textio.all;
38
use std.textio.all;
39
 
40
use work.slvtypes.all;
41
use work.simlib.all;
42
use work.rrilib.all;
43
 
44
entity rritb_rbmon is                   -- rritb, rri rbus monitor
45
  generic (
46
    DBASE : positive :=  2);            -- base for writing data values
47
  port (
48
    CLK  : in slbit;                    -- clock
49
    CLK_CYCLE : in slv31 := (others=>'0');  -- clock cycle number
50
    ENA  : in slbit := '1';             -- enable monitor output
51
    RB_MREQ : in rb_mreq_type;          -- rbus: request
52
    RB_SRES : in rb_sres_type;          -- rbus: response
53
    RB_LAM : in slv16 := (others=>'0'); -- rbus: look at me
54
    RB_STAT : in slv3                   -- rbus: status flags
55
  );
56
end rritb_rbmon;
57
 
58
 
59
architecture sim of rritb_rbmon is
60
 
61
begin
62
 
63
  proc_rbmoni: process
64
    variable oline : line;
65
    variable nhold : integer := 0;
66
    variable data : slv16 := (others=>'0');
67
    variable tag : string(1 to 8) := (others=>' ');
68
    variable err : slbit := '0';
69
 
70
    procedure write_data(L: inout line;
71
                         tag: in string;
72
                         data: in slv16;
73
                         nhold: in integer := 0;
74
                         cond: in boolean := false;
75
                         ctxt: in string := " ") is
76
    begin
77
      writetimestamp(L, CLK_CYCLE, tag);
78
      write(L, RB_MREQ.addr, right, 10);
79
      write(L, string'(" "));
80
      writegen(L, data, right, 0, DBASE);
81
      write(L, RB_STAT, right, 4);
82
      if nhold > 0 then
83
        write(L, string'("  nhold="));
84
        write(L, nhold);
85
      end if;
86
      if cond then
87
        write(L, ctxt);
88
      end if;
89
      writeline(output, L);
90
    end procedure write_data;
91
 
92
  begin
93
 
94
    loop
95
 
96
      if ENA = '0' then                 -- if disabled
97
        wait until ENA='1';             -- stall process till enabled
98
      end if;
99
 
100
      wait until CLK'event and CLK='1'; -- check at end of clock cycle
101
 
102
      if RB_MREQ.req = '1' then
103
        if RB_SRES.err = '1' then
104
          err := '1';
105
        end if;
106
        if RB_SRES.busy = '1' then
107
          nhold := nhold + 1;
108
        else
109
          if RB_MREQ.req = '1' then
110
            if RB_MREQ.we = '0' then
111
              data := RB_SRES.dout;
112
              tag  :=  ": rbre  ";
113
            else
114
              data := RB_MREQ.din;
115
              tag  :=  ": rbwe  ";
116
            end if;
117
          end if;
118
 
119
          write_data(oline, tag, data, nhold, err='1', "  ERR='1'");
120
          nhold := 0;
121
        end if;
122
 
123
      else
124
        if nhold > 0 then
125
          write_data(oline, tag, data, nhold, true, "  TIMEOUT");
126
        end if;
127
        nhold := 0;
128
        err := '0';
129
      end if;
130
 
131
      if RB_MREQ.init = '1' then                     -- init
132
        if RB_MREQ.we = '1' then
133
          write_data(oline, ": rbini ", RB_MREQ.din);  -- external
134
        else
135
          write_data(oline, ": rbint ", RB_MREQ.din);  -- internal
136
        end if;
137
      end if;
138
 
139
      if unsigned(RB_LAM) /= 0 then
140
        write_data(oline, ": rblam ", RB_LAM, 0, true, "  RB_LAM active");
141
      end if;
142
 
143
    end loop;
144
  end process proc_rbmoni;
145
 
146
end sim;

powered by: WebSVN 2.1.0

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