⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 operator.java_in

📁 一种将c高级语言转化给VHDL的编译器
💻 JAVA_IN
字号:
/* * LA-CC 05-135 Trident 0.7.1Copyright NoticeCopyright 2006 (c) the Regents of the University of California.This Software was produced under a U.S. Government contract(W-7405-ENG-36) by Los Alamos National Laboratory, which is operatedby the University of California for the U.S. Department of Energy. TheU.S. Government is licensed to use, reproduce, and distribute thisSoftware. Permission is granted to the public to copy and use thisSoftware without charge, provided that this Notice and any statementof authorship are reproduced on all copies. Neither the Government northe University makes any warranty, express or implied, or assumes anyliability or responsibility for the user of this Software. *//* * * * $Id: Operator.java_in 2576 2006-06-19 22:15:21Z kpeter $ * * THIS FILE IS MACHINE GENERATED * * */package fp.flowgraph;import fp.*;public class Operator {  // data fields   public final char opcode;  private final int _traits;  public final byte format;  // are these final?  private final int _defs;  private final int _uses;     // input classes for operations  // what kind of inputs can we handle.  public static final int ANY = 0;  public static final int INT = 1;  public static final int FP = 2;  // something for scheduling ?  private final int _input_class;  private final int _pipe_stages;  private final float _latency;  private final float _area;    //for pipelining:  private final int _slices;      // traits  static final public int none              = 0x00000000;  static final public int move              = 0x00000001;  static final public int branch            = 0x00000002;  static final public int call              = 0x00000004;  static final public int load              = 0x00000008;  //static final public int aload             = 0x00010008;  //static final public int aloadtest         = 0x00010000;  static final public int store             = 0x00000010;  //static final public int astore            = 0x00010010;  //static final public int astoretest        = 0x00010000;  static final public int compare           = 0x00000020;  static final public int alloc             = 0x00000040;  static final public int ret               = 0x00000080;  static final public int var_uses          = 0x00000100;  static final public int phi               = 0x00000200;  static final public int select            = 0x00000400;  static final public int cast              = 0x00000800;  static final public int conditional       = 0x00001000;  static final public int commutative       = 0x00002000;  static final public int var_defs          = 0x00004000;  static final public int getelementptr     = 0x00008000;  static final public int terminator        = 0x01000000;  static final public int binary_op         = 0x02000000;  static final public int unary_op          = 0x04000000;  static final public int memory            = 0x08000000;  static final public int misc              = 0x10000000;  private Operator(char opcode, byte format, int traits,                    int defs, int uses, 		   int input_class, int pipe_stages,                   float latency, float area) {    this.opcode = opcode;    this.format = format;    _traits = traits;        // def and uses ?    _defs = defs;    _uses = uses;        // scheduling info / operator selection.    _input_class = input_class;    _pipe_stages = pipe_stages;    _latency = latency;    _area = area;    _slices = 0;  }  private Operator(char opcode, byte format, int traits,                    int defs, int uses, 		   int input_class, int pipe_stages,                   float latency, float area, int slices) {    this.opcode = opcode;    this.format = format;    _traits = traits;        // def and uses ?    _defs = defs;    _uses = uses;        // scheduling info / operator selection.    _input_class = input_class;    _pipe_stages = pipe_stages;    _latency = latency;    _area = area;    _slices = slices;  }  private Operator(char opcode, byte format, int traits,                    int defs, int uses) {     this(opcode, format, traits, defs, uses, ANY, 0, (float)0.0, (float)-1.0);  }      // not public due to variable uses and/or defs  final int getNumberOfDefs() { return _defs; }  final int getNumberOfUses() { return _uses; }  public final boolean isMove() {     return (_traits & move) != 0;   }  public final boolean isBranch() {     return (_traits & branch) != 0;   }  public final boolean isConditionalBranch() {    return (_traits & (branch|conditional)) == (branch|conditional);  }  public final boolean isUnconditionalBranch() {    return (_traits & (branch|conditional)) == branch;  }  public final boolean isCall() {    return (_traits & call) != 0;   }    public final boolean isLoad() {    return (_traits & load) != 0;  }  public final boolean isALoad() {    //see AStore comments below    return ((_traits & load) != 0);    //return (((_traits & load) != 0)&&    //	   ((_traits & aloadtest) != 0));  }  public final boolean isStore() {    return (_traits & store) != 0;  }  public final boolean isAStore() {    //maybe this is not the best way to do this    //but this way, astore instructions    //will return true for both isStore and    //isAStore    //System.out.println("traits " + _traits + " store " + store + " astoretest " + astoretest);    //System.out.println("(_traits & store) != 0) " + ((_traits & store) != 0) + " (_traits & astoretest) != 0) " + ((_traits & astoretest) != 0));    return ((_traits & store) != 0);   // return (((_traits & store) != 0)&&   //         ((_traits & astoretest) != 0));  }  public final boolean isCompare() {    return (_traits & compare) != 0;  }  public final boolean isAlloc() {    return (_traits & alloc) != 0;  }  public final boolean isReturn() {     return (_traits & ret) != 0;  }  public final boolean isVariableUses() {    return (_traits & var_uses) != 0;  }  public final boolean isVariableDefs() {    return (_traits & var_defs) != 0;  }  public final boolean isPhi() {    return (_traits & phi) != 0;  }  public final boolean isGetelementptr() {    return (_traits & getelementptr) != 0;  }  public final boolean isSelect() {    return (_traits & phi) != 0;  }  public final boolean isCast() {     return (_traits & phi) != 0;  }  public final boolean isCommutative() {    return (_traits & commutative) != 0;  }  public final boolean isTerminator() {    return (_traits & terminator) != 0;  }  public final boolean isBinary() {    return (_traits & binary_op) != 0;  }  public final boolean isUnary() {    return (_traits & unary_op) != 0;  }  public final boolean isMemory() {    return (_traits & memory) != 0;  }  public final boolean isMisc() {    return (_traits & misc) != 0;  }  public final boolean isPipelined() { return _pipe_stages > 0;}  //public final float getRunLength() { return (float)(_pipe_stages * 1.0) + _latency; }                                                              //instead of changing the size of 							      //pipe stages, I am scaling the 							      //latencies to the new size of the							      //cycles.  This allows me to still							      //deal with integer times.  At the 							      //however, the latencies would 							      //have to be multiplied by the 							      //cycle length again.  public final float getRunLength() {       //System.out.println("this " + this);     // System.out.println("_pipe_stages " + _pipe_stages);      //System.out.println("((float)_pipe_stages) " + ((float)_pipe_stages));      //System.out.println("_latency " + _latency);      //System.out.println("GlobalOptions.cycleLength " + GlobalOptions.cycleLength);      //System.out.println("(_latency / GlobalOptions.cycleLength) " + (_latency / GlobalOptions.cycleLength));      //System.out.println("((float)((float)_pipe_stages) + (_latency / GlobalOptions.cycleLength)) " + ((float)((float)_pipe_stages) + (_latency / GlobalOptions.cycleLength)));    return ((float)((float)_pipe_stages) + (_latency / GlobalOptions.cycleLength)); }  public final int getPipeStages() { return _pipe_stages; }  public final float getArea() { return _area; }  public final int getInputClass() { return _input_class; }   public final float getSlices() { return _slices; }  public String toString() {    return OperatorNames.toString(this);  }    public static Operator addALoad(int latency, float area, int sliceCnt) {    int opCode = OperatorArray.length;    Operator newALoad = new Operator((char)opCode,    				     InstructionFormat.ALoad_format,    				     load | InstructionFormat.ALoad_traits,    				     1, 2,    				     ANY, latency, (float)0.0, area, sliceCnt);    Operator[] newOperatorArray = new Operator[OperatorArray.length+1];    System.arraycopy(OperatorArray, 0, newOperatorArray, 0,                      OperatorArray.length);    newOperatorArray[opCode] = newALoad;    OperatorArray = newOperatorArray;    return newALoad;  }    public static Operator addAStore(int latency, float area, int sliceCnt) {    int opCode = OperatorArray.length;    Operator newAStore = new Operator((char)opCode,                		     InstructionFormat.AStore_format,                		     store | InstructionFormat.AStore_traits,                		     0, 3,    				     ANY, latency, (float)0.0, area, sliceCnt);    Operator[] newOperatorArray = new Operator[OperatorArray.length+1];    System.arraycopy(OperatorArray, 0, newOperatorArray, 0,                      OperatorArray.length);    newOperatorArray[opCode] = newAStore;    OperatorArray = newOperatorArray;    return newAStore;  }  public static Operator[] OperatorArray = {<?pythonoper = Operators('OperatorList.dat')for operator in oper.getList():   if operator.lib_name is "NONE":   	print "// %s" % operator.symbol	print "     new Operator((char)%s," % operator.index    	print "                  InstructionFormat.%s_format," % operator.format   	print "                  %(b)s | InstructionFormat.%(a)s_traits," % \        	                                       {'a': operator.format, \                	                                'b': operator.traits }	print "                  %s, %s)," % (operator.defs, operator.uses)   else:	print "// Library %s %s" % (operator.lib_name, operator.symbol)	print "     new Operator((char)%s," % operator.index    	print "                  InstructionFormat.%s_format," % operator.format   	print "                  %s | InstructionFormat.%s_traits," % \        	                                        (operator.traits, operator.format)	print "                  %s, %s," % (operator.defs, operator.uses)        print "                  %s, %s, (float)%s, (float)%s, (int)%s)," % (operator.input_class, \                                                      operator.pipe_stages, \                                                      operator.latency, \                                                      operator.area, operator.slices)?>  };}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -