From 960610bab26a1e6873400c48fad9a71671a1e13c Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Tue, 6 Nov 2018 12:28:45 +0100 Subject: [PATCH 1/5] Fixed about dialog handling --- com.minres.scviewer.e4.application/Application.e4xmi | 4 +--- .../scviewer/e4/application/handlers/AboutHandler.java | 7 ++++--- .../com/minres/scviewer/e4/application/messages.properties | 2 +- .../minres/scviewer/e4/application/parts/AboutDialog.java | 6 +++--- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/com.minres.scviewer.e4.application/Application.e4xmi b/com.minres.scviewer.e4.application/Application.e4xmi index 8b7c1e3..a222d56 100644 --- a/com.minres.scviewer.e4.application/Application.e4xmi +++ b/com.minres.scviewer.e4.application/Application.e4xmi @@ -32,6 +32,7 @@ + @@ -142,9 +143,6 @@ - - - diff --git a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/AboutHandler.java b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/AboutHandler.java index 6d5db35..b53ec5c 100644 --- a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/AboutHandler.java +++ b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/AboutHandler.java @@ -12,6 +12,7 @@ package com.minres.scviewer.e4.application.handlers; import org.eclipse.e4.core.di.annotations.Execute; import org.eclipse.e4.ui.model.application.MApplication; +import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.eclipse.e4.ui.model.application.ui.basic.MWindow; import org.eclipse.e4.ui.workbench.modeling.EModelService; import org.eclipse.swt.widgets.Shell; @@ -22,9 +23,9 @@ public class AboutHandler { @Execute public void execute(Shell shell, MApplication app, MWindow window, EModelService ms /*@Named("mdialog01.dialog.0") MDialog dialog*/) { - MWindow dialog = (MWindow) ms.find(DIALOG_ID, app); //$NON-NLS-1$ - dialog.setToBeRendered(true); - dialog.setToBeRendered(false); + MPart mel = (MPart) ms.find(DIALOG_ID, app); //$NON-NLS-1$ + mel.setToBeRendered(true); + mel.setToBeRendered(false); } } diff --git a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/messages.properties b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/messages.properties index ae08425..5485315 100644 --- a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/messages.properties +++ b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/messages.properties @@ -1,5 +1,5 @@ AboutDialog_0=\nSCViewer - a SystemC waveform viewer\n\nVersion: 2.0\n -AboutDialog_1=\nCopyright (c) 2015, 2018 MINRES Technologies GmbH and others.\n\nAll rights reserved. MINRES and the MINRES logo are trademarks of MINRES Technologies GmbH, http://www.minres.com/. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html\n\nParts of the software are governed by the Apache License Version 2.0 available at http://www.apache.org/licenses/. These are namely org.mapdb and org.sqlite JDBC driver\n\nSources code is hosted at https://git.minres.com/VP/SCViewer and the master branch is mirrored to GitHub: https://git.com/minres/SCViewer\n +AboutDialog_1=\nCopyright (c) 2015, 2018 MINRES Technologies GmbH and others.\n\nAll rights reserved. MINRES and the MINRES logo are trademarks of MINRES Technologies GmbH, http://www.minres.com/. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html\n\nParts of the software are governed by the Apache License Version 2.0 available at http://www.apache.org/licenses/. These are namely org.mapdb and org.sqlite JDBC driver\n\nSource code is hosted at https://git.minres.com/VP/SCViewer and the master branch is mirrored to GitHub: https://git.com/minres/SCViewer\n DesignBrowser_12=Append all after DesignBrowser_16=Insert all before DesignBrowser_2=Enter text to filter waveforms diff --git a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/AboutDialog.java b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/AboutDialog.java index 8b0745c..691e378 100644 --- a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/AboutDialog.java +++ b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/AboutDialog.java @@ -75,7 +75,7 @@ public class AboutDialog extends Dialog { Composite composite = new Composite(parent, SWT.NONE); GridData gd_composite = new GridData(SWT.LEFT, SWT.FILL, true, true); gd_composite.widthHint = 600; - gd_composite.heightHint =250; + gd_composite.heightHint =300; composite.setLayoutData(gd_composite); composite.setLayout(new GridLayout(2, false)); @@ -86,7 +86,7 @@ public class AboutDialog extends Dialog { Canvas canvas = new Canvas(composite,SWT.NO_REDRAW_RESIZE); GridData gd_canvas = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); gd_canvas.widthHint = 200; - gd_canvas.heightHint =250; + gd_canvas.heightHint =300; canvas.setLayoutData(gd_canvas); canvas.addPaintListener(new PaintListener() { public void paintControl(PaintEvent e) { @@ -97,7 +97,7 @@ public class AboutDialog extends Dialog { } }); - StyledText styledText = new StyledText(composite, SWT.BORDER); + StyledText styledText = new StyledText(composite, SWT.V_SCROLL | SWT.BORDER); styledText.setEditable(false); GridData gd_styledText = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1); styledText.setLayoutData(gd_styledText); From b332eca891fc9ce5880a502fa4f4a25f57706c2f Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Tue, 6 Nov 2018 12:28:45 +0100 Subject: [PATCH 2/5] Fixed about dialog handling --- com.minres.scviewer.e4.application/Application.e4xmi | 4 +--- .../scviewer/e4/application/handlers/AboutHandler.java | 7 ++++--- .../com/minres/scviewer/e4/application/messages.properties | 2 +- .../minres/scviewer/e4/application/parts/AboutDialog.java | 6 +++--- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/com.minres.scviewer.e4.application/Application.e4xmi b/com.minres.scviewer.e4.application/Application.e4xmi index 8b7c1e3..a222d56 100644 --- a/com.minres.scviewer.e4.application/Application.e4xmi +++ b/com.minres.scviewer.e4.application/Application.e4xmi @@ -32,6 +32,7 @@ + @@ -142,9 +143,6 @@ - - - diff --git a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/AboutHandler.java b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/AboutHandler.java index 6d5db35..b53ec5c 100644 --- a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/AboutHandler.java +++ b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/AboutHandler.java @@ -12,6 +12,7 @@ package com.minres.scviewer.e4.application.handlers; import org.eclipse.e4.core.di.annotations.Execute; import org.eclipse.e4.ui.model.application.MApplication; +import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.eclipse.e4.ui.model.application.ui.basic.MWindow; import org.eclipse.e4.ui.workbench.modeling.EModelService; import org.eclipse.swt.widgets.Shell; @@ -22,9 +23,9 @@ public class AboutHandler { @Execute public void execute(Shell shell, MApplication app, MWindow window, EModelService ms /*@Named("mdialog01.dialog.0") MDialog dialog*/) { - MWindow dialog = (MWindow) ms.find(DIALOG_ID, app); //$NON-NLS-1$ - dialog.setToBeRendered(true); - dialog.setToBeRendered(false); + MPart mel = (MPart) ms.find(DIALOG_ID, app); //$NON-NLS-1$ + mel.setToBeRendered(true); + mel.setToBeRendered(false); } } diff --git a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/messages.properties b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/messages.properties index ae08425..5485315 100644 --- a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/messages.properties +++ b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/messages.properties @@ -1,5 +1,5 @@ AboutDialog_0=\nSCViewer - a SystemC waveform viewer\n\nVersion: 2.0\n -AboutDialog_1=\nCopyright (c) 2015, 2018 MINRES Technologies GmbH and others.\n\nAll rights reserved. MINRES and the MINRES logo are trademarks of MINRES Technologies GmbH, http://www.minres.com/. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html\n\nParts of the software are governed by the Apache License Version 2.0 available at http://www.apache.org/licenses/. These are namely org.mapdb and org.sqlite JDBC driver\n\nSources code is hosted at https://git.minres.com/VP/SCViewer and the master branch is mirrored to GitHub: https://git.com/minres/SCViewer\n +AboutDialog_1=\nCopyright (c) 2015, 2018 MINRES Technologies GmbH and others.\n\nAll rights reserved. MINRES and the MINRES logo are trademarks of MINRES Technologies GmbH, http://www.minres.com/. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html\n\nParts of the software are governed by the Apache License Version 2.0 available at http://www.apache.org/licenses/. These are namely org.mapdb and org.sqlite JDBC driver\n\nSource code is hosted at https://git.minres.com/VP/SCViewer and the master branch is mirrored to GitHub: https://git.com/minres/SCViewer\n DesignBrowser_12=Append all after DesignBrowser_16=Insert all before DesignBrowser_2=Enter text to filter waveforms diff --git a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/AboutDialog.java b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/AboutDialog.java index 8b0745c..691e378 100644 --- a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/AboutDialog.java +++ b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/AboutDialog.java @@ -75,7 +75,7 @@ public class AboutDialog extends Dialog { Composite composite = new Composite(parent, SWT.NONE); GridData gd_composite = new GridData(SWT.LEFT, SWT.FILL, true, true); gd_composite.widthHint = 600; - gd_composite.heightHint =250; + gd_composite.heightHint =300; composite.setLayoutData(gd_composite); composite.setLayout(new GridLayout(2, false)); @@ -86,7 +86,7 @@ public class AboutDialog extends Dialog { Canvas canvas = new Canvas(composite,SWT.NO_REDRAW_RESIZE); GridData gd_canvas = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); gd_canvas.widthHint = 200; - gd_canvas.heightHint =250; + gd_canvas.heightHint =300; canvas.setLayoutData(gd_canvas); canvas.addPaintListener(new PaintListener() { public void paintControl(PaintEvent e) { @@ -97,7 +97,7 @@ public class AboutDialog extends Dialog { } }); - StyledText styledText = new StyledText(composite, SWT.BORDER); + StyledText styledText = new StyledText(composite, SWT.V_SCROLL | SWT.BORDER); styledText.setEditable(false); GridData gd_styledText = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1); styledText.setLayoutData(gd_styledText); From dbe5d603ed0318ca82afbfdabab35ff0843606a5 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Thu, 14 Mar 2019 19:27:58 +0100 Subject: [PATCH 3/5] Fixed EOFException so that partial gzip files get loaded --- .../com/minres/scviewer/database/text/TextDbLoader.groovy | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/TextDbLoader.groovy b/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/TextDbLoader.groovy index 9d9c1cd..c915e0e 100644 --- a/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/TextDbLoader.groovy +++ b/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/TextDbLoader.groovy @@ -84,7 +84,11 @@ public class TextDbLoader implements IWaveformDbLoader{ calculateConcurrencyIndicees() return true } - } catch(Exception e) { } + } catch(EOFException e) { + return true; + } catch(Exception e) { + e.printStackTrace() + } return false; } From a49842a11961241de300471ec09d9fe82cc9b61a Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Thu, 14 Mar 2019 19:28:38 +0100 Subject: [PATCH 4/5] Added logic to keep the same element revealed in transaction details view --- .../application/parts/TransactionDetails.java | 38 ++++++++++++++++--- 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/TransactionDetails.java b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/TransactionDetails.java index 99b997e..03afe51 100644 --- a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/TransactionDetails.java +++ b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/TransactionDetails.java @@ -29,9 +29,11 @@ import org.eclipse.jface.viewers.IDoubleClickListener; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.ITreeViewerListener; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.StyledString; +import org.eclipse.jface.viewers.TreeExpansionEvent; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.jface.viewers.TreeViewerColumn; import org.eclipse.jface.viewers.Viewer; @@ -51,6 +53,7 @@ import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Tree; +import org.eclipse.swt.widgets.TreeItem; import com.minres.scviewer.database.ITx; import com.minres.scviewer.database.ITxAttribute; @@ -129,6 +132,19 @@ public class TransactionDetails { treeViewer.addFilter(attributeFilter); treeViewer.setComparator(viewSorter); treeViewer.setAutoExpandLevel(2); + treeViewer.addTreeListener(new ITreeViewerListener() { + + @Override + public void treeCollapsed(TreeExpansionEvent event) { + treeViewer.getSelection(); + } + + @Override + public void treeExpanded(TreeExpansionEvent event) { + treeViewer.getSelection(); + } + + }); // Set up the table Tree tree = treeViewer.getTree(); @@ -247,6 +263,21 @@ public class TransactionDetails { this.waveformViewerPart=part; } + public void setInput(Object object) { + if(object instanceof ITx){ + TreeItem obj = treeViewer.getTree().getTopItem(); + Rectangle bounds = null; + if(obj!=null) bounds=obj.getBounds(); + treeViewer.setInput(object); + if(bounds!=null) { + TreeItem ti = treeViewer.getTree().getItem (new Point(bounds.x, bounds.y)); + treeViewer.getTree().setTopItem(ti); + } + } else { + treeViewer.setInput(null); + } + + } /** * Sets the selection. * @@ -256,12 +287,7 @@ public class TransactionDetails { public void setSelection(@Named(IServiceConstants.ACTIVE_SELECTION) @Optional IStructuredSelection selection){ if(treeViewer!=null && selection!=null && !treeViewer.getTree().isDisposed()){ if( selection instanceof IStructuredSelection) { - Object object= ((IStructuredSelection)selection).getFirstElement(); - if(object instanceof ITx){ - treeViewer.setInput(object); - } else { - treeViewer.setInput(null); - } + setInput(((IStructuredSelection)selection).getFirstElement()); } } } From b78d8bea45d49601a7f595916cc8eefc9f054f7e Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Thu, 14 Mar 2019 20:51:02 +0100 Subject: [PATCH 5/5] Fixed format detection bug and adapted VCD loader to Arteris specifics --- .../scviewer/database/vcd/VCDDbLoader.java | 41 +++++++++++-------- .../scviewer/database/vcd/VCDFileParser.java | 27 ++++++++++-- 2 files changed, 49 insertions(+), 19 deletions(-) diff --git a/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDDbLoader.java b/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDDbLoader.java index fbbd8f4..d0a93bd 100644 --- a/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDDbLoader.java +++ b/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDDbLoader.java @@ -13,6 +13,8 @@ package com.minres.scviewer.database.vcd; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; import java.util.Collection; import java.util.Collections; import java.util.List; @@ -20,6 +22,7 @@ import java.util.NavigableMap; import java.util.Stack; import java.util.TreeMap; import java.util.Vector; +import java.util.zip.GZIPInputStream; import com.minres.scviewer.database.BitVector; import com.minres.scviewer.database.ISignal; @@ -56,8 +59,20 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder { public VCDDbLoader() { } - /** The date bytes. */ - private byte[] dateBytes = "$date".getBytes(); + private static boolean isGzipped(File f) { + InputStream is = null; + try { + is = new FileInputStream(f); + byte [] signature = new byte[2]; + int nread = is.read( signature ); //read the gzip signature + return nread == 2 && signature[ 0 ] == (byte) 0x1f && signature[ 1 ] == (byte) 0x8b; + } catch (IOException e) { + return false; + } finally { + try { is.close();} catch (IOException e) { } + } + } + /* (non-Javadoc) * @see com.minres.scviewer.database.ITrDb#load(java.io.File) @@ -67,22 +82,16 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder { public boolean load(IWaveformDb db, File file) throws Exception { this.db=db; this.maxTime=0; - try { - FileInputStream fis = new FileInputStream(file); - byte[] buffer = new byte[dateBytes.length]; - int read = fis.read(buffer, 0, dateBytes.length); - fis.close(); - if (read == dateBytes.length) - for (int i = 0; i < dateBytes.length; i++) - if (buffer[i] != dateBytes[i]) - return false; - } catch(FileNotFoundException e) { + String name = file.getCanonicalFile().getName(); + if(!(name.endsWith(".vcd") || + name.endsWith(".vcdz") || + name.endsWith(".vcdgz") || + name.endsWith(".vcd.gz")) ) return false; - } - signals = new Vector(); - moduleStack= new Stack(); - boolean res = new VCDFileParser(false).load(new FileInputStream(file), this); + moduleStack= new Stack(); + FileInputStream fis = new FileInputStream(file); + boolean res = new VCDFileParser(false).load(isGzipped(file)?new GZIPInputStream(fis):fis, this); moduleStack=null; if(!res) throw new InputFormatException(); // calculate max time of database diff --git a/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDFileParser.java b/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDFileParser.java index d1cf505..cd41817 100644 --- a/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDFileParser.java +++ b/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDFileParser.java @@ -22,10 +22,12 @@ class VCDFileParser { private HashMap nameToNetMap = new HashMap(); private long picoSecondsPerIncrement; private boolean stripNetWidth; + private boolean replaceColon; long currentTime; public VCDFileParser(boolean stripNetWidth) { this.stripNetWidth=stripNetWidth; + this.replaceColon=false; } public boolean load(InputStream is, IVCDDatabaseBuilder builder) { @@ -76,11 +78,17 @@ class VCDFileParser { } Integer net = nameToNetMap.get(id); - if (net == null) { - // We've never seen this net before + if (net == null) { // We've never seen this net before + int openBracket = netName.indexOf('['); if(stripNetWidth){ - int openBracket = netName.indexOf('['); if (openBracket != -1) netName = netName.substring(0, openBracket); + openBracket = -1; + } + if(replaceColon) { + if (openBracket != -1) { + netName = netName.substring(0, openBracket).replaceAll(":", ".")+netName.substring(openBracket); + } else + netName=netName.replaceAll(":", "."); } nameToNetMap.put(id, traceBuilder.newNet(netName, -1, width)); } else { @@ -89,6 +97,17 @@ class VCDFileParser { } } + private void parseComment() throws Exception { + nextToken(); + String s = tokenizer.sval; + nextToken(); + while(!tokenizer.sval.equals("$end")){ + s+=" "+tokenizer.sval; + nextToken(); + } + replaceColon|=s.contains("ARTERIS Architecture"); + } + private void parseTimescale() throws Exception { nextToken(); String s = tokenizer.sval; @@ -132,6 +151,8 @@ class VCDFileParser { parseUpscope(); else if (tokenizer.sval.equals("$timescale")) parseTimescale(); + else if (tokenizer.sval.equals("$comment")) + parseComment(); else if (tokenizer.sval.equals("$enddefinitions")) { match("$end"); return false;