basicmem.isa revision 3792
13388Sgblack@eecs.umich.edu// Copyright (c) 2006 The Regents of The University of Michigan 23388Sgblack@eecs.umich.edu// All rights reserved. 33388Sgblack@eecs.umich.edu// 43388Sgblack@eecs.umich.edu// Redistribution and use in source and binary forms, with or without 53388Sgblack@eecs.umich.edu// modification, are permitted provided that the following conditions are 63388Sgblack@eecs.umich.edu// met: redistributions of source code must retain the above copyright 73388Sgblack@eecs.umich.edu// notice, this list of conditions and the following disclaimer; 83388Sgblack@eecs.umich.edu// redistributions in binary form must reproduce the above copyright 93388Sgblack@eecs.umich.edu// notice, this list of conditions and the following disclaimer in the 103388Sgblack@eecs.umich.edu// documentation and/or other materials provided with the distribution; 113388Sgblack@eecs.umich.edu// neither the name of the copyright holders nor the names of its 123388Sgblack@eecs.umich.edu// contributors may be used to endorse or promote products derived from 133388Sgblack@eecs.umich.edu// this software without specific prior written permission. 143388Sgblack@eecs.umich.edu// 153388Sgblack@eecs.umich.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 163388Sgblack@eecs.umich.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 173388Sgblack@eecs.umich.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 183388Sgblack@eecs.umich.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 193388Sgblack@eecs.umich.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 203388Sgblack@eecs.umich.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 213388Sgblack@eecs.umich.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 223388Sgblack@eecs.umich.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 233388Sgblack@eecs.umich.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 243388Sgblack@eecs.umich.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 253388Sgblack@eecs.umich.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 263388Sgblack@eecs.umich.edu// 273388Sgblack@eecs.umich.edu// Authors: Ali Saidi 283388Sgblack@eecs.umich.edu// Gabe Black 293388Sgblack@eecs.umich.edu 302022SN/A//////////////////////////////////////////////////////////////////// 312022SN/A// 322022SN/A// Mem instructions 332022SN/A// 342022SN/A 353385SN/Adef template MemDeclare {{ 363385SN/A /** 373385SN/A * Static instruction class for "%(mnemonic)s". 383385SN/A */ 393385SN/A class %(class_name)s : public %(base_class)s 403385SN/A { 413385SN/A public: 423385SN/A 433385SN/A /// Constructor. 443385SN/A %(class_name)s(ExtMachInst machInst); 453385SN/A 463385SN/A %(BasicExecDeclare)s 473385SN/A 483385SN/A %(InitiateAccDeclare)s 493385SN/A 503385SN/A %(CompleteAccDeclare)s 513385SN/A }; 523385SN/A}}; 533385SN/A 542526SN/Alet {{ 553391Sgblack@eecs.umich.edu def doMemFormat(code, execute, faultCode, name, Name, opt_flags): 562516SN/A addrCalcReg = 'EA = Rs1 + Rs2;' 572591SN/A addrCalcImm = 'EA = Rs1 + imm;' 583792Sgblack@eecs.umich.edu iop = InstObjParams(name, Name, 'Mem', 593792Sgblack@eecs.umich.edu {"code": code, "fault_check": faultCode, 603792Sgblack@eecs.umich.edu "ea_code": addrCalcReg}, 613792Sgblack@eecs.umich.edu opt_flags) 623792Sgblack@eecs.umich.edu iop_imm = InstObjParams(name, Name + "Imm", 'MemImm', 633792Sgblack@eecs.umich.edu {"code": code, "fault_check": faultCode, 643792Sgblack@eecs.umich.edu "ea_code": addrCalcImm}, 653792Sgblack@eecs.umich.edu opt_flags) 663385SN/A header_output = MemDeclare.subst(iop) + MemDeclare.subst(iop_imm) 672516SN/A decoder_output = BasicConstructor.subst(iop) + BasicConstructor.subst(iop_imm) 682516SN/A decode_block = ROrImmDecode.subst(iop) 693792Sgblack@eecs.umich.edu exec_output = doDualSplitExecute(code, addrCalcReg, addrCalcImm, 703792Sgblack@eecs.umich.edu execute, faultCode, name, name + "Imm", 713792Sgblack@eecs.umich.edu Name, Name + "Imm", opt_flags) 722526SN/A return (header_output, decoder_output, exec_output, decode_block) 732022SN/A}}; 742526SN/A 753272SN/Adef format LoadAlt(code, *opt_flags) {{ 763272SN/A (header_output, 773272SN/A decoder_output, 783272SN/A exec_output, 793792Sgblack@eecs.umich.edu decode_block) = doMemFormat(code, LoadFuncs, 803391Sgblack@eecs.umich.edu AlternateAsiPrivFaultCheck, name, Name, opt_flags) 813272SN/A}}; 823272SN/A 833272SN/Adef format StoreAlt(code, *opt_flags) {{ 843272SN/A (header_output, 853272SN/A decoder_output, 863272SN/A exec_output, 873792Sgblack@eecs.umich.edu decode_block) = doMemFormat(code, StoreFuncs, 883391Sgblack@eecs.umich.edu AlternateAsiPrivFaultCheck, name, Name, opt_flags) 893272SN/A}}; 903272SN/A 913272SN/Adef format Load(code, *opt_flags) {{ 922526SN/A (header_output, 932526SN/A decoder_output, 942526SN/A exec_output, 952526SN/A decode_block) = doMemFormat(code, 963792Sgblack@eecs.umich.edu LoadFuncs, '', name, Name, opt_flags) 972526SN/A}}; 982526SN/A 993272SN/Adef format Store(code, *opt_flags) {{ 1002526SN/A (header_output, 1012526SN/A decoder_output, 1022526SN/A exec_output, 1032526SN/A decode_block) = doMemFormat(code, 1043792Sgblack@eecs.umich.edu StoreFuncs, '', name, Name, opt_flags) 1052526SN/A}}; 106