Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: azonenberg/openfpga
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: c7de7aaade1f
Choose a base ref
...
head repository: azonenberg/openfpga
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3f404d725189
Choose a head ref
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on Dec 24, 2016

  1. greenpak4: Refactored Greenpak4Device::Save() error handling to reduc…

    …e chance of resource leaks
    azonenberg committed Dec 24, 2016
    Copy the full SHA
    17b5286 View commit details
  2. Copy the full SHA
    3f404d7 View commit details
Showing with 11 additions and 12 deletions.
  1. +6 −7 src/greenpak4/Greenpak4Device.cpp
  2. +3 −4 src/greenpak4/Greenpak4SPI.cpp
  3. +2 −1 tests/greenpak4/slg46620v/SPIToDCMP.v
13 changes: 6 additions & 7 deletions src/greenpak4/Greenpak4Device.cpp
Original file line number Diff line number Diff line change
@@ -991,14 +991,15 @@ bool Greenpak4Device::WriteToFile(string fname, uint8_t userid, bool readProtect
for(unsigned int i=0; i<m_bitlen; i++)
bitstream[i] = false;

bool ok = true;

//Get the config data from each of our blocks
for(auto x : m_bitstuff)
{
if(!x->Save(bitstream))
{
LogError("Bitstream node %s failed to save\n", x->GetDescription().c_str());
fclose(fp);
return false;
ok = false;
}
}

@@ -1139,7 +1140,7 @@ bool Greenpak4Device::WriteToFile(string fname, uint8_t userid, bool readProtect

default:
LogError("NVM retry count for SLG46140 must be 1...4\n");
return false;
ok = false;
}

//Internal LDO disable
@@ -1174,9 +1175,7 @@ bool Greenpak4Device::WriteToFile(string fname, uint8_t userid, bool readProtect
//Invalid device
default:
LogError("Greenpak4Device: WriteToFile(): unknown device\n");
fclose(fp);
delete[] bitstream;
return false;
ok = false;
}

//Write the bitfile
@@ -1187,5 +1186,5 @@ bool Greenpak4Device::WriteToFile(string fname, uint8_t userid, bool readProtect
//Done
delete[] bitstream;
fclose(fp);
return true;
return ok;
}
7 changes: 3 additions & 4 deletions src/greenpak4/Greenpak4SPI.cpp
Original file line number Diff line number Diff line change
@@ -77,16 +77,15 @@ void Greenpak4SPI::SetInput(string port, Greenpak4EntityOutput src)
vector<string> Greenpak4SPI::GetOutputPorts() const
{
vector<string> r;
//r.push_back("OUT");
r.push_back("INT");
return r;
}

unsigned int Greenpak4SPI::GetOutputNetNumber(string port)
{
/*
if(port == "OUT")
if(port == "INT")
return m_outputBaseWord;
else*/
else
return -1;
}

3 changes: 2 additions & 1 deletion tests/greenpak4/slg46620v/SPIToDCMP.v
Original file line number Diff line number Diff line change
@@ -102,7 +102,8 @@ module SPIToDCMP(spi_sck, spi_cs_n, spi_mosi, spi_int, dcmp_greater, dcmp_equal)
.TXD_HIGH(8'h00),
.TXD_LOW(8'h00),
.RXD_HIGH(rxd_high),
.RXD_LOW(rxd_low)
.RXD_LOW(rxd_low),
.INT(spi_int)
);

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////