Skip to content

Commit

Permalink
Now collecting IOB characterization data and storing it in the IOB ob…
Browse files Browse the repository at this point in the history
…ject. Not serializing yet
azonenberg committed Jun 2, 2017
1 parent 0c9cd72 commit ba0213d
Showing 7 changed files with 133 additions and 39 deletions.
2 changes: 0 additions & 2 deletions src/gp4tchar/main.cpp
Original file line number Diff line number Diff line change
@@ -126,8 +126,6 @@ int main(int argc, char* argv[])
/*
if(!MeasureCrossConnectionDelays(sock, hdev))
return 1;
*/
/*
if(!MeasureLutDelays(sock, hdev))
return 1;
*/
48 changes: 19 additions & 29 deletions src/gp4tchar/measurements.cpp
Original file line number Diff line number Diff line change
@@ -266,13 +266,13 @@ bool MeasurePinToPinDelays(Socket& sock, hdevice hdev)
*/

int pins[] = {3, 4, 5, 13, 14, 15};
//Greenpak4IOB::DriveStrength drives[] = {Greenpak4IOB::DRIVE_1X, Greenpak4IOB::DRIVE_2X};

//TODO: ↓
//Test conditions (TODO: pass this in from somewhere?)
PTVCorner corner(PTVCorner::SPEED_TYPICAL, 25, 3300);

//TODO: ↓ edges
//TODO: x4 drive (if supported on this pin)
float delay;
LogNotice("+------+------+--------+----------+----------+-----------+------------+\n");
LogNotice("| From | To | IBUF ↑ | OBUFx1 ↑ | OBUFx2 ↑ | Schmitt ↑ | Crossbar ↑ |\n");
LogNotice("+------+------+--------+----------+----------+-----------+------------+\n");
for(auto src : pins)
{
for(auto dst : pins)
@@ -332,11 +332,7 @@ bool MeasurePinToPinDelays(Socket& sock, hdevice hdev)
if(!sys.Solve())
return false;

//auto sdpair = PinPair(src, dst);
//g_deviceProperties.ioDelays[drive][sdpair] = CombinatorialDelay(delay, -1);
//auto x1 = g_deviceProperties.ioDelays[drives[0]][sdpair];
//auto x2 = g_deviceProperties.ioDelays[drives[1]][sdpair];

/*
LogNotice("| %4d | %2d | %6.3f | %8.3f | %8.3f | %9.3f | %8.3f |\n",
src,
dst,
@@ -346,13 +342,19 @@ bool MeasurePinToPinDelays(Socket& sock, hdevice hdev)
schmitt.m_value,
route.m_value
);
*/

//Save combinatorial delays for these pins
auto iob = g_calDevice.GetIOB(src);
iob->AddCombinatorialDelay("IO", "OUT", corner, CombinatorialDelay(ibuf.m_value, -1));
//iob->AddCombinatorialDelay("IN", "IO", corner, CombinatorialDelay(obuf.m_value, -1));
iob->SetSchmittTriggerDelay(corner, CombinatorialDelay(schmitt.m_value, -1));
iob->SetOutputDelay(Greenpak4IOB::DRIVE_1X, corner, CombinatorialDelay(obuf.m_value, -1));
iob->SetOutputDelay(Greenpak4IOB::DRIVE_2X, corner, CombinatorialDelay(obuf.m_value/2, -1));

//TODO: route.m_value goes somewhere
}
}
LogNotice("+------+------+--------+----------+----------+-----------+------------+\n");

//OBSERVED TREND:
//Left half of device, delays increase as you go HIGHER in the matrix
//Right half of device, delays increase as you go LOWER in the matrix

return true;
}
@@ -417,35 +419,23 @@ bool MeasureCrossConnectionDelays(Socket& sock, hdevice hdev)
LogNotice("Measuring cross-connection delays...\n");
LogIndenter li;

float delays[20];

float d;
for(int i=0; i<10; i++)
{
//east
MeasureCrossConnectionDelay(sock, hdev, 0, i, 3, 13, d);
LogNotice("East cross-connection %d from pins 3 to 13: %.3f\n", i, d);
//g_eastXconnDelays[i] = CombinatorialDelay(d, -1);
delays[i] = d;

//g_calDevice.GetCrossConnection(0, i,
}

for(int i=0; i<10; i++)
{
//west
MeasureCrossConnectionDelay(sock, hdev, 1, i, 13, 3, d);
LogNotice("West cross-connection %d from pins 13 to 3: %.3f\n", i, d);
//g_westXconnDelays[i] = CombinatorialDelay(d, -1);
delays[i+10] = d;
}

//Write the CSV
/*
FILE* fp = fopen("/tmp/xconn-temp.csv", "w");
for(int i=0; i<20; i++)
fprintf(fp, "0,x,%d,%.3f\n", i, delays[i]);
fclose(fp);
*/

return true;
}

24 changes: 17 additions & 7 deletions src/greenpak4/Greenpak4BitstreamEntity.cpp
Original file line number Diff line number Diff line change
@@ -233,20 +233,22 @@ bool Greenpak4BitstreamEntity::GetCombinatorialDelay(
string srcport,
string dstport,
PTVCorner corner,
CombinatorialDelay& delay)
CombinatorialDelay& delay) const
{
//If this isn't a corner we know about, give up
if(m_pinToPinDelays.find(corner) == m_pinToPinDelays.end())
auto pit = m_pinToPinDelays.find(corner);
if(pit == 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())
auto& dmap = pit->second;
auto dit = dmap.find(pair);
if(dit == dmap.end())
return false;

//Got it
delay = dmap[pair];
delay = dit->second;
return true;
}

