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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.74/] [rtl/] [w11a/] [pdp11_tmu.vhd] - Blame information for rev 34

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

Line No. Rev Author Line
1 34 wfjm
-- $Id: pdp11_tmu.vhd 697 2015-07-05 14:23:26Z mueller $
2 2 wfjm
--
3 30 wfjm
-- Copyright 2008-2015 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
-- Module Name:    pdp11_tmu - sim
16
-- Description:    pdp11: trace and monitor unit
17
--
18
-- Dependencies:   -
19
--
20
-- Test bench:     tb/tb_pdp11_core (implicit)
21
-- Target Devices: generic
22 29 wfjm
-- Tool versions:  ghdl 0.18-0.31
23 8 wfjm
--
24 2 wfjm
-- Revision History: 
25
-- Date         Rev Version  Comment
26 34 wfjm
-- 2015-07-03   697   1.2.1  adapt to new DM_STAT_SY/DM_STAT_VM
27 30 wfjm
-- 2015-05-03   674   1.2    start/stop/suspend overhaul
28 17 wfjm
-- 2011-12-23   444   1.1    use local clkcycle count instead of simbus global
29 13 wfjm
-- 2011-11-18   427   1.0.7  now numeric_std clean
30 8 wfjm
-- 2010-10-17   333   1.0.6  use ibus V2 interface
31 2 wfjm
-- 2010-06-26   309   1.0.5  add ibmreq.dip,.cacc,.racc to trace
32
-- 2009-05-10   214   1.0.4  add ENA signal (trace enable)
33
-- 2008-12-14   177   1.0.3  write gpr_* of DM_STAT_DP and dp_ireg_we_last
34
-- 2008-12-13   176   1.0.2  write only cycle currently used by tmu_conf
35
-- 2008-08-22   161   1.0.1  rename ubf_ -> ibf_
36
-- 2008-04-19   137   1.0    Initial version 
37
------------------------------------------------------------------------------
38
 
39
library ieee;
40
use ieee.std_logic_1164.all;
41 13 wfjm
use ieee.numeric_std.all;
42 2 wfjm
use ieee.std_logic_textio.all;
43
use std.textio.all;
44
 
45
use work.slvtypes.all;
46
use work.simlib.all;
47
use work.simbus.all;
48
use work.pdp11.all;
49
 
50
-- ----------------------------------------------------------------------------
51
 
52
entity pdp11_tmu is                     -- trace and monitor unit
53
  port (
54
    CLK : in slbit;                     -- clock
55
    ENA : in slbit := '0';              -- enable trace output
56 30 wfjm
    DM_STAT_DP : in dm_stat_dp_type;    -- debug and monitor status - dpath
57
    DM_STAT_VM : in dm_stat_vm_type;    -- debug and monitor status - vmbox
58
    DM_STAT_CO : in dm_stat_co_type;    -- debug and monitor status - core
59
    DM_STAT_SY : in dm_stat_sy_type     -- debug and monitor status - system
60 2 wfjm
  );
61
end pdp11_tmu;
62
 
63
 
64
architecture sim of pdp11_tmu is
65
 
66
  signal R_FIRST : slbit := '1';
67
 
68
begin
69
 
70
  proc_tm: process (CLK)
71
    variable oline  : line;
72 17 wfjm
    variable clkcycle : integer := 0;
73 2 wfjm
    variable ipsw   : slv16 := (others=>'0');
74
    variable ibaddr : slv16 := (others=>'0');
75
    variable emaddr : slv22 := (others=>'0');
76
    variable dp_ireg_we_last : slbit := '0';
77
    variable vm_ibsres_busy_last : slbit := '0';
78
    variable vm_ibsres_ack_last  : slbit := '0';
79
    variable wcycle : boolean := false;
80
    file ofile : text open write_mode is "tmu_ofile";
81
  begin
82
 
83 13 wfjm
    if rising_edge(CLK) then
84 2 wfjm
 
85 17 wfjm
      clkcycle := clkcycle + 1;
86
 
87 2 wfjm
      if R_FIRST = '1' then
88
        R_FIRST <= '0';
89 34 wfjm
        -- sequence of field desciptors must equal the sequence of writes later
