gem5  v22.1.0.0
utility.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2003-2005 The Regents of The University of Michigan
3  * Copyright (c) 2007 MIPS Technologies, Inc.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met: redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer;
10  * redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution;
13  * neither the name of the copyright holders nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #ifndef __ARCH_MIPS_UTILITY_HH__
31 #define __ARCH_MIPS_UTILITY_HH__
32 
33 #include "arch/mips/page_size.hh"
34 #include "arch/mips/regs/misc.hh"
35 #include "arch/mips/types.hh"
36 #include "base/logging.hh"
37 #include "base/types.hh"
38 #include "cpu/static_inst.hh"
39 #include "cpu/thread_context.hh"
40 
41 namespace gem5
42 {
43 
44 class ThreadContext;
45 
46 namespace MipsISA {
47 
49 //
50 // Floating Point Utility Functions
51 //
52 uint64_t fpConvert(ConvertType cvt_type, double fp_val);
53 double roundFP(double val, int digits);
54 double truncFP(double val);
55 
56 bool getCondCode(uint32_t fcsr, int cc);
57 uint32_t genCCVector(uint32_t fcsr, int num, uint32_t cc_val);
58 uint32_t genInvalidVector(uint32_t fcsr);
59 
60 bool isNan(void *val_ptr, int size);
61 bool isQnan(void *val_ptr, int size);
62 bool isSnan(void *val_ptr, int size);
63 
65 //
66 // Translation stuff
67 //
68 inline Addr
70 {
71  return addr & ~(PageBytes - 1);
72 }
73 
74 inline Addr
76 {
77  return (addr + PageBytes - 1) & ~(PageBytes - 1);
78 }
79 
80 } // namespace MipsISA
81 } // namespace gem5
82 
83 #endif
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
bool getCondCode(uint32_t fcsr, int cc_idx)
Definition: utility.cc:112
uint64_t fpConvert(ConvertType cvt_type, double fp_val)
Definition: utility.cc:50
uint32_t genInvalidVector(uint32_t fcsr_bits)
Definition: utility.cc:132
double roundFP(double val, int digits)
Definition: utility.cc:94
const Addr PageBytes
Definition: page_size.hh:42
uint32_t genCCVector(uint32_t fcsr, int cc_num, uint32_t cc_val)
Definition: utility.cc:120
bool isNan(void *val_ptr, int size)
Definition: utility.cc:146
Addr TruncPage(Addr addr)
Definition: utility.hh:69
Addr RoundPage(Addr addr)
Definition: utility.hh:75
double truncFP(double val)
Definition: utility.cc:105
bool isQnan(void *val_ptr, int size)
Definition: utility.cc:169
bool isSnan(void *val_ptr, int size)
Definition: utility.cc:191
Bitfield< 63 > val
Definition: misc.hh:776
Bitfield< 3 > addr
Definition: types.hh:84
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147

Generated on Wed Dec 21 2022 10:22:27 for gem5 by doxygen 1.9.1