source: branches/fault_tolerance/lib/iss2/src/iss2.cpp @ 691

Last change on this file since 691 was 657, checked in by cfuguet, 11 years ago

TSAR FAULT TOLERANCE BRANCH

  • Introducing ISS containing the XTN_INST_PADDR_EXT CP2 index.
File size: 3.8 KB
Line 
1/* -*- c++ -*-
2 * SOCLIB_LGPL_HEADER_BEGIN
3 *
4 * This file is part of SoCLib, GNU LGPLv2.1.
5 *
6 * SoCLib is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License as published
8 * by the Free Software Foundation; version 2.1 of the License.
9 *
10 * SoCLib is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with SoCLib; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 * 02110-1301 USA
19 *
20 * SOCLIB_LGPL_HEADER_END
21 *
22 * Copyright (c) UPMC, Lip6
23 *         Nicolas Pouillon <nipo@ssji.net>, 2008
24 */
25
26#include <iostream>
27#include "iss2.h"
28
29namespace soclib { namespace common {
30
31#define rstr(x) case Iss2::x: return #x
32
33const char *mode_str(Iss2::ExecMode mode)
34{
35    switch(mode) {
36        rstr(MODE_HYPER);
37        rstr(MODE_KERNEL);
38        rstr(MODE_USER);
39    default: return "invalid";
40    }
41}
42
43const char *type_str(Iss2::DataOperationType type)
44{
45    switch(type) {
46        rstr(DATA_READ);
47        rstr(DATA_WRITE);
48        rstr(DATA_LL);
49        rstr(DATA_SC);
50        rstr(XTN_WRITE);
51        rstr(XTN_READ);
52    default: return "invalid";
53    }
54}
55const char *xtn_str(Iss2::ExternalAccessType type)
56{
57    switch(type) {
58        rstr(XTN_PTPR);
59        rstr(XTN_TLB_MODE);
60        rstr(XTN_ICACHE_FLUSH);
61        rstr(XTN_DCACHE_FLUSH);
62        rstr(XTN_ITLB_INVAL);
63        rstr(XTN_DTLB_INVAL);
64        rstr(XTN_ICACHE_INVAL);
65        rstr(XTN_DCACHE_INVAL);
66        rstr(XTN_ICACHE_PREFETCH);
67        rstr(XTN_DCACHE_PREFETCH);
68        rstr(XTN_SYNC);
69        rstr(XTN_INS_ERROR_TYPE);
70        rstr(XTN_DATA_ERROR_TYPE);
71        rstr(XTN_INS_BAD_VADDR);
72        rstr(XTN_DATA_BAD_VADDR);
73        rstr(XTN_MMU_PARAMS);
74        rstr(XTN_MMU_RELEASE);
75        rstr(XTN_MMU_WORD_LO);
76        rstr(XTN_MMU_WORD_HI);
77        rstr(XTN_MMU_ICACHE_PA_INV);
78        rstr(XTN_MMU_DCACHE_PA_INV);
79        rstr(XTN_MMU_LL_RESET);
80        rstr(XTN_MMU_DOUBLE_LL);
81        rstr(XTN_MMU_DOUBLE_SC);
82        rstr(XTN_DATA_PADDR_EXT);
83        rstr(XTN_INST_PADDR_EXT);
84    default: return "invalid";
85    }
86}
87
88void Iss2::InstructionRequest::print( std::ostream &o ) const
89{
90    o << "<InsReq  "
91      << (valid ? "  valid" : "invalid")
92      << " mode " << mode_str(mode)
93      << " @ " << std::hex << std::showbase << addr
94      << ">";
95}
96
97void Iss2::InstructionResponse::print( std::ostream &o ) const
98{
99    o << "<InsRsp  " 
100      << (valid ? "  valid" : "invalid")
101      << " " << (error ? "   error" : "no error")
102      << " ins " << std::hex << std::showbase << instruction << std::dec
103      << ">";
104}
105
106void Iss2::DataRequest::print( std::ostream &o ) const
107{
108    o << "<DataReq "
109      << (valid ? "  valid" : "invalid")
110      << " mode " << mode_str(mode)
111      << " type " << type_str(type);
112    if ( type == XTN_READ || type == XTN_WRITE )
113        //o << " (" << xtn_str((enum ExternalAccessType)addr) << ")";
114        o << " (" << xtn_str((enum ExternalAccessType)(addr/4)) << ")";
115    else
116        o << " @ " << std::hex << std::showbase << addr << std::dec;
117    o << " wdata " << std::hex << std::showbase << wdata
118      << " be " << (int)be  << std::dec
119      << ">";
120}
121
122void Iss2::DataResponse::print( std::ostream &o ) const
123{
124    o << "<DataRsp "
125      << (valid ? "  valid" : "invalid")
126      << " " << (error ? "   error" : "no error")
127      << " rdata " << std::hex << std::showbase << rdata
128      << ">";
129}
130
131
132}}
133
134// Local Variables:
135// tab-width: 4
136// c-basic-offset: 4
137// c-file-offsets:((innamespace . 0)(inline-open . 0))
138// indent-tabs-mode: nil
139// End:
140
141// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
142
Note: See TracBrowser for help on using the repository browser.