string.isa revision 7087
14952Sgblack@eecs.umich.edu// -*- mode:c++ -*- 24952Sgblack@eecs.umich.edu 34952Sgblack@eecs.umich.edu// Copyright (c) 2007 The Hewlett-Packard Development Company 44952Sgblack@eecs.umich.edu// All rights reserved. 54952Sgblack@eecs.umich.edu// 67087Snate@binkert.org// The license below extends only to copyright in the software and shall 77087Snate@binkert.org// not be construed as granting a license to any other intellectual 87087Snate@binkert.org// property including but not limited to intellectual property relating 97087Snate@binkert.org// to a hardware implementation of the functionality of the software 107087Snate@binkert.org// licensed hereunder. You may use the software subject to the license 117087Snate@binkert.org// terms below provided that you ensure that this notice is replicated 127087Snate@binkert.org// unmodified and in its entirety in all distributions of the software, 137087Snate@binkert.org// modified or unmodified, in source code or in binary form. 144952Sgblack@eecs.umich.edu// 157087Snate@binkert.org// Redistribution and use in source and binary forms, with or without 167087Snate@binkert.org// modification, are permitted provided that the following conditions are 177087Snate@binkert.org// met: redistributions of source code must retain the above copyright 187087Snate@binkert.org// notice, this list of conditions and the following disclaimer; 197087Snate@binkert.org// redistributions in binary form must reproduce the above copyright 207087Snate@binkert.org// notice, this list of conditions and the following disclaimer in the 217087Snate@binkert.org// documentation and/or other materials provided with the distribution; 227087Snate@binkert.org// neither the name of the copyright holders nor the names of its 234952Sgblack@eecs.umich.edu// contributors may be used to endorse or promote products derived from 247087Snate@binkert.org// this software without specific prior written permission. 254952Sgblack@eecs.umich.edu// 264952Sgblack@eecs.umich.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 274952Sgblack@eecs.umich.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 284952Sgblack@eecs.umich.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 294952Sgblack@eecs.umich.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 304952Sgblack@eecs.umich.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 314952Sgblack@eecs.umich.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 324952Sgblack@eecs.umich.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 334952Sgblack@eecs.umich.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 344952Sgblack@eecs.umich.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 354952Sgblack@eecs.umich.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 364952Sgblack@eecs.umich.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 374952Sgblack@eecs.umich.edu// 384952Sgblack@eecs.umich.edu// Authors: Gabe Black 394952Sgblack@eecs.umich.edu 404952Sgblack@eecs.umich.edu////////////////////////////////////////////////////////////////////////// 414952Sgblack@eecs.umich.edu// 424952Sgblack@eecs.umich.edu// String Instructions 434952Sgblack@eecs.umich.edu// 444952Sgblack@eecs.umich.edu////////////////////////////////////////////////////////////////////////// 454952Sgblack@eecs.umich.edu 465125Sgblack@eecs.umich.edudef format StringTestInst(*opTypeSet) {{ 474952Sgblack@eecs.umich.edu allBlocks = OutputBlocks() 484952Sgblack@eecs.umich.edu 494952Sgblack@eecs.umich.edu regBlocks = specializeInst(Name, list(opTypeSet), EmulEnv()) 504952Sgblack@eecs.umich.edu eBlocks = specializeInst(Name + "_E", list(opTypeSet), EmulEnv()) 514952Sgblack@eecs.umich.edu nBlocks = specializeInst(Name + "_N", list(opTypeSet), EmulEnv()) 524952Sgblack@eecs.umich.edu 534952Sgblack@eecs.umich.edu for blocks in (regBlocks, eBlocks, nBlocks): 544952Sgblack@eecs.umich.edu allBlocks.header_output += blocks.header_output 554952Sgblack@eecs.umich.edu allBlocks.decoder_output += blocks.decoder_output 564952Sgblack@eecs.umich.edu allBlocks.exec_output += blocks.exec_output 574952Sgblack@eecs.umich.edu 584952Sgblack@eecs.umich.edu allBlocks.decode_block = ''' 594952Sgblack@eecs.umich.edu if (LEGACY_REP) { 604952Sgblack@eecs.umich.edu %s 614952Sgblack@eecs.umich.edu } else if (LEGACY_REPNE) { 624952Sgblack@eecs.umich.edu %s 634952Sgblack@eecs.umich.edu } else { 644952Sgblack@eecs.umich.edu %s 654952Sgblack@eecs.umich.edu } 664952Sgblack@eecs.umich.edu ''' % (eBlocks.decode_block, nBlocks.decode_block, regBlocks.decode_block) 674952Sgblack@eecs.umich.edu 684952Sgblack@eecs.umich.edu (header_output, decoder_output, 694952Sgblack@eecs.umich.edu decode_block, exec_output) = allBlocks.makeList() 704952Sgblack@eecs.umich.edu}}; 715125Sgblack@eecs.umich.edu 725125Sgblack@eecs.umich.edudef format StringInst(*opTypeSet) {{ 735125Sgblack@eecs.umich.edu allBlocks = OutputBlocks() 745125Sgblack@eecs.umich.edu 755125Sgblack@eecs.umich.edu regBlocks = specializeInst(Name, list(opTypeSet), EmulEnv()) 765125Sgblack@eecs.umich.edu eBlocks = specializeInst(Name + "_E", list(opTypeSet), EmulEnv()) 775125Sgblack@eecs.umich.edu 785125Sgblack@eecs.umich.edu for blocks in (regBlocks, eBlocks): 795125Sgblack@eecs.umich.edu allBlocks.header_output += blocks.header_output 805125Sgblack@eecs.umich.edu allBlocks.decoder_output += blocks.decoder_output 815125Sgblack@eecs.umich.edu allBlocks.exec_output += blocks.exec_output 825125Sgblack@eecs.umich.edu 835125Sgblack@eecs.umich.edu allBlocks.decode_block = ''' 845125Sgblack@eecs.umich.edu if (LEGACY_REP) { 855125Sgblack@eecs.umich.edu %s 865125Sgblack@eecs.umich.edu } else if (LEGACY_REPNE) { 875125Sgblack@eecs.umich.edu // The repne prefix is illegal 885163Sgblack@eecs.umich.edu return new MicroFault(machInst, "illprefix", new InvalidOpcode, 0); 895125Sgblack@eecs.umich.edu } else { 905125Sgblack@eecs.umich.edu %s 915125Sgblack@eecs.umich.edu } 925125Sgblack@eecs.umich.edu ''' % (eBlocks.decode_block, regBlocks.decode_block) 935125Sgblack@eecs.umich.edu 945125Sgblack@eecs.umich.edu (header_output, decoder_output, 955125Sgblack@eecs.umich.edu decode_block, exec_output) = allBlocks.makeList() 965125Sgblack@eecs.umich.edu}}; 97