outputblock.isa revision 7087
14276SN/A// Copyright (c) 2007 The Hewlett-Packard Development Company 24276SN/A// All rights reserved. 34276SN/A// 47087Snate@binkert.org// The license below extends only to copyright in the software and shall 57087Snate@binkert.org// not be construed as granting a license to any other intellectual 67087Snate@binkert.org// property including but not limited to intellectual property relating 77087Snate@binkert.org// to a hardware implementation of the functionality of the software 87087Snate@binkert.org// licensed hereunder. You may use the software subject to the license 97087Snate@binkert.org// terms below provided that you ensure that this notice is replicated 107087Snate@binkert.org// unmodified and in its entirety in all distributions of the software, 117087Snate@binkert.org// modified or unmodified, in source code or in binary form. 124276SN/A// 137087Snate@binkert.org// Redistribution and use in source and binary forms, with or without 147087Snate@binkert.org// modification, are permitted provided that the following conditions are 157087Snate@binkert.org// met: redistributions of source code must retain the above copyright 167087Snate@binkert.org// notice, this list of conditions and the following disclaimer; 177087Snate@binkert.org// redistributions in binary form must reproduce the above copyright 187087Snate@binkert.org// notice, this list of conditions and the following disclaimer in the 197087Snate@binkert.org// documentation and/or other materials provided with the distribution; 207087Snate@binkert.org// neither the name of the copyright holders nor the names of its 214276SN/A// contributors may be used to endorse or promote products derived from 227087Snate@binkert.org// this software without specific prior written permission. 234276SN/A// 244276SN/A// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 254276SN/A// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 264276SN/A// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 274276SN/A// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 284276SN/A// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 294276SN/A// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 304276SN/A// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 314276SN/A// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 324276SN/A// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 334276SN/A// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 344276SN/A// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 354276SN/A// 364276SN/A// Authors: Gabe Black 374276SN/A 384276SN/A//////////////////////////////////////////////////////////////////// 394276SN/A// 404679Sgblack@eecs.umich.edu// Output blocks which group together code generated by the parser. 414276SN/A// 424276SN/A 434366SN/Alet {{ 444366SN/A # This class will help make dealing with output a little less verbose 454366SN/A class OutputBlocks(object): 464366SN/A def __init__(self, header_output="", 474366SN/A decoder_output="", 484366SN/A decode_block="", 494366SN/A exec_output=""): 504366SN/A self.header_output = header_output 514366SN/A self.decoder_output = decoder_output 524366SN/A self.decode_block = decode_block 534366SN/A self.exec_output = exec_output 544366SN/A 554366SN/A def append(self, blocks): 564366SN/A if isinstance(blocks, list) or isinstance(blocks, tuple): 574366SN/A assert(len(blocks) == 4) 584366SN/A self.header_output += blocks[0] 594366SN/A self.decoder_output += blocks[1] 604366SN/A self.decode_block += blocks[2] 614366SN/A self.exec_output += blocks[3] 624366SN/A else: 634366SN/A self.header_output += blocks.header_output 644366SN/A self.decoder_output += blocks.decoder_output 654366SN/A self.decode_block += blocks.decode_block 664366SN/A self.exec_output += blocks.exec_output 674366SN/A 684366SN/A def makeList(self): 694366SN/A return (self.header_output, 704366SN/A self.decoder_output, 714366SN/A self.decode_block, 724366SN/A self.exec_output) 734366SN/A}}; 74