gem5  v20.1.0.0
microop.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007 The Hewlett-Packard Development Company
3  * All rights reserved.
4  *
5  * The license below extends only to copyright in the software and shall
6  * not be construed as granting a license to any other intellectual
7  * property including but not limited to intellectual property relating
8  * to a hardware implementation of the functionality of the software
9  * licensed hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions are
16  * met: redistributions of source code must retain the above copyright
17  * notice, this list of conditions and the following disclaimer;
18  * redistributions in binary form must reproduce the above copyright
19  * notice, this list of conditions and the following disclaimer in the
20  * documentation and/or other materials provided with the distribution;
21  * neither the name of the copyright holders nor the names of its
22  * contributors may be used to endorse or promote products derived from
23  * this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  */
37 
39 
40 #include "arch/x86/regs/misc.hh"
41 
42 namespace X86ISA
43 {
44 
45  bool X86MicroopBase::checkCondition(uint64_t flags, int condition) const
46  {
47  CCFlagBits ccflags = flags;
48  switch(condition)
49  {
51  return true;
53  return ccflags.ecf;
55  return ccflags.ezf;
57  return !(!ccflags.ezf && ccflags.zf);
59  panic("This condition is not implemented!");
61  panic("This condition is not implemented!");
63  panic("This condition is not implemented!");
65  return !ccflags.ezf && ccflags.zf;
66  //And no interrupts or debug traps are waiting
67  case ConditionTests::OF:
68  return ccflags.of;
69  case ConditionTests::CF:
70  return ccflags.cf;
71  case ConditionTests::ZF:
72  return ccflags.zf;
74  return ccflags.cf | ccflags.zf;
75  case ConditionTests::SF:
76  return ccflags.sf;
77  case ConditionTests::PF:
78  return ccflags.pf;
80  return ccflags.sf ^ ccflags.of;
82  return (ccflags.sf ^ ccflags.of) | ccflags.zf;
84  return false;
86  return !ccflags.ecf;
88  return !ccflags.ezf;
90  return !ccflags.ezf && ccflags.zf;
92  panic("This condition is not implemented!");
94  panic("This condition is not implemented!");
96  panic("This condition is not implemented!");
98  return !ccflags.ezf && !ccflags.zf;
99  //And no interrupts or debug traps are waiting
101  return !ccflags.of;
103  return !ccflags.cf;
105  return !ccflags.zf;
107  return !(ccflags.cf | ccflags.zf);
109  return !ccflags.sf;
111  return !ccflags.pf;
113  return !(ccflags.sf ^ ccflags.of);
115  return !((ccflags.sf ^ ccflags.of) | ccflags.zf);
116  }
117  panic("Unknown condition: %d\n", condition);
118  return true;
119  }
120 }
X86ISA::ConditionTests::NotSTRZ
@ NotSTRZ
Definition: microop.hh:72
StaticInst::flags
std::bitset< Num_Flags > flags
Flag values for this instruction.
Definition: static_inst.hh:99
X86ISA::ConditionTests::NotCF
@ NotCF
Definition: microop.hh:76
X86ISA::ConditionTests::NotOF
@ NotOF
Definition: microop.hh:75
X86ISA::ConditionTests::NotSF
@ NotSF
Definition: microop.hh:79
X86ISA::ConditionTests::NotEZF
@ NotEZF
Definition: microop.hh:69
X86ISA::ConditionTests::ZF
@ ZF
Definition: microop.hh:59
X86ISA::ConditionTests::MSTRC
@ MSTRC
Definition: microop.hh:55
X86ISA::ConditionTests::SxOF
@ SxOF
Definition: microop.hh:63
microop.hh
X86ISA::ConditionTests::True
@ True
Definition: microop.hh:48
X86ISA::ConditionTests::SxOvZF
@ SxOvZF
Definition: microop.hh:64
X86ISA::ConditionTests::NotMSTRC
@ NotMSTRC
Definition: microop.hh:73
X86ISA::ConditionTests::NotSZnZF
@ NotSZnZF
Definition: microop.hh:70
X86ISA::ConditionTests::PF
@ PF
Definition: microop.hh:62
X86ISA::ConditionTests::NotMSTRZ
@ NotMSTRZ
Definition: microop.hh:71
X86ISA::ConditionTests::NotCvZF
@ NotCvZF
Definition: microop.hh:78
X86ISA::ConditionTests::False
@ False
Definition: microop.hh:66
X86ISA::ConditionTests::CvZF
@ CvZF
Definition: microop.hh:60
X86ISA::ConditionTests::MSTRZ
@ MSTRZ
Definition: microop.hh:53
X86ISA::ConditionTests::EZF
@ EZF
Definition: microop.hh:51
X86ISA
This is exposed globally, independent of the ISA.
Definition: acpi.hh:55
X86ISA::ConditionTests::ECF
@ ECF
Definition: microop.hh:50
X86ISA::ConditionTests::NotZF
@ NotZF
Definition: microop.hh:77
X86ISA::ConditionTests::STRZnEZF
@ STRZnEZF
Definition: microop.hh:56
X86ISA::ConditionTests::NotSxOvZF
@ NotSxOvZF
Definition: microop.hh:82
X86ISA::ConditionTests::NotSxOF
@ NotSxOF
Definition: microop.hh:81
X86ISA::X86MicroopBase::checkCondition
bool checkCondition(uint64_t flags, int condition) const
Definition: microop.cc:45
X86ISA::ConditionTests::STRnZnEZF
@ STRnZnEZF
Definition: microop.hh:74
X86ISA::ConditionTests::NotECF
@ NotECF
Definition: microop.hh:68
X86ISA::ConditionTests::SF
@ SF
Definition: microop.hh:61
X86ISA::ConditionTests::NotPF
@ NotPF
Definition: microop.hh:80
X86ISA::ConditionTests::STRZ
@ STRZ
Definition: microop.hh:54
X86ISA::ConditionTests::OF
@ OF
Definition: microop.hh:57
X86ISA::ConditionTests::SZnZF
@ SZnZF
Definition: microop.hh:52
misc.hh
X86ISA::ConditionTests::CF
@ CF
Definition: microop.hh:58
panic
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:171

Generated on Wed Sep 30 2020 14:02:07 for gem5 by doxygen 1.8.17