microasm.isa revision 4519:f8da6b45573f
12568SN/A// -*- mode:c++ -*- 211600Sandreas.hansson@arm.com 38668Sgeoffrey.blake@arm.com// Copyright (c) 2007 The Hewlett-Packard Development Company 48668Sgeoffrey.blake@arm.com// All rights reserved. 58668Sgeoffrey.blake@arm.com// 68668Sgeoffrey.blake@arm.com// Redistribution and use of this software in source and binary forms, 78668Sgeoffrey.blake@arm.com// with or without modification, are permitted provided that the 88668Sgeoffrey.blake@arm.com// following conditions are met: 98668Sgeoffrey.blake@arm.com// 108668Sgeoffrey.blake@arm.com// The software must be used only for Non-Commercial Use which means any 118668Sgeoffrey.blake@arm.com// use which is NOT directed to receiving any direct monetary 128668Sgeoffrey.blake@arm.com// compensation for, or commercial advantage from such use. Illustrative 138668Sgeoffrey.blake@arm.com// examples of non-commercial use are academic research, personal study, 142568SN/A// teaching, education and corporate research & development. 1510975Sdavid.hashe@amd.com// Illustrative examples of commercial use are distributing products for 162568SN/A// commercial advantage and providing services using the software for 172568SN/A// commercial advantage. 182568SN/A// 192568SN/A// If you wish to use this software or functionality therein that may be 202568SN/A// covered by patents for commercial use, please contact: 212568SN/A// Director of Intellectual Property Licensing 222568SN/A// Office of Strategy and Technology 232568SN/A// Hewlett-Packard Company 242568SN/A// 1501 Page Mill Road 252568SN/A// Palo Alto, California 94304 262568SN/A// 272568SN/A// Redistributions of source code must retain the above copyright notice, 282568SN/A// this list of conditions and the following disclaimer. Redistributions 292568SN/A// in binary form must reproduce the above copyright notice, this list of 302568SN/A// conditions and the following disclaimer in the documentation and/or 312568SN/A// other materials provided with the distribution. Neither the name of 322568SN/A// the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its 332568SN/A// contributors may be used to endorse or promote products derived from 342568SN/A// this software without specific prior written permission. No right of 352568SN/A// sublicense is granted herewith. Derivatives of the software and 362568SN/A// output created using the software may be prepared, but only for 372568SN/A// Non-Commercial Uses. Derivatives of the software may be shared with 382568SN/A// others provided: (i) the others agree to abide by the list of 392568SN/A// conditions herein which includes the Non-Commercial Use restrictions; 402665Ssaidi@eecs.umich.edu// and (ii) such Derivatives of the software include the above copyright 412665Ssaidi@eecs.umich.edu// notice to acknowledge the contribution from this software where 422665Ssaidi@eecs.umich.edu// applicable, this list of conditions and the disclaimer below. 432568SN/A// 442568SN/A// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 452568SN/A// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 462568SN/A// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 472568SN/A// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 482568SN/A// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 492568SN/A// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 503260Ssaidi@eecs.umich.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 5111793Sbrandon.potter@amd.com// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 5211793Sbrandon.potter@amd.com// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 538229Snate@binkert.org// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 543260Ssaidi@eecs.umich.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 558229Snate@binkert.org// 565314Sstever@gmail.com// Authors: Gabe Black 572590SN/A 583348Sbinkertn@umich.edu//////////////////////////////////////////////////////////////////// 592568SN/A// 605735Snate@binkert.org// Microcode assembler specialization for x86 615735Snate@binkert.org// 624022Sstever@eecs.umich.edu 634022Sstever@eecs.umich.edulet {{ 644022Sstever@eecs.umich.edu from micro_asm import MicroAssembler, Combinational_Macroop, Rom_Macroop, Rom 654022Sstever@eecs.umich.edu class X86Macroop(Combinational_Macroop): 664022Sstever@eecs.umich.edu def __init__(self, name): 674022Sstever@eecs.umich.edu super(X86Macroop, self).__init__(name) 684022Sstever@eecs.umich.edu self.directives = { 6911600Sandreas.hansson@arm.com } 7011600Sandreas.hansson@arm.com 712641Sstever@eecs.umich.edu mainRom = Rom('main ROM') 724022Sstever@eecs.umich.edu}}; 734022Sstever@eecs.umich.edu 742641Sstever@eecs.umich.edulet {{ 754022Sstever@eecs.umich.edu class X86Microop(object): 764022Sstever@eecs.umich.edu def __init__(self, name): 7710885Sandreas.hansson@arm.com self.name = name 7810885Sandreas.hansson@arm.com 794022Sstever@eecs.umich.edu # This converts a list of python bools into 804473Sstever@eecs.umich.edu # a comma seperated list of C++ bools. 814473Sstever@eecs.umich.edu def microFlagsText(self, vals): 825319Sstever@gmail.com text = "" 835319Sstever@gmail.com for val in vals: 845319Sstever@gmail.com if val: 854022Sstever@eecs.umich.edu text += ", true" 8611284Sandreas.hansson@arm.com else: 874022Sstever@eecs.umich.edu text += ", false" 884022Sstever@eecs.umich.edu return text 8911287Sandreas.hansson@arm.com 9011199Sandreas.hansson@arm.com def getAllocator(self, mnemonic, *microFlags): 9111600Sandreas.hansson@arm.com args = '' 9211199Sandreas.hansson@arm.com return 'new %s(machInst, %s%s%s)' % (self.className, mnemonic, self.microFlagsText(microFlags), args) 9311199Sandreas.hansson@arm.com}}; 9411199Sandreas.hansson@arm.com