edu.byu.ece.edif.util.clockdomain
Class ClockDomainParser

java.lang.Object
  extended by edu.byu.ece.edif.util.clockdomain.ClockDomainParser

public class ClockDomainParser
extends java.lang.Object

This class is used to identify clock domains in a flattened EDIF design and then classify nets into one of those domains. Once nets are classified, EdifCellInstances can also be classified into those domains.

Author:
Kevin Lundgreen

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  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.
protected  ClockDomainCommandParser _parser
          ClockDomainCommandParser used to parse the command-line arguments of ClockDomainArchitectureImpl.
private static java.util.Set<java.lang.String> _resetPortNames
           
protected  com.martiansoftware.jsap.JSAPResult _result
          JSAPResult used to access the command-line arguments after being parsed.
protected  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  java.io.PrintStream output
           
protected static java.lang.String RAM_PREFIX
           
 
Constructor Summary
ClockDomainParser(FlattenedEdifCell flatCell)
          Construct a ClockDomainArchitectureImpl object and initialize for clock domain analysis.
ClockDomainParser(FlattenedEdifCell flatCell, EdifCellInstanceGraph ecic)
          Construct a ClockDomainArchitectureImpl object and initialize for clock domain analysis.
ClockDomainParser(java.lang.String fileName, java.lang.String[] dirs, java.lang.String[] files)
          Construct a ClockDomainArchitectureImpl object and parse and flatten the EDIF design to be used for clock domain analysis
 
Method Summary
protected  void analyzeSCCs(SCCDepthFirstSearch scc)
          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.
protected  SCCDepthFirstSearch doSCCAnalysis(boolean noIOBFB)
          Perform SCC decomposition on the EdifCellInstanceGraph graph.
 void exec(java.io.PrintStream out)
           
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.
 java.util.Map<EdifNet,java.util.Set<EdifCellInstance>> getECIMap()
          Public method to return _clkToECIMap after classifying the nets and ECIs.
static java.lang.String getVersionInfo()
           
private  boolean hasAsynchronousReset(EdifCell cell)
          Return true if the EdifCell ec has an asynchronous reset/preset.
private  void init(FlattenedEdifCell flatCell)
          Initialize the ClockDomainArchitectureImpl object by removing the original cell from the flattened cell's library.
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)
           
 void parseCommandlineOptions(com.martiansoftware.jsap.JSAPResult result)
           
 void setOutput(java.io.PrintStream out)
           
private  void show_gated_clocks()
           
private  void showAsync(java.util.Set<EdifNet> clocks, boolean async, boolean async_reset, boolean async_reset_cells)
           
private  void showCells(java.util.Set<EdifNet> clocks)
           
private  void showClockCrossings()
           
private  void showDottyGraph()
           
private  void showNets(java.util.Set<EdifNet> clocks)
           
private  void showSyncronous(java.util.Set<EdifNet> clocks)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

output

protected java.io.PrintStream output

_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 EdifCellInstanceGraph _ecic
A graph structure used for efficiently traversing the EDIF design.


_top

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


_parser

protected ClockDomainCommandParser _parser
ClockDomainCommandParser used to parse the command-line arguments of ClockDomainArchitectureImpl.


_result

protected com.martiansoftware.jsap.JSAPResult _result
JSAPResult used to access the command-line arguments after being parsed.


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

ClockDomainParser

public ClockDomainParser(FlattenedEdifCell flatCell)
                  throws InvalidEdifNameException
Construct a ClockDomainArchitectureImpl object and initialize for clock domain analysis.

Parameters:
flatCell - The FlattenedEdifCell to analyze
Throws:
InvalidEdifNameException

ClockDomainParser

public ClockDomainParser(FlattenedEdifCell flatCell,
                         EdifCellInstanceGraph ecic)
                  throws InvalidEdifNameException
Construct a ClockDomainArchitectureImpl object and initialize for clock domain analysis.

Parameters:
flatCell - The FlattenedEdifCell to analyze
ecic - The previously generated EdifCellInstanceGraph graph to avoid having to do it again
Throws:
InvalidEdifNameException

ClockDomainParser

public ClockDomainParser(java.lang.String fileName,
                         java.lang.String[] dirs,
                         java.lang.String[] files)
                  throws EdifException,
                         ParseException,
                         java.io.FileNotFoundException
Construct a ClockDomainArchitectureImpl object and parse and flatten the EDIF design to be used for clock domain analysis

Parameters:
fileName - The name of the EDIF file that will be parsed and flattened.
Throws:
EdifException
ParseException
java.io.FileNotFoundException
Method Detail

setOutput

public void setOutput(java.io.PrintStream out)

init

private void init(FlattenedEdifCell flatCell)
           throws InvalidEdifNameException
Initialize the ClockDomainArchitectureImpl object by removing the original cell from the flattened cell's library. Also initialize the necessary data structures.

Parameters:
flatCell - The FlattenedEdifCell to analyze.
Throws:
InvalidEdifNameException

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 necessarily 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 necessarily mutually exclusive.

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

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.

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.

analyzeSCCs

protected void analyzeSCCs(SCCDepthFirstSearch scc)
Output summary of SCC to a printstream

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

getVersionInfo

public static java.lang.String getVersionInfo()
Returns:
a String of the version of this class

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 necessarily mutually exclusive.

main

public static void main(java.lang.String[] args)
                 throws ParseException,
                        java.io.FileNotFoundException,
                        EdifException
Throws:
ParseException
java.io.FileNotFoundException
EdifException

parseCommandlineOptions

public void parseCommandlineOptions(com.martiansoftware.jsap.JSAPResult result)

exec

public void exec(java.io.PrintStream out)

showAsync

private void showAsync(java.util.Set<EdifNet> clocks,
                       boolean async,
                       boolean async_reset,
                       boolean async_reset_cells)

showDottyGraph

private void showDottyGraph()

showClockCrossings

private void showClockCrossings()

showSyncronous

private void showSyncronous(java.util.Set<EdifNet> clocks)

showCells

private void showCells(java.util.Set<EdifNet> clocks)

showNets

private void showNets(java.util.Set<EdifNet> clocks)

show_gated_clocks

private void show_gated_clocks()