]> AND Private Git Repository - blast.git/blobdiff - AbstractInterface.cpp
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
modif in VHDLConverter
[blast.git] / AbstractInterface.cpp
index e651f583583e507f0b198288088bcd629114e909..76654ff84ec03669c748138dd6b0e1ef448f7aa5 100644 (file)
@@ -10,10 +10,12 @@ AbstractInterface::AbstractInterface(AbstractBlock* _owner) {
   direction = Input;
   purpose = Data;  
   type = Boolean;
   direction = Input;
   purpose = Data;  
   type = Boolean;
+  endianess = LittleEndian;
+  associatedIface = NULL;
 
 }
 
 
 }
 
-AbstractInterface::AbstractInterface(AbstractBlock* _owner, const QString& _name, const QString& _type, const QString& _width, int _direction, int _purpose) {
+AbstractInterface::AbstractInterface(AbstractBlock* _owner, const QString& _name, int _direction, int _purpose, const QString& _type, const QString& _width, int _endianess) {
 
   owner = _owner;  
   name = _name;
 
   owner = _owner;  
   name = _name;
@@ -21,6 +23,8 @@ AbstractInterface::AbstractInterface(AbstractBlock* _owner, const QString& _name
   direction = _direction;
   purpose = _purpose;
   type = typeFromString(_type);
   direction = _direction;
   purpose = _purpose;
   type = typeFromString(_type);
+  endianess = _endianess;
+  associatedIface = NULL;
 }
 
 AbstractInterface::AbstractInterface(AbstractInterface* other) {
 }
 
 AbstractInterface::AbstractInterface(AbstractInterface* other) {
@@ -30,6 +34,8 @@ AbstractInterface::AbstractInterface(AbstractInterface* other) {
   width = other->width;
   direction = other->direction;
   purpose = other->purpose;
   width = other->width;
   direction = other->direction;
   purpose = other->purpose;
+  endianess = LittleEndian;
+  associatedIface = NULL;
 }
 
 AbstractInterface::~AbstractInterface() {
 }
 
 AbstractInterface::~AbstractInterface() {
@@ -48,23 +54,42 @@ bool AbstractInterface::isGroupInterface() {
   return false;
 }
 
   return false;
 }
 
+QString AbstractInterface::getEndianessString() {
+  QString str="unknown";
+  switch(endianess){
+  case AbstractInterface::LittleEndian:
+    str = QString("little");
+    break;
+  case AbstractInterface::BigEndian:
+    str = QString("big");
+    break;
+  }
+  return str;
+}
+
 QString AbstractInterface::getPurposeString() {
 QString AbstractInterface::getPurposeString() {
-    QString str;
-    switch(purpose){
-        case AbstractInterface::Data:
-            str = QString("data");
-            break;
-        case AbstractInterface::Clock:
-            str = QString("clock");
-            break;
-        case AbstractInterface::Reset:
-            str = QString("reset");
-            break;
-        case AbstractInterface::Wishbone:
-            str = QString("wishbone");
-            break;
-    }
-    return str;
+  QString str;
+  switch(purpose){
+  case AbstractInterface::AnyPurpose:
+    str = QString("any");
+    break;
+  case AbstractInterface::Data:
+    str = QString("data");
+    break;
+  case AbstractInterface::Control:
+    str = QString("control");
+    break;
+  case AbstractInterface::Clock:
+    str = QString("clock");
+    break;
+  case AbstractInterface::Reset:
+    str = QString("reset");
+    break;
+  case AbstractInterface::Wishbone:
+    str = QString("wishbone");
+    break;
+  }
+  return str;
 }
 
 QString AbstractInterface::getDirectionString() {
 }
 
 QString AbstractInterface::getDirectionString() {
@@ -126,14 +151,29 @@ void AbstractInterface::setDirection(int _direction) {
   }
 }
 
   }
 }
 
+bool AbstractInterface::setAssociatedIface(AbstractInterface* iface) {
+  if (purpose != Control) return false;
+  if (iface->purpose != Data) return false;
+  associatedIface = iface;
+  iface->associatedIface = this;  
+  return true;
+}
+
 
 int AbstractInterface::getIntDirection(QString str) {
     if(str == "input") return Input;
     if(str == "output") return Output;
 
 int AbstractInterface::getIntDirection(QString str) {
     if(str == "input") return Input;
     if(str == "output") return Output;
-    if(str == "inOut") return InOut;
+    if(str == "inout") return InOut;
     return -1;
 }
 
     return -1;
 }
 
+int AbstractInterface::getIntPurpose(QString str) {
+    if(str == "data") return Data;
+    else if(str == "clock") return Clock;
+    else if(str == "reset") return Reset;
+    else if(str == "wishbone") return Wishbone;
+    return -1;
+}
 
 QString AbstractInterface::getTypeString() {
 
 
 QString AbstractInterface::getTypeString() {
 
@@ -151,7 +191,7 @@ QString AbstractInterface::getTypeString() {
 
 int AbstractInterface::typeFromString(const QString &_type) {
 
 
 int AbstractInterface::typeFromString(const QString &_type) {
 
-  int ret;
+  int ret = Expression; // default type
   if (_type == "expression") {
     ret = Expression;
   }
   if (_type == "expression") {
     ret = Expression;
   }
@@ -161,6 +201,9 @@ int AbstractInterface::typeFromString(const QString &_type) {
   else if (_type == "natural") {
     ret = Natural;
   }
   else if (_type == "natural") {
     ret = Natural;
   }
+  else if (_type == "inherited") {
+    ret = Inherited;
+  }
   return ret;
 }
 
   return ret;
 }