increment_and_decrement.py revision 8610:9bdd52a2214c
15347Ssaidi@eecs.umich.edu# Copyright (c) 2007 The Hewlett-Packard Development Company
23395Shsul@eecs.umich.edu# All rights reserved.
33395Shsul@eecs.umich.edu#
43395Shsul@eecs.umich.edu# The license below extends only to copyright in the software and shall
53395Shsul@eecs.umich.edu# not be construed as granting a license to any other intellectual
63395Shsul@eecs.umich.edu# property including but not limited to intellectual property relating
73395Shsul@eecs.umich.edu# to a hardware implementation of the functionality of the software
83395Shsul@eecs.umich.edu# licensed hereunder.  You may use the software subject to the license
93395Shsul@eecs.umich.edu# terms below provided that you ensure that this notice is replicated
103395Shsul@eecs.umich.edu# unmodified and in its entirety in all distributions of the software,
113395Shsul@eecs.umich.edu# modified or unmodified, in source code or in binary form.
123395Shsul@eecs.umich.edu#
133395Shsul@eecs.umich.edu# Redistribution and use in source and binary forms, with or without
143395Shsul@eecs.umich.edu# modification, are permitted provided that the following conditions are
153395Shsul@eecs.umich.edu# met: redistributions of source code must retain the above copyright
163395Shsul@eecs.umich.edu# notice, this list of conditions and the following disclaimer;
173395Shsul@eecs.umich.edu# redistributions in binary form must reproduce the above copyright
183395Shsul@eecs.umich.edu# notice, this list of conditions and the following disclaimer in the
193395Shsul@eecs.umich.edu# documentation and/or other materials provided with the distribution;
203395Shsul@eecs.umich.edu# neither the name of the copyright holders nor the names of its
213395Shsul@eecs.umich.edu# contributors may be used to endorse or promote products derived from
223395Shsul@eecs.umich.edu# this software without specific prior written permission.
233395Shsul@eecs.umich.edu#
243395Shsul@eecs.umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
253395Shsul@eecs.umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
263395Shsul@eecs.umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
273395Shsul@eecs.umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
283395Shsul@eecs.umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
293395Shsul@eecs.umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
303509Shsul@eecs.umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
316654Snate@binkert.org# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
323395Shsul@eecs.umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
336654Snate@binkert.org# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
343395Shsul@eecs.umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
356654Snate@binkert.org#
366654Snate@binkert.org# Authors: Gabe Black
376654Snate@binkert.org
383395Shsul@eecs.umich.edumicrocode = '''
393481Shsul@eecs.umich.edudef macroop INC_R
403481Shsul@eecs.umich.edu{
413481Shsul@eecs.umich.edu    addi reg, reg, 1, flags=(OF, SF, ZF, AF, PF)
423481Shsul@eecs.umich.edu};
435347Ssaidi@eecs.umich.edu
443481Shsul@eecs.umich.edudef macroop INC_M
453681Sktlim@umich.edu{
463681Sktlim@umich.edu    ldst t1, seg, sib, disp
473681Sktlim@umich.edu    addi t1, t1, 1, flags=(OF, SF, ZF, AF, PF)
485347Ssaidi@eecs.umich.edu    st t1, seg, sib, disp
495869Sksewell@umich.edu};
505869Sksewell@umich.edu
515869Sksewell@umich.edudef macroop INC_P
525869Sksewell@umich.edu{
535869Sksewell@umich.edu    rdip t7
543481Shsul@eecs.umich.edu    ldst t1, seg, riprel, disp
555347Ssaidi@eecs.umich.edu    addi t1, t1, 1, flags=(OF, SF, ZF, AF, PF)
563481Shsul@eecs.umich.edu    st t1, seg, riprel, disp
573481Shsul@eecs.umich.edu};
583481Shsul@eecs.umich.edu
593481Shsul@eecs.umich.edudef macroop INC_LOCKED_M
603481Shsul@eecs.umich.edu{
613481Shsul@eecs.umich.edu    mfence
625369Ssaidi@eecs.umich.edu    ldstl t1, seg, sib, disp
633481Shsul@eecs.umich.edu    addi t1, t1, 1, flags=(OF, SF, ZF, AF, PF)
645347Ssaidi@eecs.umich.edu    stul t1, seg, sib, disp
653481Shsul@eecs.umich.edu    mfence
663481Shsul@eecs.umich.edu};
673481Shsul@eecs.umich.edu
683481Shsul@eecs.umich.edudef macroop INC_LOCKED_P
693481Shsul@eecs.umich.edu{
703481Shsul@eecs.umich.edu    rdip t7
713481Shsul@eecs.umich.edu    mfence
723395Shsul@eecs.umich.edu    ldstl t1, seg, riprel, disp
733395Shsul@eecs.umich.edu    addi t1, t1, 1, flags=(OF, SF, ZF, AF, PF)
743395Shsul@eecs.umich.edu    stul t1, seg, riprel, disp
754167Sbinkertn@umich.edu    mfence
763395Shsul@eecs.umich.edu};
773395Shsul@eecs.umich.edu
783395Shsul@eecs.umich.edudef macroop DEC_R
793511Shsul@eecs.umich.edu{
803395Shsul@eecs.umich.edu    subi reg, reg, 1, flags=(OF, SF, ZF, AF, PF)
813395Shsul@eecs.umich.edu};
823395Shsul@eecs.umich.edu
835211Ssaidi@eecs.umich.edudef macroop DEC_M
845211Ssaidi@eecs.umich.edu{
853395Shsul@eecs.umich.edu    ldst t1, seg, sib, disp
863395Shsul@eecs.umich.edu    subi t1, t1, 1, flags=(OF, SF, ZF, AF, PF)
873395Shsul@eecs.umich.edu    st t1, seg, sib, disp
885370Ssaidi@eecs.umich.edu};
896654Snate@binkert.org
905370Ssaidi@eecs.umich.edudef macroop DEC_P
915371Shsul@eecs.umich.edu{
926654Snate@binkert.org    rdip t7
935370Ssaidi@eecs.umich.edu    ldst t1, seg, riprel, disp
943395Shsul@eecs.umich.edu    subi t1, t1, 1, flags=(OF, SF, ZF, AF, PF)
953395Shsul@eecs.umich.edu    st t1, seg, riprel, disp
963481Shsul@eecs.umich.edu};
973481Shsul@eecs.umich.edu
986144Sksewell@umich.edudef macroop DEC_LOCKED_M
996144Sksewell@umich.edu{
1006144Sksewell@umich.edu    mfence
1016144Sksewell@umich.edu    ldstl t1, seg, sib, disp
1026641Sksewell@umich.edu    subi t1, t1, 1, flags=(OF, SF, ZF, AF, PF)
1036641Sksewell@umich.edu    stul t1, seg, sib, disp
1046641Sksewell@umich.edu    mfence
1056641Sksewell@umich.edu};
1063481Shsul@eecs.umich.edu
1073481Shsul@eecs.umich.edudef macroop DEC_LOCKED_P
1083481Shsul@eecs.umich.edu{
1093481Shsul@eecs.umich.edu    rdip t7
1103481Shsul@eecs.umich.edu    mfence
1115361Srstrong@cs.ucsd.edu    ldstl t1, seg, riprel, disp
1125369Ssaidi@eecs.umich.edu    subi t1, t1, 1, flags=(OF, SF, ZF, AF, PF)
1133481Shsul@eecs.umich.edu    stul t1, seg, riprel, disp
1146654Snate@binkert.org    mfence
1153481Shsul@eecs.umich.edu};
1163481Shsul@eecs.umich.edu'''
1175369Ssaidi@eecs.umich.edu