Merge branch 'feature/real_signal_support' into develop
This commit is contained in:
commit
c4b16338a8
|
@ -45,6 +45,7 @@ $var wire 1 aaabd s_gpio_29 $end
|
||||||
$var wire 1 aaabe s_gpio_30 $end
|
$var wire 1 aaabe s_gpio_30 $end
|
||||||
$var wire 1 aaabf s_gpio_31 $end
|
$var wire 1 aaabf s_gpio_31 $end
|
||||||
$var wire 1 aaabg s_rst_n $end
|
$var wire 1 aaabg s_rst_n $end
|
||||||
|
$var real 1 bbbbb a_real $end
|
||||||
$scope module i_platform $end
|
$scope module i_platform $end
|
||||||
$var wire 1 aaabh erst_n $end
|
$var wire 1 aaabh erst_n $end
|
||||||
$var wire 64 aabdc s_tlclk [63:0] $end
|
$var wire 64 aabdc s_tlclk [63:0] $end
|
||||||
|
@ -1621,6 +1622,7 @@ b1110100011010100101001010 aabdd
|
||||||
0aabdv
|
0aabdv
|
||||||
0aabdw
|
0aabdw
|
||||||
0aabdx
|
0aabdx
|
||||||
|
r0.0 bbbbb
|
||||||
$end
|
$end
|
||||||
|
|
||||||
#10000
|
#10000
|
||||||
|
@ -1641,6 +1643,7 @@ $end
|
||||||
|
|
||||||
#1287121272
|
#1287121272
|
||||||
b1000000000100000000000000000100 aabcr
|
b1000000000100000000000000000100 aabcr
|
||||||
|
r1.0 bbbbb
|
||||||
|
|
||||||
#1288121272
|
#1288121272
|
||||||
b111111110100111110 aaabi
|
b111111110100111110 aaabi
|
||||||
|
@ -1656,33 +1659,43 @@ b11000000000100000000000000000100 aabcr
|
||||||
b111111110100111110 aabcw
|
b111111110100111110 aabcw
|
||||||
b101010 aabdb
|
b101010 aabdb
|
||||||
b111111110100111110 aabdc
|
b111111110100111110 aabdc
|
||||||
|
r2.0 bbbbb
|
||||||
|
|
||||||
#1303801016
|
#1303801016
|
||||||
b1000 aaacx
|
b1000 aaacx
|
||||||
|
r3.0 bbbbb
|
||||||
|
|
||||||
#1311382718
|
#1311382718
|
||||||
b100000000 aabcu
|
b100000000 aabcu
|
||||||
|
r2.0 bbbbb
|
||||||
|
|
||||||
#1312689908
|
#1312689908
|
||||||
b1000000010111110001 aabct
|
b1000000010111110001 aabct
|
||||||
|
r1.0 bbbbb
|
||||||
|
|
||||||
#1315304288
|
#1315304288
|
||||||
b10000000000000000000010111110001 aabct
|
b10000000000000000000010111110001 aabct
|
||||||
|
r0.0 bbbbb
|
||||||
|
|
||||||
#1317395792
|
#1317395792
|
||||||
b101011 aabdb
|
b101011 aabdb
|
||||||
|
r-1.0 bbbbb
|
||||||
|
|
||||||
#1345892534
|
#1345892534
|
||||||
b101100 aabdb
|
b101100 aabdb
|
||||||
|
r-2.0 bbbbb
|
||||||
|
|
||||||
#1375173590
|
#1375173590
|
||||||
b101101 aabdb
|
b101101 aabdb
|
||||||
|
r-3.0 bbbbb
|
||||||
|
|
||||||
#1404454646
|
#1404454646
|
||||||
b101110 aabdb
|
b101110 aabdb
|
||||||
|
r-2.0 bbbbb
|
||||||
|
|
||||||
#1437918710
|
#1437918710
|
||||||
b101111 aabdb
|
b101111 aabdb
|
||||||
|
r-1.0 bbbbb
|
||||||
|
|
||||||
#1443670346
|
#1443670346
|
||||||
b11111111010100 aaabi
|
b11111111010100 aaabi
|
||||||
|
@ -1697,6 +1710,7 @@ b11111111010100 aabac
|
||||||
b10000000000000010000010111110001 aabct
|
b10000000000000010000010111110001 aabct
|
||||||
b11111111010100 aabcw
|
b11111111010100 aabcw
|
||||||
b11111111010100 aabdc
|
b11111111010100 aabdc
|
||||||
|
r0.0 bbbbb
|
||||||
|
|
||||||
#1444438324
|
#1444438324
|
||||||
1aaaar
|
1aaaar
|
||||||
|
|
|
@ -92,7 +92,7 @@ public class DatabaseServicesTest {
|
||||||
assertTrue(f.exists());
|
assertTrue(f.exists());
|
||||||
waveformDb.load(f);
|
waveformDb.load(f);
|
||||||
assertNotNull(waveformDb);
|
assertNotNull(waveformDb);
|
||||||
assertEquals(778, waveformDb.getAllWaves().size());
|
assertEquals(779, waveformDb.getAllWaves().size());
|
||||||
assertEquals(1, waveformDb.getChildNodes().size());
|
assertEquals(1, waveformDb.getChildNodes().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
package com.minres.scviewer.database.swt.internal;
|
package com.minres.scviewer.database.swt.internal;
|
||||||
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.NavigableMap;
|
import java.util.NavigableMap;
|
||||||
|
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
@ -24,8 +26,9 @@ import org.eclipse.swt.graphics.Rectangle;
|
||||||
|
|
||||||
import com.minres.scviewer.database.ISignal;
|
import com.minres.scviewer.database.ISignal;
|
||||||
import com.minres.scviewer.database.ISignalChange;
|
import com.minres.scviewer.database.ISignalChange;
|
||||||
import com.minres.scviewer.database.ISignalChangeMulti;
|
import com.minres.scviewer.database.ISignalChangeBitVector;
|
||||||
import com.minres.scviewer.database.ISignalChangeSingle;
|
import com.minres.scviewer.database.ISignalChangeReal;
|
||||||
|
import com.minres.scviewer.database.ISignalChangeBit;
|
||||||
import com.minres.scviewer.database.ui.TrackEntry;
|
import com.minres.scviewer.database.ui.TrackEntry;
|
||||||
import com.minres.scviewer.database.ui.WaveformColors;
|
import com.minres.scviewer.database.ui.WaveformColors;
|
||||||
|
|
||||||
|
@ -107,7 +110,6 @@ public class SignalPainter extends TrackPainter {
|
||||||
NavigableMap<Long, ? extends ISignalChange> entries = signal.getEvents().subMap(first.getKey(), false, last.getKey(), true);
|
NavigableMap<Long, ? extends ISignalChange> entries = signal.getEvents().subMap(first.getKey(), false, last.getKey(), true);
|
||||||
SignalChange left = new SignalChange(first);
|
SignalChange left = new SignalChange(first);
|
||||||
SignalChange right = new SignalChange(entries.size() > 0 ? entries.firstEntry() : first);
|
SignalChange right = new SignalChange(entries.size() > 0 ? entries.firstEntry() : first);
|
||||||
SignalStencil stencil = left.value instanceof ISignalChangeSingle ? new SingleBitStencil() : new MultiBitStencil(gc);
|
|
||||||
|
|
||||||
maxX = area.x + area.width;
|
maxX = area.x + area.width;
|
||||||
yOffsetT = this.waveCanvas.getTrackHeight() / 5 + area.y;
|
yOffsetT = this.waveCanvas.getTrackHeight() / 5 + area.y;
|
||||||
|
@ -132,6 +134,7 @@ public class SignalPainter extends TrackPainter {
|
||||||
xEnd = getXEnd(right.time);
|
xEnd = getXEnd(right.time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SignalStencil stencil = getStencil(gc, left, entries);
|
||||||
do {
|
do {
|
||||||
stencil.draw(gc, area, left.value, right.value, xBegin, xEnd, multiple);
|
stencil.draw(gc, area, left.value, right.value, xBegin, xEnd, multiple);
|
||||||
if (right.time >= endTime)
|
if (right.time >= endTime)
|
||||||
|
@ -150,6 +153,17 @@ public class SignalPainter extends TrackPainter {
|
||||||
} while (left.time < endTime);
|
} while (left.time < endTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private SignalStencil getStencil(GC gc, SignalChange left, NavigableMap<Long, ? extends ISignalChange> entries) {
|
||||||
|
if(left.value instanceof ISignalChangeBit)
|
||||||
|
return new SingleBitStencil();
|
||||||
|
else if (left.value instanceof ISignalChangeBitVector)
|
||||||
|
return new MultiBitStencil(gc);
|
||||||
|
else if (left.value instanceof ISignalChangeReal)
|
||||||
|
return new RealStencil(entries, left.value);
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private interface SignalStencil {
|
private interface SignalStencil {
|
||||||
|
|
||||||
public void draw(GC gc, Rectangle area, ISignalChange left, ISignalChange right, int xBegin, int xEnd, boolean multiple);
|
public void draw(GC gc, Rectangle area, ISignalChange left, ISignalChange right, int xBegin, int xEnd, boolean multiple);
|
||||||
|
@ -168,7 +182,7 @@ public class SignalPainter extends TrackPainter {
|
||||||
|
|
||||||
public void draw(GC gc, Rectangle area, ISignalChange left, ISignalChange right, int xBegin, int xEnd, boolean multiple) {
|
public void draw(GC gc, Rectangle area, ISignalChange left, ISignalChange right, int xBegin, int xEnd, boolean multiple) {
|
||||||
Color colorBorder = waveCanvas.colors[WaveformColors.SIGNAL0.ordinal()];
|
Color colorBorder = waveCanvas.colors[WaveformColors.SIGNAL0.ordinal()];
|
||||||
ISignalChangeMulti last = (ISignalChangeMulti) left;
|
ISignalChangeBitVector last = (ISignalChangeBitVector) left;
|
||||||
if (last.getValue().toString().contains("X")) {
|
if (last.getValue().toString().contains("X")) {
|
||||||
colorBorder = waveCanvas.colors[WaveformColors.SIGNALX.ordinal()];
|
colorBorder = waveCanvas.colors[WaveformColors.SIGNALX.ordinal()];
|
||||||
} else if (last.getValue().toString().contains("Z")) {
|
} else if (last.getValue().toString().contains("Z")) {
|
||||||
|
@ -216,11 +230,12 @@ public class SignalPainter extends TrackPainter {
|
||||||
if (multiple) {
|
if (multiple) {
|
||||||
gc.setForeground(waveCanvas.colors[WaveformColors.SIGNALU.ordinal()]);
|
gc.setForeground(waveCanvas.colors[WaveformColors.SIGNALU.ordinal()]);
|
||||||
gc.drawLine(xBegin, yOffsetT, xBegin, yOffsetB);
|
gc.drawLine(xBegin, yOffsetT, xBegin, yOffsetB);
|
||||||
gc.drawLine(xEnd, yOffsetT, xEnd, yOffsetB);
|
if(xEnd>xBegin)
|
||||||
|
gc.drawLine(xEnd, yOffsetT, xEnd, yOffsetB);
|
||||||
} else {
|
} else {
|
||||||
Color color = waveCanvas.colors[WaveformColors.SIGNALX.ordinal()];
|
Color color = waveCanvas.colors[WaveformColors.SIGNALX.ordinal()];
|
||||||
int yOffset = yOffsetM;
|
int yOffset = yOffsetM;
|
||||||
switch (((ISignalChangeSingle) left).getValue()) {
|
switch (((ISignalChangeBit) left).getValue()) {
|
||||||
case '1':
|
case '1':
|
||||||
color = waveCanvas.colors[WaveformColors.SIGNAL1.ordinal()];
|
color = waveCanvas.colors[WaveformColors.SIGNAL1.ordinal()];
|
||||||
yOffset = yOffsetT;
|
yOffset = yOffsetT;
|
||||||
|
@ -240,7 +255,7 @@ public class SignalPainter extends TrackPainter {
|
||||||
} else {
|
} else {
|
||||||
gc.drawLine(xBegin, yOffset, xEnd, yOffset);
|
gc.drawLine(xBegin, yOffset, xEnd, yOffset);
|
||||||
int yNext = yOffsetM;
|
int yNext = yOffsetM;
|
||||||
switch (((ISignalChangeSingle) right).getValue()) {
|
switch (((ISignalChangeBit) right).getValue()) {
|
||||||
case '1':
|
case '1':
|
||||||
yNext = yOffsetT;
|
yNext = yOffsetT;
|
||||||
break;
|
break;
|
||||||
|
@ -257,6 +272,61 @@ public class SignalPainter extends TrackPainter {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class RealStencil implements SignalStencil {
|
||||||
|
|
||||||
|
double minVal, range;
|
||||||
|
|
||||||
|
final double scaleFactor = 1.05;
|
||||||
|
|
||||||
|
boolean stepWise=true;
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public RealStencil(NavigableMap<Long, ? extends ISignalChange> entries, ISignalChange left) {
|
||||||
|
Collection<ISignalChangeReal> values = ((NavigableMap<Long, ISignalChangeReal>) entries).values();
|
||||||
|
minVal=((ISignalChangeReal) left).getValue();
|
||||||
|
range=2.0;
|
||||||
|
if(!values.isEmpty()) {
|
||||||
|
double maxVal=minVal;
|
||||||
|
for(ISignalChangeReal v:values) {
|
||||||
|
minVal=Math.min(minVal, v.getValue());
|
||||||
|
maxVal=Math.max(maxVal, v.getValue());
|
||||||
|
}
|
||||||
|
range = (maxVal-minVal)*scaleFactor;
|
||||||
|
double avg = (maxVal+minVal)/2.0;
|
||||||
|
minVal=avg-(avg-minVal)*scaleFactor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void draw(GC gc, Rectangle area, ISignalChange left, ISignalChange right, int xBegin, int xEnd, boolean multiple) {
|
||||||
|
double leftVal = ((ISignalChangeReal) left).getValue();
|
||||||
|
double rightVal= ((ISignalChangeReal) right).getValue();
|
||||||
|
// if (multiple) {
|
||||||
|
// gc.setForeground(waveCanvas.colors[WaveformColors.SIGNALX.ordinal()]);
|
||||||
|
// } else {
|
||||||
|
gc.setForeground(waveCanvas.colors[WaveformColors.SIGNAL_REAL.ordinal()]);
|
||||||
|
// }
|
||||||
|
int yOffsetLeft = (int) ((leftVal-minVal) / range * (yOffsetB-yOffsetT));
|
||||||
|
int yOffsetRight = (int) ((rightVal-minVal) / range * (yOffsetB-yOffsetT));
|
||||||
|
if(stepWise) {
|
||||||
|
if (xEnd > maxX) {
|
||||||
|
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, maxX, yOffsetB-yOffsetLeft);
|
||||||
|
} else {
|
||||||
|
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetLeft);
|
||||||
|
if(yOffsetRight!=yOffsetLeft) {
|
||||||
|
gc.drawLine(xEnd, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetRight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (xEnd > maxX) {
|
||||||
|
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, maxX, yOffsetB-yOffsetRight);
|
||||||
|
} else {
|
||||||
|
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetRight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ISignal<? extends ISignalChange> getSignal() {
|
public ISignal<? extends ISignalChange> getSignal() {
|
||||||
return signal;
|
return signal;
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,6 +126,30 @@ public class WaveformCanvas extends Canvas {
|
||||||
painterList.add(marker);
|
painterList.add(marker);
|
||||||
cursorPainters.add(marker);
|
cursorPainters.add(marker);
|
||||||
wave2painterMap=new HashMap<>();
|
wave2painterMap=new HashMap<>();
|
||||||
|
// fall back initialization
|
||||||
|
colors[WaveformColors.LINE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
||||||
|
colors[WaveformColors.LINE_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_CYAN);
|
||||||
|
colors[WaveformColors.TRACK_BG_EVEN.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_BLACK);
|
||||||
|
colors[WaveformColors.TRACK_BG_ODD.ordinal()] = SWTResourceManager.getColor(40, 40, 40);
|
||||||
|
colors[WaveformColors.TRACK_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(40, 40, 80);
|
||||||
|
colors[WaveformColors.TX_BG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
|
||||||
|
colors[WaveformColors.TX_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
|
||||||
|
colors[WaveformColors.TX_BORDER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
||||||
|
colors[WaveformColors.SIGNAL0.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
|
||||||
|
colors[WaveformColors.SIGNAL1.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
|
||||||
|
colors[WaveformColors.SIGNALZ.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_YELLOW);
|
||||||
|
colors[WaveformColors.SIGNALX.ordinal()] = SWTResourceManager.getColor(255, 51, 51);
|
||||||
|
colors[WaveformColors.SIGNALU.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
|
||||||
|
colors[WaveformColors.SIGNAL_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
||||||
|
colors[WaveformColors.SIGNAL_REAL.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
|
||||||
|
colors[WaveformColors.CURSOR.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
||||||
|
colors[WaveformColors.CURSOR_DRAG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GRAY);
|
||||||
|
colors[WaveformColors.CURSOR_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
||||||
|
colors[WaveformColors.MARKER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GRAY);
|
||||||
|
colors[WaveformColors.MARKER_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
||||||
|
colors[WaveformColors.REL_ARROW.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_MAGENTA);
|
||||||
|
colors[WaveformColors.REL_ARROW_HIGHLITE.ordinal()] = SWTResourceManager.getColor(255, 128, 255);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addCursoPainter(CursorPainter cursorPainter){
|
public void addCursoPainter(CursorPainter cursorPainter){
|
||||||
|
@ -137,33 +161,10 @@ public class WaveformCanvas extends Canvas {
|
||||||
Display d = getDisplay();
|
Display d = getDisplay();
|
||||||
if (colourMap != null) {
|
if (colourMap != null) {
|
||||||
for (WaveformColors c : WaveformColors.values()) {
|
for (WaveformColors c : WaveformColors.values()) {
|
||||||
if (colourMap.containsKey(c)) {
|
if (colourMap.containsKey(c))
|
||||||
colors[c.ordinal()] = new Color(d, colourMap.get(c));
|
colors[c.ordinal()] = new Color(d, colourMap.get(c));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
redraw();
|
redraw();
|
||||||
} else {
|
|
||||||
colors[WaveformColors.LINE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
|
||||||
colors[WaveformColors.LINE_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_CYAN);
|
|
||||||
colors[WaveformColors.TRACK_BG_EVEN.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_BLACK);
|
|
||||||
colors[WaveformColors.TRACK_BG_ODD.ordinal()] = SWTResourceManager.getColor(40, 40, 40);
|
|
||||||
colors[WaveformColors.TRACK_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(40, 40, 80);
|
|
||||||
colors[WaveformColors.TX_BG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
|
|
||||||
colors[WaveformColors.TX_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
|
|
||||||
colors[WaveformColors.TX_BORDER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
|
||||||
colors[WaveformColors.SIGNAL0.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
|
|
||||||
colors[WaveformColors.SIGNAL1.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
|
|
||||||
colors[WaveformColors.SIGNALZ.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_YELLOW);
|
|
||||||
colors[WaveformColors.SIGNALX.ordinal()] = SWTResourceManager.getColor(255, 51, 51);
|
|
||||||
colors[WaveformColors.SIGNALU.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
|
|
||||||
colors[WaveformColors.SIGNAL_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
|
||||||
colors[WaveformColors.CURSOR.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
|
||||||
colors[WaveformColors.CURSOR_DRAG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GRAY);
|
|
||||||
colors[WaveformColors.CURSOR_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
|
||||||
colors[WaveformColors.MARKER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GRAY);
|
|
||||||
colors[WaveformColors.MARKER_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
|
||||||
colors[WaveformColors.REL_ARROW.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_MAGENTA);
|
|
||||||
colors[WaveformColors.REL_ARROW_HIGHLITE.ordinal()] = SWTResourceManager.getColor(255, 128, 255);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ package com.minres.scviewer.database.swt.internal;
|
||||||
import java.beans.PropertyChangeEvent;
|
import java.beans.PropertyChangeEvent;
|
||||||
import java.beans.PropertyChangeListener;
|
import java.beans.PropertyChangeListener;
|
||||||
import java.beans.PropertyChangeSupport;
|
import java.beans.PropertyChangeSupport;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -71,8 +72,9 @@ import org.eclipse.wb.swt.SWTResourceManager;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.minres.scviewer.database.ISignal;
|
import com.minres.scviewer.database.ISignal;
|
||||||
import com.minres.scviewer.database.ISignalChange;
|
import com.minres.scviewer.database.ISignalChange;
|
||||||
import com.minres.scviewer.database.ISignalChangeMulti;
|
import com.minres.scviewer.database.ISignalChangeBitVector;
|
||||||
import com.minres.scviewer.database.ISignalChangeSingle;
|
import com.minres.scviewer.database.ISignalChangeReal;
|
||||||
|
import com.minres.scviewer.database.ISignalChangeBit;
|
||||||
import com.minres.scviewer.database.ITx;
|
import com.minres.scviewer.database.ITx;
|
||||||
import com.minres.scviewer.database.ITxEvent;
|
import com.minres.scviewer.database.ITxEvent;
|
||||||
import com.minres.scviewer.database.ITxRelation;
|
import com.minres.scviewer.database.ITxRelation;
|
||||||
|
@ -102,11 +104,11 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
|
|
||||||
private Control namePaneHeader;
|
private Control namePaneHeader;
|
||||||
|
|
||||||
private Canvas nameList;
|
final private Canvas nameList;
|
||||||
|
|
||||||
private Canvas valueList;
|
final private Canvas valueList;
|
||||||
|
|
||||||
WaveformCanvas waveformCanvas;
|
final WaveformCanvas waveformCanvas;
|
||||||
|
|
||||||
private Composite top;
|
private Composite top;
|
||||||
|
|
||||||
|
@ -125,12 +127,11 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
protected MouseListener nameValueMouseListener = new MouseAdapter() {
|
protected MouseListener nameValueMouseListener = new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void mouseDown(MouseEvent e) {
|
public void mouseDown(MouseEvent e) {
|
||||||
if ((e.button == 1 || e.button == 3)) {
|
if (e.button == 1) {
|
||||||
Entry<Integer, TrackEntry> entry = trackVerticalOffset.floorEntry(e.y);
|
Entry<Integer, TrackEntry> entry = trackVerticalOffset.floorEntry(e.y);
|
||||||
if (entry != null)
|
if (entry != null)
|
||||||
setSelection(new StructuredSelection(entry.getValue()));
|
setSelection(new StructuredSelection(entry.getValue()));
|
||||||
}
|
} else if (e.button == 3) {
|
||||||
if (e.button == 3) {
|
|
||||||
Menu topMenu= top.getMenu();
|
Menu topMenu= top.getMenu();
|
||||||
if(topMenu!=null) topMenu.setVisible(true);
|
if(topMenu!=null) topMenu.setVisible(true);
|
||||||
}
|
}
|
||||||
|
@ -171,7 +172,7 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}else if (e.button == 2) {
|
}else if (e.button == 2) {
|
||||||
setMarkerTime(snapOffsetToEvent(e), selectedMarker);
|
setMarkerTime(snapOffsetToEvent(e), selectedMarker);
|
||||||
e.widget.getDisplay().asyncExec(new Runnable() {
|
e.widget.getDisplay().asyncExec(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -273,9 +274,11 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
nameList.addListener(SWT.Paint, new Listener() {
|
nameList.addListener(SWT.Paint, new Listener() {
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(Event event) {
|
public void handleEvent(Event event) {
|
||||||
GC gc = event.gc;
|
if(!trackVerticalOffset.isEmpty()) {
|
||||||
Rectangle rect = ((Canvas) event.widget).getClientArea();
|
GC gc = event.gc;
|
||||||
paintNames(gc, rect);
|
Rectangle rect = ((Canvas) event.widget).getClientArea();
|
||||||
|
paintNames(gc, rect);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
nameList.addMouseListener(nameValueMouseListener);
|
nameList.addMouseListener(nameValueMouseListener);
|
||||||
|
@ -305,9 +308,11 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
valueList.addListener(SWT.Paint, new Listener() {
|
valueList.addListener(SWT.Paint, new Listener() {
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(Event event) {
|
public void handleEvent(Event event) {
|
||||||
GC gc = event.gc;
|
if(!trackVerticalOffset.isEmpty()) {
|
||||||
Rectangle rect = ((Canvas) event.widget).getClientArea();
|
GC gc = event.gc;
|
||||||
paintValues(gc, rect);
|
Rectangle rect = ((Canvas) event.widget).getClientArea();
|
||||||
|
paintValues(gc, rect);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
valueList.addMouseListener(nameValueMouseListener);
|
valueList.addMouseListener(nameValueMouseListener);
|
||||||
|
@ -454,10 +459,16 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
for(Entry<IWaveform<? extends IWaveformEvent>, String> entry:actualValues.entrySet()){
|
for(Entry<IWaveform<? extends IWaveformEvent>, String> entry:actualValues.entrySet()){
|
||||||
if(entry.getKey() instanceof ISignal){
|
if(entry.getKey() instanceof ISignal){
|
||||||
ISignalChange event = ((ISignal<?>)entry.getKey()).getWaveformEventsBeforeTime(time);
|
ISignalChange event = ((ISignal<?>)entry.getKey()).getWaveformEventsBeforeTime(time);
|
||||||
if(event instanceof ISignalChangeSingle){
|
if(event instanceof ISignalChangeBit){
|
||||||
entry.setValue("b'"+((ISignalChangeSingle)event).getValue());
|
entry.setValue("b'"+((ISignalChangeBit)event).getValue());
|
||||||
} else if(event instanceof ISignalChangeMulti){
|
} else if(event instanceof ISignalChangeBitVector){
|
||||||
entry.setValue("h'"+((ISignalChangeMulti)event).getValue().toHexString());
|
entry.setValue("h'"+((ISignalChangeBitVector)event).getValue().toHexString());
|
||||||
|
} else if(event instanceof ISignalChangeReal){
|
||||||
|
double val = ((ISignalChangeReal)event).getValue();
|
||||||
|
if(val>0.001)
|
||||||
|
entry.setValue(String.format("%1$,.3f", val));
|
||||||
|
else
|
||||||
|
entry.setValue(Double.toString(val));
|
||||||
}
|
}
|
||||||
} else if(entry.getKey() instanceof ITxStream<?>){
|
} else if(entry.getKey() instanceof ITxStream<?>){
|
||||||
ITxStream<?> stream = (ITxStream<?>) entry.getKey();
|
ITxStream<?> stream = (ITxStream<?>) entry.getKey();
|
||||||
|
@ -551,9 +562,10 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
public ISelection getSelection() {
|
public ISelection getSelection() {
|
||||||
if (currentTxSelection != null)
|
if (currentTxSelection != null)
|
||||||
return new StructuredSelection(currentTxSelection);
|
return new StructuredSelection(currentTxSelection);
|
||||||
else if (currentWaveformSelection != null)
|
else if (currentWaveformSelection != null) {
|
||||||
return new StructuredSelection(currentWaveformSelection.waveform);
|
Object[] elem = {currentWaveformSelection.waveform, currentWaveformSelection};
|
||||||
else
|
return new StructuredSelection(elem);
|
||||||
|
} else
|
||||||
return new StructuredSelection();
|
return new StructuredSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -738,6 +750,7 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
setCursorTime(time);
|
setCursorTime(time);
|
||||||
waveformCanvas.reveal(time);
|
waveformCanvas.reveal(time);
|
||||||
waveformCanvas.redraw();
|
waveformCanvas.redraw();
|
||||||
|
updateValueList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ public enum WaveformColors {
|
||||||
LINE, LINE_HIGHLITE,
|
LINE, LINE_HIGHLITE,
|
||||||
TRACK_BG_EVEN, TRACK_BG_ODD, TRACK_BG_HIGHLITE,
|
TRACK_BG_EVEN, TRACK_BG_ODD, TRACK_BG_HIGHLITE,
|
||||||
TX_BG, TX_BG_HIGHLITE, TX_BORDER,
|
TX_BG, TX_BG_HIGHLITE, TX_BORDER,
|
||||||
SIGNAL0, SIGNAL1, SIGNALZ, SIGNALX, SIGNALU, SIGNAL_TEXT,
|
SIGNAL0, SIGNAL1, SIGNALZ, SIGNALX, SIGNALU, SIGNAL_TEXT, SIGNAL_REAL,
|
||||||
CURSOR, CURSOR_DRAG, CURSOR_TEXT,
|
CURSOR, CURSOR_DRAG, CURSOR_TEXT,
|
||||||
MARKER, MARKER_TEXT, REL_ARROW, REL_ARROW_HIGHLITE
|
MARKER, MARKER_TEXT, REL_ARROW, REL_ARROW_HIGHLITE
|
||||||
}
|
}
|
|
@ -34,26 +34,44 @@ public interface IVCDDatabaseBuilder {
|
||||||
*
|
*
|
||||||
* @param netName the net name
|
* @param netName the net name
|
||||||
* @param i the index of the net, -1 if a new one, otherwise the id if the referenced
|
* @param i the index of the net, -1 if a new one, otherwise the id if the referenced
|
||||||
* @param width the width
|
* @param width the width, -1 equals real, 0... is a bit vector
|
||||||
* @return the integer
|
* @return the net id
|
||||||
*/
|
*/
|
||||||
public Integer newNet(String netName, int i, int width) ;
|
public Integer newNet(String netName, int i, int width) ;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the net width.
|
* Gets the net width.
|
||||||
*
|
*
|
||||||
* @param intValue the int value
|
* @param intValue the net id
|
||||||
* @return the net width
|
* @return the net width, -1 means a real-valued net
|
||||||
*/
|
*/
|
||||||
public int getNetWidth(int intValue);
|
public int getNetWidth(int netId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append transition.
|
* Append transition.
|
||||||
*
|
*
|
||||||
* @param signalId the int value
|
* @param netId the int value
|
||||||
* @param currentTime the current time in ps
|
* @param currentTime the current time in ps
|
||||||
* @param decodedValues the decoded values
|
* @param decodedValues the decoded values
|
||||||
*/
|
*/
|
||||||
public void appendTransition(int signalId, long currentTime, BitVector decodedValues);
|
public void appendTransition(int netId, long currentTime, char decodedValue);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append transition.
|
||||||
|
*
|
||||||
|
* @param netId the int value
|
||||||
|
* @param currentTime the current time in ps
|
||||||
|
* @param decodedValues the decoded values
|
||||||
|
*/
|
||||||
|
public void appendTransition(int netId, long currentTime, BitVector decodedValue);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append transition.
|
||||||
|
*
|
||||||
|
* @param netId the int value
|
||||||
|
* @param currentTime the current time in ps
|
||||||
|
* @param decodedValue the decoded values
|
||||||
|
*/
|
||||||
|
public void appendTransition(int netId, long currentTime, double decodedValue);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ import java.io.FileInputStream;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.NavigableMap;
|
||||||
import java.util.Stack;
|
import java.util.Stack;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
@ -22,8 +23,9 @@ import java.util.Vector;
|
||||||
import com.minres.scviewer.database.BitVector;
|
import com.minres.scviewer.database.BitVector;
|
||||||
import com.minres.scviewer.database.ISignal;
|
import com.minres.scviewer.database.ISignal;
|
||||||
import com.minres.scviewer.database.ISignalChange;
|
import com.minres.scviewer.database.ISignalChange;
|
||||||
import com.minres.scviewer.database.ISignalChangeMulti;
|
import com.minres.scviewer.database.ISignalChangeBitVector;
|
||||||
import com.minres.scviewer.database.ISignalChangeSingle;
|
import com.minres.scviewer.database.ISignalChangeReal;
|
||||||
|
import com.minres.scviewer.database.ISignalChangeBit;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformDb;
|
import com.minres.scviewer.database.IWaveformDb;
|
||||||
import com.minres.scviewer.database.IWaveformDbLoader;
|
import com.minres.scviewer.database.IWaveformDbLoader;
|
||||||
|
@ -83,20 +85,25 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
||||||
moduleStack=null;
|
moduleStack=null;
|
||||||
if(!res) throw new InputFormatException();
|
if(!res) throw new InputFormatException();
|
||||||
// calculate max time of database
|
// calculate max time of database
|
||||||
for(IWaveform<? extends IWaveformEvent> waveform:signals)
|
for(IWaveform<? extends IWaveformEvent> waveform:signals) {
|
||||||
maxTime= Math.max(maxTime, ((ISignal<? extends ISignalChange>)waveform).getEvents().lastKey());
|
NavigableMap<Long, ? extends ISignalChange> events =((ISignal<? extends ISignalChange>)waveform).getEvents();
|
||||||
|
if(events.size()>0)
|
||||||
|
maxTime= Math.max(maxTime, events.lastKey());
|
||||||
|
}
|
||||||
// extend signals to hav a last value set at max time
|
// extend signals to hav a last value set at max time
|
||||||
for(IWaveform<? extends IWaveformEvent> waveform:signals){
|
for(IWaveform<? extends IWaveformEvent> waveform:signals){
|
||||||
TreeMap<Long,? extends ISignalChange> events = ((VCDSignal<? extends ISignalChange>)waveform).values;
|
TreeMap<Long,? extends ISignalChange> events = ((VCDSignal<? extends ISignalChange>)waveform).values;
|
||||||
if(events.lastKey()<maxTime){
|
if(events.size()>0 && events.lastKey()<maxTime){
|
||||||
ISignalChange x = events.lastEntry().getValue();
|
ISignalChange x = events.lastEntry().getValue();
|
||||||
if(x instanceof ISignalChangeSingle)
|
if(x instanceof ISignalChangeBit)
|
||||||
((VCDSignal<ISignalChangeSingle>)waveform).values.put(maxTime,
|
((VCDSignal<ISignalChangeBit>)waveform).values.put(maxTime,
|
||||||
new VCDSignalChangeSingle(maxTime, ((ISignalChangeSingle)x).getValue()));
|
new VCDSignalChangeBit(maxTime, ((ISignalChangeBit)x).getValue()));
|
||||||
else
|
else if(x instanceof ISignalChangeBitVector)
|
||||||
if(x instanceof ISignalChangeMulti)
|
((VCDSignal<ISignalChangeBitVector>)waveform).values.put(maxTime,
|
||||||
((VCDSignal<ISignalChangeMulti>)waveform).values.put(maxTime,
|
new VCDSignalChangeBitVector(maxTime, ((ISignalChangeBitVector)x).getValue()));
|
||||||
new VCDSignalChangeMulti(maxTime, ((ISignalChangeMulti)x).getValue()));
|
else if(x instanceof ISignalChangeReal)
|
||||||
|
((VCDSignal<ISignalChangeReal>)waveform).values.put(maxTime,
|
||||||
|
new VCDSignalChangeReal(maxTime, ((ISignalChangeReal)x).getValue()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -147,12 +154,15 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
||||||
String netName = moduleStack.empty()? name: moduleStack.lastElement()+"."+name;
|
String netName = moduleStack.empty()? name: moduleStack.lastElement()+"."+name;
|
||||||
int id = signals.size();
|
int id = signals.size();
|
||||||
VCDSignal<? extends IWaveformEvent> signal;
|
VCDSignal<? extends IWaveformEvent> signal;
|
||||||
if(width==1){
|
if(width<0) {
|
||||||
signal = i<0 ? new VCDSignal<ISignalChangeSingle>(db, id, netName) :
|
signal = i<0 ? new VCDSignal<ISignalChangeReal>(db, id, netName, width) :
|
||||||
new VCDSignal<ISignalChangeSingle>((VCDSignal<ISignalChangeSingle>)signals.get(i), id, netName);
|
new VCDSignal<ISignalChangeReal>((VCDSignal<ISignalChangeReal>)signals.get(i), id, netName);
|
||||||
|
} else if(width==1){
|
||||||
|
signal = i<0 ? new VCDSignal<ISignalChangeBit>(db, id, netName) :
|
||||||
|
new VCDSignal<ISignalChangeBit>((VCDSignal<ISignalChangeBit>)signals.get(i), id, netName);
|
||||||
} else {
|
} else {
|
||||||
signal = i<0 ? new VCDSignal<ISignalChangeMulti>(db, id, netName, width) :
|
signal = i<0 ? new VCDSignal<ISignalChangeBitVector>(db, id, netName, width) :
|
||||||
new VCDSignal<ISignalChangeMulti>((VCDSignal<VCDSignalChangeMulti>)signals.get(i), id, netName);
|
new VCDSignal<ISignalChangeBitVector>((VCDSignal<VCDSignalChangeBitVector>)signals.get(i), id, netName);
|
||||||
};
|
};
|
||||||
signals.add(signal);
|
signals.add(signal);
|
||||||
return id;
|
return id;
|
||||||
|
@ -172,13 +182,37 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void appendTransition(int signalId, long currentTime, BitVector decodedValues) {
|
public void appendTransition(int signalId, long currentTime, char decodedValues) {
|
||||||
VCDSignal<? extends IWaveformEvent> signal = (VCDSignal<? extends IWaveformEvent>) signals.get(signalId);
|
VCDSignal<? extends IWaveformEvent> signal = (VCDSignal<? extends IWaveformEvent>) signals.get(signalId);
|
||||||
Long time = currentTime* TIME_RES;
|
Long time = currentTime* TIME_RES;
|
||||||
if(signal.getWidth()==1){
|
if(signal.getWidth()==1){
|
||||||
((VCDSignal<ISignalChangeSingle>)signal).values.put(time, new VCDSignalChangeSingle(time, decodedValues.getValue()[0]));
|
((VCDSignal<ISignalChangeBit>)signal).values.put(time, new VCDSignalChangeBit(time, decodedValues));
|
||||||
} else {
|
}
|
||||||
((VCDSignal<VCDSignalChangeMulti>)signal).values.put(time, new VCDSignalChangeMulti(time, decodedValues));
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.minres.scviewer.database.vcd.ITraceBuilder#appendTransition(int, long, com.minres.scviewer.database.vcd.BitVector)
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public void appendTransition(int signalId, long currentTime, BitVector decodedValues) {
|
||||||
|
VCDSignal<? extends IWaveformEvent> signal = (VCDSignal<? extends IWaveformEvent>) signals.get(signalId);
|
||||||
|
Long time = currentTime* TIME_RES;
|
||||||
|
if(signal.getWidth()>1){
|
||||||
|
((VCDSignal<VCDSignalChangeBitVector>)signal).values.put(time, new VCDSignalChangeBitVector(time, decodedValues));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.minres.scviewer.database.vcd.ITraceBuilder#appendTransition(int, long, com.minres.scviewer.database.vcd.BitVector)
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public void appendTransition(int signalId, long currentTime, double decodedValue) {
|
||||||
|
VCDSignal<? extends IWaveformEvent> signal = (VCDSignal<? extends IWaveformEvent>) signals.get(signalId);
|
||||||
|
Long time = currentTime* TIME_RES;
|
||||||
|
if(signal.getWidth()<0){
|
||||||
|
((VCDSignal<ISignalChangeReal>)signal).values.put(time, new VCDSignalChangeReal(time, decodedValue));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,9 +61,11 @@ class VCDFileParser {
|
||||||
|
|
||||||
private void parseVar() throws Exception {
|
private void parseVar() throws Exception {
|
||||||
nextToken(); // type
|
nextToken(); // type
|
||||||
|
String type = tokenizer.sval;
|
||||||
nextToken(); // size
|
nextToken(); // size
|
||||||
int width = Integer.parseInt(tokenizer.sval);
|
int width = Integer.parseInt(tokenizer.sval);
|
||||||
|
if("real".equals(type))
|
||||||
|
width*=-1;
|
||||||
nextToken();
|
nextToken();
|
||||||
String id = tokenizer.sval;
|
String id = tokenizer.sval;
|
||||||
nextToken();
|
nextToken();
|
||||||
|
@ -153,7 +155,8 @@ class VCDFileParser {
|
||||||
} while (!tokenizer.sval.equals("$end"));
|
} while (!tokenizer.sval.equals("$end"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (tokenizer.sval.equals("$dumpvars") || tokenizer.sval.equals("$end")) return true;
|
if (tokenizer.sval.equals("$dumpvars") || tokenizer.sval.equals("$end"))
|
||||||
|
return true;
|
||||||
String value, id;
|
String value, id;
|
||||||
if (tokenizer.sval.charAt(0) == 'b') {
|
if (tokenizer.sval.charAt(0) == 'b') {
|
||||||
// Multiple value net. Value appears first, followed by space,
|
// Multiple value net. Value appears first, followed by space,
|
||||||
|
@ -161,6 +164,12 @@ class VCDFileParser {
|
||||||
value = tokenizer.sval.substring(1);
|
value = tokenizer.sval.substring(1);
|
||||||
nextToken();
|
nextToken();
|
||||||
id = tokenizer.sval;
|
id = tokenizer.sval;
|
||||||
|
}else if (tokenizer.sval.charAt(0) == 'r') {
|
||||||
|
// Multiple value net. Value appears first, followed by space,
|
||||||
|
// then identifier
|
||||||
|
value = tokenizer.sval.substring(1);
|
||||||
|
nextToken();
|
||||||
|
id = tokenizer.sval;
|
||||||
} else {
|
} else {
|
||||||
// Single value net. identifier first, then value, no space.
|
// Single value net. identifier first, then value, no space.
|
||||||
value = tokenizer.sval.substring(0, 1);
|
value = tokenizer.sval.substring(0, 1);
|
||||||
|
@ -174,39 +183,46 @@ class VCDFileParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
int netWidth = traceBuilder.getNetWidth(net);
|
int netWidth = traceBuilder.getNetWidth(net);
|
||||||
BitVector decodedValues = new BitVector(netWidth);
|
if(netWidth<0) {
|
||||||
if (value.equals("z") && netWidth > 1) {
|
traceBuilder.appendTransition(net, currentTime, Double.parseDouble(value));
|
||||||
for (int i = 0; i < netWidth; i++)
|
|
||||||
decodedValues.setValue(i, BitVector.VALUE_Z);
|
|
||||||
} else if (value.equals("x") && netWidth > 1) {
|
|
||||||
for (int i = 0; i < netWidth; i++)
|
|
||||||
decodedValues.setValue(i, BitVector.VALUE_X);
|
|
||||||
} else {
|
} else {
|
||||||
int stringIndex = 0;
|
BitVector decodedValues = new BitVector(netWidth);
|
||||||
for (int convertedIndex = netWidth - value.length(); convertedIndex < netWidth; convertedIndex++) {
|
if (value.equals("z") && netWidth > 1) {
|
||||||
switch (value.charAt(stringIndex++)) {
|
for (int i = 0; i < netWidth; i++)
|
||||||
case 'z':
|
decodedValues.setValue(i, BitVector.VALUE_Z);
|
||||||
decodedValues.setValue(convertedIndex, BitVector.VALUE_Z);
|
} else if (value.equals("x") && netWidth > 1) {
|
||||||
break;
|
for (int i = 0; i < netWidth; i++)
|
||||||
|
decodedValues.setValue(i, BitVector.VALUE_X);
|
||||||
|
} else {
|
||||||
|
int stringIndex = 0;
|
||||||
|
for (int convertedIndex = netWidth - value.length(); convertedIndex < netWidth; convertedIndex++) {
|
||||||
|
switch (value.charAt(stringIndex++)) {
|
||||||
|
case 'z':
|
||||||
|
decodedValues.setValue(convertedIndex, BitVector.VALUE_Z);
|
||||||
|
break;
|
||||||
|
|
||||||
case '1':
|
case '1':
|
||||||
decodedValues.setValue(convertedIndex, BitVector.VALUE_1);
|
decodedValues.setValue(convertedIndex, BitVector.VALUE_1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '0':
|
case '0':
|
||||||
decodedValues.setValue(convertedIndex, BitVector.VALUE_0);
|
decodedValues.setValue(convertedIndex, BitVector.VALUE_0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'x':
|
case 'x':
|
||||||
decodedValues.setValue(convertedIndex, BitVector.VALUE_X);
|
decodedValues.setValue(convertedIndex, BitVector.VALUE_X);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
decodedValues.setValue(convertedIndex, BitVector.VALUE_X);
|
decodedValues.setValue(convertedIndex, BitVector.VALUE_X);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(netWidth==1)
|
||||||
|
traceBuilder.appendTransition(net, currentTime, decodedValues.getValue()[0]);
|
||||||
|
else
|
||||||
|
traceBuilder.appendTransition(net, currentTime, decodedValues);
|
||||||
}
|
}
|
||||||
traceBuilder.appendTransition(net, currentTime, decodedValues);
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,14 +10,14 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.vcd;
|
package com.minres.scviewer.database.vcd;
|
||||||
|
|
||||||
import com.minres.scviewer.database.ISignalChangeSingle;
|
import com.minres.scviewer.database.ISignalChangeBit;
|
||||||
import com.minres.scviewer.database.SignalChange;
|
import com.minres.scviewer.database.SignalChange;
|
||||||
|
|
||||||
public class VCDSignalChangeSingle extends SignalChange implements ISignalChangeSingle, Cloneable {
|
public class VCDSignalChangeBit extends SignalChange implements ISignalChangeBit, Cloneable {
|
||||||
|
|
||||||
private char value;
|
private char value;
|
||||||
|
|
||||||
public VCDSignalChangeSingle(Long time, char value) {
|
public VCDSignalChangeBit(Long time, char value) {
|
||||||
super(time);
|
super(time);
|
||||||
this.value=value;
|
this.value=value;
|
||||||
}
|
}
|
|
@ -11,18 +11,18 @@
|
||||||
package com.minres.scviewer.database.vcd;
|
package com.minres.scviewer.database.vcd;
|
||||||
|
|
||||||
import com.minres.scviewer.database.BitVector;
|
import com.minres.scviewer.database.BitVector;
|
||||||
import com.minres.scviewer.database.ISignalChangeMulti;
|
import com.minres.scviewer.database.ISignalChangeBitVector;
|
||||||
import com.minres.scviewer.database.SignalChange;
|
import com.minres.scviewer.database.SignalChange;
|
||||||
|
|
||||||
public class VCDSignalChangeMulti extends SignalChange implements ISignalChangeMulti, Cloneable {
|
public class VCDSignalChangeBitVector extends SignalChange implements ISignalChangeBitVector, Cloneable {
|
||||||
|
|
||||||
private BitVector value;
|
private BitVector value;
|
||||||
|
|
||||||
public VCDSignalChangeMulti(Long time) {
|
public VCDSignalChangeBitVector(Long time) {
|
||||||
super(time);
|
super(time);
|
||||||
}
|
}
|
||||||
|
|
||||||
public VCDSignalChangeMulti(Long time, BitVector decodedValues) {
|
public VCDSignalChangeBitVector(Long time, BitVector decodedValues) {
|
||||||
super(time);
|
super(time);
|
||||||
this.value=decodedValues;
|
this.value=decodedValues;
|
||||||
}
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. 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
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package com.minres.scviewer.database.vcd;
|
||||||
|
|
||||||
|
import com.minres.scviewer.database.ISignalChangeReal;
|
||||||
|
import com.minres.scviewer.database.SignalChange;
|
||||||
|
|
||||||
|
public class VCDSignalChangeReal extends SignalChange implements ISignalChangeReal, Cloneable {
|
||||||
|
|
||||||
|
private double value;
|
||||||
|
|
||||||
|
public VCDSignalChangeReal(Long time, double value) {
|
||||||
|
super(time);
|
||||||
|
this.value=value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(double value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return value+"@"+getTime();
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,7 +10,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database;
|
package com.minres.scviewer.database;
|
||||||
|
|
||||||
public interface ISignalChangeSingle extends ISignalChange{
|
public interface ISignalChangeBit extends ISignalChange{
|
||||||
|
|
||||||
public char getValue();
|
public char getValue();
|
||||||
|
|
|
@ -10,8 +10,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database;
|
package com.minres.scviewer.database;
|
||||||
|
|
||||||
|
public interface ISignalChangeBitVector extends ISignalChange {
|
||||||
public interface ISignalChangeMulti extends ISignalChange {
|
|
||||||
|
|
||||||
public BitVector getValue();
|
public BitVector getValue();
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. 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
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package com.minres.scviewer.database;
|
||||||
|
|
||||||
|
public interface ISignalChangeReal extends ISignalChange{
|
||||||
|
|
||||||
|
public double getValue();
|
||||||
|
|
||||||
|
}
|
|
@ -245,10 +245,12 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
if (filesToLoad.size() > 0)
|
if (filesToLoad.size() > 0)
|
||||||
loadDatabase(persistedState);
|
loadDatabase(persistedState);
|
||||||
eventBroker.post(WaveStatusBarControl.ZOOM_LEVEL, zoomLevel[waveformPane.getZoomLevel()]);
|
eventBroker.post(WaveStatusBarControl.ZOOM_LEVEL, zoomLevel[waveformPane.getZoomLevel()]);
|
||||||
|
// menuService.registerContextMenu(waveformPane.getNameControl(),
|
||||||
|
// "com.minres.scviewer.e4.application.popupmenu.namecontext"); //$NON-NLS-1$
|
||||||
menuService.registerContextMenu(waveformPane.getNameControl(),
|
menuService.registerContextMenu(waveformPane.getNameControl(),
|
||||||
"com.minres.scviewer.e4.application.popupmenu.namecontext"); //$NON-NLS-1$
|
"com.minres.scviewer.e4.application.popupmenu.wavecontext"); //$NON-NLS-1$
|
||||||
menuService.registerContextMenu(waveformPane.getValueControl(),
|
menuService.registerContextMenu(waveformPane.getValueControl(),
|
||||||
"com.minres.scviewer.e4.application.popupmenu.namecontext"); //$NON-NLS-1$
|
"com.minres.scviewer.e4.application.popupmenu.wavecontext"); //$NON-NLS-1$
|
||||||
menuService.registerContextMenu(waveformPane.getWaveformControl(),
|
menuService.registerContextMenu(waveformPane.getWaveformControl(),
|
||||||
"com.minres.scviewer.e4.application.popupmenu.wavecontext"); //$NON-NLS-1$
|
"com.minres.scviewer.e4.application.popupmenu.wavecontext"); //$NON-NLS-1$
|
||||||
ePartService.addPartListener(new PartListener() {
|
ePartService.addPartListener(new PartListener() {
|
||||||
|
@ -412,7 +414,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
*/
|
*/
|
||||||
@Focus
|
@Focus
|
||||||
public void setFocus() {
|
public void setFocus() {
|
||||||
myParent.setFocus();
|
waveformPane.getWaveformControl().setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -658,6 +660,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
index++;
|
index++;
|
||||||
waveformPane.getStreamList().addAll(index, streams);
|
waveformPane.getStreamList().addAll(index, streams);
|
||||||
}
|
}
|
||||||
|
setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue