From cf914cbd21a6c986de324919a870fab89ed046b7 Mon Sep 17 00:00:00 2001 From: Andrea Enrici <andrea.enrici@nokia.com> Date: Mon, 27 Apr 2015 09:16:56 +0000 Subject: [PATCH] solved compatibility bug with old versions of models --- bin/config.xml | 2 +- .../ctranslator/CpuMemoryCopyMEC.java | 9 ------- .../ctranslator/SingleDmaMEC.java | 12 --------- src/ui/tmldd/TMLArchiArtifact.java | 27 ++++--------------- src/ui/tmldd/TMLArchiCPNode.java | 8 +++--- src/ui/tmldd/TMLArchiCPUNode.java | 8 +++--- src/ui/tmldd/TMLArchiNode.java | 2 +- 7 files changed, 16 insertions(+), 52 deletions(-) diff --git a/bin/config.xml b/bin/config.xml index 1dd7d29956..49faf2bec0 100755 --- a/bin/config.xml +++ b/bin/config.xml @@ -61,7 +61,7 @@ <ExternalCommand2Host data="localhost"/> <ExternalCommand2 data="/packages/uppaal(4.0.11/uppaal /home/enrici/TURTLE/uppaal/spec.xml"/> -<LastOpenFile data="/home/enrici/embb/trunk/baseband/docs/andreae/Zigbee/models/MYZigbee_final.xml"/> +<LastOpenFile data="/home/enrici/TURTLE/modeling/SmartCardProtocol.xml"/> diff --git a/src/tmltranslator/ctranslator/CpuMemoryCopyMEC.java b/src/tmltranslator/ctranslator/CpuMemoryCopyMEC.java index 5a3109ac5c..063215f0ab 100644 --- a/src/tmltranslator/ctranslator/CpuMemoryCopyMEC.java +++ b/src/tmltranslator/ctranslator/CpuMemoryCopyMEC.java @@ -62,21 +62,12 @@ public class CpuMemoryCopyMEC extends CPMEC { private String memoryBaseAddress = "0"; public CpuMemoryCopyMEC( String ctxName, ArchUnitMEC archMEC, String sizeString ) { - //public CpuMemoryCopyMEC( String ctxName, String pssBaseAddress, String offset, String ddrAddress, String size ) { node_type = "CpuMemoryCopy"; inst_type = "MEMORY_COPY"; inst_decl = "VOID"; buff_type = "MM_BUFFER_TYPE"; buff_init = "VOID"; - /*exec_code = TAB + CR + TAB + - "int i = 0;" + CR + TAB + - "int k = 0;" + CR + TAB + - "for( i = 0 ;i < " + size + "; i += 4, k++ )\t{" + CR + TAB + - TAB + "cpu_mem_write_32( " + pssBaseAddress + " + " + offset + " + i, " + ddrAddress + "[k] );" + CR + TAB + "}" + CR; - - init_code = TAB + "embb_memcpy_ctx_init(&" + ctxName + ");" + CR; - cleanup_code = TAB + archMEC.getCtxCleanupCode() + "(&" + ctxName +");";*/ exec_code = TAB + "embb_mem2ip((EMBB_CONTEXT *)&" + ctxName + ", (uintptr_t) " + memoryBaseAddress + ", /*USER TODO: *SRC */, " + sizeString + " );" + CR; init_code = TAB + archMEC.getCtxInitCode() + "((EMBB_CONTEXT *)&" + ctxName + ", " + "(uintptr_t) " + archMEC.getLocalMemoryPointer() + " );" + CR; cleanup_code = TAB + archMEC.getCtxCleanupCode() + "(&" + ctxName +");"; diff --git a/src/tmltranslator/ctranslator/SingleDmaMEC.java b/src/tmltranslator/ctranslator/SingleDmaMEC.java index 2f73a3b1df..b5b28cdc35 100755 --- a/src/tmltranslator/ctranslator/SingleDmaMEC.java +++ b/src/tmltranslator/ctranslator/SingleDmaMEC.java @@ -125,18 +125,6 @@ public class SingleDmaMEC extends CPMEC { } -// public SingleDmaMEC( String ctxName, String destinationAddress, String sourceAddress, String size ) { -// -// node_type = "SingleDmaMEC"; -// inst_type = "VOID"; -// inst_decl = "EMBB_DMA_CONTEXT"; -// buff_type = "MM_BUFFER_TYPE"; -// buff_init = "VOID"; -// exec_code = TAB + "embb_dma_start(&" + ctxName + ", (uintptr_t) " + sourceAddress + ", (uintptr_t) " + destinationAddress + ", (size_t) " + size + " );" + CR; -// init_code = TAB + "embb_dma_ctx_init(&" + ctxName + ", /*USER TO DO: DMA_DEVICE*/, /*USER TO DO: DST_DEV*/, NULL );" + CR; -// cleanup_code = TAB + "embb_dma_ctx_cleanup(&" + ctxName +");"; -// } - public String getInitCode() { return init_code; } diff --git a/src/ui/tmldd/TMLArchiArtifact.java b/src/ui/tmldd/TMLArchiArtifact.java index bb1b25789e..11976ffbe1 100755 --- a/src/ui/tmldd/TMLArchiArtifact.java +++ b/src/ui/tmldd/TMLArchiArtifact.java @@ -73,7 +73,7 @@ public class TMLArchiArtifact extends TGCWithoutInternalComponent implements Swa protected int priority = 0; // Between 0 and 10 protected String operation = "VOID"; - private ArchUnitMEC fatherArchUnitMECType; + private ArchUnitMEC fatherArchUnitMECType = new CpuMEC(); public TMLArchiArtifact(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); @@ -161,7 +161,6 @@ public class TMLArchiArtifact extends TGCWithoutInternalComponent implements Swa boolean error = false; fatherArchUnitMECType = ((TMLArchiNode)father).getMECType(); - TraceManager.addDev( "Father: " + father.getClass().toString() + " with MEC " + ((TMLArchiNode)father).getMECType() ); JDialogTMLTaskArtifact dialog = new JDialogTMLTaskArtifact(frame, "Setting artifact attributes", this, operation, fatherArchUnitMECType); dialog.setSize(400, 350); GraphicLib.centerOnParent(dialog); @@ -235,8 +234,7 @@ public class TMLArchiArtifact extends TGCWithoutInternalComponent implements Swa sb.append( priority ); sb.append( "\" operation=\"" ); sb.append( operation ); - sb.append( "\" fatherComponentMECType=\"" ); - sb.append( fatherArchUnitMECType.getIndex() ); + sb.append( "\" fatherComponentMECType=\"" + fatherArchUnitMECType.getIndex() ); sb.append( "\" />\n" ); sb.append( "</extraparam>\n" ); return new String(sb); @@ -272,7 +270,9 @@ public class TMLArchiArtifact extends TGCWithoutInternalComponent implements Swa priority = Integer.decode(prio).intValue(); } operation = elt.getAttribute("operation"); - fatherArchUnitMECType = ArchUnitMEC.Types.get( Integer.valueOf( elt.getAttribute("fatherComponentMECType") ) ); + if( (elt.getAttribute("fatherComponentMECType") != null) && (elt.getAttribute("fatherComponentMECType").length() > 0) ) { + fatherArchUnitMECType = ArchUnitMEC.Types.get( Integer.valueOf( elt.getAttribute("fatherComponentMECType") ) ); + } } if (svalue != null) { value = svalue; @@ -317,7 +317,6 @@ public class TMLArchiArtifact extends TGCWithoutInternalComponent implements Swa public OperationMEC getOperationMECOfTask() { - TraceManager.addDev( "Inside getMECofTask, fatherArchUnitMECType: " + fatherArchUnitMECType ); if( fatherArchUnitMECType instanceof FepMEC ) { if( operation.equals( "CWM" ) ) { return new CwmMEC( "", "", "" ); @@ -355,22 +354,6 @@ public class TMLArchiArtifact extends TGCWithoutInternalComponent implements Swa public ArchUnitMEC getArchUnitMEC() { return fatherArchUnitMECType; - /*if( fatherArchUnitMECType instanceof FepMEC ) { - return new FepMEC(); - } - else if( fatherArchUnitMECType instanceof MapperMEC ) { - return new MapperMEC(); - } - else if( fatherArchUnitMECType instanceof InterleaverMEC ) { - return new InterleaverMEC(); - } - else if( fatherArchUnitMECType instanceof AdaifMEC ) { - return new AdaifMEC(); - } - else if( fatherArchUnitMECType instanceof CpuMEC ) { - return new CpuMEC(); - } - return null;*/ } } diff --git a/src/ui/tmldd/TMLArchiCPNode.java b/src/ui/tmldd/TMLArchiCPNode.java index 7a221db7db..a9bbe1b52f 100755 --- a/src/ui/tmldd/TMLArchiCPNode.java +++ b/src/ui/tmldd/TMLArchiCPNode.java @@ -291,9 +291,11 @@ public class TMLArchiCPNode extends TMLArchiCommunicationNode implements Swallow if (elt.getTagName().equals("info")) { sstereotype = elt.getAttribute("stereotype"); snodeName = elt.getAttribute("nodeName"); - cpMEC = elt.getAttribute( "cpMEC" ); - transferType1 = Integer.parseInt(elt.getAttribute( "transferType1" ) ); - transferType2 = Integer.parseInt(elt.getAttribute( "transferType2" ) ); + if( ( elt.getAttribute("cpMEC") != null ) && ( elt.getAttribute("cpMEC").length() > 0 ) ) { + cpMEC = elt.getAttribute( "cpMEC" ); + transferType1 = Integer.parseInt(elt.getAttribute( "transferType1" ) ); + transferType2 = Integer.parseInt(elt.getAttribute( "transferType2" ) ); + } } if (sstereotype != null) { stereotype = sstereotype; diff --git a/src/ui/tmldd/TMLArchiCPUNode.java b/src/ui/tmldd/TMLArchiCPUNode.java index b48e62748d..525e25b0d3 100755 --- a/src/ui/tmldd/TMLArchiCPUNode.java +++ b/src/ui/tmldd/TMLArchiCPUNode.java @@ -193,8 +193,6 @@ public class TMLArchiCPUNode extends TMLArchiNode implements SwallowTGComponent, GraphicLib.centerOnParent(dialog); dialog.show(); // blocked until dialog has been closed MECType = dialog.getMECType(); - TraceManager.addDev( "after JDialog " + MECType ); - TraceManager.addDev( "after JDialog " + MECType.getIndex() ); if (!dialog.isRegularClose()) { return false; @@ -479,7 +477,7 @@ public class TMLArchiCPUNode extends TMLArchiNode implements SwallowTGComponent, sb.append(" execiTime=\"" + execiTime + "\""); sb.append(" execcTime=\"" + execcTime + "\""); sb.append(" clockRatio=\"" + clockRatio + "\""); - sb.append(" MECType=\"" + MECType.getIndex() + "\""); + sb.append(" MECType=\"" + MECType.getIndex() + "\""); sb.append("/>\n"); sb.append("</extraparam>\n"); return new String(sb); @@ -543,7 +541,9 @@ public class TMLArchiCPUNode extends TMLArchiNode implements SwallowTGComponent, if ((elt.getAttribute("clockRatio") != null) && (elt.getAttribute("clockRatio").length() > 0)){ clockRatio = Integer.decode(elt.getAttribute("clockRatio")).intValue(); } - MECType = ArchUnitMEC.Types.get( Integer.valueOf( elt.getAttribute("MECType") ) ); + if ((elt.getAttribute("MECType") != null) && (elt.getAttribute("MECType").length() > 0)){ + MECType = ArchUnitMEC.Types.get( Integer.valueOf( elt.getAttribute("MECType") ) ); + } if ((elt.getAttribute("sliceTime") != null) && (elt.getAttribute("sliceTime").length() > 0)){ sliceTime = Integer.decode(elt.getAttribute("sliceTime")).intValue(); } diff --git a/src/ui/tmldd/TMLArchiNode.java b/src/ui/tmldd/TMLArchiNode.java index a5dbb9fd1b..f88e2a32d2 100755 --- a/src/ui/tmldd/TMLArchiNode.java +++ b/src/ui/tmldd/TMLArchiNode.java @@ -67,7 +67,7 @@ public abstract class TMLArchiNode extends TGCWithInternalComponent implements S public final static int TRANSFER = 1; public final static int CONTROLLER = 2; public final static int OTHER = 3; //for CPNodes - protected ArchUnitMEC MECType; + protected ArchUnitMEC MECType = new CpuMEC(); public TMLArchiNode(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); -- GitLab