Adding support for WOR_BIT in Net::Direction.

Modificate Alliance vst parser/drivers so now the wor_bit and wor_vector
are correctly loaded and written back (instead of degenrated into INOUT).
This commit is contained in:
Jean-Paul Chaput 2014-05-13 17:11:48 +02:00
parent dda3f99fd8
commit 724d92f816
9 changed files with 175 additions and 178 deletions

View File

@ -151,20 +151,16 @@ unsigned FindIndex(const string& stringtosearch, string::size_type openpar)
return atoi(numberString.c_str()); return atoi(numberString.c_str());
} }
string getNetDirection(const Net* net) { string getNetDirection(const Net* net)
switch (net->getDirection()) { {
case Net::Direction::UNDEFINED: switch ( net->getDirection() & Net::Direction::INOUT ) {
return ("linkage"); case Net::Direction::UNDEFINED: return "linkage";
case Net::Direction::IN: case Net::Direction::IN: return "in";
return ("in"); case Net::Direction::OUT: return "out";
case Net::Direction::OUT: case Net::Direction::INOUT: return "inout";
case Net::Direction::TRISTATE: default:
return ("out"); throw Error( "Unrecognized direction" );
case Net::Direction::INOUT: }
return ("inout");
default:
throw Error("Unrecognized direction");
}
} }
typedef vector<string*> StringPtVector; typedef vector<string*> StringPtVector;
@ -233,10 +229,9 @@ void DumpPortList(ofstream &ccell, Cell* cell)
} }
Net* net1 = snmit->second; Net* net1 = snmit->second;
string bitType; string bitType;
if (net1->getDirection() == Net::Direction::TRISTATE) if (net1->getDirection() & Net::Direction::ConnTristate) bitType = " mux_bit bus";
bitType = " mux_bit bus"; else if (net1->getDirection() & Net::Direction::ConnWiredOr ) bitType = " wor_bit bus";
else else bitType = " bit";
bitType = " bit";
if (string1OpenPar == string::npos) if (string1OpenPar == string::npos)
{ {
@ -298,13 +293,15 @@ void DumpPortList(ofstream &ccell, Cell* cell)
string name = string(*string1, 0, string1OpenPar); string name = string(*string1, 0, string1OpenPar);
string vectorType; string vectorType;
string busType; string busType;
if (net1->getDirection() == Net::Direction::TRISTATE) if (net1->getDirection() & Net::Direction::ConnTristate) {
{ vectorType = " mux_vector(";
vectorType = " mux_vector("; busType = " bus";
busType = " bus"; } else if (net1->getDirection() & Net::Direction::ConnWiredOr) {
} vectorType = " wor_vector(";
else busType = " bus";
vectorType = " bit_vector("; } else
vectorType = " bit_vector(";
vectorizedNetsString.push_back( vectorizedNetsString.push_back(
" " " "
+ name + name

View File

@ -45,7 +45,6 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <string> #include <string>
#include <sstream> #include <sstream>
#include <map> #include <map>
@ -500,11 +499,7 @@ formal_port_element
{ if ( !__ys->_firstPass ) { { if ( !__ys->_firstPass ) {
Net::Direction modeDirection = (Net::Direction::Code)$4; Net::Direction modeDirection = (Net::Direction::Code)$4;
Net::Direction typeDirection = (Net::Direction::Code)$5; Net::Direction typeDirection = (Net::Direction::Code)$5;
Net::Direction direction; Net::Direction direction = (Net::Direction::Code)(modeDirection | typeDirection);
if ( typeDirection != Net::Direction::UNDEFINED )
direction = typeDirection;
else
direction = modeDirection;
for ( unsigned int i=0 ; i < __ys->_identifiersList.size() ; i++ ) { for ( unsigned int i=0 ; i < __ys->_identifiersList.size() ; i++ ) {
if ( __ys->_constraint.IsSet() ) { if ( __ys->_constraint.IsSet() ) {
int j; int j;
@ -1056,19 +1051,19 @@ type_convertion
; ;
type_mark type_mark
: BIT { $$ = Net::Direction::UNDEFINED; } : BIT { $$ = Net::Direction::UNDEFINED; }
| WOR_BIT { $$ = Net::Direction::UNDEFINED; } | WOR_BIT { $$ = Net::Direction::ConnWiredOr; }
| MUX_BIT { $$ = Net::Direction::TRISTATE; } | MUX_BIT { $$ = Net::Direction::ConnTristate; }
| BIT_VECTOR { $$ = Net::Direction::UNDEFINED; } | BIT_VECTOR { $$ = Net::Direction::UNDEFINED; }
| WOR_VECTOR { $$ = Net::Direction::UNDEFINED; } | WOR_VECTOR { $$ = Net::Direction::ConnWiredOr; }
| MUX_VECTOR { $$ = Net::Direction::TRISTATE; } | MUX_VECTOR { $$ = Net::Direction::ConnTristate; }
| INTEGER { $$ = Net::Direction::UNDEFINED; } | INTEGER { $$ = Net::Direction::UNDEFINED; }
| NATURAL { $$ = Net::Direction::UNDEFINED; } | NATURAL { $$ = Net::Direction::UNDEFINED; }
| NATURAL_VECTOR { $$ = Net::Direction::UNDEFINED; } | NATURAL_VECTOR { $$ = Net::Direction::UNDEFINED; }
| POSITIVE { $$ = Net::Direction::UNDEFINED; } | POSITIVE { $$ = Net::Direction::UNDEFINED; }
| STRING { $$ = Net::Direction::UNDEFINED; } | STRING { $$ = Net::Direction::UNDEFINED; }
| _LIST { $$ = Net::Direction::UNDEFINED; } | _LIST { $$ = Net::Direction::UNDEFINED; }
| ARG { $$ = Net::Direction::UNDEFINED; } | ARG { $$ = Net::Direction::UNDEFINED; }
; ;
.BUS. .BUS.

View File

@ -30,50 +30,76 @@
* signal category. * signal category.
*/ */
/*! \enum Net::Type::Code //! \enum Net::Type::Code
* This enumeration defines the signal category inside the Net::Type. //! This enumeration defines the signal category inside the Net::Type.
*/
/*! \var Net::Type::Code Net::Type::UNDEFINED
* Type undefined.
*/
/*! \var Net::Type::Code Net::Type::LOGICAL
* Type assigned to ordinary signals.
*/
/*! \var Net::Type::Code Net::Type::CLOCK
* Type assigned to clock signals.
*/
/*! \var Net::Type::Code Net::Type::POWER
* Type assigned to supply signals.
*/
/*! \var Net::Type::Code Net::Type::GROUND
* Type assigned to supply signals.
*/
/*! \class Net::Direction //! \var Net::Type::Code Net::Type::UNDEFINED
* Encapsulate the Net::Direction::Code enumeration that defines the //! Type undefined.
* signal direction. This direction is meaningful for external nets only.
*/
/*! \enum Net::Direction::Code //! \var Net::Type::Code Net::Type::LOGICAL
* This enumeration defines the signal direction inside the Net::Direction. //! Type assigned to ordinary signals.
*/
/*! \var Net::Direction::Code Net::Direction::UNDEFINED //! \var Net::Type::Code Net::Type::CLOCK
* Undefined direction. //! Type assigned to clock signals.
*/
/*! \var Net::Direction::Code Net::Direction::IN //! \var Net::Type::Code Net::Type::POWER
* There must be no driver inside and a single permanent driver //! Type assigned to supply signals.
* outside.
*/ //! \var Net::Type::Code Net::Type::GROUND
/*! \var Net::Direction::Code Net::Direction::OUT //! Type assigned to supply signals.
* There must be no driver outside and a single permanent driver
* inside. //! \class Net::Direction
*/ //! Encapsulate the Net::Direction::Code enumeration that defines the
/*! \var Net::Direction::Code Net::Direction::INOUT //! signal direction. This direction is meaningful for external nets only.
* No constraint. //!
*/
/*! \var Net::Direction::Code Net::Direction::TRISTATE //! \enum Net::Direction::Code
* Type assigned to logical tri-states signals. //! This enumeration defines the signal direction inside the Net::Direction.
*/ //! It is build upon two kind of atomic flags, one telling were the sources
//! and sinks are located regarding the Cell and the other indicating the
//! nature of the driver (normal, tristate, wired-or).
//!
//! \var Net::Direction::Code Net::Direction::DirUndefined
//! Undefined direction (<em>atomic</em>).
//!
//! \var Net::Direction::Code Net::Direction::DirIn
//! There is at least one sink on this net (<em>atomic</em>).
//!
//! \var Net::Direction::Code Net::Direction::DirOut
//! There is at least one source on this net (<em>atomic</em>).
//!
//! \var Net::Direction::Code Net::Direction::ConnTristate
//! The sources are <b>tristates</b>, this a bus (<em>atomic</em>).
//!
//! \var Net::Direction::Code Net::Direction::ConnWiredOr
//! The sources are <b>wired or</b>, this a bus (<em>atomic</em>).
//!
//! \var Net::Direction::Code Net::Direction::UNDEFINED
//! Undefined direction.
//!
//! \var Net::Direction::Code Net::Direction::IN
//! There must be only sinks inside and a single permanent driver
//! outside.
//!
//! \var Net::Direction::Code Net::Direction::OUT
//! There must be no driver outside and a single permanent driver
//! inside (and no sinks inside).
//!
//! \var Net::Direction::Code Net::Direction::INOUT
//! There must be one permanent driver inside withs at least one
//! sink inside.
//!
//! \var Net::Direction::Code Net::Direction::TRISTATE
//! An OUT signal with a tristate driver (bus).
//!
//! \var Net::Direction::Code Net::Direction::TRANSCV
//! An INOUT signal with a tristate driver (bus).
//!
//! \var Net::Direction::Code Net::Direction::WOR_OUT
//! An OUT signal with a wired-or driver (bus).
//!
//! \var Net::Direction::Code Net::Direction::WOR_INOUT
//! An INOUT signal with a wired-or driver (bus).
/*! \function Net* Net::create(Cell* cell, const Name& name); /*! \function Net* Net::create(Cell* cell, const Name& name);

View File

@ -1,7 +1,7 @@
// -*- C++ -*- // -*- C++ -*-
// //
// Copyright (c) BULL S.A. 2000-2009, All Rights Reserved // Copyright (c) BULL S.A. 2000-2014, All Rights Reserved
// //
// This file is part of Hurricane. // This file is part of Hurricane.
// //
@ -23,8 +23,7 @@
// //
// $Id$ // $Id$
// //
// x-----------------------------------------------------------------x // +-----------------------------------------------------------------+
// | |
// | H U R R I C A N E | // | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e | // | V L S I B a c k e n d D a t a - B a s e |
// | | // | |
@ -32,21 +31,16 @@
// | E-mail : Jean-Paul.Chaput@lip6.fr | // | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== | // | =============================================================== |
// | C++ Header : "./hurricane/Commons.h" | // | C++ Header : "./hurricane/Commons.h" |
// | *************************************************************** | // +-----------------------------------------------------------------+
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __HURRICANE_COMMONS__ #ifndef HURRICANE_COMMONS_H
#define __HURRICANE_COMMONS__ #define HURRICANE_COMMONS_H
#include <cstdio> #include <cstdio>
#include <cassert> #include <cassert>
#include <cmath> #include <cmath>
#include <memory>
#include <tr1/memory>
#include <string> #include <string>
#include <list> #include <list>
#include <set> #include <set>
@ -58,27 +52,21 @@
#include <sstream> #include <sstream>
// +-----------------------------------------------------------------+
// x-----------------------------------------------------------------x
// | Macros Definition | // | Macros Definition |
// x-----------------------------------------------------------------x // +-----------------------------------------------------------------+
namespace Hurricane { namespace Hurricane {
using namespace std; using namespace std;
class Slot; class Slot;
// +-------------------------------------------------------------+
// x-------------------------------------------------------------x
// | Tracing/Debugging Utilites | // | Tracing/Debugging Utilites |
// x-------------------------------------------------------------x // +-------------------------------------------------------------+
bool in_trace (); bool in_trace ();
@ -98,9 +86,9 @@ namespace Hurricane {
// x-------------------------------------------------------------x // +-------------------------------------------------------------+
// | shared_ptr<> support for DBo | // | shared_ptr<> support for DBo |
// x-------------------------------------------------------------x // +-------------------------------------------------------------+
template<typename DboType> template<typename DboType>
@ -111,17 +99,17 @@ namespace Hurricane {
template<typename DboType> template<typename DboType>
class dbo_ptr : public tr1::shared_ptr<DboType> { class dbo_ptr : public std::shared_ptr<DboType> {
public: public:
dbo_ptr ( DboType* dbo ) : tr1::shared_ptr<DboType>(dbo,DboDestroy<DboType>()) { } dbo_ptr ( DboType* dbo ) : std::shared_ptr<DboType>(dbo,DboDestroy<DboType>()) { }
}; };
// x-------------------------------------------------------------x // +-------------------------------------------------------------+
// | Miscellaneous Utilites | // | Miscellaneous Utilites |
// x-------------------------------------------------------------x // +-------------------------------------------------------------+
inline string _TName ( const string& s ) { return s; } inline string _TName ( const string& s ) { return s; }
@ -171,9 +159,9 @@ namespace Hurricane {
#include "hurricane/Record.h" #include "hurricane/Record.h"
// x-----------------------------------------------------------------x // +-----------------------------------------------------------------+
// | Functions for Inspector Support | // | Functions for Inspector Support |
// x-----------------------------------------------------------------x // +-----------------------------------------------------------------+
// Note 1: Theses are specialized templates for "getString<>()" & "getRecord<>()". // Note 1: Theses are specialized templates for "getString<>()" & "getRecord<>()".
// Note 2: we are outside the Hurricane namespace. // Note 2: we are outside the Hurricane namespace.
@ -750,11 +738,8 @@ inline Hurricane::Record* getRecord ( const std::multiset<Element,Compare>* s )
// | Classes Neededs in All Hurricane Modules | // | Classes Neededs in All Hurricane Modules |
// x-----------------------------------------------------------------x // x-----------------------------------------------------------------x
#include "hurricane/Slot.h" #include "hurricane/Slot.h"
#include "hurricane/Tabulation.h" #include "hurricane/Tabulation.h"
#endif // HURRICANE_COMMONS_H
#endif

View File

@ -80,7 +80,20 @@ class Net : public Entity {
public: class Direction { public: class Direction {
// ******************** // ********************
public: enum Code {UNDEFINED=0, IN=1, OUT=2, INOUT=3, TRISTATE=4}; public: enum Code { DirUndefined = 0x0000
, DirIn = 0x0001
, DirOut = 0x0002
, ConnTristate = 0x0100
, ConnWiredOr = 0x0200
, UNDEFINED = DirUndefined
, IN = DirIn
, OUT = DirOut
, INOUT = DirIn | DirOut
, TRISTATE = DirOut | ConnTristate
, TRANSCV = DirIn | DirOut | ConnTristate
, WOR_OUT = DirOut | ConnWiredOr
, WOR_INOUT = DirIn | DirOut | ConnWiredOr
};
private: Code _code; private: Code _code;
@ -271,14 +284,23 @@ template<>
inline std::string getString<const Hurricane::Net::Direction::Code*> inline std::string getString<const Hurricane::Net::Direction::Code*>
( const Hurricane::Net::Direction::Code* object ) ( const Hurricane::Net::Direction::Code* object )
{ {
switch ( *object ) { std::ostringstream s;
case Hurricane::Net::Direction::UNDEFINED: return "UNDEFINED"; s << (((*object) & Hurricane::Net::Direction::DirIn ) ? 'i' : '-');
case Hurricane::Net::Direction::IN: return "IN"; s << (((*object) & Hurricane::Net::Direction::DirOut ) ? 'o' : '-');
case Hurricane::Net::Direction::OUT: return "OUT"; s << (((*object) & Hurricane::Net::Direction::ConnTristate) ? 't' : '-');
case Hurricane::Net::Direction::INOUT: return "INOUT"; s << (((*object) & Hurricane::Net::Direction::ConnWiredOr ) ? 'w' : '-');
case Hurricane::Net::Direction::TRISTATE: return "TRISTATE";
switch ( (int)*object ) {
case Hurricane::Net::Direction::UNDEFINED: s << " (UNDEFINED)"; break;
case Hurricane::Net::Direction::IN: s << " (IN)"; break;
case Hurricane::Net::Direction::OUT: s << " (OUT)"; break;
case Hurricane::Net::Direction::INOUT: s << " (INOUT)"; break;
case Hurricane::Net::Direction::TRISTATE: s << " (TRISTATE)"; break;
case Hurricane::Net::Direction::TRANSCV: s << " (TRANSCV)"; break;
case Hurricane::Net::Direction::WOR_OUT: s << " (WOR_OUT)"; break;
case Hurricane::Net::Direction::WOR_INOUT: s << " (WOR_INOUT)"; break;
} }
return "ABNORMAL"; return s.str();
} }
template<> template<>

View File

@ -1,7 +1,6 @@
// -*- C++ -*- // -*- C++ -*-
// //
// Copyright (c) BULL S.A. 2000-2009, All Rights Reserved // Copyright (c) BULL S.A. 2000-2014, All Rights Reserved
// //
// This file is part of Hurricane. // This file is part of Hurricane.
// //
@ -19,12 +18,7 @@
// License along with Hurricane. If not, see // License along with Hurricane. If not, see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
// //
// =================================================================== // +-----------------------------------------------------------------+
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | H U R R I C A N E | // | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e | // | V L S I B a c k e n d D a t a - B a s e |
// | | // | |
@ -32,24 +26,19 @@
// | E-mail : Jean-Paul.Chaput@lip6.fr | // | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== | // | =============================================================== |
// | C++ Header : "./hurricane/Record.h" | // | C++ Header : "./hurricane/Record.h" |
// | *************************************************************** | // +-----------------------------------------------------------------+
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __HURRICANE_RECORD__ #ifndef HURRICANE_RECORD_H
#define __HURRICANE_RECORD__ #define HURRICANE_RECORD_H
#ifndef HURRICANE_COMMONS_H
#ifndef __HURRICANE_COMMONS__
#error "Record.h musn't be included alone, please uses Commons.h." #error "Record.h musn't be included alone, please uses Commons.h."
#endif #endif
namespace Hurricane { namespace Hurricane {
class Slot; class Slot;
@ -89,9 +78,7 @@ namespace Hurricane {
inline Record::SlotVector& Record::_getSlotVector () { return _slots; } inline Record::SlotVector& Record::_getSlotVector () { return _slots; }
} // End of Hurricane namespace. } // Hurricane namespace.
#endif // HURRICANE_RECORD_H
#endif

View File

@ -1,7 +1,6 @@
// -*- C++ -*- // -*- C++ -*-
// //
// Copyright (c) BULL S.A. 2000-2009, All Rights Reserved // Copyright (c) BULL S.A. 2000-2014, All Rights Reserved
// //
// This file is part of Hurricane. // This file is part of Hurricane.
// //
@ -19,12 +18,7 @@
// License along with Hurricane. If not, see // License along with Hurricane. If not, see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
// //
// =================================================================== // +-----------------------------------------------------------------+
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | H U R R I C A N E | // | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e | // | V L S I B a c k e n d D a t a - B a s e |
// | | // | |
@ -32,30 +26,22 @@
// | E-mail : Jean-Paul.Chaput@lip6.fr | // | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== | // | =============================================================== |
// | C++ Header : "./hurricane/Slot.h" | // | C++ Header : "./hurricane/Slot.h" |
// | *************************************************************** | // +-----------------------------------------------------------------+
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __HURRICANE_SLOT__ #ifndef HURRICANE_SLOT_H
#define __HURRICANE_SLOT__ #define HURRICANE_SLOT_H
#ifndef HURRICANE_COMMONS_H
#ifndef __HURRICANE_COMMONS__
#error "Slot.h musn't be included alone, please uses Commons.h." #error "Slot.h musn't be included alone, please uses Commons.h."
#endif #endif
namespace Hurricane { namespace Hurricane {
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Class : "Slot". // Class : "Slot".
class Slot { class Slot {
public: public:
@ -322,7 +308,7 @@ namespace Hurricane {
{ return new SlotTemplate<Record*>(_name,_data); } { return new SlotTemplate<Record*>(_name,_data); }
} // End of Hurricane namespace. } // Hurricane namespace.
template<typename Data> template<typename Data>
@ -356,5 +342,4 @@ inline Hurricane::Slot* getSlot( const std::string& name, Data* d )
return new Hurricane::SlotTemplate<Data*> ( name, d ); return new Hurricane::SlotTemplate<Data*> ( name, d );
} }
#endif // HURRICANE_SLOT_H
#endif

View File

@ -17,12 +17,12 @@
// not, see <http://www.gnu.org/licenses/>. // not, see <http://www.gnu.org/licenses/>.
// **************************************************************************************************** // ****************************************************************************************************
#ifndef HURRICANE_TABULATION #ifndef HURRICANE_TABULATION_H
#define HURRICANE_TABULATION #define HURRICANE_TABULATION_H
#include "hurricane/Commons.h" #include "hurricane/Commons.h"
#ifndef __HURRICANE_SLOT__ #ifndef HURRICANE_SLOT_H
#error "Tabulation.h must be included after Commons.h" #error "Tabulation.h must be included after Commons.h"
#endif #endif
@ -96,7 +96,7 @@ INSPECTOR_PV_SUPPORT(Hurricane::Tabulation);
// Generic functions // Generic functions
// **************************************************************************************************** // ****************************************************************************************************
#endif // HURRICANE_TABULATION #endif // HURRICANE_TABULATION_H
// **************************************************************************************************** // ****************************************************************************************************

View File

@ -32,8 +32,8 @@
namespace Hurricane { namespace Hurricane {
class RawDrawingStyle; class RawDrawingStyle;
typedef std::tr1::shared_ptr<RawDrawingStyle> DrawingStyle; typedef std::shared_ptr<RawDrawingStyle> DrawingStyle;
typedef std::vector <DrawingStyle> DrawingStyles; typedef std::vector <DrawingStyle> DrawingStyles;
class DrawingGroup { class DrawingGroup {