This commit is contained in:
Christophe Alexandre 2003-12-01 12:28:03 +00:00
parent 5a7d0ffe4e
commit 3aa90432c0
13 changed files with 0 additions and 603 deletions

View File

@ -1,3 +0,0 @@
## Process this file with automake to produce Makefile.in
SUBDIRS = src doc

View File

@ -1,36 +0,0 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(src/IOPath.cpp)
A2SDF_MAJOR_VERSION=0
A2SDF_MINOR_VERSION=9b
A2SDF_VERSION=$A2SDF_MAJOR_VERSION.$A2SDF_MINOR_VERSION
AC_SUBST(A2SDF_MAJOR_VERSION)
AC_SUBST(A2SDF_MINOR_VERSION)
AC_SUBST(A2SDF_VERSION)
# For automake.
VERSION=$A2SDF_VERSION
PACKAGE=a2sdf
dnl Initialize automake stuff
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
dnl Checks for programs.
AC_PROG_CXX
AC_PROG_RANLIB
AC_PROG_MAKE_SET
dnl Checks for libraries.
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AM_PATH_POPT
AM_ALLIANCE
AC_OUTPUT([
Makefile
src/Makefile
doc/Makefile
])

View File

@ -1,4 +0,0 @@
## Process this file with automake to produce Makefile.in
man_MANS = a2sdf.1
EXTRA_DIST = $(man_MANS)

View File

@ -1,39 +0,0 @@
.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

View File

