misc.isa revision 7202
17199Sgblack@eecs.umich.edu// -*- mode:c++ -*-
27199Sgblack@eecs.umich.edu
37199Sgblack@eecs.umich.edu// Copyright (c) 2010 ARM Limited
47199Sgblack@eecs.umich.edu// All rights reserved
57199Sgblack@eecs.umich.edu//
67199Sgblack@eecs.umich.edu// The license below extends only to copyright in the software and shall
77199Sgblack@eecs.umich.edu// not be construed as granting a license to any other intellectual
87199Sgblack@eecs.umich.edu// property including but not limited to intellectual property relating
97199Sgblack@eecs.umich.edu// to a hardware implementation of the functionality of the software
107199Sgblack@eecs.umich.edu// licensed hereunder.  You may use the software subject to the license
117199Sgblack@eecs.umich.edu// terms below provided that you ensure that this notice is replicated
127199Sgblack@eecs.umich.edu// unmodified and in its entirety in all distributions of the software,
137199Sgblack@eecs.umich.edu// modified or unmodified, in source code or in binary form.
147199Sgblack@eecs.umich.edu//
157199Sgblack@eecs.umich.edu// Redistribution and use in source and binary forms, with or without
167199Sgblack@eecs.umich.edu// modification, are permitted provided that the following conditions are
177199Sgblack@eecs.umich.edu// met: redistributions of source code must retain the above copyright
187199Sgblack@eecs.umich.edu// notice, this list of conditions and the following disclaimer;
197199Sgblack@eecs.umich.edu// redistributions in binary form must reproduce the above copyright
207199Sgblack@eecs.umich.edu// notice, this list of conditions and the following disclaimer in the
217199Sgblack@eecs.umich.edu// documentation and/or other materials provided with the distribution;
227199Sgblack@eecs.umich.edu// neither the name of the copyright holders nor the names of its
237199Sgblack@eecs.umich.edu// contributors may be used to endorse or promote products derived from
247199Sgblack@eecs.umich.edu// this software without specific prior written permission.
257199Sgblack@eecs.umich.edu//
267199Sgblack@eecs.umich.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
277199Sgblack@eecs.umich.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
287199Sgblack@eecs.umich.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
297199Sgblack@eecs.umich.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
307199Sgblack@eecs.umich.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
317199Sgblack@eecs.umich.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
327199Sgblack@eecs.umich.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
337199Sgblack@eecs.umich.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
347199Sgblack@eecs.umich.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
357199Sgblack@eecs.umich.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
367199Sgblack@eecs.umich.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
377199Sgblack@eecs.umich.edu//
387199Sgblack@eecs.umich.edu// Authors: Gabe Black
397199Sgblack@eecs.umich.edu
407199Sgblack@eecs.umich.edulet {{
417199Sgblack@eecs.umich.edu
427199Sgblack@eecs.umich.edu    svcCode = '''
437199Sgblack@eecs.umich.edu#if FULL_SYSTEM
447199Sgblack@eecs.umich.edu    fault = new SupervisorCall;
457199Sgblack@eecs.umich.edu#else
467199Sgblack@eecs.umich.edu    fault = new SupervisorCall(machInst);
477199Sgblack@eecs.umich.edu#endif
487199Sgblack@eecs.umich.edu    '''
497199Sgblack@eecs.umich.edu
507199Sgblack@eecs.umich.edu    svcIop = InstObjParams("svc", "Svc", "PredOp",
517199Sgblack@eecs.umich.edu                           { "code": svcCode,
527199Sgblack@eecs.umich.edu                             "predicate_test": predicateTest }, ["IsSyscall"])
537199Sgblack@eecs.umich.edu    header_output = BasicDeclare.subst(svcIop)
547199Sgblack@eecs.umich.edu    decoder_output = BasicConstructor.subst(svcIop)
557199Sgblack@eecs.umich.edu    exec_output = PredOpExecute.subst(svcIop)
567199Sgblack@eecs.umich.edu
577199Sgblack@eecs.umich.edu}};
587202Sgblack@eecs.umich.edu
597202Sgblack@eecs.umich.edulet {{
607202Sgblack@eecs.umich.edu
617202Sgblack@eecs.umich.edu    header_output = decoder_output = exec_output = ""
627202Sgblack@eecs.umich.edu
637202Sgblack@eecs.umich.edu    mrsCpsrCode = "Dest = (Cpsr | CondCodes) & 0xF8FF03DF"
647202Sgblack@eecs.umich.edu    mrsCpsrIop = InstObjParams("mrs", "MrsCpsr", "MrsOp",
657202Sgblack@eecs.umich.edu                               { "code": mrsCpsrCode,
667202Sgblack@eecs.umich.edu                                 "predicate_test": predicateTest }, [])
677202Sgblack@eecs.umich.edu    header_output += MrsDeclare.subst(mrsCpsrIop)
687202Sgblack@eecs.umich.edu    decoder_output += MrsConstructor.subst(mrsCpsrIop)
697202Sgblack@eecs.umich.edu    exec_output += PredOpExecute.subst(mrsCpsrIop)
707202Sgblack@eecs.umich.edu
717202Sgblack@eecs.umich.edu    mrsSpsrCode = "Dest = Spsr"
727202Sgblack@eecs.umich.edu    mrsSpsrIop = InstObjParams("mrs", "MrsSpsr", "MrsOp",
737202Sgblack@eecs.umich.edu                               { "code": mrsSpsrCode,
747202Sgblack@eecs.umich.edu                                 "predicate_test": predicateTest }, [])
757202Sgblack@eecs.umich.edu    header_output += MrsDeclare.subst(mrsSpsrIop)
767202Sgblack@eecs.umich.edu    decoder_output += MrsConstructor.subst(mrsSpsrIop)
777202Sgblack@eecs.umich.edu    exec_output += PredOpExecute.subst(mrsSpsrIop)
787202Sgblack@eecs.umich.edu
797202Sgblack@eecs.umich.edu    msrCpsrRegCode = '''
807202Sgblack@eecs.umich.edu        uint32_t newCpsr =
817202Sgblack@eecs.umich.edu            cpsrWriteByInstr(Cpsr | CondCodes, Op1, byteMask, false);
827202Sgblack@eecs.umich.edu        Cpsr = ~CondCodesMask & newCpsr;
837202Sgblack@eecs.umich.edu        CondCodes = CondCodesMask & newCpsr;
847202Sgblack@eecs.umich.edu    '''
857202Sgblack@eecs.umich.edu    msrCpsrRegIop = InstObjParams("msr", "MsrCpsrReg", "MsrRegOp",
867202Sgblack@eecs.umich.edu                                  { "code": msrCpsrRegCode,
877202Sgblack@eecs.umich.edu                                    "predicate_test": predicateTest }, [])
887202Sgblack@eecs.umich.edu    header_output += MsrRegDeclare.subst(msrCpsrRegIop)
897202Sgblack@eecs.umich.edu    decoder_output += MsrRegConstructor.subst(msrCpsrRegIop)
907202Sgblack@eecs.umich.edu    exec_output += PredOpExecute.subst(msrCpsrRegIop)
917202Sgblack@eecs.umich.edu
927202Sgblack@eecs.umich.edu    msrSpsrRegCode = "Spsr = spsrWriteByInstr(Spsr, Op1, byteMask, false);"
937202Sgblack@eecs.umich.edu    msrSpsrRegIop = InstObjParams("msr", "MsrSpsrReg", "MsrRegOp",
947202Sgblack@eecs.umich.edu                                  { "code": msrSpsrRegCode,
957202Sgblack@eecs.umich.edu                                    "predicate_test": predicateTest }, [])
967202Sgblack@eecs.umich.edu    header_output += MsrRegDeclare.subst(msrSpsrRegIop)
977202Sgblack@eecs.umich.edu    decoder_output += MsrRegConstructor.subst(msrSpsrRegIop)
987202Sgblack@eecs.umich.edu    exec_output += PredOpExecute.subst(msrSpsrRegIop)
997202Sgblack@eecs.umich.edu
1007202Sgblack@eecs.umich.edu    msrCpsrImmCode = '''
1017202Sgblack@eecs.umich.edu        uint32_t newCpsr =
1027202Sgblack@eecs.umich.edu            cpsrWriteByInstr(Cpsr | CondCodes, imm, byteMask, false);
1037202Sgblack@eecs.umich.edu        Cpsr = ~CondCodesMask & newCpsr;
1047202Sgblack@eecs.umich.edu        CondCodes = CondCodesMask & newCpsr;
1057202Sgblack@eecs.umich.edu    '''
1067202Sgblack@eecs.umich.edu    msrCpsrImmIop = InstObjParams("msr", "MsrCpsrImm", "MsrImmOp",
1077202Sgblack@eecs.umich.edu                                  { "code": msrCpsrImmCode,
1087202Sgblack@eecs.umich.edu                                    "predicate_test": predicateTest }, [])
1097202Sgblack@eecs.umich.edu    header_output += MsrImmDeclare.subst(msrCpsrImmIop)
1107202Sgblack@eecs.umich.edu    decoder_output += MsrImmConstructor.subst(msrCpsrImmIop)
1117202Sgblack@eecs.umich.edu    exec_output += PredOpExecute.subst(msrCpsrImmIop)
1127202Sgblack@eecs.umich.edu
1137202Sgblack@eecs.umich.edu    msrSpsrImmCode = "Spsr = spsrWriteByInstr(Spsr, imm, byteMask, false);"
1147202Sgblack@eecs.umich.edu    msrSpsrImmIop = InstObjParams("msr", "MsrSpsrImm", "MsrImmOp",
1157202Sgblack@eecs.umich.edu                                  { "code": msrSpsrImmCode,
1167202Sgblack@eecs.umich.edu                                    "predicate_test": predicateTest }, [])
1177202Sgblack@eecs.umich.edu    header_output += MsrImmDeclare.subst(msrSpsrImmIop)
1187202Sgblack@eecs.umich.edu    decoder_output += MsrImmConstructor.subst(msrSpsrImmIop)
1197202Sgblack@eecs.umich.edu    exec_output += PredOpExecute.subst(msrSpsrImmIop)
1207202Sgblack@eecs.umich.edu}};
121