increment_and_decrement.py revision 6092:e4ffbb3546fa
12SN/A# Copyright (c) 2007 The Hewlett-Packard Development Company
24039Sbinkertn@umich.edu# All rights reserved.
32SN/A#
42SN/A# Redistribution and use of this software in source and binary forms,
52SN/A# with or without modification, are permitted provided that the
62SN/A# following conditions are met:
72SN/A#
82SN/A# The software must be used only for Non-Commercial Use which means any
92SN/A# use which is NOT directed to receiving any direct monetary
102SN/A# compensation for, or commercial advantage from such use.  Illustrative
112SN/A# examples of non-commercial use are academic research, personal study,
122SN/A# teaching, education and corporate research & development.
132SN/A# Illustrative examples of commercial use are distributing products for
142SN/A# commercial advantage and providing services using the software for
152SN/A# commercial advantage.
162SN/A#
172SN/A# If you wish to use this software or functionality therein that may be
182SN/A# covered by patents for commercial use, please contact:
192SN/A#     Director of Intellectual Property Licensing
202SN/A#     Office of Strategy and Technology
212SN/A#     Hewlett-Packard Company
222SN/A#     1501 Page Mill Road
232SN/A#     Palo Alto, California  94304
242SN/A#
252SN/A# Redistributions of source code must retain the above copyright notice,
262SN/A# this list of conditions and the following disclaimer.  Redistributions
272665Ssaidi@eecs.umich.edu# in binary form must reproduce the above copyright notice, this list of
282665Ssaidi@eecs.umich.edu# conditions and the following disclaimer in the documentation and/or
292665Ssaidi@eecs.umich.edu# other materials provided with the distribution.  Neither the name of
302SN/A# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
312SN/A# contributors may be used to endorse or promote products derived from
321354SN/A# this software without specific prior written permission.  No right of
331354SN/A# sublicense is granted herewith.  Derivatives of the software and
342SN/A# output created using the software may be prepared, but only for
354046Sbinkertn@umich.edu# Non-Commercial Uses.  Derivatives of the software may be shared with
362SN/A# others provided: (i) the others agree to abide by the list of
372SN/A# conditions herein which includes the Non-Commercial Use restrictions;
3856SN/A# and (ii) such Derivatives of the software include the above copyright
391031SN/A# notice to acknowledge the contribution from this software where
404046Sbinkertn@umich.edu# applicable, this list of conditions and the disclaimer below.
416214Snate@binkert.org#
424167Sbinkertn@umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
432SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
442SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
452SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
464046Sbinkertn@umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
474046Sbinkertn@umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
482SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
494046Sbinkertn@umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
504046Sbinkertn@umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
514046Sbinkertn@umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
524046Sbinkertn@umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
534046Sbinkertn@umich.edu#
544046Sbinkertn@umich.edu# Authors: Gabe Black
552SN/A
564046Sbinkertn@umich.edumicrocode = '''
574046Sbinkertn@umich.edudef macroop INC_R
582SN/A{
594046Sbinkertn@umich.edu    addi reg, reg, 1, flags=(OF, SF, ZF, AF, PF)
604046Sbinkertn@umich.edu};
614046Sbinkertn@umich.edu
622SN/Adef macroop INC_M
637811Ssteve.reinhardt@amd.com{
644039Sbinkertn@umich.edu    ldst t1, seg, sib, disp
651070SN/A    addi t1, t1, 1, flags=(OF, SF, ZF, AF, PF)
661070SN/A    st t1, seg, sib, disp
671070SN/A};
681070SN/A
691070SN/Adef macroop INC_P
701070SN/A{
711070SN/A    rdip t7
721070SN/A    ldst t1, seg, riprel, disp
731070SN/A    addi t1, t1, 1, flags=(OF, SF, ZF, AF, PF)
742SN/A    st t1, seg, riprel, disp
752SN/A};
762SN/A
772SN/Adef macroop INC_LOCKED_M
782SN/A{
792SN/A    ldstl t1, seg, sib, disp
802SN/A    addi t1, t1, 1, flags=(OF, SF, ZF, AF, PF)
812SN/A    stul t1, seg, sib, disp
822SN/A};
832SN/A
842SN/Adef macroop INC_LOCKED_P
852SN/A{
862SN/A    rdip t7
872SN/A    ldstl t1, seg, riprel, disp
884042Sbinkertn@umich.edu    addi t1, t1, 1, flags=(OF, SF, ZF, AF, PF)
892SN/A    stul t1, seg, riprel, disp
904041Sbinkertn@umich.edu};
914041Sbinkertn@umich.edu
924046Sbinkertn@umich.edudef macroop DEC_R
932SN/A{
942SN/A    subi reg, reg, 1, flags=(OF, SF, ZF, AF, PF)
954041Sbinkertn@umich.edu};
964041Sbinkertn@umich.edu
974041Sbinkertn@umich.edudef macroop DEC_M
982SN/A{
992SN/A    ldst t1, seg, sib, disp
1005806Ssaidi@eecs.umich.edu    subi t1, t1, 1, flags=(OF, SF, ZF, AF, PF)
1015806Ssaidi@eecs.umich.edu    st t1, seg, sib, disp
1025806Ssaidi@eecs.umich.edu};
1035806Ssaidi@eecs.umich.edu
1045806Ssaidi@eecs.umich.edudef macroop DEC_P
1055806Ssaidi@eecs.umich.edu{
1064041Sbinkertn@umich.edu    rdip t7
1074041Sbinkertn@umich.edu    ldst t1, seg, riprel, disp
1084041Sbinkertn@umich.edu    subi t1, t1, 1, flags=(OF, SF, ZF, AF, PF)
1092SN/A    st t1, seg, riprel, disp
1102SN/A};
1114046Sbinkertn@umich.edu
1124046Sbinkertn@umich.edudef macroop DEC_LOCKED_M
1134046Sbinkertn@umich.edu{
1144046Sbinkertn@umich.edu    ldstl t1, seg, sib, disp
1154041Sbinkertn@umich.edu    subi t1, t1, 1, flags=(OF, SF, ZF, AF, PF)
1164041Sbinkertn@umich.edu    stul t1, seg, sib, disp
1172SN/A};
1182SN/A
1194041Sbinkertn@umich.edudef macroop DEC_LOCKED_P
1204041Sbinkertn@umich.edu{
121507SN/A    rdip t7
122507SN/A    ldstl t1, seg, riprel, disp
1232SN/A    subi t1, t1, 1, flags=(OF, SF, ZF, AF, PF)
1242SN/A    stul t1, seg, riprel, disp
1252SN/A};
1264046Sbinkertn@umich.edu'''
1274041Sbinkertn@umich.edu