StaticInstFlags.py revision 10201
110259SAndrew.Bardsley@arm.com# Copyright (c) 2003-2005 The Regents of The University of Michigan
210259SAndrew.Bardsley@arm.com# Copyright (c) 2013 Advanced Micro Devices, Inc.
310259SAndrew.Bardsley@arm.com# All rights reserved.
410259SAndrew.Bardsley@arm.com#
510259SAndrew.Bardsley@arm.com# Redistribution and use in source and binary forms, with or without
610259SAndrew.Bardsley@arm.com# modification, are permitted provided that the following conditions are
710259SAndrew.Bardsley@arm.com# met: redistributions of source code must retain the above copyright
810259SAndrew.Bardsley@arm.com# notice, this list of conditions and the following disclaimer;
910259SAndrew.Bardsley@arm.com# redistributions in binary form must reproduce the above copyright
1010259SAndrew.Bardsley@arm.com# notice, this list of conditions and the following disclaimer in the
1110259SAndrew.Bardsley@arm.com# documentation and/or other materials provided with the distribution;
1210259SAndrew.Bardsley@arm.com# neither the name of the copyright holders nor the names of its
1310259SAndrew.Bardsley@arm.com# contributors may be used to endorse or promote products derived from
1410259SAndrew.Bardsley@arm.com# this software without specific prior written permission.
1510259SAndrew.Bardsley@arm.com#
1610259SAndrew.Bardsley@arm.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1710259SAndrew.Bardsley@arm.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1810259SAndrew.Bardsley@arm.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1910259SAndrew.Bardsley@arm.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2010259SAndrew.Bardsley@arm.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2110259SAndrew.Bardsley@arm.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2210259SAndrew.Bardsley@arm.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2310259SAndrew.Bardsley@arm.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2410259SAndrew.Bardsley@arm.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2510259SAndrew.Bardsley@arm.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2610259SAndrew.Bardsley@arm.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2710259SAndrew.Bardsley@arm.com#
2810259SAndrew.Bardsley@arm.com# Authors: Steve Reinhardt
2910259SAndrew.Bardsley@arm.com
3010259SAndrew.Bardsley@arm.comfrom m5.params import *
3110259SAndrew.Bardsley@arm.com
3210259SAndrew.Bardsley@arm.com# Set of boolean static instruction properties.
3310259SAndrew.Bardsley@arm.com#
3410259SAndrew.Bardsley@arm.com# Notes:
3510259SAndrew.Bardsley@arm.com# - The IsInteger and IsFloating flags are based on the class of registers
3610259SAndrew.Bardsley@arm.com# accessed by the instruction.  Although most instructions will have exactly
3710259SAndrew.Bardsley@arm.com# one of these two flags set, it is possible for an instruction to have
3810259SAndrew.Bardsley@arm.com# neither (e.g., direct unconditional branches, memory barriers) or both
3910259SAndrew.Bardsley@arm.com# (e.g., an FP/int conversion).
4010259SAndrew.Bardsley@arm.com# - If IsMemRef is set, then exactly one of IsLoad or IsStore will be set.
4110259SAndrew.Bardsley@arm.com# - If IsControl is set, then exactly one of IsDirectControl or IsIndirect
4210259SAndrew.Bardsley@arm.com# Control will be set, and exactly one of IsCondControl or IsUncondControl
4310259SAndrew.Bardsley@arm.com# will be set.
4410259SAndrew.Bardsley@arm.com# - IsSerializing, IsMemBarrier, and IsWriteBarrier are implemented as flags
4510259SAndrew.Bardsley@arm.com# since in the current model there's no other way for instructions to inject
4610259SAndrew.Bardsley@arm.com# behavior into the pipeline outside of fetch.  Once we go to an exec-in-exec
4710259SAndrew.Bardsley@arm.com# CPU model we should be able to get rid of these flags and implement this
4810259SAndrew.Bardsley@arm.com# behavior via the execute() methods.
4910259SAndrew.Bardsley@arm.com
5010259SAndrew.Bardsley@arm.comclass StaticInstFlags(Enum):
5110259SAndrew.Bardsley@arm.com    wrapper_name = 'StaticInstFlags'
5210259SAndrew.Bardsley@arm.com    wrapper_is_struct = True
5310259SAndrew.Bardsley@arm.com    enum_name = 'Flags'
5410259SAndrew.Bardsley@arm.com
5510259SAndrew.Bardsley@arm.com    vals = [
5610259SAndrew.Bardsley@arm.com        'IsNop',            # Is a no-op (no effect at all).
5710259SAndrew.Bardsley@arm.com
5810259SAndrew.Bardsley@arm.com        'IsInteger',        # References integer regs.
5910259SAndrew.Bardsley@arm.com        'IsFloating',       # References FP regs.
6010259SAndrew.Bardsley@arm.com        'IsCC',             # References CC regs.
6110259SAndrew.Bardsley@arm.com
6210259SAndrew.Bardsley@arm.com        'IsMemRef',         # References memory (load, store, or prefetch)
6310259SAndrew.Bardsley@arm.com        'IsLoad',           # Reads from memory (load or prefetch).
6410259SAndrew.Bardsley@arm.com        'IsStore',          # Writes to memory.
6510259SAndrew.Bardsley@arm.com        'IsStoreConditional',   # Store conditional instruction.
6610259SAndrew.Bardsley@arm.com        'IsIndexed',        # Accesses memory with an indexed address
6710259SAndrew.Bardsley@arm.com                            # computation
6810259SAndrew.Bardsley@arm.com        'IsInstPrefetch',   # Instruction-cache prefetch.
6910259SAndrew.Bardsley@arm.com        'IsDataPrefetch',   # Data-cache prefetch.
7010259SAndrew.Bardsley@arm.com
7110259SAndrew.Bardsley@arm.com        'IsControl',        # Control transfer instruction.
7210259SAndrew.Bardsley@arm.com        'IsDirectControl',  # PC relative control transfer.
7310259SAndrew.Bardsley@arm.com        'IsIndirectControl',# Register indirect control transfer.
7410259SAndrew.Bardsley@arm.com        'IsCondControl',    # Conditional control transfer.
7510259SAndrew.Bardsley@arm.com        'IsUncondControl',  # Unconditional control transfer.
7610259SAndrew.Bardsley@arm.com        'IsCall',           # Subroutine call.
7710259SAndrew.Bardsley@arm.com        'IsReturn',         # Subroutine return.
7810259SAndrew.Bardsley@arm.com
7910259SAndrew.Bardsley@arm.com        'IsCondDelaySlot',  # Conditional Delay-Slot Instruction
8010259SAndrew.Bardsley@arm.com
8110259SAndrew.Bardsley@arm.com        'IsThreadSync',     # Thread synchronization operation.
8210259SAndrew.Bardsley@arm.com
8310259SAndrew.Bardsley@arm.com        'IsSerializing',    # Serializes pipeline: won't execute until all
8410259SAndrew.Bardsley@arm.com                            # older instructions have committed.
8510259SAndrew.Bardsley@arm.com        'IsSerializeBefore',
8610259SAndrew.Bardsley@arm.com        'IsSerializeAfter',
8710259SAndrew.Bardsley@arm.com        'IsMemBarrier',     # Is a memory barrier
8810259SAndrew.Bardsley@arm.com        'IsWriteBarrier',   # Is a write barrier
8910259SAndrew.Bardsley@arm.com        'IsReadBarrier',    # Is a read barrier
9010259SAndrew.Bardsley@arm.com        'IsERET',           # <- Causes the IFU to stall (MIPS ISA)
9110259SAndrew.Bardsley@arm.com
9210259SAndrew.Bardsley@arm.com        'IsNonSpeculative', # Should not be executed speculatively
9310259SAndrew.Bardsley@arm.com        'IsQuiesce',        # Is a quiesce instruction
9410259SAndrew.Bardsley@arm.com
9510259SAndrew.Bardsley@arm.com        'IsIprAccess',      # Accesses IPRs
9610259SAndrew.Bardsley@arm.com        'IsUnverifiable',   # Can't be verified by a checker
9710259SAndrew.Bardsley@arm.com
9810259SAndrew.Bardsley@arm.com        'IsSyscall',        # Causes a system call to be emulated in syscall
9910259SAndrew.Bardsley@arm.com                            # emulation mode.
10010259SAndrew.Bardsley@arm.com
10110259SAndrew.Bardsley@arm.com        # Flags for microcode
10210259SAndrew.Bardsley@arm.com        'IsMacroop',        # Is a macroop containing microops
10310259SAndrew.Bardsley@arm.com        'IsMicroop',        # Is a microop
10410259SAndrew.Bardsley@arm.com        'IsDelayedCommit',  # This microop doesn't commit right away
10510259SAndrew.Bardsley@arm.com        'IsLastMicroop',    # This microop ends a microop sequence
10610259SAndrew.Bardsley@arm.com        'IsFirstMicroop',   # This microop begins a microop sequence
10710259SAndrew.Bardsley@arm.com        # This flag doesn't do anything yet
10810259SAndrew.Bardsley@arm.com        'IsMicroBranch',    # This microop branches within the microcode for
10910259SAndrew.Bardsley@arm.com                            # a macroop
11010259SAndrew.Bardsley@arm.com        'IsDspOp',
11110259SAndrew.Bardsley@arm.com        'IsSquashAfter'     # Squash all uncommitted state after executed
11210259SAndrew.Bardsley@arm.com        ]
11310259SAndrew.Bardsley@arm.com