From 96a864c64e15a892300d7e4b5ce76ee855b464ce Mon Sep 17 00:00:00 2001
From: Daniela Genius <genius@debussy.soc.lip6.fr>
Date: Fri, 20 Dec 2019 15:35:14 +0100
Subject: [PATCH] two minor bugfixes

---
 .../toSysCAMSCluster/ClusterCode.java         | 11 +++++++----
 .../PrimitiveCodeCluster.java                 | 19 ++++++++++---------
 2 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/src/main/java/syscamstranslator/toSysCAMSCluster/ClusterCode.java b/src/main/java/syscamstranslator/toSysCAMSCluster/ClusterCode.java
index cc44de40d8..7362368111 100644
--- a/src/main/java/syscamstranslator/toSysCAMSCluster/ClusterCode.java
+++ b/src/main/java/syscamstranslator/toSysCAMSCluster/ClusterCode.java
@@ -149,14 +149,17 @@ public class ClusterCode {
                                     + "sig_" + nb_con + ";" + CR;
                             names.add("sig_" + nb_con);
                         } else {
-			    if(((SysCAMSTPortConverter) connectors.get(i).get_p1().getComponent()).getNbits()==0){
+			    // System.out.println("***@@@"+ connectors.get(i).get_p1().getComponent().getName());
+			    //System.out.println("***@@@"+ connectors.get(i).get_p1().getComponent().getDEType());
+			    if(((SysCAMSTPortDE) connectors.get(i).get_p1().getComponent()).getNbits()==0){//DG 20.12. Converter ->DE
+				
                             corpsCluster = corpsCluster + "\tsc_core::sc_signal<" + ((SysCAMSTPortConverter) connectors.get(i).get_p2().getComponent()).getConvType() + "> " 
                                     + connectors.get(i).getName() + ";" + CR;
                             names.add(connectors.get(i).getName());
 			}
 			else{
-
-                            corpsCluster = corpsCluster + "\tsc_core::sc_signal<" + ((SysCAMSTPortConverter) connectors.get(i).get_p2().getComponent()).getConvType() + "<"+ ((SysCAMSTPortConverter) connectors.get(i).get_p1().getComponent()).getNbits()+"> " + "> " 
+//DG 20.12. Converter ->DE
+                            corpsCluster = corpsCluster + "\tsc_core::sc_signal<" + ((SysCAMSTPortConverter) connectors.get(i).get_p2().getComponent()).getConvType() + "<"+ ((SysCAMSTPortDE) connectors.get(i).get_p1().getComponent()).getNbits()+"> " + "> " 
                                     + connectors.get(i).getName() + ";" + CR;
                             names.add(connectors.get(i).getName());
 			    
@@ -214,7 +217,7 @@ public class ClusterCode {
 
 	    	    for (SysCAMSTClock t : clock) {
 		corpsCluster += "sc_clock "+t.getName()+";"+CR;
-		}
+		    }
 	    
 		    
             corpsCluster = corpsCluster + "public:" + CR;
diff --git a/src/main/java/syscamstranslator/toSysCAMSCluster/PrimitiveCodeCluster.java b/src/main/java/syscamstranslator/toSysCAMSCluster/PrimitiveCodeCluster.java
index 9eb00bf451..7d614cd1d1 100644
--- a/src/main/java/syscamstranslator/toSysCAMSCluster/PrimitiveCodeCluster.java
+++ b/src/main/java/syscamstranslator/toSysCAMSCluster/PrimitiveCodeCluster.java
@@ -476,9 +476,9 @@ public class PrimitiveCodeCluster {
 				corpsPrimitiveDE = corpsPrimitiveDE + "\t};" + CR2;
 			}
 
-			//DG 17.10.
-			if(de.getClockName()!="")
-			corpsPrimitiveDE = corpsPrimitiveDE + "\tsc_core::sc_in <bool>"  + de.getClockName() + ";" + CR;			
+			//	DG 17.10.
+				if(de.getClockName()!="")
+				corpsPrimitiveDE = corpsPrimitiveDE + "\tsc_core::sc_in <bool>"  + de.getClockName() + ";" + CR;			
 	       
 	if (!deports.isEmpty()) {
 			   
@@ -526,7 +526,7 @@ if (t.getOrigin() == 0) {
 			if (!deports.isEmpty() || !de.getListStruct().isEmpty()) {
 				corpsPrimitiveDE = corpsPrimitiveDE + "\t: ";
 				if (!deports.isEmpty()) {
-					for (int i = 0; i < deports.size(); i++) {
+				    for (int i = 0; i < deports.size(); i++) {
 						if (deports.size() >= 1) {
 							if (cpt == 0) {
 								corpsPrimitiveDE = corpsPrimitiveDE + deports.get(i).getName() + "(\"" + deports.get(i).getName() + "\")" + CR;
@@ -542,7 +542,8 @@ if (t.getOrigin() == 0) {
 				}
 				String identifier;
 				if (!de.getListStruct().isEmpty()) {
-					for (int i = 0; i < de.getListStruct().size(); i++) {
+				    
+				    for (int i = 0; i < de.getListStruct().getSize(); i++) {
 						String select = de.getListStruct().get(i);
 						String[] splita = select.split(" = ");
 						identifier = splita[0];
@@ -560,10 +561,10 @@ if (t.getOrigin() == 0) {
 					}
 				}
 			}
-
-			//for (SysCAMSTClock t : clock) {
-			   corpsPrimitiveDE = corpsPrimitiveDE + "\t, "+de.getClockName()+"(\""+de.getClockName()+"\")"+CR;
-			   //	}
+		
+			if(de.getClockName()!="")
+			  corpsPrimitiveDE = corpsPrimitiveDE + "\t, "+de.getClockName()+"(\""+de.getClockName()+"\")"+CR;
+		
 			
 			boolean sensitive = false, method = false;
 			if (!de.getCode().equals("")) {
-- 
GitLab