edu.byu.ece.edif.jedif
Class JEdifClockDomain

java.lang.Object
  extended by edu.byu.ece.edif.jedif.EDIFMain
      extended by edu.byu.ece.edif.jedif.JEdifClockDomain

public class JEdifClockDomain
extends EDIFMain


Field Summary
protected  java.util.Map<EdifNet,java.util.Set<EdifCellInstance>> _clkToECIMap
          A map whose keys are EdifNets that have been classified as clocks.
protected  java.util.Map<EdifNet,java.util.Set<EdifNet>> _clkToNetMap
          A map whose keys are EdifNets that have been classified as clocks.
protected static EdifCellInstanceGraph _ecic
          A graph structure used for efficiently traversing the EDIF design.
protected  java.util.Set<EdifCellInstance> _noClockECIs
          A set of EdifCellInstances that do not fall into any of the classified domains.
protected  java.util.Set<EdifNet> _noClockNets
          A set of EdifNets that do not fall into any of the classified domains.
private static java.util.Set<java.lang.String> _resetPortNames
           
protected static EdifEnvironment _top
          An EdifEnvironment used to store the environment of the flattened design.
protected static java.lang.String ALL
           
protected static java.lang.String BAR
           
protected static java.lang.String RAM_PREFIX
           
 
Fields inherited from class edu.byu.ece.edif.jedif.EDIFMain
COPYRIGHT_STRING, DEFAULT_AUTHOR_STRING, EXECUTABLE_NAME, newLine, TOOL_SUMMARY_STRING, VERSION_DATE, VERSION_STRING
 
Constructor Summary
JEdifClockDomain(EdifEnvironment e)
           
 
Method Summary
protected  void analyzeSCCs(SCCDepthFirstSearch scc, java.io.PrintStream out)
          Output summary of SCC to a printstream
protected  java.util.Map<EdifNet,java.util.Set<EdifCellInstance>> classifyECIs()
          Iterate through the design and classify EdifCellInstances into a clock domain.
protected  java.util.Map<EdifNet,java.util.Set<EdifNet>> classifyNets()
          Iterate through the design and classify nets into a clock domain.
private static void createDottyGraph(JEdifClockDomain jecd, java.lang.String[] params, java.io.PrintStream out)
          Creates a dotty graph representation of the specified cell and its predecessors through the specified port.
protected  SCCDepthFirstSearch doSCCAnalysis(boolean noIOBFB)
          Perform SCC decomposition on the EdifCellInstanceGraph graph.
protected  java.util.Map<EdifNet,java.util.Set<EdifCellInstance>> getAsynchronousResets()
          Find all asynchronous resets/presets in the design.
protected  java.util.Map<java.lang.String,java.util.Set<java.lang.String>> getClockCrossings()
          Find all clock crossing in the design.
private static java.util.Set<EdifNet> getClocksToShow(com.martiansoftware.jsap.JSAPResult result, JEdifClockDomain jecd, java.io.PrintStream out)
          Returns a Set of EdifNets corresponding to the clock domains that will be printed out and analyzed.
 java.util.Map<EdifNet,java.util.Set<EdifCellInstance>> getECIMap()
          Public method to return _clkToECIMap after classifying the nets and ECIs.
private  boolean hasAsynchronousReset(EdifCell cell)
          Return true if the EdifCell ec has an asynchronous reset/preset.
private  boolean isClockDriver(EdifCell cell)
          Return true if the EdifCell ec is BUFG, DLL, or DCM
private  boolean isSequential(EdifCell cell)
          Return true if the EdifCell ec is sequential (has a clock port).
static void main(java.lang.String[] args)
           
private static void showAsynchronous(JEdifClockDomain jecd, java.util.Set<EdifNet> clocks, boolean showNoDomain, java.io.PrintStream out)
          Prints out a list of asynchronous EdifCellInstances belonging to the specified clock domains.
private static void showAsynchronousResetCells(JEdifClockDomain jecd, java.io.PrintStream out)
          Prints out a list of asynchronous reset cells in the design.
private static void showAsynchronousResets(JEdifClockDomain jecd, java.io.PrintStream out)
          Prints out a list of synchronous resets in the design.
private static void showCells(JEdifClockDomain jecd, java.util.Set<EdifNet> clocks, boolean showNoDomain, java.io.PrintStream out)
          Prints out a list of EdifCellInstances belonging to the specified clock domains.
private static void showClockCrossings(JEdifClockDomain jecd, java.lang.String[] params, java.io.PrintStream out)
          Prints information about all clock crossings belonging to the specified clock domain pairs.
private static void showGatedClocks(JEdifClockDomain jecd, java.io.PrintStream out)
          Prints a list of all gated clocks in the design.
private static void showNets(JEdifClockDomain jecd, java.util.Set<EdifNet> clocks, boolean showNoDomain, java.io.PrintStream out)
          Prints out a list of EdifNets belonging to the specified clock domains.