@ -1,56 +0,0 @@
dnl AM_PATH_POPT([ACTION-IF-FOUND])
dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
AC_DEFUN(AM_PATH_POPT,[
AC_ARG_WITH(popt-prefix,
[ --with-popt-prefix=PFX Prefix where popt is installed (optional)],
popt_prefix="$withval", popt_prefix="")
if test x$popt_prefix != x ; then
POPT_CFLAGS="-I$popt_prefix/include"
POPT_LIBS="-L$popt_prefix/lib -lpopt"
else
POPT_CFLAGS=""
POPT_LIBS="-lpopt"
fi
AC_MSG_CHECKING(for popt library)
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $POPT_CFLAGS"
LIBS="$POPT_LIBS $LIBS"
AC_TRY_RUN([
#include <popt.h>
int main(int argc, const char** argv)
{
struct poptOption options[] = {
POPT_AUTOHELP
{ NULL, 0, 0, NULL, 0 }
};
poptContext context = poptGetContext("popt-test", argc, argv, options, 0);
poptGetNextOpt(context);
return 0;
}
],, no_popt=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
if test "x$no_popt" = x ; then
AC_MSG_RESULT(yes)
ifelse([$1], , :, [$1])
else
AC_MSG_RESULT(no)
AC_MSG_ERROR([This version of $PACKAGE requires libpopt:
ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.1.x/])
POPT_CFLAGS=""
POPT_LIBS=""
dnl ifelse([$2], , :, [$2])
fi
AC_SUBST(POPT_CFLAGS)
AC_SUBST(POPT_LIBS)
])

View File

@ -1,123 +0,0 @@
#include "A2Sdf.h"
#include <mut.h>
#include <abl.h>
#include <mlo.h>
#include <mlu.h>
#include <abe.h>
#include <abv.h>
/*for inputs to output: Tphl_i_t */
#define Tphl "tphl"
#define Tpll "tpll"
#define Tplh "tplh"
#define Tphh "tphh"
/*for flip-flop*/
#define Tsr "tsr" /* tsr_i_ck */
#define Tsf "tsf" /* tsf_i_ck */
#define Thr "thr" /* thr_i_ck */
#define Thf "thf" /* thf_i_ck */
#define Tar "tar" /* tar_ck_q */
#define Taf "taf" /* taf_ck_q */
A2Sdf::~A2Sdf()
{
for (TimingCells::iterator it = _timingCells.begin();
it != _timingCells.end();
it++)
{
delete *it;
}
}
void
A2Sdf::CreateTimingCell(const char* name)
{
char* Thl, *Tll, *Tlh, *Thh, *tar, *taf;
TimingCell* timingCell = new TimingCell(name);
_timingCells.push_back(timingCell);
befig_list* befig = vhdlloadbefig(NULL,const_cast<char*>(name),0/*don't dump message*/);
assert(befig);
if (_verbose)
{
cout << " o Treating cell: " << name << endl;
}
list<const char*> outs;
for (const bepor_list* bepor=befig->BEPOR; bepor; bepor=bepor->NEXT)
{
if (isvdd(bepor->NAME) || isvss(bepor->NAME)) continue;
if (bepor->DIRECTION == OUT || bepor->DIRECTION == INOUT)
{
outs.push_back(bepor->NAME);
}
}
for (list<const char*>::const_iterator lit = outs.begin();
lit != outs.end();
lit++)
{
const char* output = *lit;
for (const bepor_list* bepor=befig->BEPOR; bepor; bepor=bepor->NEXT)
{
char* newCon = bepor->NAME;
if (newCon == output) continue;
if (isvdd(newCon) || isvss(newCon)) continue;
if (bepor->DIRECTION == IN || bepor->DIRECTION == INOUT)
{
char memo=SEPAR;
SEPAR='_';
Thl=concatname(Tphl,newCon);
Tll=concatname(Tpll,newCon);
Thh=concatname(Tphh,newCon);
Tlh=concatname(Tplh,newCon);
tar=concatname(Tar,newCon);
taf=concatname(Taf,newCon);
Thl=concatname(Thl,output);
Tll=concatname(Tll,output);
Thh=concatname(Thh,output);
Tlh=concatname(Tlh,output);
tar=concatname(tar,output);
taf=concatname(taf,output);
SEPAR=memo;
for (const begen_list* begen=befig->BEGEN; begen; begen=begen->NEXT)
{
if (begen->NAME==Tlh || begen->NAME==Thh)
{
IOPath* ioPath = timingCell->AddIOPath(newCon, output);
ioPath->CreateRisingPath(*(int*)begen->VALUE);
}
if (begen->NAME==Thl || begen->NAME==Tll)
{
IOPath* ioPath = timingCell->AddIOPath(newCon, output);
ioPath->CreateFallingPath(*(int*)begen->VALUE);
}
}
}
}
}
}
void
A2Sdf::Dump() const
{
ofstream out(_fileName);
out << "(DELAYFILE" << endl
<< " (SDFVERSION \"3.0\")" << endl
<< " (VENDOR \"ASIM/LIP6\")" << endl
<< " (VERSION \"1.0b\")" << endl
<< " (TIMESCALE 1 ps)" << endl;
for (TimingCells::const_iterator it = _timingCells.begin();
it != _timingCells.end();
it++)
{
(*it)->Dump(out);
}
out << ")" << endl;
}

View File

@ -1,28 +0,0 @@
#ifndef __A2SDF_H
#define __A2SDF_H
#include <list>
#include "TimingCell.h"
using namespace std;
class A2Sdf
{
public:
typedef list<TimingCell*> TimingCells;
private:
bool _verbose;
const char* _fileName;
TimingCells _timingCells;
public:
A2Sdf(const char* filename, bool verbose)
: _verbose(verbose)
, _fileName(filename)
, _timingCells()
{}
~A2Sdf();
void CreateTimingCell(const char* name);
void Dump() const;
};
#endif /* __A2SDF_H */

View File

@ -1,58 +0,0 @@
#include "IOPath.h"
IOPath::~IOPath()
{
if (_risingPath)
delete _risingPath;
if (_fallingPath)
delete _fallingPath;
}
void
IOPath::CreateRisingPath(const int value)
{
if (!_risingPath)
_risingPath = new TimePath(value);
else
_risingPath->PutValue(value);
}
void
IOPath::CreateFallingPath(const int value)
{
if (!_fallingPath)
_fallingPath = new TimePath(value);
else
_fallingPath->PutValue(value);
}
ofstream&
IOPath::Dump(ofstream& out) const
{
out << " (IOPATH "
<< _input
<< " "
<< _output
<< " ";
if (_risingPath)
{
out << "(" << _risingPath->GetWorstValue()
<< "::"
<< _risingPath->GetBestValue()
<< ") ";
}
else
out << "() ";
if (_fallingPath)
{
out << "(" << _fallingPath->GetWorstValue()
<< "::"
<< _fallingPath->GetBestValue()
<< ") ";
}
else
out << "() ";
out << ")" << endl;
return out;
}

View File

@ -1,47 +0,0 @@
#ifndef __IO_PATH_H
#define __IO_PATH_H
#include <fstream>
using namespace std;
class TimePath
{
friend class IOPath;
private:
int _worstValue;
int _bestValue;
TimePath(const int value):
_worstValue(value), _bestValue(value)
{}
void PutValue(const int value)
{
if (value < _worstValue)
_worstValue = value;
else
if (value > _bestValue)
_bestValue = value;
}
int GetWorstValue() const { return _worstValue; }
int GetBestValue() const { return _bestValue; }
};
class IOPath
{
private:
const char* _input;
const char* _output;
TimePath* _risingPath;
TimePath* _fallingPath;
public:
IOPath(const char* input, const char* output):
_input(input), _output(output),
_risingPath(NULL), _fallingPath(NULL)
{}
~IOPath();
void CreateRisingPath(const int value);
void CreateFallingPath(const int value);
ofstream& Dump(ofstream& out) const;
};
#endif /* __IO_PATH_H */

View File

@ -1,16 +0,0 @@
## Process this file with automake to produce Makefile.in
AM_CXXFLAGS = @ALLIANCE_CFLAGS@ @POPT_CFLAGS@
bin_PROGRAMS = a2sdf
a2sdf_SOURCES = IOPath.cpp IOPath.h \
TimingCell.cpp TimingCell.h \
A2Sdf.cpp A2Sdf.h \
a2sdf.cpp
a2sdf_LDADD = @ALLIANCE_LIBS@ @POPT_LIBS@ \
-lAbv -lAbe -lAbt -lMlu \
-lMcl -lMal -lMsl -lMhl \
-lMel -lMvl -lMgl -lRcn \
-lMlo -lBdd -lAbl -lAut -lMut

View File

@ -1,42 +0,0 @@
#include "TimingCell.h"
TimingCell::~TimingCell()
{
for (IOPaths::iterator it = _ioPaths.begin();
it != _ioPaths.end();
it++)
delete it->second;
}
IOPath*
TimingCell::AddIOPath(const char* input, const char* output)
{
IOPathKey key(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;
}
ofstream&
TimingCell::Dump(ofstream& out)
{
if (_ioPaths.empty())
return out;
out << " (CELL" << endl
<< " (CELLTYPE \"" << _cellName << "\")" << endl
<< " (DELAY" << endl
<< " (ABSOLUTE" << endl;
for (IOPaths::iterator it = _ioPaths.begin();
it != _ioPaths.end();
it++)
{
it->second->Dump(out);
}
out << " )" << endl
<< " )" << endl
<< " )" << endl;
return out;
}

View File

@ -1,38 +0,0 @@
#ifndef __TIMING_CELL_H
#define __TIMING_CELL_H
#include <string>
#include <iostream>
#include <fstream>
#include <map>
#include "IOPath.h"
using namespace std;
struct CompIoPaths
{
bool operator()(const pair<const char*, const char*> p1,
const pair<const char*, const char*> p2) const
{
return (((int)(p1.first) < (int)(p2.first))
|| ((int)(p1.second) < (int)(p2.second)));
}
};
class TimingCell
{
public:
typedef pair<const char*, const char*> IOPathKey;
typedef map<IOPathKey, IOPath*, CompIoPaths> IOPaths;
private:
string _cellName;
IOPaths _ioPaths;
public:
TimingCell(const char* name):
_cellName(name), _ioPaths()
{}
~TimingCell();
IOPath* AddIOPath(const char* input, const char* output);
ofstream& Dump(ofstream& out);
};
#endif /* __TIMING_CELL_H */

View File

@ -1,113 +0,0 @@
#include <dirent.h>
#include <iostream>
#include <popt.h>
#include "mut.h"
#include "A2Sdf.h"
using namespace std;
#define EXTENSION ".vbe"
static void version(void)
{
cout << "a2sdf(" PACKAGE ") " VERSION << endl;
cout << "ALLIANCE " << ALLIANCE_VERSION << endl;
}
int
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, " -hvV <cellsdir> <sdffilename> ");
if (int rc = poptGetNextOpt(context) < -1)
{
cerr << "a2sdf: bad argument " << poptBadOption(context, POPT_BADOPTION_NOALIAS) << ": " << poptStrerror(rc) << endl;
cerr << "Try `" << argv[0] << " --help' for more information" << endl;
return 1;
}
if (showVersion)
{
version();
return 0;
}
if (showUsage)
{
version();
cout << endl;
poptPrintHelp(context, stdout, 0);
return 0;
}
if ((cellsDir = poptGetArg(context)) == 0 || poptPeekArg(context) == 0)
{
poptPrintUsage(context, stderr, 0);
return 1;
}
if ((sdfFileName = poptGetArg(context)) == 0 || poptPeekArg(context) != 0)
{
poptPrintUsage(context, stderr, 0);
return 1;
}
poptFreeContext(context);
alliancebanner ("A2Sdf", VERSION, "Alliance to SDF format translator", "2002", ALLIANCE_VERSION);
DIR* dir = opendir (cellsDir);
if (!dir)
{
cerr << "No directory " << cellsDir << endl;
return 1;
}
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;
int filenamelength = strlen (filename);
if (filenamelength <= extensionlength) continue;
/* 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());
}
if (cellFound)
a2sdf.Dump();
else
{
cerr << " o Error: No cell to convert in: "
<< cellsDir << endl;
return 1;
}
return 0;
}