diff --git a/com.minres.scviewer.database.leveldb/pom.xml b/com.minres.scviewer.database.leveldb/pom.xml index 88fc3e4..2226782 100644 --- a/com.minres.scviewer.database.leveldb/pom.xml +++ b/com.minres.scviewer.database.leveldb/pom.xml @@ -2,42 +2,12 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.minres.scviewer.database.leveldb + 1.0.0-SNAPSHOT com.minres.scviewer com.minres.scviewer.parent - 1.0.0-SNAPSHOT + 2.0.0-SNAPSHOT ../com.minres.scviewer.parent eclipse-plugin - - - - org.eclipse.tycho - tycho-compiler-plugin - 0.23.1 - - groovy-eclipse-compiler - - - 1.7 - 1.7 - - - - org.codehaus.groovy - groovy-eclipse-compiler - ${groovy-eclipse-compiler-version} - - - org.codehaus.groovy - groovy-eclipse-batch - ${groovy-eclipse-batch-version} - - - - - - - - 1.0.1-SNAPSHOT \ No newline at end of file diff --git a/com.minres.scviewer.database.leveldb/src/com/minres/scviewer/database/leveldb/LevelDBLoader.java b/com.minres.scviewer.database.leveldb/src/com/minres/scviewer/database/leveldb/LevelDBLoader.java index 005ef50..8f7ee35 100644 --- a/com.minres.scviewer.database.leveldb/src/com/minres/scviewer/database/leveldb/LevelDBLoader.java +++ b/com.minres.scviewer.database.leveldb/src/com/minres/scviewer/database/leveldb/LevelDBLoader.java @@ -15,7 +15,6 @@ import org.json.JSONObject; import com.minres.scviewer.database.IWaveform; import com.minres.scviewer.database.IWaveformDb; import com.minres.scviewer.database.IWaveformDbLoader; -import com.minres.scviewer.database.IWaveformEvent; import com.minres.scviewer.database.RelationType; public class LevelDBLoader implements IWaveformDbLoader { diff --git a/com.minres.scviewer.database.leveldb/src/com/minres/scviewer/database/leveldb/TxAttribute.java b/com.minres.scviewer.database.leveldb/src/com/minres/scviewer/database/leveldb/TxAttribute.java index 8384658..9622e18 100644 --- a/com.minres.scviewer.database.leveldb/src/com/minres/scviewer/database/leveldb/TxAttribute.java +++ b/com.minres.scviewer.database.leveldb/src/com/minres/scviewer/database/leveldb/TxAttribute.java @@ -18,8 +18,6 @@ import com.minres.scviewer.database.ITxAttribute; public class TxAttribute implements ITxAttribute{ - private Tx trTransaction; - private String name; private DataType dataType; @@ -29,7 +27,6 @@ public class TxAttribute implements ITxAttribute{ private Object value; public TxAttribute(Tx trTransaction, JSONObject attribute) { - this.trTransaction=trTransaction; this.name=attribute.getString("name"); this.dataType=DataType.values()[attribute.getInt("type")]; this.associationType=AssociationType.values()[attribute.getInt("assoc")]; diff --git a/com.minres.scviewer.database.leveldb/src/com/minres/scviewer/database/leveldb/pom.xml b/com.minres.scviewer.database.leveldb/src/com/minres/scviewer/database/leveldb/pom.xml deleted file mode 100644 index 94123fe..0000000 --- a/com.minres.scviewer.database.leveldb/src/com/minres/scviewer/database/leveldb/pom.xml +++ /dev/null @@ -1,43 +0,0 @@ - - 4.0.0 - com.minres.scviewer.database.text - - com.minres.scviewer - com.minres.scviewer.parent - 2.0.0-SNAPSHOT - ../com.minres.scviewer.parent - - eclipse-plugin - - - - org.eclipse.tycho - tycho-compiler-plugin - 0.23.1 - - groovy-eclipse-compiler - - - 1.7 - 1.7 - - - - org.codehaus.groovy - groovy-eclipse-compiler - ${groovy-eclipse-compiler-version} - - - org.codehaus.groovy - groovy-eclipse-batch - ${groovy-eclipse-batch-version} - - - - - - - - 1.0.1-SNAPSHOT - \ No newline at end of file diff --git a/com.minres.scviewer.database.sqlite/src/com/minres/scviewer/database/sqlite/SQLiteDbLoader.java b/com.minres.scviewer.database.sqlite/src/com/minres/scviewer/database/sqlite/SQLiteDbLoader.java index 000f627..a6e05ed 100644 --- a/com.minres.scviewer.database.sqlite/src/com/minres/scviewer/database/sqlite/SQLiteDbLoader.java +++ b/com.minres.scviewer.database.sqlite/src/com/minres/scviewer/database/sqlite/SQLiteDbLoader.java @@ -23,7 +23,6 @@ import java.util.List; import com.minres.scviewer.database.IWaveform; import com.minres.scviewer.database.IWaveformDb; import com.minres.scviewer.database.IWaveformDbLoader; -import com.minres.scviewer.database.IWaveformEvent; import com.minres.scviewer.database.RelationType; import com.minres.scviewer.database.sqlite.db.IDatabase; import com.minres.scviewer.database.sqlite.db.SQLiteDatabase; diff --git a/com.minres.scviewer.database.test/src/com/minres/scviewer/database/test/DatabaseServicesTest.java b/com.minres.scviewer.database.test/src/com/minres/scviewer/database/test/DatabaseServicesTest.java index ea706e1..23ba7c3 100644 --- a/com.minres.scviewer.database.test/src/com/minres/scviewer/database/test/DatabaseServicesTest.java +++ b/com.minres.scviewer.database.test/src/com/minres/scviewer/database/test/DatabaseServicesTest.java @@ -16,7 +16,6 @@ import static org.junit.Assert.assertTrue; import java.io.File; import java.util.List; -import java.util.Map; import java.util.Map.Entry; import java.util.NavigableMap; @@ -26,6 +25,7 @@ import org.junit.Test; import com.minres.scviewer.database.AssociationType; import com.minres.scviewer.database.DataType; +import com.minres.scviewer.database.ISignal; import com.minres.scviewer.database.ITx; import com.minres.scviewer.database.ITxAttribute; import com.minres.scviewer.database.ITxEvent; @@ -34,7 +34,6 @@ import com.minres.scviewer.database.ITxStream; import com.minres.scviewer.database.IWaveform; import com.minres.scviewer.database.IWaveformDb; import com.minres.scviewer.database.IWaveformDbFactory; -import com.minres.scviewer.database.vcd.VCDSignal; public class DatabaseServicesTest { @@ -72,11 +71,11 @@ public class DatabaseServicesTest { assertEquals(14, waves.size()); assertEquals(2, waveformDb.getChildNodes().size()); IWaveform bus_data_wave = waves.get(0); - VCDSignal bus_data_sig = (VCDSignal) bus_data_wave; + ISignal bus_data_sig = (ISignal) bus_data_wave; Entry bus_data_entry = bus_data_sig.getEvents().floorEntry(1400000000L); assertTrue("01111000".equals(bus_data_entry.getValue().toString())); IWaveform rw_wave = waves.get(2); - VCDSignal rw_sig = (VCDSignal) rw_wave; + ISignal rw_sig = (ISignal) rw_wave; Entry rw_entry = rw_sig.getEvents().floorEntry(2360000000L); assertTrue("1".equals(rw_entry.getValue().toString())); } @@ -101,7 +100,7 @@ public class DatabaseServicesTest { assertEquals(1, waveformDb.getChildNodes().size()); } - @Test + //@Test public void testTxLDb() throws Exception { File f = new File("inputs/my_ldb.txldb").getAbsoluteFile(); assertTrue(f.exists()); diff --git a/com.minres.scviewer.database.text/.classpath b/com.minres.scviewer.database.text/.classpath index f5b847b..fbe692e 100644 --- a/com.minres.scviewer.database.text/.classpath +++ b/com.minres.scviewer.database.text/.classpath @@ -1,5 +1,11 @@ + + + + + + diff --git a/com.minres.scviewer.database.text/META-INF/MANIFEST.MF b/com.minres.scviewer.database.text/META-INF/MANIFEST.MF index befe580..61b0865 100644 --- a/com.minres.scviewer.database.text/META-INF/MANIFEST.MF +++ b/com.minres.scviewer.database.text/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Textual transaction database Bundle-SymbolicName: com.minres.scviewer.database.text -Bundle-Version: 1.0.1.qualifier +Bundle-Version: 2.0.0.qualifier Bundle-Vendor: MINRES Technologies GmbH Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Import-Package: org.osgi.framework;version="1.3.0" @@ -16,4 +16,10 @@ Service-Component: OSGI-INF/component.xml Bundle-ActivationPolicy: lazy Automatic-Module-Name: com.minres.scviewer.database.text Bundle-ClassPath: lib/mapdb-3.0.7.jar, - . + ., + lib/eclipse-collections-9.2.0.jar, + lib/eclipse-collections-api-9.2.0.jar, + lib/eclipse-collections-forkjoin-9.2.0.jar, + lib/kotlin-stdlib-1.2.42.jar, + lib/lz4-1.3.0.jar, + lib/elsa-3.0.0-M5.jar diff --git a/com.minres.scviewer.database.text/build.properties b/com.minres.scviewer.database.text/build.properties index e1806ea..5a2fc62 100644 --- a/com.minres.scviewer.database.text/build.properties +++ b/com.minres.scviewer.database.text/build.properties @@ -12,6 +12,14 @@ bin.includes = META-INF/,\ .,\ OSGI-INF/,\ lib/,\ - lib/mapdb-3.0.7.jar -bin.excludes = **/*.groovy + lib/mapdb-3.0.7.jar,\ + lib/eclipse-collections-9.2.0.jar,\ + lib/eclipse-collections-api-9.2.0.jar,\ + lib/eclipse-collections-forkjoin-9.2.0.jar,\ + lib/kotlin-stdlib-1.2.42.jar,\ + lib/lz4-1.3.0.jar,\ + lib/elsa-3.0.0-M5.jar +bin.excludes = **/*.groovy,\ + lib/mapdb-3.0.7-sources.jar,\ + lib/mapdb-3.0.7-javadoc.jar source.. = src/ diff --git a/com.minres.scviewer.database.text/lib/eclipse-collections-9.2.0.jar b/com.minres.scviewer.database.text/lib/eclipse-collections-9.2.0.jar new file mode 100755 index 0000000..694343e Binary files /dev/null and b/com.minres.scviewer.database.text/lib/eclipse-collections-9.2.0.jar differ diff --git a/com.minres.scviewer.database.text/lib/eclipse-collections-api-9.2.0.jar b/com.minres.scviewer.database.text/lib/eclipse-collections-api-9.2.0.jar new file mode 100755 index 0000000..e585e77 Binary files /dev/null and b/com.minres.scviewer.database.text/lib/eclipse-collections-api-9.2.0.jar differ diff --git a/com.minres.scviewer.database.text/lib/eclipse-collections-forkjoin-9.2.0.jar b/com.minres.scviewer.database.text/lib/eclipse-collections-forkjoin-9.2.0.jar new file mode 100755 index 0000000..2ccffc1 Binary files /dev/null and b/com.minres.scviewer.database.text/lib/eclipse-collections-forkjoin-9.2.0.jar differ diff --git a/com.minres.scviewer.database.text/lib/elsa-3.0.0-M5.jar b/com.minres.scviewer.database.text/lib/elsa-3.0.0-M5.jar new file mode 100755 index 0000000..dc46000 Binary files /dev/null and b/com.minres.scviewer.database.text/lib/elsa-3.0.0-M5.jar differ diff --git a/com.minres.scviewer.database.text/lib/kotlin-stdlib-1.2.42.jar b/com.minres.scviewer.database.text/lib/kotlin-stdlib-1.2.42.jar new file mode 100755 index 0000000..9663606 Binary files /dev/null and b/com.minres.scviewer.database.text/lib/kotlin-stdlib-1.2.42.jar differ diff --git a/com.minres.scviewer.database.text/lib/lz4-1.3.0.jar b/com.minres.scviewer.database.text/lib/lz4-1.3.0.jar new file mode 100755 index 0000000..aaf641c Binary files /dev/null and b/com.minres.scviewer.database.text/lib/lz4-1.3.0.jar differ diff --git a/com.minres.scviewer.database.text/pom.xml b/com.minres.scviewer.database.text/pom.xml index 94123fe..aa0c0d0 100644 --- a/com.minres.scviewer.database.text/pom.xml +++ b/com.minres.scviewer.database.text/pom.xml @@ -2,6 +2,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.minres.scviewer.database.text + 2.0.0-SNAPSHOT com.minres.scviewer com.minres.scviewer.parent @@ -9,9 +10,10 @@ ../com.minres.scviewer.parent eclipse-plugin + - - + + org.eclipse.tycho tycho-compiler-plugin 0.23.1 @@ -37,7 +39,6 @@ - + - 1.0.1-SNAPSHOT \ No newline at end of file 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 d8e9a44..9d9c1cd 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 @@ -13,6 +13,11 @@ package com.minres.scviewer.database.text; import java.nio.charset.CharsetDecoder; import java.util.Collection; import java.util.zip.GZIPInputStream + +import org.codehaus.groovy.ast.stmt.CatchStatement +import org.mapdb.DB +import org.mapdb.DBMaker + import groovy.io.FileType import com.minres.scviewer.database.AssociationType @@ -34,6 +39,8 @@ public class TextDbLoader implements IWaveformDbLoader{ def relationTypes=[:] + DB mapDb + public TextDbLoader() { } @@ -62,6 +69,17 @@ public class TextDbLoader implements IWaveformDbLoader{ try { def gzipped = isGzipped(file) if(isTxfile(gzipped?new GZIPInputStream(new FileInputStream(file)):new FileInputStream(file))){ + def mapDbFile = File.createTempFile("."+file.name, "tmp", file.parentFile) + mapDbFile.delete() + mapDbFile.deleteOnExit() + this.mapDb = DBMaker + .fileDB(mapDbFile) + .fileMmapEnableIfSupported() + .fileMmapPreclearDisable() + .cleanerHackEnable() + .allocateStartSize(64*1024*1024) + .allocateIncrement(64*1024*1024) + .make() parseInput(gzipped?new GZIPInputStream(new FileInputStream(file)):new FileInputStream(file)) calculateConcurrencyIndicees() return true @@ -124,7 +142,7 @@ public class TextDbLoader implements IWaveformDbLoader{ case "end_attribute": if ((matcher = line =~ /^scv_tr_stream\s+\(ID (\d+),\s+name\s+"([^"]+)",\s+kind\s+"([^"]+)"\)$/)) { def id = Integer.parseInt(matcher[0][1]) - def stream = new TxStream(db, id, matcher[0][2], matcher[0][3]) + def stream = new TxStream(this, id, matcher[0][2], matcher[0][3]) streams<> events - TxStream(IWaveformDb db, int id, String name, String kind){ + TxStream(TextDbLoader loader, int id, String name, String kind){ super(name) this.id=id - this.database=db + this.database=loader.db this.fullName=name this.kind=kind this.maxConcurrency=0 - events = new TreeMap>() + //events = new TreeMap>() + events = loader.mapDb.treeMap(name).keySerializer(Serializer.LONG).createOrOpen(); } List getGenerators(){ diff --git a/com.minres.scviewer.database.vcd/pom.xml b/com.minres.scviewer.database.vcd/pom.xml index f1a21ec..20be6aa 100644 --- a/com.minres.scviewer.database.vcd/pom.xml +++ b/com.minres.scviewer.database.vcd/pom.xml @@ -8,5 +8,4 @@ ../com.minres.scviewer.parent eclipse-plugin - 2.0.0-SNAPSHOT \ No newline at end of file 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 16c8ef7..fbbd8f4 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 @@ -26,7 +26,6 @@ import com.minres.scviewer.database.ISignal; import com.minres.scviewer.database.IWaveform; import com.minres.scviewer.database.IWaveformDb; import com.minres.scviewer.database.IWaveformDbLoader; -import com.minres.scviewer.database.IWaveformEvent; import com.minres.scviewer.database.InputFormatException; import com.minres.scviewer.database.RelationType; @@ -152,9 +151,9 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder { public Integer newNet(String name, int i, int width) { String netName = moduleStack.empty()? name: moduleStack.lastElement()+"."+name; int id = signals.size(); - assert(width>0); + assert(width>=0); if(width==0) { - signals.add( i<0 ? new VCDSignal(db, id, netName) : + signals.add( i<0 ? new VCDSignal(db, id, netName, width) : new VCDSignal((VCDSignal)signals.get(i), id, netName)); } else if(width>0){ signals.add( i<0 ? new VCDSignal(db, id, netName, width) : diff --git a/com.minres.scviewer.database/src/com/minres/scviewer/database/BitVector.java b/com.minres.scviewer.database/src/com/minres/scviewer/database/BitVector.java index 56eb9b4..f6d74cd 100644 --- a/com.minres.scviewer.database/src/com/minres/scviewer/database/BitVector.java +++ b/com.minres.scviewer.database/src/com/minres/scviewer/database/BitVector.java @@ -96,16 +96,15 @@ public class BitVector { public long toUnsignedValue() { long res = 0; - int bitOffset = width * 2; - int wordOffset = bitOffset >> 5; - bitOffset &= 31; - int currentWord = packedValues[wordOffset] >> bitOffset; + int bitOffset = 0; + int wordOffset = 0; + int currentWord = 0; // Copy values out of packed array for (int i = 0; i < width; i++) { - res<<=1; + if(bitOffset==0) currentWord = packedValues[wordOffset]; switch (currentWord & 3) { case 1: - res++; + res|=1<>= 2; @@ -126,42 +124,46 @@ public class BitVector { } public long toSignedValue() { - Boolean negative=null; long res = 0; - int bitOffset = width * 2; - int wordOffset = bitOffset >> 5; - bitOffset &= 31; - int currentWord = packedValues[wordOffset] >> bitOffset; + int bitOffset = 0; + int wordOffset = 0; + int currentWord = 0; + int lastVal=0; // Copy values out of packed array for (int i = 0; i < width; i++) { - if(negative == null) { - switch (currentWord & 3) { - case 1: negative=true; break; - case 0: negative=false; break; - case 2: - case 3: return 0; - default: - } - } else { - res<<=1; - switch (currentWord & 3) { - case 1: if(!negative) res++; break; - case 0: if(negative) res++; break; - case 2: - case 3: return 0; - default: - } + if(bitOffset==0) currentWord = packedValues[wordOffset]; + lastVal=0; + switch (currentWord & 3) { + case 1: + res|=1<>= 2; } } - return negative?-1*(res+1):res; + for(int i=width; i<64; i++) { + if(bitOffset==0) currentWord = packedValues[wordOffset]; + res|=lastVal<>= 2; + } + + } + return res; } } diff --git a/com.minres.scviewer.database/src/com/minres/scviewer/database/IWaveformDb.java b/com.minres.scviewer.database/src/com/minres/scviewer/database/IWaveformDb.java index 3f58f85..2dee198 100644 --- a/com.minres.scviewer.database/src/com/minres/scviewer/database/IWaveformDb.java +++ b/com.minres.scviewer.database/src/com/minres/scviewer/database/IWaveformDb.java @@ -24,7 +24,7 @@ public interface IWaveformDb extends IHierNode { public List getAllRelationTypes(); - public boolean load(File inp) throws Exception; + public boolean load(File inp); public boolean isLoaded(); diff --git a/com.minres.scviewer.database/src/com/minres/scviewer/database/internal/WaveformDb.java b/com.minres.scviewer.database/src/com/minres/scviewer/database/internal/WaveformDb.java index 60daa1a..c734827 100644 --- a/com.minres.scviewer.database/src/com/minres/scviewer/database/internal/WaveformDb.java +++ b/com.minres.scviewer.database/src/com/minres/scviewer/database/internal/WaveformDb.java @@ -22,12 +22,9 @@ import java.util.Map; import com.minres.scviewer.database.HierNode; import com.minres.scviewer.database.IHierNode; -import com.minres.scviewer.database.ISignal; -import com.minres.scviewer.database.ITxStream; import com.minres.scviewer.database.IWaveform; import com.minres.scviewer.database.IWaveformDb; import com.minres.scviewer.database.IWaveformDbLoader; -import com.minres.scviewer.database.IWaveformEvent; import com.minres.scviewer.database.InputFormatException; import com.minres.scviewer.database.RelationType; @@ -82,22 +79,26 @@ public class WaveformDb extends HierNode implements IWaveformDb { } @Override - public boolean load(File inp) throws Exception { + public boolean load(File inp){ for(IWaveformDbLoader loader:loaders){ - if(loader.load(this, inp)){ - for(IWaveform w:loader.getAllWaves()){ - waveforms.put(w.getFullName(),w); + try { + if(loader.load(this, inp)){ + for(IWaveform w:loader.getAllWaves()){ + waveforms.put(w.getFullName(),w); + } + if(loader.getMaxTime()>maxTime){ + maxTime=loader.getMaxTime(); + } + if(name==null) name=getFileBasename(inp.getName()); + buildHierarchyNodes() ; + relationTypes.addAll(loader.getAllRelationTypes()); + pcs.firePropertyChange("WAVEFORMS", null, waveforms); + pcs.firePropertyChange("CHILDS", null, childNodes); + loaded = true; + return true; } - if(loader.getMaxTime()>maxTime){ - maxTime=loader.getMaxTime(); - } - if(name==null) name=getFileBasename(inp.getName()); - buildHierarchyNodes() ; - relationTypes.addAll(loader.getAllRelationTypes()); - pcs.firePropertyChange("WAVEFORMS", null, waveforms); - pcs.firePropertyChange("CHILDS", null, childNodes); - loaded = true; - return true; + } catch (Exception e) { + return false; } } return false; diff --git a/com.minres.scviewer.parent/pom.xml b/com.minres.scviewer.parent/pom.xml index 736e844..13bb8f3 100644 --- a/com.minres.scviewer.parent/pom.xml +++ b/com.minres.scviewer.parent/pom.xml @@ -11,6 +11,7 @@ ../com.minres.scviewer.database.sqlite ../com.minres.scviewer.database.text ../com.minres.scviewer.database.vcd + ../com.minres.scviewer.database.leveldb ../com.minres.scviewer.database.test ../com.minres.scviewer.database.ui ../com.minres.scviewer.database.ui.swt