📄 faultyfeedforwardoptimizedmapping.java~
字号:
/* * OptimizedMapping.java * * Created on 25 November 2003, 15:39 */package jaga.pj.circuits.fpgaft;import jaga.BitSet;import jaga.pj.circuits.*;import java.util.Vector;import java.awt.Point;/** This will remove elements from the element array that aren't connected to the outputs * in order to optimize the circuit simulation by avoiding refreshing unused gates. This will * obviously skew the position of these elements in the array making the getElementFromAddress * method useless. * * @author mmg20 */public class FaultyFeedForwardOptimizedMapping implements CircuitMapping { // Config protected CircuitMapping inMap; protected Point[] persistentFaults; public FaultyFeedForwardOptimizedMapping(CircuitMapping inMap) { this( inMap, null ); } /** Creates a new instance of OptimizedMapping */ public FaultyFeedForwardOptimizedMapping(CircuitMapping inMap, Point[] persistentFaults) { this.inMap = inMap; this.persistentFaults = persistentFaults; } public SimulatorLogicElement getElementFromAddress(SimulatorLogicElement[][] inoutels, int address) { return inMap.getElementFromAddress( inoutels, address ); } /** Takes and individual and an array of arrays of logic elements where this * individual must be instantiated. * @param individual The individual to be mapped into a circuit. * @return Array consisting of three subarrays: The first will represent * the inputs to the circuit and is where the inputs will be fed in. The second * represents the elements that are the outputs of the circuit and is where they * will be read out from. The last is an array with all the elements of the * circuit. */ public SimulatorLogicElement[][] map(BitSet individual) { SimulatorLogicElement[][] rv = inMap.map( individual ); SimulatorFaultyDelayLE[] elements = ( SimulatorFaultyDelayLE[] )rv[ ELEMENTS ]; for( int ql = 0; ql < rv[ 1 ].length; ql ++ ) { System.out.println("" + rv[ 1 ][ ql ] ); } // Set faults if have any if( persistentFaults != null ) { for( int flp = 0; flp < persistentFaults.length; flp++ ) { elements[ persistentFaults[ flp ].x ].setFault( persistentFaults[ flp ].y ); } } rv[ ELEMENTS ] = trim( rv ); return rv; } protected SimulatorFaultyDelayLE[] trim( SimulatorLogicElement[][] inoutels ) { return FTLib.getConnectedGatesInFeedForwardOrder( inoutels ); } public void resetDelays(Object delayDef) { inMap.resetDelays( delayDef ); } public void setPersistentFaults( Point[] persistentFaults ) { this.persistentFaults = persistentFaults; } public String toString() { String rv = ""; rv = "Fauly Optimized Mapping with internal mapping: " + inMap; return rv; } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -