macromem.isa revision 7170
16019SN/A// -*- mode:c++ -*-
26019SN/A
37134Sgblack@eecs.umich.edu// Copyright (c) 2010 ARM Limited
47134Sgblack@eecs.umich.edu// All rights reserved
57134Sgblack@eecs.umich.edu//
67134Sgblack@eecs.umich.edu// The license below extends only to copyright in the software and shall
77134Sgblack@eecs.umich.edu// not be construed as granting a license to any other intellectual
87134Sgblack@eecs.umich.edu// property including but not limited to intellectual property relating
97134Sgblack@eecs.umich.edu// to a hardware implementation of the functionality of the software
107134Sgblack@eecs.umich.edu// licensed hereunder.  You may use the software subject to the license
117134Sgblack@eecs.umich.edu// terms below provided that you ensure that this notice is replicated
127134Sgblack@eecs.umich.edu// unmodified and in its entirety in all distributions of the software,
137134Sgblack@eecs.umich.edu// modified or unmodified, in source code or in binary form.
147134Sgblack@eecs.umich.edu//
156019SN/A// Copyright (c) 2007-2008 The Florida State University
166019SN/A// All rights reserved.
176019SN/A//
186019SN/A// Redistribution and use in source and binary forms, with or without
196019SN/A// modification, are permitted provided that the following conditions are
206019SN/A// met: redistributions of source code must retain the above copyright
216019SN/A// notice, this list of conditions and the following disclaimer;
226019SN/A// redistributions in binary form must reproduce the above copyright
236019SN/A// notice, this list of conditions and the following disclaimer in the
246019SN/A// documentation and/or other materials provided with the distribution;
256019SN/A// neither the name of the copyright holders nor the names of its
266019SN/A// contributors may be used to endorse or promote products derived from
276019SN/A// this software without specific prior written permission.
286019SN/A//
296019SN/A// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
306019SN/A// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
316019SN/A// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
326019SN/A// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
336019SN/A// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
346019SN/A// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
356019SN/A// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
366019SN/A// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
376019SN/A// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
386019SN/A// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
396019SN/A// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
406019SN/A//
416019SN/A// Authors: Stephen Hines
426308SN/A//          Gabe Black
436308SN/A
446309SN/A////////////////////////////////////////////////////////////////////
456309SN/A//
466309SN/A// Load/store microops
476309SN/A//
486309SN/A
497134Sgblack@eecs.umich.edulet {{
507134Sgblack@eecs.umich.edu    predicateTest = 'testPredicate(CondCodes, condCode)'
516309SN/A}};
526309SN/A
536309SN/Alet {{
546309SN/A    microLdrUopIop = InstObjParams('ldr_uop', 'MicroLdrUop',
556309SN/A                                   'MicroMemOp',
566309SN/A                                   {'memacc_code': 'Ra = Mem;',
577134Sgblack@eecs.umich.edu                                    'ea_code': 'EA = Rb + (up ? imm : -imm);',
586309SN/A                                    'predicate_test': predicateTest},
596309SN/A                                   ['IsMicroop'])
606309SN/A
616754SN/A    microLdrRetUopCode = '''
626754SN/A        Ra = Mem;
637134Sgblack@eecs.umich.edu        uint32_t newCpsr =
647134Sgblack@eecs.umich.edu            cpsrWriteByInstr(Cpsr | CondCodes, Spsr, 0xF, true);
657134Sgblack@eecs.umich.edu        Cpsr = ~CondCodesMask & newCpsr;
667134Sgblack@eecs.umich.edu        CondCodes = CondCodesMask & newCpsr;
676754SN/A    '''
686754SN/A    microLdrRetUopIop = InstObjParams('ldr_ret_uop', 'MicroLdrRetUop',
696754SN/A                                      'MicroMemOp',
706754SN/A                                      {'memacc_code': microLdrRetUopCode,
716754SN/A                                       'ea_code':
727134Sgblack@eecs.umich.edu                                          'EA = Rb + (up ? imm : -imm);',
736754SN/A                                       'predicate_test': predicateTest},
746754SN/A                                      ['IsMicroop'])
756754SN/A
766309SN/A    microStrUopIop = InstObjParams('str_uop', 'MicroStrUop',
776309SN/A                                   'MicroMemOp',
786309SN/A                                   {'memacc_code': 'Mem = Ra;',
797134Sgblack@eecs.umich.edu                                    'ea_code': 'EA = Rb + (up ? imm : -imm);',
806309SN/A                                    'predicate_test': predicateTest},
816309SN/A                                   ['IsMicroop'])
826309SN/A
836309SN/A    header_output = MicroMemDeclare.subst(microLdrUopIop) + \
846754SN/A                    MicroMemDeclare.subst(microLdrRetUopIop) + \
856309SN/A                    MicroMemDeclare.subst(microStrUopIop)
867134Sgblack@eecs.umich.edu    decoder_output = MicroMemConstructor.subst(microLdrUopIop) + \
877134Sgblack@eecs.umich.edu                     MicroMemConstructor.subst(microLdrRetUopIop) + \
887134Sgblack@eecs.umich.edu                     MicroMemConstructor.subst(microStrUopIop)
896309SN/A    exec_output = LoadExecute.subst(microLdrUopIop) + \
906754SN/A                  LoadExecute.subst(microLdrRetUopIop) + \
916309SN/A                  StoreExecute.subst(microStrUopIop) + \
926309SN/A                  LoadInitiateAcc.subst(microLdrUopIop) + \
936754SN/A                  LoadInitiateAcc.subst(microLdrRetUopIop) + \
946309SN/A                  StoreInitiateAcc.subst(microStrUopIop) + \
956309SN/A                  LoadCompleteAcc.subst(microLdrUopIop) + \
966754SN/A                  LoadCompleteAcc.subst(microLdrRetUopIop) + \
976309SN/A                  StoreCompleteAcc.subst(microStrUopIop)
986309SN/A}};
996308SN/A
1006308SN/A////////////////////////////////////////////////////////////////////
1016308SN/A//
1026308SN/A// Integer = Integer op Immediate microops
1036308SN/A//
1046308SN/A
1056308SN/Alet {{
1066308SN/A    microAddiUopIop = InstObjParams('addi_uop', 'MicroAddiUop',
1076308SN/A                                    'MicroIntOp',
1086308SN/A                                    {'code': 'Ra = Rb + imm;',
1096308SN/A                                     'predicate_test': predicateTest},
1106308SN/A                                    ['IsMicroop'])
1116308SN/A
1126308SN/A    microSubiUopIop = InstObjParams('subi_uop', 'MicroSubiUop',
1136308SN/A                                    'MicroIntOp',
1146308SN/A                                    {'code': 'Ra = Rb - imm;',
1156308SN/A                                     'predicate_test': predicateTest},
1166308SN/A                                    ['IsMicroop'])
1176308SN/A
1186308SN/A    header_output = MicroIntDeclare.subst(microAddiUopIop) + \
1196308SN/A                    MicroIntDeclare.subst(microSubiUopIop)
1207134Sgblack@eecs.umich.edu    decoder_output = MicroIntConstructor.subst(microAddiUopIop) + \
1217134Sgblack@eecs.umich.edu                     MicroIntConstructor.subst(microSubiUopIop)
1226308SN/A    exec_output = PredOpExecute.subst(microAddiUopIop) + \
1236308SN/A                  PredOpExecute.subst(microSubiUopIop)
1246308SN/A}};
1256019SN/A
1267134Sgblack@eecs.umich.edulet {{
1277170Sgblack@eecs.umich.edu    iop = InstObjParams("ldmstm", "LdmStm", 'MacroMemOp', "", [])
1287134Sgblack@eecs.umich.edu    header_output = MacroMemDeclare.subst(iop)
1297134Sgblack@eecs.umich.edu    decoder_output = MacroMemConstructor.subst(iop)
1306019SN/A}};
131