private static void showSynchronous(JEdifClockDomain jecd, java.util.Set<EdifNet> clocks, boolean showNoDomain, java.io.PrintStream out)
          Prints out a list of synchronous EdifCellInstances belonging to the specified clock domains.
 
Methods inherited from class edu.byu.ece.edif.jedif.EDIFMain
getExtendedVersionString, printProgramExecutableString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_clkToNetMap

protected java.util.Map<EdifNet,java.util.Set<EdifNet>> _clkToNetMap
A map whose keys are EdifNets that have been classified as clocks. The values in the map are sets of EdifNets that fall into the clock domains.


_clkToECIMap

protected java.util.Map<EdifNet,java.util.Set<EdifCellInstance>> _clkToECIMap
A map whose keys are EdifNets that have been classified as clocks. The values in the map are sets of EdifCellInstances that fall into the clock domains.


_noClockNets

protected java.util.Set<EdifNet> _noClockNets
A set of EdifNets that do not fall into any of the classified domains.


_noClockECIs

protected java.util.Set<EdifCellInstance> _noClockECIs
A set of EdifCellInstances that do not fall into any of the classified domains.


_ecic

protected static EdifCellInstanceGraph _ecic
A graph structure used for efficiently traversing the EDIF design.


_top

protected static EdifEnvironment _top
An EdifEnvironment used to store the environment of the flattened design.


BAR

protected static final java.lang.String BAR
See Also:
Constant Field Values

ALL

protected static final java.lang.String ALL
See Also:
Constant Field Values

RAM_PREFIX

protected static final java.lang.String RAM_PREFIX
See Also:
Constant Field Values

_resetPortNames

private static final java.util.Set<java.lang.String> _resetPortNames
Constructor Detail

JEdifClockDomain

public JEdifClockDomain(EdifEnvironment e)
Method Detail

main

public static void main(java.lang.String[] args)

isSequential

private boolean isSequential(EdifCell cell)
Return true if the EdifCell ec is sequential (has a clock port).

Parameters:
cell - The name of the cell to check
Returns:
True if this cell is sequential

hasAsynchronousReset

private boolean hasAsynchronousReset(EdifCell cell)
Return true if the EdifCell ec has an asynchronous reset/preset.

Parameters:
cell - The name of the cell to check
Returns:
True if this cell has an asynchronous reset/preset

isClockDriver

private boolean isClockDriver(EdifCell cell)
Return true if the EdifCell ec is BUFG, DLL, or DCM

Parameters:
cell - The name of the cell to check
Returns:
True if this cell is BUFG, DLL, or DCM

classifyNets

protected java.util.Map<EdifNet,java.util.Set<EdifNet>> classifyNets()
Iterate through the design and classify nets into a clock domain. First, clock domains are identified as those nets that drive clock ports of sequential cells. Once clock domains have been identified, sequential cells and their children (up to another sequential cell) are added to that domain.

Returns:
A map whose key is the EdifNet of the clock domain and whose value is a set of EdifNets that belong to that domain. The sets of EdifNets are not neccessarily mutually exclusive.

classifyECIs

protected java.util.Map<EdifNet,java.util.Set<EdifCellInstance>> classifyECIs()
Iterate through the design and classify EdifCellInstances into a clock domain. Based on the net domains which should have been previously found, non-sequential cells, like LUTs, belong to the domains of their input nets, and sequential cells belong to the domain of the net driving their clock port(s).

Returns:
A map whose key is the EdifNet of the clock domain and whose value is a set of EdifCellInstances that belong to that domain. The sets of EdifCellInstances are not neccessarily mutually exclusive.

getClockCrossings

protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> getClockCrossings()
Find all clock crossing in the design. This is found by iterating over all EdifCellInstances in the design. Clock crossings occur when a sequential cell's inputs are in a different domain than its own.

TODO: do we still want to use a map here? Maybe we should return a clock domain crossing object to make it easier to interact with the outside. Or, we could do that in another method - this one works great for printing.