90 2 wfjm
        write(oline, string'("#"));
91
        write(oline, string'(" clkcycle:d"));
92
        write(oline, string'(" cpu:o"));
93
        write(oline, string'(" dp.pc:o"));
94
        write(oline, string'(" dp.psw:o"));
95
        write(oline, string'(" dp.ireg:o"));
96
        write(oline, string'(" dp.ireg_we:b"));
97
        write(oline, string'(" dp.ireg_we_last:b"));  -- is ireg_we last cycle
98
        write(oline, string'(" dp.dsrc:o"));
99
        write(oline, string'(" dp.ddst:o"));
100
        write(oline, string'(" dp.dtmp:o"));
101
        write(oline, string'(" dp.dres:o"));
102
        write(oline, string'(" dp.gpr_adst:o"));
103
        write(oline, string'(" dp.gpr_mode:o"));
104
        write(oline, string'(" dp.gpr_bytop:b"));
105
        write(oline, string'(" dp.gpr_we:b"));
106
 
107 8 wfjm
        write(oline, string'(" vm.ibmreq.aval:b"));
108
        write(oline, string'(" vm.ibmreq.re:b"));
109 2 wfjm
        write(oline, string'(" vm.ibmreq.we:b"));
110 8 wfjm
        write(oline, string'(" vm.ibmreq.rmw:b"));
111 2 wfjm
        write(oline, string'(" vm.ibmreq.be0:b"));
112
        write(oline, string'(" vm.ibmreq.be1:b"));
113
        write(oline, string'(" vm.ibmreq.cacc:b"));
114
        write(oline, string'(" vm.ibmreq.racc:b"));
115
        write(oline, string'(" vm.ibmreq.addr:o"));
116
        write(oline, string'(" vm.ibmreq.din:o"));
117
        write(oline, string'(" vm.ibsres.ack:b"));
118
        write(oline, string'(" vm.ibsres.busy:b"));
119
        write(oline, string'(" vm.ibsres.dout:o"));
120 34 wfjm
        write(oline, string'(" vm.emmreq.req:b"));
121
        write(oline, string'(" vm.emmreq.we:b"));
122
        write(oline, string'(" vm.emmreq.be:b"));
123
        write(oline, string'(" vm.emmreq.cancel:b"));
124
        write(oline, string'(" vm.emmreq.addr:o"));
125
        write(oline, string'(" vm.emmreq.din:o"));
126
        write(oline, string'(" vm.emsres.ack_r:b"));
127
        write(oline, string'(" vm.emsres.ack_w:b"));
128
        write(oline, string'(" vm.emsres.dout:o"));
129 2 wfjm
 
130
        write(oline, string'(" co.cpugo:b"));
131 30 wfjm
        write(oline, string'(" co.cpususp:b"));
132
        write(oline, string'(" co.suspint:b"));
133
        write(oline, string'(" co.suspext:b"));
134 2 wfjm
 
135
        write(oline, string'(" sy.chit:b"));
136
 
137
        writeline(ofile, oline);
138
      end if;
139
 
140
      ipsw := (others=>'0');
141
      ipsw(psw_ibf_cmode) := DM_STAT_DP.psw.cmode;
142
      ipsw(psw_ibf_pmode) := DM_STAT_DP.psw.pmode;
143
      ipsw(psw_ibf_rset)  := DM_STAT_DP.psw.rset;
144
      ipsw(psw_ibf_pri)   := DM_STAT_DP.psw.pri;
145
      ipsw(psw_ibf_tflag) := DM_STAT_DP.psw.tflag;
146
      ipsw(psw_ibf_cc)    := DM_STAT_DP.psw.cc;
147
 
148
      ibaddr := "1110000000000000";
149
      ibaddr(DM_STAT_VM.ibmreq.addr'range) := DM_STAT_VM.ibmreq.addr;
150
 
151
      emaddr := (others=>'0');
152 34 wfjm
      emaddr(DM_STAT_VM.emmreq.addr'range) := DM_STAT_VM.emmreq.addr;
153 2 wfjm
 
154
      wcycle := false;
155
      if dp_ireg_we_last='1' or
156
         DM_STAT_DP.gpr_we='1' or
157 34 wfjm
         DM_STAT_VM.emmreq.req='1' or
158
         DM_STAT_VM.emsres.ack_r='1' or
159
         DM_STAT_VM.emsres.ack_w='1' or
160
         DM_STAT_VM.emmreq.cancel='1' or
161 8 wfjm
         DM_STAT_VM.ibmreq.re='1' or
162
         DM_STAT_VM.ibmreq.we='1' or
163 2 wfjm
         DM_STAT_VM.ibsres.ack='1'
164
      then
165
        wcycle := true;
166
      end if;
167
 
168
      if DM_STAT_VM.ibsres.busy='0' and
169
         (vm_ibsres_busy_last='1' and vm_ibsres_ack_last='0')
170
      then
171
        wcycle := true;
172
      end if;
173
 
174
      if ENA = '0' then                 -- if not enabled
175
        wcycle := false;                -- force to not logged...
176
      end if;
177
 
178
      if wcycle then
179 34 wfjm
        -- sequence of writes must equal the sequence of field desciptors above
180 17 wfjm
        write(oline, clkcycle, right, 9);
181 2 wfjm
        write(oline, string'(" 0"));
182
        writeoct(oline, DM_STAT_DP.pc,   right, 7);
183
        writeoct(oline, ipsw, right, 7);
184
        writeoct(oline, DM_STAT_DP.ireg, right, 7);
185
        write(oline,    DM_STAT_DP.ireg_we, right, 2);
186
        write(oline,    dp_ireg_we_last, right, 2);
187
        writeoct(oline, DM_STAT_DP.dsrc, right, 7);
188
        writeoct(oline, DM_STAT_DP.ddst, right, 7);
189
        writeoct(oline, DM_STAT_DP.dtmp, right, 7);
190
        writeoct(oline, DM_STAT_DP.dres, right, 7);
191
        writeoct(oline, DM_STAT_DP.gpr_adst, right, 2);
192
        writeoct(oline, DM_STAT_DP.gpr_mode, right, 2);
193
        write(oline, DM_STAT_DP.gpr_bytop, right, 2);
194
        write(oline, DM_STAT_DP.gpr_we, right, 2);
195
 
196 8 wfjm
        write(oline,    DM_STAT_VM.ibmreq.aval, right, 2);
197
        write(oline,    DM_STAT_VM.ibmreq.re, right, 2);
198 2 wfjm
        write(oline,    DM_STAT_VM.ibmreq.we, right, 2);
199 8 wfjm
        write(oline,    DM_STAT_VM.ibmreq.rmw, right, 2);
200 2 wfjm
        write(oline,    DM_STAT_VM.ibmreq.be0, right, 2);
201
        write(oline,    DM_STAT_VM.ibmreq.be1, right, 2);
202
        write(oline,    DM_STAT_VM.ibmreq.cacc, right, 2);
203
        write(oline,    DM_STAT_VM.ibmreq.racc, right, 2);
204
        writeoct(oline, ibaddr, right, 7);
205
        writeoct(oline, DM_STAT_VM.ibmreq.din, right, 7);
206
        write(oline,    DM_STAT_VM.ibsres.ack, right, 2);
207
        write(oline,    DM_STAT_VM.ibsres.busy, right, 2);
208
        writeoct(oline, DM_STAT_VM.ibsres.dout, right, 7);
209
 
210 34 wfjm
        write(oline,    DM_STAT_VM.emmreq.req, right, 2);
211
        write(oline,    DM_STAT_VM.emmreq.we, right, 2);
212
        write(oline,    DM_STAT_VM.emmreq.be, right, 3);
213
        write(oline,    DM_STAT_VM.emmreq.cancel, right, 2);
214
        writeoct(oline, emaddr, right, 9);
215
        writeoct(oline, DM_STAT_VM.emmreq.din, right, 7);
216
        write(oline,    DM_STAT_VM.emsres.ack_r, right, 2);
217
        write(oline,    DM_STAT_VM.emsres.ack_w, right, 2);
218
        writeoct(oline, DM_STAT_VM.emsres.dout, right, 7);
219
 
220 2 wfjm
        write(oline,    DM_STAT_CO.cpugo, right, 2);
221 30 wfjm
        write(oline,    DM_STAT_CO.cpususp, right, 2);
222
        write(oline,    DM_STAT_CO.suspint, right, 2);
223
        write(oline,    DM_STAT_CO.suspext, right, 2);
224 34 wfjm
 
225 2 wfjm
        write(oline,    DM_STAT_SY.chit, right, 2);
226
 
227
        writeline(ofile, oline);
228
      end if;
229
 
230
      dp_ireg_we_last     := DM_STAT_DP.ireg_we;
231
      vm_ibsres_busy_last := DM_STAT_VM.ibsres.busy;
232
      vm_ibsres_ack_last  := DM_STAT_VM.ibsres.ack;
233
 
234
    end if;
235
 
236
  end process proc_tm;
237
 
238
end sim;

powered by: WebSVN 2.1.0

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