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

📄 stimuli.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: Stimuli.java * * 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.simulation;import com.sun.electric.database.hierarchy.Cell;import com.sun.electric.tool.io.FileType;import com.sun.electric.tool.user.waveform.WaveformWindow;import java.awt.geom.Rectangle2D;import java.net.URL;import java.util.ArrayList;import java.util.HashMap;import java.util.Iterator;import java.util.List;/** * Class to define a set of simulation data. * This class encapsulates all of the simulation data that is displayed in a waveform window. * It includes the labels and values. * It can handle digital, analog, and many variations (intervals, sweeps). */public class Stimuli{	// logic levels and signal strengths for digital signals	public static final int LOGIC         =  03;	public static final int LOGIC_LOW     =   0;	public static final int LOGIC_X       =   1;	public static final int LOGIC_HIGH    =   2;	public static final int LOGIC_Z       =   3;	public static final int STRENGTH      = 014;	public static final int OFF_STRENGTH  =   0;	public static final int NODE_STRENGTH =  04;	public static final int GATE_STRENGTH = 010;	public static final int VDD_STRENGTH  = 014;	/** the WaveformWindow associated with this Stimuli */		private WaveformWindow ww;	/** the simulation engine associated with this Stimuli */	private Engine engine;	/** the cell attached to this Stimuli information */		private Cell cell;	/** the type of data in this Stimuli */						private FileType type;	/** the disk file associated with this Stimuli */			private URL fileURL;	/** the separator character that breaks names */			private char separatorChar;	/** the analyses in this Stimuli */							private HashMap<Analysis.AnalysisType,Analysis> analyses;	/** the list of analyses in this Stimuli */					private List<Analysis> analysisList;	/** control points when signals are selected */				private HashMap<Signal,Double[]> controlPointMap;	/**	 * Constructor to build a new Simulation Data object.	 */	public Stimuli()	{		separatorChar = '.';		analyses = new HashMap<Analysis.AnalysisType,Analysis>();		analysisList = new ArrayList<Analysis>();		controlPointMap = new HashMap<Signal,Double[]>();	}	/**	 * Free allocated resources before closing.	 */	public void finished()	{		for (Analysis an: analysisList)			an.finished();		controlPointMap.clear();		for (Analysis an: analyses.values())			an.finished();		analyses.clear();	}	public void addAnalysis(Analysis an)	{		analyses.put(an.getAnalysisType(), an);		analysisList.add(an);	}	/**	 * Method to find an Analysis of a given type.	 * @param type the stimulus type being queried.	 * @return the Analysis of that type (null if not found).	 */	public Analysis findAnalysis(Analysis.AnalysisType type)	{		Analysis an = analyses.get(type);		return an;	}	public int getNumAnalyses() { return analysisList.size(); }	public Iterator<Analysis> getAnalyses() { return analysisList.iterator(); }	/**	 * Method to set the Cell associated with this simulation data.	 * The associated Cell is the top-level cell in the hierarchy,	 * and is usually the Cell that was used to generate the simulation input deck.	 * @param cell the Cell associated with this simulation data.	 */	public void setCell(Cell cell) { this.cell = cell; }	/**	 * Method to return the Cell associated with this simulation data.	 * The associated Cell is the top-level cell in the hierarchy,	 * and is usually the Cell that was used to generate the simulation input deck.	 * @return the Cell associated with this simulation data.	 */	public Cell getCell() { return cell; }	/**	 * Method to set the simulation Engine associated with this simulation data.	 * This is only for data associated with built-in simulators (ALS and IRSIM).	 * @param engine the simulation Engine associated with this simulation data.	 */	public void setEngine(Engine engine) { this.engine = engine; }	/**	 * Method to return the simulation Engine associated with this simulation data.	 * This is only for data associated with built-in simulators (ALS and IRSIM).	 * @return the simulation Engine associated with this simulation data.	 */	public Engine getEngine() { return engine; }	public void setWaveformWindow(WaveformWindow ww) { this.ww = ww; }	/**	 * Method to return the separator character for names in this simulation.	 * The separator character separates levels of hierarchy.  It is usually a "."	 * @return the separator character for names in this simulation.	 */	public char getSeparatorChar() { return separatorChar; }	/**	 * Method to set the separator character for names in this simulation.	 * The separator character separates levels of hierarchy.  It is usually a "."	 * @param sep the separator character for names in this simulation.	 */	public void setSeparatorChar(char sep) { separatorChar = sep; }	/**	 * Method to set the type of this simulation data.	 * Data types are file types, which are unique among the different simulation output formats.	 * For example, OpenFile.Type.HSPICEOUT is the output of HSpice, whereas	 * OpenFile.Type.SPICEOUT is the output of Spice3/GNUCap.	 * @param type the type of this simulation data.	 */	public void setDataType(FileType type) { this.type = type; }	/**	 * Method to return the type of this simulation data.	 * Data types are file types, which are unique among the different simulation output formats.	 * For example, OpenFile.Type.HSPICEOUT is the output of HSpice, whereas	 * OpenFile.Type.SPICEOUT is the output of Spice3/GNUCap.	 * @return the type of this simulation data.	 */	public FileType getDataType() { return type; }	/**	 * Method to set a URL to the file containing this simulation data.	 * @param fileURL a URL to the file containing this simulation data.	 */	public void setFileURL(URL fileURL) { this.fileURL = fileURL; }	/**	 * Method to return a URL to the file containing this simulation data.	 * @return a URL to the file containing this simulation data.	 */	public URL getFileURL() { return fileURL; }	/**	 * Method to return the WaveformWindow that displays this simulation data.	 * @return the WaveformWindow that displays this simulation data.	 */	public WaveformWindow getWaveformWindow() { return ww; }	/**	 * Method to return an array of control points associated with a signal.	 * Control points are places where the user has added stimuli to the signal (set a level or strength).	 * These points can be selected for change of the stimuli.	 * @param sig the signal in question.	 * @return an array of times where there are control points.	 * Null if no control points are defined.	 */	public Double [] getControlPoints(Signal sig) { return controlPointMap.get(sig); }	/**	 * Method to clear the list of control points associated with a signal.	 * Control points are places where the user has added stimuli to the signal (set a level or strength).	 * These points can be selected for change of the stimuli.	 * @param sig the signal to clear.	 */	public void clearControlPoints(Signal sig) { controlPointMap.remove(sig); }	/**	 * Method to add a new control point to the list on a signal.	 * Control points are places where the user has added stimuli to the signal (set a level or strength).	 * These points can be selected for change of the stimuli.	 * @param sig the signal in question.	 * @param time the time of the new control point.	 */	public void addControlPoint(Signal sig, double time)	{		Double [] controlPoints = controlPointMap.get(sig);		if (controlPoints == null)		{			controlPoints = new Double[1];			controlPoints[0] = new Double(time);			controlPointMap.put(sig, controlPoints);		} else		{			// see if it is in the list already			for(int i=0; i<controlPoints.length; i++)				if (controlPoints[i].doubleValue() == time) return;			// extend the list

⌨️ 快捷键说明

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