Skip to content

Commit

Permalink
Greenpak4BitstreamEntity / Greenpak4Flipflop: correct loading of netl…
Browse files Browse the repository at this point in the history
…ists that use FF Q/nQ output
azonenberg committed Jul 21, 2017
1 parent fde41d2 commit 96420f3
Showing 4 changed files with 26 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/greenpak4/Greenpak4BitstreamEntity.cpp
Original file line number Diff line number Diff line change
@@ -124,6 +124,11 @@ bool Greenpak4BitstreamEntity::IsGeneralFabricInput(string port) const
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Load/save helpers

vector<string> Greenpak4BitstreamEntity::GetOutputPortsFiltered(bool* /*bitstream*/) const
{
return GetOutputPorts();
}

Greenpak4BitstreamEntity* Greenpak4BitstreamEntity::GetRealEntity()
{
if(m_dual && !m_dualMaster)
@@ -223,7 +228,7 @@ void Greenpak4BitstreamEntity::ReadMatrixSelector(
for(size_t i=0; i<m_device->GetEntityCount(); i++)
{
auto entity = m_device->GetEntity(i);
auto outputs = entity->GetOutputPorts();
auto outputs = entity->GetOutputPortsFiltered(bitstream);
for(auto pname : outputs)
{
//Skip mismatched net numbers
3 changes: 3 additions & 0 deletions src/greenpak4/Greenpak4BitstreamEntity.h
Original file line number Diff line number Diff line change
@@ -123,6 +123,9 @@ class Greenpak4BitstreamEntity
//Get a list of output ports on this node that connect to general fabric routing (may be empty)
virtual std::vector<std::string> GetOutputPorts() const =0;

//Calls GetOutputPorts() then filters the output to only include ports valid in the current configuration
virtual std::vector<std::string> GetOutputPortsFiltered(bool* bitstream) const;

//Commit changes from the assigned PAR graph node to us
virtual bool CommitChanges() =0;

16 changes: 16 additions & 0 deletions src/greenpak4/Greenpak4Flipflop.cpp
Original file line number Diff line number Diff line change
@@ -108,6 +108,22 @@ vector<string> Greenpak4Flipflop::GetOutputPorts() const
return r;
}

/**
@brief Q and nQ go to the same route and we can only use one at a time, so filter them
*/
vector<string> Greenpak4Flipflop::GetOutputPortsFiltered(bool* bitstream) const
{
//Read the bitstream to see if we should be filtering.
//Do not call Load() as we're const

vector<string> r;
if(bitstream[m_configBase + 1])
r.push_back("nQ");
else
r.push_back("Q");
return r;
}

unsigned int Greenpak4Flipflop::GetOutputNetNumber(string port)
{
if( (port == "Q") || (port == "nQ") )
1 change: 1 addition & 0 deletions src/greenpak4/Greenpak4Flipflop.h
Original file line number Diff line number Diff line change
@@ -57,6 +57,7 @@ class Greenpak4Flipflop : public Greenpak4BitstreamEntity

virtual std::vector<std::string> GetInputPorts() const;
virtual std::vector<std::string> GetOutputPorts() const;
virtual std::vector<std::string> GetOutputPortsFiltered(bool* bitstream) const;

virtual bool CommitChanges();

0 comments on commit 96420f3

Please sign in to comment.