Returns:
A map whose keys are Strings representing the domain crossing (e.g. "domainA to domainB", and whose values are Sets of Strings describing the clock crossing.

getAsynchronousResets

protected java.util.Map<EdifNet,java.util.Set<EdifCellInstance>> getAsynchronousResets()
Find all asynchronous resets/presets in the design.

Returns:
A map whose keys are nets that drive asynchronous reset ports and whose values are Sets of EdifCellInstances that have asynchronous resets/presets.

getClocksToShow

private static java.util.Set<EdifNet> getClocksToShow(com.martiansoftware.jsap.JSAPResult result,
                                                      JEdifClockDomain jecd,
                                                      java.io.PrintStream out)
Returns a Set of EdifNets corresponding to the clock domains that will be printed out and analyzed.

Parameters:
result - The results of the command line parser
jecd - The JEdifClockDomain instance created for this design
out - The specified output PrintStream
Returns:
Set of EdifNets corresponding to user-specified clock domains.

doSCCAnalysis

protected SCCDepthFirstSearch doSCCAnalysis(boolean noIOBFB)
Perform SCC decomposition on the EdifCellInstanceGraph graph.

Parameters:
noIOBFB - Boolean value indicating whether or not to exclude IOBs as feedback paths.
Returns:
SCCDepthFirstSearch data structure

showGatedClocks

private static void showGatedClocks(JEdifClockDomain jecd,
                                    java.io.PrintStream out)
Prints a list of all gated clocks in the design.

Parameters:
jecd - The JEdifClockDomain instance created for this design
out - The specified output PrintStream

showNets

private static void showNets(JEdifClockDomain jecd,
                             java.util.Set<EdifNet> clocks,
                             boolean showNoDomain,
                             java.io.PrintStream out)
Prints out a list of EdifNets belonging to the specified clock domains.

Parameters:
jecd - The JEdifClockDomain instance created for this design
clocks - The set of EdifNets corresponding to user-specified clock domains
showNoDomain - Boolean specifying whether to print EdifNets belonging to no clock domain
out - The specified output PrintStream

showCells

private static void showCells(JEdifClockDomain jecd,
                              java.util.Set<EdifNet> clocks,
                              boolean showNoDomain,
                              java.io.PrintStream out)
Prints out a list of EdifCellInstances belonging to the specified clock domains.

Parameters:
jecd - The JEdifClockDomain instance created for this design
clocks - The set of EdifNets corresponding to user-specified clock domains
showNoDomain - Boolean specifying whether to print EdifNets belonging to no clock domain
out - The specified output PrintStream

showSynchronous

private static void showSynchronous(JEdifClockDomain jecd,
                                    java.util.Set<EdifNet> clocks,
                                    boolean showNoDomain,
                                    java.io.PrintStream out)
Prints out a list of synchronous EdifCellInstances belonging to the specified clock domains.

Parameters:
jecd - The JEdifClockDomain instance created for this design
clocks - The set of EdifNets corresponding to user-specified clock domains
showNoDomain - Boolean specifying whether to print EdifNets belonging to no clock domain
out - The specified output PrintStream

showAsynchronous

private static void showAsynchronous(JEdifClockDomain jecd,
                                     java.util.Set<EdifNet> clocks,
                                     boolean showNoDomain,
                                     java.io.PrintStream out)
Prints out a list of asynchronous EdifCellInstances belonging to the specified clock domains.

Parameters:
jecd - The JEdifClockDomain instance created for this design
clocks - The set of EdifNets corresponding to user-specified clock domains
showNoDomain - Boolean specifying whether to print EdifNets belonging to no clock domain
out - The specified output PrintStream

showAsynchronousResetCells

private static void showAsynchronousResetCells(JEdifClockDomain jecd,
                                               java.io.PrintStream out)
Prints out a list of asynchronous reset cells in the design.

Parameters:
jecd - The JEdifClockDomain instance created for this design
out - The specified output PrintStream

showAsynchronousResets

private static void showAsynchronousResets(JEdifClockDomain jecd,
                                           java.io.PrintStream out)
Prints out a list of synchronous resets in the design.

Parameters:
jecd - The JEdifClockDomain instance created for this design
out - The specified output PrintStream

showClockCrossings

private static void showClockCrossings(JEdifClockDomain jecd,
                                       java.lang.String[] params,
                                       java.io.PrintStream out)
Prints information about all clock crossings belonging to the specified clock domain pairs.

Parameters:
jecd - The JEdifClockDomain instance created for this design
params - The array of clock domain names specified by the user
out - The specified output PrintStream

analyzeSCCs

protected void analyzeSCCs(SCCDepthFirstSearch scc,
                           java.io.PrintStream out)
Output summary of SCC to a printstream

Parameters:
scc - The SCC to analyze
output - The PrintStream to write the summary to

createDottyGraph

private static void createDottyGraph(JEdifClockDomain jecd,
                                     java.lang.String[] params,
                                     java.io.PrintStream out)
Creates a dotty graph representation of the specified cell and its predecessors through the specified port. Outputs a file with filename in the form of: [name of EdifCellInstance][size of EdifCellInstance].dot

Parameters:
jecd - The JEdifClockDomain instance created for this design
params - The array of cell/port names provided by the user
out - The specified output PrintStream

getECIMap

public java.util.Map<EdifNet,java.util.Set<EdifCellInstance>> getECIMap()
Public method to return _clkToECIMap after classifying the nets and ECIs.

Returns:
A map whose key is the EdifNet of the clock domain and whose value is a set of EdifCellInstances that belong to that domain. The sets of EdifCellInstances are not neccessarily mutually exclusive.