13995Sgblack@eecs.umich.edu// Copyright (c) 2006-2007 The Regents of The University of Michigan 22632Sstever@eecs.umich.edu// All rights reserved. 32632Sstever@eecs.umich.edu// 42632Sstever@eecs.umich.edu// Redistribution and use in source and binary forms, with or without 52632Sstever@eecs.umich.edu// modification, are permitted provided that the following conditions are 62632Sstever@eecs.umich.edu// met: redistributions of source code must retain the above copyright 72632Sstever@eecs.umich.edu// notice, this list of conditions and the following disclaimer; 82632Sstever@eecs.umich.edu// redistributions in binary form must reproduce the above copyright 92632Sstever@eecs.umich.edu// notice, this list of conditions and the following disclaimer in the 102632Sstever@eecs.umich.edu// documentation and/or other materials provided with the distribution; 112632Sstever@eecs.umich.edu// neither the name of the copyright holders nor the names of its 122632Sstever@eecs.umich.edu// contributors may be used to endorse or promote products derived from 132632Sstever@eecs.umich.edu// this software without specific prior written permission. 142632Sstever@eecs.umich.edu// 152632Sstever@eecs.umich.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 162632Sstever@eecs.umich.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 172632Sstever@eecs.umich.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 182632Sstever@eecs.umich.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 192632Sstever@eecs.umich.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 202632Sstever@eecs.umich.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 212632Sstever@eecs.umich.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 222632Sstever@eecs.umich.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 232632Sstever@eecs.umich.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 242632Sstever@eecs.umich.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 252632Sstever@eecs.umich.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 262632Sstever@eecs.umich.edu// 272632Sstever@eecs.umich.edu// Authors: Gabe Black 282632Sstever@eecs.umich.edu// Steve Reinhardt 292632Sstever@eecs.umich.edu 302022SN/A//////////////////////////////////////////////////////////////////// 312022SN/A// 322022SN/A// Trap instructions 332022SN/A// 342022SN/A 352022SN/Adef template TrapExecute {{ 367741Sgblack@eecs.umich.edu Fault 3712234Sgabeblack@google.com %(class_name)s::execute(ExecContext *xc, 382224SN/A Trace::InstRecord *traceData) const 392022SN/A { 402469SN/A Fault fault = NoFault; 412488SN/A %(op_decl)s; 422488SN/A %(op_rd)s; 432469SN/A %(code)s 442469SN/A return fault; 452022SN/A } 462022SN/A}}; 472022SN/A 483996Sgblack@eecs.umich.edudef template FpUnimplExecute {{ 497741Sgblack@eecs.umich.edu Fault 5012234Sgabeblack@google.com %(class_name)s::execute(ExecContext *xc, 513996Sgblack@eecs.umich.edu Trace::InstRecord *traceData) const 523996Sgblack@eecs.umich.edu { 533996Sgblack@eecs.umich.edu Fault fault = NoFault; 543996Sgblack@eecs.umich.edu %(op_decl)s; 553996Sgblack@eecs.umich.edu %(op_rd)s; 563996Sgblack@eecs.umich.edu %(code)s 573996Sgblack@eecs.umich.edu %(op_wb)s; 583996Sgblack@eecs.umich.edu return fault; 593996Sgblack@eecs.umich.edu } 603996Sgblack@eecs.umich.edu}}; 613996Sgblack@eecs.umich.edu 622022SN/Adef format Trap(code, *opt_flags) {{ 633792Sgblack@eecs.umich.edu iop = InstObjParams(name, Name, 'Trap', code, opt_flags) 642022SN/A header_output = BasicDeclare.subst(iop) 652022SN/A decoder_output = BasicConstructor.subst(iop) 662469SN/A decode_block = BasicDecode.subst(iop) 672022SN/A exec_output = TrapExecute.subst(iop) 682022SN/A}}; 693995Sgblack@eecs.umich.edu 703995Sgblack@eecs.umich.edudef format FpUnimpl(*flags) {{ 713995Sgblack@eecs.umich.edu fpunimpl_code = ''' 723995Sgblack@eecs.umich.edu Fsr = insertBits(Fsr, 16, 14, 3); 7310474Sandreas.hansson@arm.com fault = std::make_shared<FpExceptionOther>(); 743995Sgblack@eecs.umich.edu ''' 753995Sgblack@eecs.umich.edu iop = InstObjParams(name, Name, 'FpUnimpl', fpunimpl_code, flags) 763995Sgblack@eecs.umich.edu header_output = BasicDeclare.subst(iop) 773995Sgblack@eecs.umich.edu decoder_output = BasicConstructor.subst(iop) 783995Sgblack@eecs.umich.edu decode_block = BasicDecode.subst(iop) 793996Sgblack@eecs.umich.edu exec_output = FpUnimplExecute.subst(iop) 803995Sgblack@eecs.umich.edu}}; 81