Skip to content

Commit

Permalink
Added PTVCorner. Added initial timing functions to Greenpak4Bitstream…
Browse files Browse the repository at this point in the history
…Entity. No serialization yet.
azonenberg committed Jun 2, 2017
1 parent 83d0d15 commit 396c094
Showing 5 changed files with 153 additions and 2 deletions.
33 changes: 33 additions & 0 deletions src/greenpak4/Greenpak4BitstreamEntity.cpp
Original file line number Diff line number Diff line change
@@ -225,3 +225,36 @@ bool Greenpak4BitstreamEntity::WriteMatrixSelector(

return true;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Timing analysis

bool Greenpak4BitstreamEntity::GetCombinatorialDelay(
string srcport,
string dstport,
PTVCorner corner,
CombinatorialDelay& delay)
{
//If this isn't a corner we know about, give up
if(m_pinToPinDelays.find(corner) == m_pinToPinDelays.end())
return false;

//If we don't have data for this pin pair, give up
PinPair pair(srcport, dstport);
auto& dmap = m_pinToPinDelays[corner];
if(dmap.find(pair) == dmap.end())
return false;

//Got it
delay = dmap[pair];
return true;
}

void Greenpak4BitstreamEntity::AddCombinatorialDelay(
string srcport,
string dstport,
PTVCorner corner,
CombinatorialDelay delay)
{
m_pinToPinDelays[corner][PinPair(srcport, dstport)] = delay;
}
35 changes: 34 additions & 1 deletion src/greenpak4/Greenpak4BitstreamEntity.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/***********************************************************************************************************************
* Copyright (C) 2016 Andrew Zonenberg and contributors *
* Copyright (C) 2016-2017 Andrew Zonenberg and contributors *
* *
* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General *
* Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) *
@@ -130,6 +130,28 @@ class Greenpak4BitstreamEntity

bool HasLoadsOnPort(std::string port);

/**
@brief Gets the combinatorial delay through the cell between a given set of ports
@return false if no timing data available, true if data was recovered
*/
virtual bool GetCombinatorialDelay(
std::string srcport,
std::string dstport,
PTVCorner corner,
CombinatorialDelay& delay);

/**
@brief Adds a combinatorial delay value to the cell (mostly used by gp4tchar)
*/
virtual void AddCombinatorialDelay(
std::string srcport,
std::string dstport,
PTVCorner corner,
CombinatorialDelay delay);

//TODO: interface for serializing/deserializing combinatorial delays

protected:

///Return our assigned netlist entity, if we have one (or NULL if not)
@@ -176,6 +198,17 @@ class Greenpak4BitstreamEntity

///True if we're the master of a dual pair, or not a dual
bool m_dualMaster;

//A (srcport, dstport) tuple
typedef std::pair<std::string, std::string> PinPair;

//Delays at a specific process corner
typedef std::map<PinPair, CombinatorialDelay> DelayMap;

//Combinatorial delays (only valid in the master of a dual)
//Derived classes are free to extend this to add support for more complex features
//(for example, Schmitt trigger or output drive strength in an IOB)
std::map<PTVCorner, DelayMap> m_pinToPinDelays;
};

#endif
4 changes: 3 additions & 1 deletion src/xbpar/CombinatorialDelay.h
Original file line number Diff line number Diff line change
@@ -19,7 +19,9 @@
#ifndef CombinatorialDelay_h
#define CombinatorialDelay_h

//Combinatorial delay values
/**
@brief Delay down a combinatorial path (at externally specified conditions)
*/
class CombinatorialDelay
{
public:
82 changes: 82 additions & 0 deletions src/xbpar/PTVCorner.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/***********************************************************************************************************************
* Copyright (C) 2016-2017 Andrew Zonenberg and contributors *
* *
* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General *
* Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) *
* any later version. *
* *
* This program 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 Lesser General Public License for *
* more details. *
* *
* You should have received a copy of the GNU Lesser General Public License along with this program; if not, you may *
* find one here: *
* https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt *
* or you may search the http://www.gnu.org website for the version 2.1 license, or you may write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
**********************************************************************************************************************/

#ifndef PTVCorner_h
#define PTVCorner_h

/**
@brief A single point in the (process, temperature, voltage) space
*/
class PTVCorner
{
public:
enum ProcessSpeed
{
SPEED_SLOW,
SPEED_TYPICAL, //TODO: average across all tested dies to find this? or just skip and specify slow/fast?
SPEED_FAST
};

PTVCorner(ProcessSpeed s, int t, int v)
: m_speed(s)
, m_dieTemp(t)
, m_voltage(v)
{}

ProcessSpeed GetSpeed() const
{ return m_speed; }

int GetTemp() const
{ return m_dieTemp; }

int GetVoltage() const
{ return m_voltage; }

//Comparison operator for STL collections
bool operator<(const PTVCorner& rhs) const
{
if(m_speed < rhs.m_speed)
return true;
if(m_dieTemp < rhs.m_dieTemp)
return true;
if(m_voltage < rhs.m_voltage)
return true;
return false;
}

protected:

/**
@brief Where does this die fall in the process spectrum? Can be at either extreme or somewhere in the middle
*/
ProcessSpeed m_speed;

/**
@brief Die temperature, in degC
*/
int m_dieTemp;

/**
@brief Supply voltage, in mV
Note, this is *cell* supply voltage which may not be the Vcore rail (e.g. if we're querying an I/O cell)
*/
int m_voltage;
};

#endif
1 change: 1 addition & 0 deletions src/xbpar/xbpar.h
Original file line number Diff line number Diff line change
@@ -20,6 +20,7 @@
#define xbpar_h

#include "CombinatorialDelay.h"
#include "PTVCorner.h"

#include "PARGraph.h"
#include "PARGraphNode.h"

0 comments on commit 396c094

Please sign in to comment.