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

📄 lenodable.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* -*- tab-width: 4 -*- * * Electric(tm) VLSI Design System * * File: LENodable.java * Written by: Jonathan Gainsley, Sun Microsystems. * * Copyright (c) 2004 Sun Microsystems and Static Free Software * * Electric(tm) is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * Electric(tm) is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Electric(tm); see the file COPYING.  If not, write to * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, Mass 02111-1307, USA. */package com.sun.electric.tool.logicaleffort;import com.sun.electric.database.hierarchy.Nodable;import com.sun.electric.database.network.Network;import com.sun.electric.database.text.TextUtils;import com.sun.electric.database.variable.VarContext;import com.sun.electric.database.variable.Variable;import com.sun.electric.technology.technologies.Schematics;import java.util.ArrayList;import java.util.Iterator;import java.util.List;public class LENodable {    /** Type is a typesafe enum class that describes the type of Instance this is */    protected static class Type {        private final String name;        private Type(String name) { this.name = name; }        public String toString() { return name; }        /** NotSizeable */  protected static final Type STATICGATE = new Type("Static Gate");        /** NotSizeable */  protected static final Type LOAD = new Type("Load");        /** NotSizeable */  protected static final Type WIRE = new Type("Wire");        /** LeGate */       protected static final Type LEGATE = new Type("LE Gate");        /** LeKeeper */     protected static final Type LEKEEPER = new Type("LE Keeper");        /** NotSizeable */  protected static final Type TRANSISTOR = new Type("Transistor");        /** NotSizeable */  protected static final Type CAPACITOR = new Type("Capacitor");        /** Cached cell */  protected static final Type CACHEDCELL = new Type("Cached Cell");        /** Ignore */       protected static final Type IGNORE = new Type("LE Ignore");    }    // --------- Definition fields ----------    /** list of pins */                     private List<LEPin> pins; // do not point to networks    /** nodable */                          private Nodable no;    /** gate type */                        private Type type;    /** output Network */                   private Network outputNet;    /** mfactor variable */                 private Variable mfactorVar;    /** su variable */                      private Variable suVar;    /** parallel group # variable */        private Variable parallelGroupVar;    // --------- instance fields ------------    protected VarContext context;    protected LENetwork outputNetwork;        // global network    private float mfactor = 1f;    protected float su;    protected float leX;    protected int parallelGroup;    /**     * Create a new LEInstance tied to the Nodable.     * If the type represents a singular instance, i.e. whose properties     * do not change based on it's location in the hierarchy, then     * leContext is the singular (one and only) context.     * Otherwise, leContext is merely the first of many possible contexts.     * @param no the Nodable     */    public LENodable(Nodable no, Type type, Variable mfactorVar, Variable suVar, Variable parallelGroupVar) {        this.no = no;        this.type = type;        pins = new ArrayList<LEPin>();        this.outputNet = null;        this.mfactorVar = mfactorVar;        this.suVar = suVar;        this.parallelGroupVar = parallelGroupVar;        this.context = VarContext.globalContext;        this.mfactor = 1f;        this.leX = 0f;    }    protected LENodable copy() {        LENodable copy = new LENodable(no, type, mfactorVar, suVar, parallelGroupVar);        for (LEPin pin : pins) {            copy.addPort(pin.getName(), pin.getDir(), pin.getLE(), pin.getNetwork());        }        return copy;    }    /**     * Add a port to this LEInstance     * @param name the name of the port     * @param dir the direction of the port     * @param le the logical effort of the port     */    protected void addPort(String name, LEPin.Dir dir, float le, Network jnet) {        LEPin pin = new LEPin(name, dir, le, jnet, this);        pins.add(pin);    }    /** Set the output network */    protected void setOutputNet(Network jnet) { outputNet = jnet; }    /** Get the output network */    protected Network getOutputNet() { return outputNet; }    /** Get the nodable */    protected Nodable getNodable() { return no; }    /** Get the type */    protected Type getType() { return type; }    /** Get the pins */    protected List<LEPin> getPins() { return pins; }    float getMfactor() { return mfactor; }    /** Return true if this is a sizeable gate */    protected boolean isLeGate() {        if (type == Type.LEKEEPER || type == Type.LEGATE) return true;        return false;    }    /** True if this is a gate */    protected boolean isGate() {        if (type == Type.LEGATE || type == Type.LEKEEPER || type == Type.STATICGATE)            return true;        return false;    }    /**     * Set the only context of this LENodable. This is used when the nodable is cacheable,     * and remains the same throughout all contexts above the passed context.     * Returns false if provided context is not enough to evaluate all variables properly.     * @param context the context     * @param outputNetwork the global network loading the output     * @param mfactor the parent's mfactor     * @param su the parent's step-up     */    protected boolean setOnlyContext(VarContext context, LENetwork outputNetwork, float mfactor, float su, LENetlister2.NetlisterConstants constants) {        boolean evalOk = instantiate(this, context, outputNetwork, mfactor, su, constants, true);        //print();        return evalOk;    }    /**     * Factory method to create a copy of this Nodable with the context-relevant info     * evaluated.     * @param context the context     * @param outputNetwork the global network loading the output     * @param mfactor the parent's mfactor     * @param su the parent's step-up     */    protected LENodable createUniqueInstance(VarContext context, LENetwork outputNetwork, float mfactor, float su, LENetlister.NetlisterConstants constants) {        LENodable instance = new LENodable(no, type, mfactorVar, suVar, parallelGroupVar);        // copy pins        for (LEPin pin : pins) {            instance.addPort(pin.getName(), pin.getDir(), pin.getLE(), pin.getNetwork());        }        instantiate(instance, context, outputNetwork, mfactor, su, constants, false);        return instance;    }    /**     * Fill-in the given LENodable with evalutated instance-specific info for the given context.     * Returns false if there are variables that cannot be evaluated in the given context     * @param instance the LENodable to fill-in     * @param context the context     * @param outputNetwork the global network loading the output

⌨️ 快捷键说明

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