string.isa revision 7626
12221SN/A// -*- mode:c++ -*- 22221SN/A 32221SN/A// Copyright (c) 2007 The Hewlett-Packard Development Company 42221SN/A// All rights reserved. 52221SN/A// 62221SN/A// The license below extends only to copyright in the software and shall 72221SN/A// not be construed as granting a license to any other intellectual 82221SN/A// property including but not limited to intellectual property relating 92221SN/A// to a hardware implementation of the functionality of the software 102221SN/A// licensed hereunder. You may use the software subject to the license 112221SN/A// terms below provided that you ensure that this notice is replicated 122221SN/A// unmodified and in its entirety in all distributions of the software, 132221SN/A// modified or unmodified, in source code or in binary form. 142221SN/A// 152221SN/A// Redistribution and use in source and binary forms, with or without 162221SN/A// modification, are permitted provided that the following conditions are 172221SN/A// met: redistributions of source code must retain the above copyright 182221SN/A// notice, this list of conditions and the following disclaimer; 192221SN/A// redistributions in binary form must reproduce the above copyright 202221SN/A// notice, this list of conditions and the following disclaimer in the 212221SN/A// documentation and/or other materials provided with the distribution; 222221SN/A// neither the name of the copyright holders nor the names of its 232221SN/A// contributors may be used to endorse or promote products derived from 242221SN/A// this software without specific prior written permission. 252221SN/A// 262221SN/A// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 272665Ssaidi@eecs.umich.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 282665Ssaidi@eecs.umich.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 292665Ssaidi@eecs.umich.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 302221SN/A// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 312221SN/A// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 323890Ssaidi@eecs.umich.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 333890Ssaidi@eecs.umich.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 342221SN/A// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 352221SN/A// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 362221SN/A// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 372221SN/A// 382221SN/A// Authors: Gabe Black 392223SN/A 402221SN/A////////////////////////////////////////////////////////////////////////// 412221SN/A// 423415Sgblack@eecs.umich.edu// String Instructions 433415Sgblack@eecs.umich.edu// 442221SN/A////////////////////////////////////////////////////////////////////////// 453573Sgblack@eecs.umich.edu 462221SN/Adef format StringTestInst(*opTypeSet) {{ 472221SN/A allBlocks = OutputBlocks() 483576Sgblack@eecs.umich.edu 493576Sgblack@eecs.umich.edu regBlocks = specializeInst(Name, list(opTypeSet), EmulEnv()) 503576Sgblack@eecs.umich.edu eBlocks = specializeInst(Name + "_E", list(opTypeSet), EmulEnv()) 513576Sgblack@eecs.umich.edu nBlocks = specializeInst(Name + "_N", list(opTypeSet), EmulEnv()) 523576Sgblack@eecs.umich.edu 533576Sgblack@eecs.umich.edu for blocks in (regBlocks, eBlocks, nBlocks): 543576Sgblack@eecs.umich.edu allBlocks.header_output += blocks.header_output 553576Sgblack@eecs.umich.edu allBlocks.decoder_output += blocks.decoder_output 563576Sgblack@eecs.umich.edu allBlocks.exec_output += blocks.exec_output 573573Sgblack@eecs.umich.edu 583573Sgblack@eecs.umich.edu allBlocks.decode_block = ''' 593573Sgblack@eecs.umich.edu if (LEGACY_REP) { 603573Sgblack@eecs.umich.edu %s 613573Sgblack@eecs.umich.edu } else if (LEGACY_REPNE) { 623576Sgblack@eecs.umich.edu %s 633573Sgblack@eecs.umich.edu } else { 643573Sgblack@eecs.umich.edu %s 652221SN/A } 662680Sktlim@umich.edu ''' % (eBlocks.decode_block, nBlocks.decode_block, regBlocks.decode_block) 672221SN/A 683573Sgblack@eecs.umich.edu (header_output, decoder_output, 692223SN/A decode_block, exec_output) = allBlocks.makeList() 702223SN/A}}; 712223SN/A 723576Sgblack@eecs.umich.edudef format StringInst(*opTypeSet) {{ 732221SN/A allBlocks = OutputBlocks() 742221SN/A 753573Sgblack@eecs.umich.edu regBlocks = specializeInst(Name, list(opTypeSet), EmulEnv()) 763573Sgblack@eecs.umich.edu eBlocks = specializeInst(Name + "_E", list(opTypeSet), EmulEnv()) 772221SN/A 783573Sgblack@eecs.umich.edu for blocks in (regBlocks, eBlocks): 793573Sgblack@eecs.umich.edu allBlocks.header_output += blocks.header_output 802221SN/A allBlocks.decoder_output += blocks.decoder_output 813573Sgblack@eecs.umich.edu allBlocks.exec_output += blocks.exec_output 823573Sgblack@eecs.umich.edu 833573Sgblack@eecs.umich.edu allBlocks.decode_block = ''' 843573Sgblack@eecs.umich.edu if (LEGACY_REP) { 853576Sgblack@eecs.umich.edu %s 863576Sgblack@eecs.umich.edu } else if (LEGACY_REPNE) { 873576Sgblack@eecs.umich.edu // The repne prefix is illegal 883576Sgblack@eecs.umich.edu return new MicroFault(machInst, "illprefix", 0, 893573Sgblack@eecs.umich.edu new InvalidOpcode, 0); 903573Sgblack@eecs.umich.edu } else { 913576Sgblack@eecs.umich.edu %s 923576Sgblack@eecs.umich.edu } 933576Sgblack@eecs.umich.edu ''' % (eBlocks.decode_block, regBlocks.decode_block) 943576Sgblack@eecs.umich.edu 953576Sgblack@eecs.umich.edu (header_output, decoder_output, 963576Sgblack@eecs.umich.edu decode_block, exec_output) = allBlocks.makeList() 973576Sgblack@eecs.umich.edu}}; 983576Sgblack@eecs.umich.edu