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

View File

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

View File

@ -30,50 +30,76 @@
* signal category.
*/
/*! \enum Net::Type::Code
* 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.
*/
//! \enum Net::Type::Code
//! This enumeration defines the signal category inside the Net::Type.
/*! \class Net::Direction
* Encapsulate the Net::Direction::Code enumeration that defines the
* signal direction. This direction is meaningful for external nets only.
*/
//! \var Net::Type::Code Net::Type::UNDEFINED
//! Type undefined.
/*! \enum Net::Direction::Code
* This enumeration defines the signal direction inside the Net::Direction.
*/
/*! \var Net::Direction::Code Net::Direction::UNDEFINED
* Undefined direction.
*/
/*! \var Net::Direction::Code Net::Direction::IN
* There must be no driver 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.
*/
/*! \var Net::Direction::Code Net::Direction::INOUT
* No constraint.
*/
/*! \var Net::Direction::Code Net::Direction::TRISTATE
* Type assigned to logical tri-states signals.
*/
//! \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
//! Encapsulate the Net::Direction::Code enumeration that defines the
//! signal direction. This direction is meaningful for external nets only.
//!
//! \enum Net::Direction::Code
//! 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);

View File

@ -1,7 +1,7 @@
// -*- 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.
//
@ -23,8 +23,7 @@
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// +-----------------------------------------------------------------+
// | 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 |
// | |
@ -32,21 +31,16 @@
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Header : "./hurricane/Commons.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
// +-----------------------------------------------------------------+
#ifndef __HURRICANE_COMMONS__
#define __HURRICANE_COMMONS__
#ifndef HURRICANE_COMMONS_H
#define HURRICANE_COMMONS_H
#include <cstdio>
#include <cassert>
#include <cmath>
#include <tr1/memory>
#include <memory>
#include <string>
#include <list>
#include <set>
@ -58,27 +52,21 @@
#include <sstream>
// x-----------------------------------------------------------------x
// +-----------------------------------------------------------------+
// | Macros Definition |
// x-----------------------------------------------------------------x
// +-----------------------------------------------------------------+
namespace Hurricane {
using namespace std;
class Slot;
// x-------------------------------------------------------------x
// +-------------------------------------------------------------+
// | Tracing/Debugging Utilites |
// x-------------------------------------------------------------x
// +-------------------------------------------------------------+
bool in_trace ();
@ -98,9 +86,9 @@ namespace Hurricane {
// x-------------------------------------------------------------x
// +-------------------------------------------------------------+
// | shared_ptr<> support for DBo |
// x-------------------------------------------------------------x
// +-------------------------------------------------------------+
template<typename DboType>
@ -111,17 +99,17 @@ namespace Hurricane {
template<typename DboType>
class dbo_ptr : public tr1::shared_ptr<DboType> {
class dbo_ptr : public std::shared_ptr<DboType> {
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 |
// x-------------------------------------------------------------x
// +-------------------------------------------------------------+
inline string _TName ( const string& s ) { return s; }
@ -171,9 +159,9 @@ namespace Hurricane {
#include "hurricane/Record.h"
// x-----------------------------------------------------------------x
// +-----------------------------------------------------------------+
// | Functions for Inspector Support |
// x-----------------------------------------------------------------x
// +-----------------------------------------------------------------+
// Note 1: Theses are specialized templates for "getString<>()" & "getRecord<>()".
// 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 |
// x-----------------------------------------------------------------x
#include "hurricane/Slot.h"
#include "hurricane/Tabulation.h"
#endif
#endif // HURRICANE_COMMONS_H

View File

@ -80,7 +80,20 @@ class Net : public Entity {
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;
@ -271,14 +284,23 @@ template<>
inline std::string getString<const Hurricane::Net::Direction::Code*>
( const Hurricane::Net::Direction::Code* object )
{
switch ( *object ) {
case Hurricane::Net::Direction::UNDEFINED: return "UNDEFINED";
case Hurricane::Net::Direction::IN: return "IN";
case Hurricane::Net::Direction::OUT: return "OUT";
case Hurricane::Net::Direction::INOUT: return "INOUT";
case Hurricane::Net::Direction::TRISTATE: return "TRISTATE";
std::ostringstream s;
s << (((*object) & Hurricane::Net::Direction::DirIn ) ? 'i' : '-');
s << (((*object) & Hurricane::Net::Direction::DirOut ) ? 'o' : '-');
s << (((*object) & Hurricane::Net::Direction::ConnTristate) ? 't' : '-');
s << (((*object) & Hurricane::Net::Direction::ConnWiredOr ) ? 'w' : '-');
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<>

View File

@ -1,7 +1,6 @@
// -*- 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.
//
@ -19,12 +18,7 @@
// License along with Hurricane. If not, see
// <http://www.gnu.org/licenses/>.
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// +-----------------------------------------------------------------+
// | 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 |
// | |
@ -32,24 +26,19 @@
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Header : "./hurricane/Record.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
// +-----------------------------------------------------------------+
#ifndef __HURRICANE_RECORD__
#define __HURRICANE_RECORD__
#ifndef HURRICANE_RECORD_H
#define HURRICANE_RECORD_H
#ifndef __HURRICANE_COMMONS__
#ifndef HURRICANE_COMMONS_H
#error "Record.h musn't be included alone, please uses Commons.h."
#endif
namespace Hurricane {
class Slot;
@ -89,9 +78,7 @@ namespace Hurricane {
inline Record::SlotVector& Record::_getSlotVector () { return _slots; }
} // End of Hurricane namespace.
} // Hurricane namespace.
#endif
#endif // HURRICANE_RECORD_H

View File

@ -1,7 +1,6 @@
// -*- 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.
//
@ -19,12 +18,7 @@
// License along with Hurricane. If not, see
// <http://www.gnu.org/licenses/>.
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// +-----------------------------------------------------------------+
// | 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 |
// | |
@ -32,30 +26,22 @@
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Header : "./hurricane/Slot.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
// +-----------------------------------------------------------------+
#ifndef __HURRICANE_SLOT__
#define __HURRICANE_SLOT__
#ifndef HURRICANE_SLOT_H
#define HURRICANE_SLOT_H
#ifndef __HURRICANE_COMMONS__
#ifndef HURRICANE_COMMONS_H
#error "Slot.h musn't be included alone, please uses Commons.h."
#endif
namespace Hurricane {
// -------------------------------------------------------------------
// Class : "Slot".
class Slot {
public:
@ -322,7 +308,7 @@ namespace Hurricane {
{ return new SlotTemplate<Record*>(_name,_data); }
} // End of Hurricane namespace.
} // Hurricane namespace.
template<typename Data>
@ -356,5 +342,4 @@ inline Hurricane::Slot* getSlot( const std::string& name, Data* d )
return new Hurricane::SlotTemplate<Data*> ( name, d );
}
#endif
#endif // HURRICANE_SLOT_H

View File

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

View File

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