Support for .gates and .mlatch in Blif. Ap parser beautifying.

This commit is contained in:
Jean-Paul Chaput 2015-04-29 10:41:43 +02:00
parent 693c05cf32
commit 479429e12d
2 changed files with 24 additions and 11 deletions

View File

@ -518,8 +518,8 @@ namespace {
, WIDTH , WIDTH
); );
} }
if (not net ) _printError( false, "Unknown net name %s." , fields[5] ); if (not net ) _printError( false, "Unknown net name <%s>." , fields[5] );
if (not layerInfo ) _printError( false, "Unknown layer name %s.", fields[6] ); if (not layerInfo ) _printError( false, "Unknown layer name <%s>.", fields[6] );
} }
} }
@ -542,7 +542,7 @@ namespace {
if ( layerInfo ) if ( layerInfo )
Contact::create ( net, layerInfo->getLayer(), XVIA, YVIA ); Contact::create ( net, layerInfo->getLayer(), XVIA, YVIA );
else else
_printError ( false, "Unknown layer name %s.", fields[2] ); _printError ( false, "Unknown layer name <%s>.", fields[2] );
} }
} }
@ -572,7 +572,7 @@ namespace {
Contact::create ( net, layerInfo->getLayer(), XVIA, YVIA, WIDTH-shrink, HEIGHT-shrink ); Contact::create ( net, layerInfo->getLayer(), XVIA, YVIA, WIDTH-shrink, HEIGHT-shrink );
} else } else
_printError ( false, "Unknown layer name %s.", fields[4] ); _printError ( false, "Unknown layer name <%s>.", fields[4] );
} }
} }
@ -627,7 +627,7 @@ namespace {
} }
} }
else else
_printError ( false, "Unknown layer name %s.", fields[7] ); _printError ( false, "Unknown layer name <%s>.", fields[7] );
} }
} }

View File

@ -61,11 +61,13 @@ namespace {
, Model = 0x00000004 , Model = 0x00000004
, End = 0x00000008 , End = 0x00000008
, Subckt = 0x00000010 , Subckt = 0x00000010
, Latch = 0x00000020 , Gate = 0x00000020
, Inputs = 0x00000040 , MLatch = 0x00000040
, Outputs = 0x00000080 , Latch = 0x00000080
, Clock = 0x00000100 , Inputs = 0x00000100
, Names = 0x00000200 , Outputs = 0x00000200
, Clock = 0x00000400
, Names = 0x00000800
, CoverZero = 0x00001000 , CoverZero = 0x00001000
, CoverOne = 0x00002000 , CoverOne = 0x00002000
, CoverLogic = 0x00004000 , CoverLogic = 0x00004000
@ -128,7 +130,9 @@ namespace {
if (_tokens.front() == ".outputs") { _state = Outputs; } if (_tokens.front() == ".outputs") { _state = Outputs; }
if (_tokens.front() == ".clock" ) { _state = Clock; } if (_tokens.front() == ".clock" ) { _state = Clock; }
if (_tokens.front() == ".subckt" ) { _state = Subckt; } if (_tokens.front() == ".subckt" ) { _state = Subckt; }
if (_tokens.front() == ".gate" ) { _state = Gate; }
if (_tokens.front() == ".latch" ) { _state = Latch; } if (_tokens.front() == ".latch" ) { _state = Latch; }
if (_tokens.front() == ".mlatch" ) { _state = MLatch; }
if (_tokens.front() == ".names" ) { if (_tokens.front() == ".names" ) {
_state = Names; _state = Names;
@ -560,6 +564,15 @@ namespace CRL {
continue; continue;
} }
if (tokenize.state() == Tokenize::MLatch) {
cerr << Error( "Blif::load() \".mlatch\" command is not supported.\n"
" File %s.blif at line %u."
, blifFile.c_str()
, tokenize.lineno()
) << endl;
continue;
}
if (not blifModel) { if (not blifModel) {
cerr << Error( "Blif::load() Unexpected command \"%s\" outside of .model definition.\n" cerr << Error( "Blif::load() Unexpected command \"%s\" outside of .model definition.\n"
" File %s.blif at line %u." " File %s.blif at line %u."
@ -595,7 +608,7 @@ namespace CRL {
} }
} }
if (tokenize.state() == Tokenize::Subckt) { if (tokenize.state() == Tokenize::Subckt or tokenize.state() == Tokenize::Gate) {
Subckt* subckt = blifModel->addSubckt( blifLine[1] ); Subckt* subckt = blifModel->addSubckt( blifLine[1] );
for ( size_t i=2 ; i<blifLine.size() ; ++i ) { for ( size_t i=2 ; i<blifLine.size() ; ++i ) {
size_t equal = blifLine[i].find('='); size_t equal = blifLine[i].find('=');