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

Subversion Repositories w11

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

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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