@@ -265,7 +267,7 @@ void Greenpak4BitstreamEntity::PrintTimingData() const
if(m_pinToPinDelays.empty())
return;

//LogNotice("%s\n", GetDescription().c_str());
LogNotice("%s\n", GetDescription().c_str());

//Combinatorial delays
LogIndenter li;
@@ -277,13 +279,21 @@ void Greenpak4BitstreamEntity::PrintTimingData() const
{
auto& pair = jt.first;
auto& time = jt.second;
LogNotice("%6s to %6s: %.3f ns rising, %.3f ns falling\n",
LogNotice("%10s to %10s: %.3f ns rising, %.3f ns falling\n",
pair.first.c_str(),
pair.second.c_str(),
time.m_rising,
time.m_falling);
}

PrintExtraTimingData(it.first);
}

//TODO: Setup/hold margins
}

void Greenpak4BitstreamEntity::PrintExtraTimingData(PTVCorner /*corner*/) const
{
//Empty in base class but need to provide an empty default implementation
//so children don't HAVE to override
}
3 changes: 2 additions & 1 deletion src/greenpak4/Greenpak4BitstreamEntity.h
Original file line number Diff line number Diff line change
@@ -139,7 +139,7 @@ class Greenpak4BitstreamEntity
std::string srcport,
std::string dstport,
PTVCorner corner,
CombinatorialDelay& delay);
CombinatorialDelay& delay) const;

/**
@brief Adds a combinatorial delay value to the cell (mostly used by gp4tchar)
@@ -153,6 +153,7 @@ class Greenpak4BitstreamEntity
//TODO: interface for serializing/deserializing combinatorial delays

virtual void PrintTimingData() const;
virtual void PrintExtraTimingData(PTVCorner corner) const;

protected:

66 changes: 66 additions & 0 deletions src/greenpak4/Greenpak4IOB.cpp
Original file line number Diff line number Diff line change
@@ -241,3 +241,69 @@ vector<string> Greenpak4IOB::GetOutputPorts() const
r.push_back("OUT");
return r;
}

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

void Greenpak4IOB::PrintExtraTimingData(PTVCorner corner) const
{
//Schmitt trigger delay
auto sd = m_schmittTriggerDelays.find(corner);
if(sd != m_schmittTriggerDelays.end())
{
auto time = sd->second;

//Look up normal buffer delay and add
CombinatorialDelay bd;
if(GetCombinatorialDelay("IO", "OUT", corner, bd))
{
LogNotice("%10s to %10s: %.3f ns rising, %.3f ns falling\n",
"IO",
"OUT (Sch)",
time.m_rising + bd.m_rising,
time.m_falling + bd.m_falling);
}
}

//Output buffer delays
for(auto it : m_outputDelays)
{
//Skip results for other process corners
if(it.first.second != corner)
continue;

string drive;
switch(it.first.first)
{
case DRIVE_4X:
drive = "4x";
break;

case DRIVE_2X:
drive = "2x";
break;

case DRIVE_1X:
default:
drive = "1x";
break;
}
string ioname = string("IO (") + drive + ")";

LogNotice("%10s to %10s: %.3f ns rising, %.3f ns falling\n",
"IN",
ioname.c_str(),
it.second.m_rising,
it.second.m_falling);
}
}

bool Greenpak4IOB::GetCombinatorialDelay(
string srcport,
string dstport,
PTVCorner corner,
CombinatorialDelay& delay) const
{
//Default: return base class info
return Greenpak4BitstreamEntity::GetCombinatorialDelay(srcport, dstport, corner, delay);
}
28 changes: 28 additions & 0 deletions src/greenpak4/Greenpak4IOB.h
Original file line number Diff line number Diff line change
@@ -141,6 +141,25 @@ class Greenpak4IOB : public Greenpak4BitstreamEntity
bool IsAnalogIbuf()
{ return (m_inputThreshold == THRESHOLD_ANALOG); }

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Timing stuff

virtual void PrintExtraTimingData(PTVCorner corner) const;

void SetSchmittTriggerDelay(PTVCorner c, CombinatorialDelay d)
{ m_schmittTriggerDelays[c] = d; }

typedef std::pair<DriveStrength, PTVCorner> DriveCondition;

void SetOutputDelay(DriveStrength s, PTVCorner c, CombinatorialDelay d)
{ m_outputDelays[DriveCondition(s, c)] = d; }

virtual bool GetCombinatorialDelay(
std::string srcport,
std::string dstport,
PTVCorner corner,
CombinatorialDelay& delay) const;

protected:

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -178,6 +197,15 @@ class Greenpak4IOB : public Greenpak4BitstreamEntity

///Second configuration base for analog output
unsigned int m_analogConfigBase;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Timing data

//Schmitt trigger delays
std::map<PTVCorner, CombinatorialDelay> m_schmittTriggerDelays;

//Output propagation delay depends on drive strength
std::map< DriveCondition, CombinatorialDelay > m_outputDelays;
};

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

//Comparison operator for STL collections
bool operator<(const PTVCorner& rhs) const;
bool operator!=(const PTVCorner& rhs) const;

protected:

0 comments on commit ba0213d

Please sign in to comment.