Skip to content
This repository has been archived by the owner on Jul 23, 2021. It is now read-only.

Commit

Permalink
fixed hardwired xc3s200 in xdl header. Device and speed designations …
Browse files Browse the repository at this point in the history
…are now parsed out of the .xdlrc file
  • Loading branch information
stacksmith committed May 29, 2013
1 parent b0f2664 commit 28d1db5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
16 changes: 13 additions & 3 deletions cDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,23 +219,29 @@ void CLASS::parse_xdlrc(const char* fname){
}
lineno=1;
buf = (char*)malloc(1024);
int stage=0;
int stage=-1;
while(true){
if(!readline()) break;
switch(stage){
//----------------------------------------------------------
case -1: // look for part name/speed
if(0==strncmp(buf,"(xdl_resource_report ",21)){
designator=strtok(buf+21," ");
designator=strdup(strtok(NULL," "));
stage=0;
}
break;
//----------------------------------------------------------
case 0: // parse until (tiles...
if(0==strncmp(buf,"(tiles ",7)){
//TODO: parse tile size...
stage=1;
//fprintf(stderr,"STAGE 1\n");
}
break;
//----------------------------------------------------------
case 1: //tile...
if(0==strncmp(buf,")",1)){
stage=2;
//fprintf(stderr,"STAGE 2\n");
} else {
parse_tile(buf);
}
Expand Down Expand Up @@ -285,3 +291,7 @@ void CLASS::error(U32 xerrno){
fprintf(stderr,"----------------------------------------------------------------------\n");
throw(xerrno);
}
//device name and speed grade for output
const char* CLASS::getDesignator(){
return designator;
}
2 changes: 2 additions & 0 deletions cDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class cDevice{
int lineno;
char* buf;
FILE* f;
char* designator; //device name and speed
//CODE
public:
cDevice();
Expand All @@ -43,6 +44,7 @@ class cDevice{

void listProtos();
const char* tileFor( char* primsite); //like SLICE_XY or IOB
const char* getDesignator(); //device name and speed grade for output
private:
bool readline();
void parse_tile(char* buf);
Expand Down
2 changes: 1 addition & 1 deletion cDynXdl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ void CLASS::xdlHeader(){
fprintf(fout,"# =======================================================\n");
fprintf(fout,"# top FPGA Hammer tools 0.1.0\n");
fprintf(fout,"# =======================================================\n");
fprintf(fout,"design \"top\" xc3s200ft256-4 v3.2 ,\n");
fprintf(fout,"design \"top\" %s v3.2 ,\n",pDevice->getDesignator() );
fprintf(fout," cfg \" \" ;\n") ;
}

Expand Down

0 comments on commit 28d1db5

Please sign in to comment.