gem5 v24.0.0.0
Loading...
Searching...
No Matches
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
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
41namespace gem5
42{
43
44class ThreadContext;
45
46namespace MipsISA {
47
49//
50// Floating Point Utility Functions
51//
52uint64_t fpConvert(ConvertType cvt_type, double fp_val);
53double roundFP(double val, int digits);
54double truncFP(double val);
55
56bool getCondCode(uint32_t fcsr, int cc);
57uint32_t genCCVector(uint32_t fcsr, int num, uint32_t cc_val);
58uint32_t genInvalidVector(uint32_t fcsr);
59
60bool isNan(void *val_ptr, int size);
61bool isQnan(void *val_ptr, int size);
62bool isSnan(void *val_ptr, int size);
63
65//
66// Translation stuff
67//
68inline Addr
70{
71 return addr & ~(PageBytes - 1);
72}
73
74inline 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:804
Bitfield< 3 > addr
Definition types.hh:84
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition types.hh:147

Generated on Tue Jun 18 2024 16:23:57 for gem5 by doxygen 1.11.0