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

📄 flagannotations.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
字号:
package com.sun.electric.tool.generator.flag;

import java.util.ArrayList;
import java.util.List;

import com.sun.electric.database.hierarchy.Cell;
import com.sun.electric.database.variable.Variable;

public class FlagAnnotations {
	/** key of Variable holding FLAG Cell annotations. */	
	public static final Variable.Key FLAG_ANNOTATION_KEY = Variable.newKey("ATTR_FLAG");
	public static final String ATOMIC = "atomic";
	public static final String AUTO_GEN = "autoGen";
	
	private String cellThatOwnsMe;
	private List<String> annotText = new ArrayList<String>();
	private boolean cellHasAnnotations;
	private boolean atomic;
	private String autoGenClassName;
	
	private void prErr(String s) {
		String currAnnot = annotText.get(annotText.size()-1);
		System.out.println("  "+s+"  cell= "+cellThatOwnsMe+" annotation= "+currAnnot);
	}
	private void doAnnotation(String note) {
		annotText.add(note); // for prErr()
		String[] toks = note.split("\\s+");
		String ann = toks[0];
		if (ann.equals(ATOMIC)) {
			atomic = true;
		} else if (ann.equals(AUTO_GEN)) {
			if (toks.length!=2) {
				prErr("Wrong number of arguments to FLAG "+AUTO_GEN+" annotation.");
				return;
			}
			autoGenClassName = toks[1];
		} else {
			prErr("Unrecognized FLAG annotation");
		}
	}
    
    
    // -------------------------- public methods ------------------------------
    
	/** Method to get the FLAG annotations on a Cell. */
	public FlagAnnotations(Cell cell) {
		Variable flagVar = cell.getVar(FLAG_ANNOTATION_KEY);
		if (flagVar==null) return;
		Object annotation = flagVar.getObject();
		
    	cellThatOwnsMe = cell.libDescribe();
		if (annotation instanceof String) {
			doAnnotation((String) annotation);
		} else if (annotation instanceof String[]) {
			String[] ss = (String[]) annotation;
			for (int i=0; i<ss.length; i++)  doAnnotation(ss[i]);
		} else {
			prErr(" ignoring bad Flag annotation: ");
		}
    }
	public boolean isAtomic() {return atomic;}
	public boolean isAutoGen() {return autoGenClassName!=null;}
	public String getAutoGenClassName() {return autoGenClassName;}
	public boolean cellHasAnnotations() {return cellHasAnnotations;}
}

⌨️ 快捷键说明

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