From 710ad11452f97161fda1b2a6ebddf7d325aafc50 Mon Sep 17 00:00:00 2001 From: Christophe Alexandre Date: Mon, 9 Dec 2002 15:03:28 +0000 Subject: [PATCH] -bugs, prise en compte des cellules multi-sorties, +doc ... --- alliance/src/a2sdf/configure.in | 3 ++- alliance/src/a2sdf/doc/Makefile.am | 4 +++ alliance/src/a2sdf/doc/a2sdf.1 | 39 +++++++++++++++++++++++++++ alliance/src/a2sdf/src/A2Sdf.cpp | 12 ++++----- alliance/src/a2sdf/src/A2Sdf.h | 7 +++-- alliance/src/a2sdf/src/TimingCell.cpp | 8 +++--- alliance/src/a2sdf/src/a2sdf.cpp | 23 ++++++++++++---- 7 files changed, 78 insertions(+), 18 deletions(-) create mode 100644 alliance/src/a2sdf/doc/Makefile.am create mode 100644 alliance/src/a2sdf/doc/a2sdf.1 diff --git a/alliance/src/a2sdf/configure.in b/alliance/src/a2sdf/configure.in index db61f7cc..b2b40159 100644 --- a/alliance/src/a2sdf/configure.in +++ b/alliance/src/a2sdf/configure.in @@ -11,7 +11,7 @@ AC_SUBST(A2SDF_VERSION) # For automake. VERSION=$A2SDF_VERSION -PACKAGE=emmaus +PACKAGE=a2sdf dnl Initialize automake stuff AM_INIT_AUTOMAKE($PACKAGE, $VERSION) @@ -32,4 +32,5 @@ AM_ALLIANCE AC_OUTPUT([ Makefile src/Makefile +doc/Makefile ]) diff --git a/alliance/src/a2sdf/doc/Makefile.am b/alliance/src/a2sdf/doc/Makefile.am new file mode 100644 index 00000000..677ca920 --- /dev/null +++ b/alliance/src/a2sdf/doc/Makefile.am @@ -0,0 +1,4 @@ +## Process this file with automake to produce Makefile.in + +man_MANS = a2sdf.1 +EXTRA_DIST = $(man_MANS) diff --git a/alliance/src/a2sdf/doc/a2sdf.1 b/alliance/src/a2sdf/doc/a2sdf.1 new file mode 100644 index 00000000..bc39a271 --- /dev/null +++ b/alliance/src/a2sdf/doc/a2sdf.1 @@ -0,0 +1,39 @@ +.pl -.4 +.TH A2SDF 1 "December 09, 2002" "ASIM/LIP6" "CAO\-VLSI Reference Manual" +.SH NAME +.TP +a2sdf + - alliance to sdf format converter +.so man1/alc_origin.1 +.SH SYNOPSIS +.TP +\fBa2sdf\fP +[\fBoptions\fP] \fIcells_dir\fP \fIoutputname\fP +.br + +.SH DESCRIPTION +\fBa2sdf\fP translates the SXLIB library to the SDF format. Please refer to +http://www.eda.org/sdf/ for more information on SDF format. +.br +Only the SXLIB library has got timing informations at the moment, so it's +the only library we are able to convert. +.br +\fBcells directory\fP +.br +The path to the SXLIB cells directory. +.br +\fBoutput name\fP +.br +Just the name of the file containing the timing information in sdf format. +It should be named with a .sdf extension. +.br + +.SH OPTIONS +.PP +\fB-v[ersion]\fP displays the tool's version. +.br +\fB-h[elp]\fP displays a small help message. +.br +\fB-V[erbose]\fP sets the verbose mode on. +.br +.so man1/alc_bug_report.1 diff --git a/alliance/src/a2sdf/src/A2Sdf.cpp b/alliance/src/a2sdf/src/A2Sdf.cpp index c02a2e0f..144ad6f1 100644 --- a/alliance/src/a2sdf/src/A2Sdf.cpp +++ b/alliance/src/a2sdf/src/A2Sdf.cpp @@ -42,6 +42,12 @@ A2Sdf::CreateTimingCell(const char* name) befig_list* befig = vhdlloadbefig(NULL,const_cast(name),0/*don't dump message*/); assert(befig); + + if (_verbose) + { + cout << " o Treating cell: " << name << endl; + } + list outs; for (const bepor_list* bepor=befig->BEPOR; bepor; bepor=bepor->NEXT) { @@ -52,12 +58,6 @@ A2Sdf::CreateTimingCell(const char* name) } } - if (outs.size() > 1) - { - cerr << name << endl; - return; - } - for (list::const_iterator lit = outs.begin(); lit != outs.end(); lit++) diff --git a/alliance/src/a2sdf/src/A2Sdf.h b/alliance/src/a2sdf/src/A2Sdf.h index b15c11e6..613ba2c5 100644 --- a/alliance/src/a2sdf/src/A2Sdf.h +++ b/alliance/src/a2sdf/src/A2Sdf.h @@ -10,11 +10,14 @@ class A2Sdf public: typedef list TimingCells; private: + bool _verbose; const char* _fileName; TimingCells _timingCells; public: - A2Sdf(const char* filename): - _fileName(filename), _timingCells() + A2Sdf(const char* filename, bool verbose) + : _verbose(verbose) + , _fileName(filename) + , _timingCells() {} ~A2Sdf(); diff --git a/alliance/src/a2sdf/src/TimingCell.cpp b/alliance/src/a2sdf/src/TimingCell.cpp index 814af972..cc3e9746 100644 --- a/alliance/src/a2sdf/src/TimingCell.cpp +++ b/alliance/src/a2sdf/src/TimingCell.cpp @@ -12,10 +12,10 @@ IOPath* TimingCell::AddIOPath(const char* input, const char* output) { IOPathKey key(input, output); - IOPath* ioPath = _ioPaths[key]; - if (ioPath) - return ioPath; - ioPath = new IOPath(input, output); + IOPaths::iterator ioPathIt; + if ((ioPathIt = _ioPaths.find(key)) != _ioPaths.end()) + return ioPathIt->second; + IOPath* ioPath = new IOPath(input, output); _ioPaths[key] = ioPath; return ioPath; } diff --git a/alliance/src/a2sdf/src/a2sdf.cpp b/alliance/src/a2sdf/src/a2sdf.cpp index 62580a1d..4b574135 100644 --- a/alliance/src/a2sdf/src/a2sdf.cpp +++ b/alliance/src/a2sdf/src/a2sdf.cpp @@ -10,7 +10,7 @@ using namespace std; static void version(void) { cout << "a2sdf(" PACKAGE ") " VERSION << endl; - cout << "The " PACKAGE " package comes with NO WARRANTY" << endl; + cout << "ALLIANCE " << ALLIANCE_VERSION << endl; } int @@ -18,20 +18,22 @@ main(int argc, char** argv) { int showUsage = 0; int showVersion = 0; + int verbose = 0; const char* cellsDir = NULL; const char* sdfFileName = NULL; poptOption options[] = { { "help", 'h', POPT_ARG_NONE, &showUsage, 0, "print this message", 0}, { "version", 'v', POPT_ARG_NONE, &showVersion, 0, "print the version information", 0}, + { "Verbose", 'V', POPT_ARG_NONE, &verbose, 0, "verbose mode", 0}, { 0, 0, 0, 0, 0, 0, 0 } }; poptContext context = poptGetContext("a2sdf", argc, (const char**)argv, options, 0); - poptSetOtherOptionHelp(context, " "); + poptSetOtherOptionHelp(context, " -hvV "); if (int rc = poptGetNextOpt(context) < -1) { - cerr << "simann: bad argument " << poptBadOption(context, POPT_BADOPTION_NOALIAS) << ": " << poptStrerror(rc) << endl; + cerr << "a2sdf: bad argument " << poptBadOption(context, POPT_BADOPTION_NOALIAS) << ": " << poptStrerror(rc) << endl; cerr << "Try `" << argv[0] << " --help' for more information" << endl; return 1; } @@ -74,12 +76,14 @@ main(int argc, char** argv) return 1; } - A2Sdf a2sdf(sdfFileName); + A2Sdf a2sdf(sdfFileName, verbose); int extensionlength = strlen(EXTENSION); struct dirent* entry = NULL; + bool cellFound = false; + while ((entry = readdir (dir)) != NULL) { char* filename = entry->d_name; @@ -89,12 +93,21 @@ main(int argc, char** argv) /* is extension of filename accepted */ if (strncmp (filename + filenamelength - extensionlength, EXTENSION, extensionlength)) continue; + cellFound = true; string cellName(filename); cellName.erase( cellName.find(EXTENSION)); a2sdf.CreateTimingCell(cellName.c_str()); } - a2sdf.Dump(); + if (cellFound) + a2sdf.Dump(); + else + { + cerr << " o Error: No cell to convert in: " + << cellsDir << endl; + return 1; + } + return 0; }