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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.6/] [rtl/] [vlib/] [rlink/] [rlink_mon.vhd] - Blame information for rev 24

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 17 wfjm
-- $Id: rlink_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:    rlink_mon - sim
16
-- Description:    rlink 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.2  now numeric_std clean
26 9 wfjm
-- 2010-12-24   347   3.0.1  rename: CP_*->RL->*
27
-- 2010-12-22   346   3.0    renamed rritb_cpmon -> rlink_mon
28 2 wfjm
-- 2010-06-11   303   2.5.1  fix data9 assignment, always proper width now
29
-- 2010-06-07   302   2.5    use sop/eop framing instead of soc+chaining
30
-- 2008-03-24   129   1.0.1  CLK_CYCLE now 31 bits
31
-- 2007-09-09    81   1.0    Initial version 
32
------------------------------------------------------------------------------
33
 
34
library ieee;
35
use ieee.std_logic_1164.all;
36 13 wfjm
use ieee.numeric_std.all;
37 2 wfjm
use ieee.std_logic_textio.all;
38
use std.textio.all;
39
 
40
use work.slvtypes.all;
41
use work.simlib.all;
42 9 wfjm
use work.rlinklib.all;
43 2 wfjm
 
44 9 wfjm
entity rlink_mon is                     -- rlink monitor
45 2 wfjm
  generic (
46
    DWIDTH : positive :=  9);           -- data port width (8 or 9)
47
  port (
48
    CLK  : in slbit;                    -- clock
49 17 wfjm
    CLK_CYCLE : in integer := 0;        -- clock cycle number
50 2 wfjm
    ENA  : in slbit := '1';             -- enable monitor output
51 9 wfjm
    RL_DI : in slv(DWIDTH-1 downto 0);  -- rlink: data in
52
    RL_ENA : in slbit;                  -- rlink: data enable
53
    RL_BUSY : in slbit;                 -- rlink: data busy
54
    RL_DO : in slv(DWIDTH-1 downto 0);  -- rlink: data out
55
    RL_VAL : in slbit;                  -- rlink: data valid
56
    RL_HOLD : in slbit                  -- rlink: data hold
57 2 wfjm
  );
58 9 wfjm
end rlink_mon;
59 2 wfjm
 
60
 
61 9 wfjm
architecture sim of rlink_mon is
62 2 wfjm
 
63
begin
64
 
65
  assert DWIDTH=8 or DWIDTH=9
66
    report "assert(DWIDTH=8 or DWIDTH=9)" severity failure;
67
 
68 9 wfjm
  proc_moni: process
69 2 wfjm
    variable oline : line;
70
    variable nbusy : integer := 0;
71
    variable nhold : integer := 0;
72
 
73
    procedure write_val(L: inout line;
74
                        data: in slv(DWIDTH-1 downto 0);
75
                        nwait: in integer;
76
                        txt1: in string;
77
                        txt2: in string) is
78
      variable data9 : slv9 := (others=>'0');
79
    begin
80
 
81
      writetimestamp(L, CLK_CYCLE, txt1);
82
 
83
      if DWIDTH = 9 then
84
        write(L, data(data'left), right, 1);
85
      else
86
        write(L, string'(" "));
87
      end if;
88
 
89
      write(L, data(7 downto 0), right, 9);
90
      if nwait > 0 then
91
        write(L, txt2);
92
        write(L, nwait);
93
      end if;
94
 
95
      if DWIDTH=9 and data(data'left)='1' then
96
        -- a copy to data9 needed to allow following case construct
97
        -- using data directly gives a 'subtype is not locally static' error
98
        data9 := (others=>'0');
99
        data9(data'range) := data;
100
        write(L, string'("  comma"));
101
        case data9 is
102 9 wfjm
          when c_rlink_dat_idle => write(L, string'(" idle"));
103
          when c_rlink_dat_sop  => write(L, string'(" sop"));
104
          when c_rlink_dat_eop  => write(L, string'(" eop"));
105
          when c_rlink_dat_nak  => write(L, string'(" nak"));
106
          when c_rlink_dat_attn => write(L, string'(" attn"));
107 2 wfjm
          when others => null;
108
        end case;
109
      end if;
110
 
111
      writeline(output, L);
112
    end procedure write_val;
113
 
114
  begin
115
 
116
    loop
117
 
118
      if ENA='0' then                   -- if disabled
119
        wait until ENA='1';             -- stall process till enabled
120
      end if;
121
 
122 13 wfjm
      wait until rising_edge(CLK); -- check at end of clock cycle
123 2 wfjm
 
124 9 wfjm
      if RL_ENA = '1' then
125
        if RL_BUSY = '1' then
126 2 wfjm
          nbusy := nbusy + 1;
127
        else
128 9 wfjm
          write_val(oline, RL_DI, nbusy, ": rlrx  ", "  nbusy=");
129 2 wfjm
          nbusy := 0;
130
        end if;
131
      else
132
        nbusy := 0;
133
      end if;
134
 
135 9 wfjm
      if RL_VAL = '1' then
136
        if RL_HOLD = '1' then
137 2 wfjm
          nhold := nhold + 1;
138
        else
139 9 wfjm
          write_val(oline, RL_DO, nhold, ": rltx  ", "  nhold=");
140 2 wfjm
          nhold := 0;
141
        end if;
142
      else
143
        nhold := 0;
144
      end if;
145
 
146
    end loop;
147 9 wfjm
  end process proc_moni;
148 2 wfjm
 
149
end sim;

powered by: WebSVN 2.1.0

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