Skip to content

Commit

Permalink
gp4prog/gpdevboard: Implemented socket test for SLG46140V
Browse files Browse the repository at this point in the history
azonenberg committed Oct 24, 2016
1 parent e849edc commit fd575af
Showing 2 changed files with 59 additions and 8 deletions.
21 changes: 20 additions & 1 deletion src/gp4prog/main.cpp
Original file line number Diff line number Diff line change
@@ -49,6 +49,7 @@ int main(int argc, char* argv[])
double voltage = 0.0;
double voltage2 = 0.0;
vector<int> nets;
bool hexdump = false;

//Parse command-line arguments
for(int i=1; i<argc; i++)
@@ -145,6 +146,8 @@ int main(int argc, char* argv[])
}
else if(s == "--force")
force = true;
else if(s == "--hexdump")
hexdump = true;
else if(s == "--pattern-id")
{
if(i+1 < argc)
@@ -378,6 +381,19 @@ int main(int argc, char* argv[])
if(!TweakBitstream(newBitstream, detectedPart, rcFtw, patternId, readProtect))
return 1;

//Dump to the console if requested
if(hexdump)
{
LogNotice("Dumping bitstream as hex\n");
LogIndenter li;
for(size_t i=0; i<newBitstream.size(); i++)
{
LogNotice("%02x", (unsigned int)newBitstream[i]);
if((i & 31) == 31)
LogNotice("\n");
}
}

if(!programNvram)
{
//Load bitstream into SRAM
@@ -526,7 +542,10 @@ void ShowUsage()
" -n, --nets <net list>\n"
" For every test point in the specified comma-separated list:\n"
" * enables a non-inverted LED, if any;\n"
" * enables expansion connector passthrough.\n");
" * enables expansion connector passthrough.\n"
" --hexdump\n"
" Prints a hex dump of the bitstream (after applying ID code etc)\n"
" suitable for passing to BitstreamToHex\n");
}

void ShowVersion()
46 changes: 39 additions & 7 deletions src/gpdevboard/utils.cpp
Original file line number Diff line number Diff line change
@@ -311,13 +311,12 @@ bool SocketTest(hdevice hdev, SilegoPart part)

vector<uint8_t> loopbackBitstream;

int avail_gpios = 18;

switch(part)
{
case SLG46620V:
// To reproduce:
// module top((* LOC="P2" *) input i, output [16:0] o));
// assign o = {17{i}};
// endmodule
//To reproduce: build SocketTestLoopback_STQFN20 for SLG46620V
loopbackBitstream = BitstreamFromHex(
"0000000000000000000000000000000000000000000000000000000000000000"
"00000000000000000000d88f613f86fd18f6633f000000000000000000000000"
@@ -327,14 +326,32 @@ bool SocketTest(hdevice hdev, SilegoPart part)
"0000000000000000000034fdd33f4dff34fdd33f0d0000000000000000000000"
"0000000000000000000000002004000000000000000000000000000000000000"
"0000000000000000000000000000000200800020000004000000000200000000");

avail_gpios = 18; //single rail STQFN-20
break;

case SLG46140V:
LogWarning("FIXME: not doing anything in SocketTest\n");
case SLG46621V:
//To reproduce: build SocketTestLoopback_STQFN20D for SLG46621V

LogWarning("FIXME: not doing anything in SocketTest for SLG46621V\n");
return true;

avail_gpios = 17; //dual rail STQFN-20
break;

default: LogFatal("Unknown part\n");
case SLG46140V:
//To reproduce: build SocketTestLoopback_STQFN14 for SLG46140V
loopbackBitstream = BitstreamFromHex(
"0000000000000000000000000000000000000000000000000000000000000000"
"00d66ffdd66f59bff55b96f55bbff5bf00000000000000000000000000900000"
"0000000000000000000000000000000000000000000000000000000000000000"
"00004000002040000000000000000000000000000000000000000000008020a5");

avail_gpios = 12; //single rail STQFN-14
break;

default:
LogFatal("Unknown part\n");
}

LogVerbose("Downloading test bitstream\n");
@@ -368,14 +385,29 @@ bool SocketTest(hdevice hdev, SilegoPart part)

ioConfig.driverConfigs[2] = get<0>(config);
for(size_t i = 3; i <= 20; i++)
{
//Don't mess with the VCCIO2 driver in dual-rail parts
if( (avail_gpios == 17) && (i == 14) )
continue;

ioConfig.driverConfigs[i] = get<1>(config);
}
if(!SetIOConfig(hdev, ioConfig))
return false;

for(int i = 2; i <= 20; i++)
{
if(i == 11) continue;

//Skip un-bonded pins for lower pin count packages
if(avail_gpios == 12)
{
if( (i == 8) || (i == 9) || (i == 10) || (i == 18) || (i == 19) || (i == 20) )
continue;
}
else if( (avail_gpios == 17) && (i == 14) )
continue;

if(!SelectADCChannel(hdev, i))
return false;
double value;

0 comments on commit fd575af

Please sign in to comment.