Added MapDB backing store for Text based Transactions, cleanup of
imports etc.
This commit is contained in:
parent
c080773878
commit
47a285bf6d
|
@ -2,42 +2,12 @@
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>com.minres.scviewer.database.leveldb</artifactId>
|
<artifactId>com.minres.scviewer.database.leveldb</artifactId>
|
||||||
|
<version>1.0.0-SNAPSHOT</version>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.minres.scviewer</groupId>
|
<groupId>com.minres.scviewer</groupId>
|
||||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
<version>2.0.0-SNAPSHOT</version>
|
||||||
<relativePath>../com.minres.scviewer.parent</relativePath>
|
<relativePath>../com.minres.scviewer.parent</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<packaging>eclipse-plugin</packaging>
|
<packaging>eclipse-plugin</packaging>
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.eclipse.tycho</groupId>
|
|
||||||
<artifactId>tycho-compiler-plugin</artifactId>
|
|
||||||
<version>0.23.1</version>
|
|
||||||
<configuration>
|
|
||||||
<compilerId>groovy-eclipse-compiler</compilerId>
|
|
||||||
<!-- set verbose to be true if you want lots of uninteresting messages -->
|
|
||||||
<!-- <verbose>true</verbose> -->
|
|
||||||
<source>1.7</source>
|
|
||||||
<target>1.7</target>
|
|
||||||
</configuration>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.codehaus.groovy</groupId>
|
|
||||||
<artifactId>groovy-eclipse-compiler</artifactId>
|
|
||||||
<version>${groovy-eclipse-compiler-version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.codehaus.groovy</groupId>
|
|
||||||
<artifactId>groovy-eclipse-batch</artifactId>
|
|
||||||
<version>${groovy-eclipse-batch-version}</version>
|
|
||||||
<!-- or choose a different compiler version -->
|
|
||||||
<!-- <version>2.1.8-01</version> -->
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
<version>1.0.1-SNAPSHOT</version>
|
|
||||||
</project>
|
</project>
|
|
@ -15,7 +15,6 @@ import org.json.JSONObject;
|
||||||
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;
|
||||||
import com.minres.scviewer.database.IWaveformEvent;
|
|
||||||
import com.minres.scviewer.database.RelationType;
|
import com.minres.scviewer.database.RelationType;
|
||||||
|
|
||||||
public class LevelDBLoader implements IWaveformDbLoader {
|
public class LevelDBLoader implements IWaveformDbLoader {
|
||||||
|
|
|
@ -18,8 +18,6 @@ import com.minres.scviewer.database.ITxAttribute;
|
||||||
|
|
||||||
public class TxAttribute implements ITxAttribute{
|
public class TxAttribute implements ITxAttribute{
|
||||||
|
|
||||||
private Tx trTransaction;
|
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
private DataType dataType;
|
private DataType dataType;
|
||||||
|
@ -29,7 +27,6 @@ public class TxAttribute implements ITxAttribute{
|
||||||
private Object value;
|
private Object value;
|
||||||
|
|
||||||
public TxAttribute(Tx trTransaction, JSONObject attribute) {
|
public TxAttribute(Tx trTransaction, JSONObject attribute) {
|
||||||
this.trTransaction=trTransaction;
|
|
||||||
this.name=attribute.getString("name");
|
this.name=attribute.getString("name");
|
||||||
this.dataType=DataType.values()[attribute.getInt("type")];
|
this.dataType=DataType.values()[attribute.getInt("type")];
|
||||||
this.associationType=AssociationType.values()[attribute.getInt("assoc")];
|
this.associationType=AssociationType.values()[attribute.getInt("assoc")];
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<artifactId>com.minres.scviewer.database.text</artifactId>
|
|
||||||
<parent>
|
|
||||||
<groupId>com.minres.scviewer</groupId>
|
|
||||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
|
||||||
<version>2.0.0-SNAPSHOT</version>
|
|
||||||
<relativePath>../com.minres.scviewer.parent</relativePath>
|
|
||||||
</parent>
|
|
||||||
<packaging>eclipse-plugin</packaging>
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.eclipse.tycho</groupId>
|
|
||||||
<artifactId>tycho-compiler-plugin</artifactId>
|
|
||||||
<version>0.23.1</version>
|
|
||||||
<configuration>
|
|
||||||
<compilerId>groovy-eclipse-compiler</compilerId>
|
|
||||||
<!-- set verbose to be true if you want lots of uninteresting messages -->
|
|
||||||
<!-- <verbose>true</verbose> -->
|
|
||||||
<source>1.7</source>
|
|
||||||
<target>1.7</target>
|
|
||||||
</configuration>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.codehaus.groovy</groupId>
|
|
||||||
<artifactId>groovy-eclipse-compiler</artifactId>
|
|
||||||
<version>${groovy-eclipse-compiler-version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.codehaus.groovy</groupId>
|
|
||||||
<artifactId>groovy-eclipse-batch</artifactId>
|
|
||||||
<version>${groovy-eclipse-batch-version}</version>
|
|
||||||
<!-- or choose a different compiler version -->
|
|
||||||
<!-- <version>2.1.8-01</version> -->
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
<version>1.0.1-SNAPSHOT</version>
|
|
||||||
</project>
|
|
|
@ -23,7 +23,6 @@ import java.util.List;
|
||||||
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;
|
||||||
import com.minres.scviewer.database.IWaveformEvent;
|
|
||||||
import com.minres.scviewer.database.RelationType;
|
import com.minres.scviewer.database.RelationType;
|
||||||
import com.minres.scviewer.database.sqlite.db.IDatabase;
|
import com.minres.scviewer.database.sqlite.db.IDatabase;
|
||||||
import com.minres.scviewer.database.sqlite.db.SQLiteDatabase;
|
import com.minres.scviewer.database.sqlite.db.SQLiteDatabase;
|
||||||
|
|
|
@ -16,7 +16,6 @@ import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.NavigableMap;
|
import java.util.NavigableMap;
|
||||||
|
|
||||||
|
@ -26,6 +25,7 @@ import org.junit.Test;
|
||||||
|
|
||||||
import com.minres.scviewer.database.AssociationType;
|
import com.minres.scviewer.database.AssociationType;
|
||||||
import com.minres.scviewer.database.DataType;
|
import com.minres.scviewer.database.DataType;
|
||||||
|
import com.minres.scviewer.database.ISignal;
|
||||||
import com.minres.scviewer.database.ITx;
|
import com.minres.scviewer.database.ITx;
|
||||||
import com.minres.scviewer.database.ITxAttribute;
|
import com.minres.scviewer.database.ITxAttribute;
|
||||||
import com.minres.scviewer.database.ITxEvent;
|
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.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformDb;
|
import com.minres.scviewer.database.IWaveformDb;
|
||||||
import com.minres.scviewer.database.IWaveformDbFactory;
|
import com.minres.scviewer.database.IWaveformDbFactory;
|
||||||
import com.minres.scviewer.database.vcd.VCDSignal;
|
|
||||||
|
|
||||||
public class DatabaseServicesTest {
|
public class DatabaseServicesTest {
|
||||||
|
|
||||||
|
@ -72,11 +71,11 @@ public class DatabaseServicesTest {
|
||||||
assertEquals(14, waves.size());
|
assertEquals(14, waves.size());
|
||||||
assertEquals(2, waveformDb.getChildNodes().size());
|
assertEquals(2, waveformDb.getChildNodes().size());
|
||||||
IWaveform bus_data_wave = waves.get(0);
|
IWaveform bus_data_wave = waves.get(0);
|
||||||
VCDSignal<?> bus_data_sig = (VCDSignal<?>) bus_data_wave;
|
ISignal<?> bus_data_sig = (ISignal<?>) bus_data_wave;
|
||||||
Entry<Long, ?> bus_data_entry = bus_data_sig.getEvents().floorEntry(1400000000L);
|
Entry<Long, ?> bus_data_entry = bus_data_sig.getEvents().floorEntry(1400000000L);
|
||||||
assertTrue("01111000".equals(bus_data_entry.getValue().toString()));
|
assertTrue("01111000".equals(bus_data_entry.getValue().toString()));
|
||||||
IWaveform rw_wave = waves.get(2);
|
IWaveform rw_wave = waves.get(2);
|
||||||
VCDSignal<?> rw_sig = (VCDSignal<?>) rw_wave;
|
ISignal<?> rw_sig = (ISignal<?>) rw_wave;
|
||||||
Entry<Long, ?> rw_entry = rw_sig.getEvents().floorEntry(2360000000L);
|
Entry<Long, ?> rw_entry = rw_sig.getEvents().floorEntry(2360000000L);
|
||||||
assertTrue("1".equals(rw_entry.getValue().toString()));
|
assertTrue("1".equals(rw_entry.getValue().toString()));
|
||||||
}
|
}
|
||||||
|
@ -101,7 +100,7 @@ public class DatabaseServicesTest {
|
||||||
assertEquals(1, waveformDb.getChildNodes().size());
|
assertEquals(1, waveformDb.getChildNodes().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
//@Test
|
||||||
public void testTxLDb() throws Exception {
|
public void testTxLDb() throws Exception {
|
||||||
File f = new File("inputs/my_ldb.txldb").getAbsoluteFile();
|
File f = new File("inputs/my_ldb.txldb").getAbsoluteFile();
|
||||||
assertTrue(f.exists());
|
assertTrue(f.exists());
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
|
<classpathentry exported="true" kind="lib" path="lib/elsa-3.0.0-M5.jar"/>
|
||||||
|
<classpathentry exported="true" kind="lib" path="lib/eclipse-collections-9.2.0.jar"/>
|
||||||
|
<classpathentry exported="true" kind="lib" path="lib/eclipse-collections-api-9.2.0.jar"/>
|
||||||
|
<classpathentry exported="true" kind="lib" path="lib/eclipse-collections-forkjoin-9.2.0.jar"/>
|
||||||
|
<classpathentry exported="true" kind="lib" path="lib/kotlin-stdlib-1.2.42.jar"/>
|
||||||
|
<classpathentry exported="true" kind="lib" path="lib/lz4-1.3.0.jar"/>
|
||||||
<classpathentry exported="true" kind="lib" path="lib/mapdb-3.0.7.jar" sourcepath="lib/mapdb-3.0.7-sources.jar">
|
<classpathentry exported="true" kind="lib" path="lib/mapdb-3.0.7.jar" sourcepath="lib/mapdb-3.0.7-sources.jar">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="javadoc_location" value="jar:platform:/resource/com.minres.scviewer.database.text/lib/mapdb-3.0.7-javadoc.jar!/"/>
|
<attribute name="javadoc_location" value="jar:platform:/resource/com.minres.scviewer.database.text/lib/mapdb-3.0.7-javadoc.jar!/"/>
|
||||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: Textual transaction database
|
Bundle-Name: Textual transaction database
|
||||||
Bundle-SymbolicName: com.minres.scviewer.database.text
|
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-Vendor: MINRES Technologies GmbH
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Import-Package: org.osgi.framework;version="1.3.0"
|
Import-Package: org.osgi.framework;version="1.3.0"
|
||||||
|
@ -16,4 +16,10 @@ Service-Component: OSGI-INF/component.xml
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Automatic-Module-Name: com.minres.scviewer.database.text
|
Automatic-Module-Name: com.minres.scviewer.database.text
|
||||||
Bundle-ClassPath: lib/mapdb-3.0.7.jar,
|
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
|
||||||
|
|
|
@ -12,6 +12,14 @@ bin.includes = META-INF/,\
|
||||||
.,\
|
.,\
|
||||||
OSGI-INF/,\
|
OSGI-INF/,\
|
||||||
lib/,\
|
lib/,\
|
||||||
lib/mapdb-3.0.7.jar
|
lib/mapdb-3.0.7.jar,\
|
||||||
bin.excludes = **/*.groovy
|
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/
|
source.. = src/
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -2,6 +2,7 @@
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>com.minres.scviewer.database.text</artifactId>
|
<artifactId>com.minres.scviewer.database.text</artifactId>
|
||||||
|
<version>2.0.0-SNAPSHOT</version>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.minres.scviewer</groupId>
|
<groupId>com.minres.scviewer</groupId>
|
||||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||||
|
@ -9,9 +10,10 @@
|
||||||
<relativePath>../com.minres.scviewer.parent</relativePath>
|
<relativePath>../com.minres.scviewer.parent</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<packaging>eclipse-plugin</packaging>
|
<packaging>eclipse-plugin</packaging>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.eclipse.tycho</groupId>
|
<groupId>org.eclipse.tycho</groupId>
|
||||||
<artifactId>tycho-compiler-plugin</artifactId>
|
<artifactId>tycho-compiler-plugin</artifactId>
|
||||||
<version>0.23.1</version>
|
<version>0.23.1</version>
|
||||||
|
@ -37,7 +39,6 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<version>1.0.1-SNAPSHOT</version>
|
|
||||||
</project>
|
</project>
|
|
@ -13,6 +13,11 @@ package com.minres.scviewer.database.text;
|
||||||
import java.nio.charset.CharsetDecoder;
|
import java.nio.charset.CharsetDecoder;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.zip.GZIPInputStream
|
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 groovy.io.FileType
|
||||||
|
|
||||||
import com.minres.scviewer.database.AssociationType
|
import com.minres.scviewer.database.AssociationType
|
||||||
|
@ -34,6 +39,8 @@ public class TextDbLoader implements IWaveformDbLoader{
|
||||||
|
|
||||||
def relationTypes=[:]
|
def relationTypes=[:]
|
||||||
|
|
||||||
|
DB mapDb
|
||||||
|
|
||||||
public TextDbLoader() {
|
public TextDbLoader() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,6 +69,17 @@ public class TextDbLoader implements IWaveformDbLoader{
|
||||||
try {
|
try {
|
||||||
def gzipped = isGzipped(file)
|
def gzipped = isGzipped(file)
|
||||||
if(isTxfile(gzipped?new GZIPInputStream(new FileInputStream(file)):new FileInputStream(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))
|
parseInput(gzipped?new GZIPInputStream(new FileInputStream(file)):new FileInputStream(file))
|
||||||
calculateConcurrencyIndicees()
|
calculateConcurrencyIndicees()
|
||||||
return true
|
return true
|
||||||
|
@ -124,7 +142,7 @@ public class TextDbLoader implements IWaveformDbLoader{
|
||||||
case "end_attribute":
|
case "end_attribute":
|
||||||
if ((matcher = line =~ /^scv_tr_stream\s+\(ID (\d+),\s+name\s+"([^"]+)",\s+kind\s+"([^"]+)"\)$/)) {
|
if ((matcher = line =~ /^scv_tr_stream\s+\(ID (\d+),\s+name\s+"([^"]+)",\s+kind\s+"([^"]+)"\)$/)) {
|
||||||
def id = Integer.parseInt(matcher[0][1])
|
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<<stream
|
streams<<stream
|
||||||
streamsById[id]=stream
|
streamsById[id]=stream
|
||||||
} else if ((matcher = line =~ /^scv_tr_generator\s+\(ID\s+(\d+),\s+name\s+"([^"]+)",\s+scv_tr_stream\s+(\d+),$/)) {
|
} else if ((matcher = line =~ /^scv_tr_generator\s+\(ID\s+(\d+),\s+name\s+"([^"]+)",\s+scv_tr_stream\s+(\d+),$/)) {
|
||||||
|
|
|
@ -16,6 +16,9 @@ import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.NavigableMap;
|
import java.util.NavigableMap;
|
||||||
|
|
||||||
|
import org.mapdb.Serializer
|
||||||
|
|
||||||
import com.minres.scviewer.database.ITxEvent;
|
import com.minres.scviewer.database.ITxEvent;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformDb
|
import com.minres.scviewer.database.IWaveformDb
|
||||||
|
@ -42,14 +45,15 @@ class TxStream extends HierNode implements ITxStream {
|
||||||
|
|
||||||
private TreeMap<Long, List<ITxEvent>> events
|
private TreeMap<Long, List<ITxEvent>> events
|
||||||
|
|
||||||
TxStream(IWaveformDb db, int id, String name, String kind){
|
TxStream(TextDbLoader loader, int id, String name, String kind){
|
||||||
super(name)
|
super(name)
|
||||||
this.id=id
|
this.id=id
|
||||||
this.database=db
|
this.database=loader.db
|
||||||
this.fullName=name
|
this.fullName=name
|
||||||
this.kind=kind
|
this.kind=kind
|
||||||
this.maxConcurrency=0
|
this.maxConcurrency=0
|
||||||
events = new TreeMap<Long, List<ITxEvent>>()
|
//events = new TreeMap<Long, List<ITxEvent>>()
|
||||||
|
events = loader.mapDb.treeMap(name).keySerializer(Serializer.LONG).createOrOpen();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ITxGenerator> getGenerators(){
|
List<ITxGenerator> getGenerators(){
|
||||||
|
|
|
@ -8,5 +8,4 @@
|
||||||
<relativePath>../com.minres.scviewer.parent</relativePath>
|
<relativePath>../com.minres.scviewer.parent</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<packaging>eclipse-plugin</packaging>
|
<packaging>eclipse-plugin</packaging>
|
||||||
<version>2.0.0-SNAPSHOT</version>
|
|
||||||
</project>
|
</project>
|
|
@ -26,7 +26,6 @@ import com.minres.scviewer.database.ISignal;
|
||||||
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;
|
||||||
import com.minres.scviewer.database.IWaveformEvent;
|
|
||||||
import com.minres.scviewer.database.InputFormatException;
|
import com.minres.scviewer.database.InputFormatException;
|
||||||
import com.minres.scviewer.database.RelationType;
|
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) {
|
public Integer newNet(String name, int i, int width) {
|
||||||
String netName = moduleStack.empty()? name: moduleStack.lastElement()+"."+name;
|
String netName = moduleStack.empty()? name: moduleStack.lastElement()+"."+name;
|
||||||
int id = signals.size();
|
int id = signals.size();
|
||||||
assert(width>0);
|
assert(width>=0);
|
||||||
if(width==0) {
|
if(width==0) {
|
||||||
signals.add( i<0 ? new VCDSignal<Double>(db, id, netName) :
|
signals.add( i<0 ? new VCDSignal<Double>(db, id, netName, width) :
|
||||||
new VCDSignal<Double>((VCDSignal<Double>)signals.get(i), id, netName));
|
new VCDSignal<Double>((VCDSignal<Double>)signals.get(i), id, netName));
|
||||||
} else if(width>0){
|
} else if(width>0){
|
||||||
signals.add( i<0 ? new VCDSignal<BitVector>(db, id, netName, width) :
|
signals.add( i<0 ? new VCDSignal<BitVector>(db, id, netName, width) :
|
||||||
|
|
|
@ -96,16 +96,15 @@ public class BitVector {
|
||||||
|
|
||||||
public long toUnsignedValue() {
|
public long toUnsignedValue() {
|
||||||
long res = 0;
|
long res = 0;
|
||||||
int bitOffset = width * 2;
|
int bitOffset = 0;
|
||||||
int wordOffset = bitOffset >> 5;
|
int wordOffset = 0;
|
||||||
bitOffset &= 31;
|
int currentWord = 0;
|
||||||
int currentWord = packedValues[wordOffset] >> bitOffset;
|
|
||||||
// Copy values out of packed array
|
// Copy values out of packed array
|
||||||
for (int i = 0; i < width; i++) {
|
for (int i = 0; i < width; i++) {
|
||||||
res<<=1;
|
if(bitOffset==0) currentWord = packedValues[wordOffset];
|
||||||
switch (currentWord & 3) {
|
switch (currentWord & 3) {
|
||||||
case 1:
|
case 1:
|
||||||
res++;
|
res|=1<<i;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
case 3:
|
case 3:
|
||||||
|
@ -116,7 +115,6 @@ public class BitVector {
|
||||||
bitOffset += 2;
|
bitOffset += 2;
|
||||||
if (bitOffset == 32) {
|
if (bitOffset == 32) {
|
||||||
wordOffset++;
|
wordOffset++;
|
||||||
currentWord = packedValues[wordOffset];
|
|
||||||
bitOffset = 0;
|
bitOffset = 0;
|
||||||
} else {
|
} else {
|
||||||
currentWord >>= 2;
|
currentWord >>= 2;
|
||||||
|
@ -126,42 +124,46 @@ public class BitVector {
|
||||||
}
|
}
|
||||||
|
|
||||||
public long toSignedValue() {
|
public long toSignedValue() {
|
||||||
Boolean negative=null;
|
|
||||||
long res = 0;
|
long res = 0;
|
||||||
int bitOffset = width * 2;
|
int bitOffset = 0;
|
||||||
int wordOffset = bitOffset >> 5;
|
int wordOffset = 0;
|
||||||
bitOffset &= 31;
|
int currentWord = 0;
|
||||||
int currentWord = packedValues[wordOffset] >> bitOffset;
|
int lastVal=0;
|
||||||
// Copy values out of packed array
|
// Copy values out of packed array
|
||||||
for (int i = 0; i < width; i++) {
|
for (int i = 0; i < width; i++) {
|
||||||
if(negative == null) {
|
if(bitOffset==0) currentWord = packedValues[wordOffset];
|
||||||
switch (currentWord & 3) {
|
lastVal=0;
|
||||||
case 1: negative=true; break;
|
switch (currentWord & 3) {
|
||||||
case 0: negative=false; break;
|
case 1:
|
||||||
case 2:
|
res|=1<<i;
|
||||||
case 3: return 0;
|
lastVal=1;
|
||||||
default:
|
break;
|
||||||
}
|
case 2:
|
||||||
} else {
|
case 3:
|
||||||
res<<=1;
|
return 0;
|
||||||
switch (currentWord & 3) {
|
default:
|
||||||
case 1: if(!negative) res++; break;
|
|
||||||
case 0: if(negative) res++; break;
|
|
||||||
case 2:
|
|
||||||
case 3: return 0;
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
bitOffset += 2;
|
bitOffset += 2;
|
||||||
if (bitOffset == 32) {
|
if (bitOffset == 32) {
|
||||||
wordOffset++;
|
wordOffset++;
|
||||||
currentWord = packedValues[wordOffset];
|
|
||||||
bitOffset = 0;
|
bitOffset = 0;
|
||||||
} else {
|
} else {
|
||||||
currentWord >>= 2;
|
currentWord >>= 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return negative?-1*(res+1):res;
|
for(int i=width; i<64; i++) {
|
||||||
|
if(bitOffset==0) currentWord = packedValues[wordOffset];
|
||||||
|
res|=lastVal<<i;
|
||||||
|
bitOffset += 2;
|
||||||
|
if (bitOffset == 32) {
|
||||||
|
wordOffset++;
|
||||||
|
bitOffset = 0;
|
||||||
|
} else {
|
||||||
|
currentWord >>= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ public interface IWaveformDb extends IHierNode {
|
||||||
|
|
||||||
public List<RelationType> getAllRelationTypes();
|
public List<RelationType> getAllRelationTypes();
|
||||||
|
|
||||||
public boolean load(File inp) throws Exception;
|
public boolean load(File inp);
|
||||||
|
|
||||||
public boolean isLoaded();
|
public boolean isLoaded();
|
||||||
|
|
||||||
|
|
|
@ -22,12 +22,9 @@ import java.util.Map;
|
||||||
|
|
||||||
import com.minres.scviewer.database.HierNode;
|
import com.minres.scviewer.database.HierNode;
|
||||||
import com.minres.scviewer.database.IHierNode;
|
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.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;
|
||||||
import com.minres.scviewer.database.IWaveformEvent;
|
|
||||||
import com.minres.scviewer.database.InputFormatException;
|
import com.minres.scviewer.database.InputFormatException;
|
||||||
import com.minres.scviewer.database.RelationType;
|
import com.minres.scviewer.database.RelationType;
|
||||||
|
|
||||||
|
@ -82,22 +79,26 @@ public class WaveformDb extends HierNode implements IWaveformDb {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean load(File inp) throws Exception {
|
public boolean load(File inp){
|
||||||
for(IWaveformDbLoader loader:loaders){
|
for(IWaveformDbLoader loader:loaders){
|
||||||
if(loader.load(this, inp)){
|
try {
|
||||||
for(IWaveform w:loader.getAllWaves()){
|
if(loader.load(this, inp)){
|
||||||
waveforms.put(w.getFullName(),w);
|
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){
|
} catch (Exception e) {
|
||||||
maxTime=loader.getMaxTime();
|
return false;
|
||||||
}
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
<module>../com.minres.scviewer.database.sqlite</module>
|
<module>../com.minres.scviewer.database.sqlite</module>
|
||||||
<module>../com.minres.scviewer.database.text</module>
|
<module>../com.minres.scviewer.database.text</module>
|
||||||
<module>../com.minres.scviewer.database.vcd</module>
|
<module>../com.minres.scviewer.database.vcd</module>
|
||||||
|
<module>../com.minres.scviewer.database.leveldb</module>
|
||||||
<module>../com.minres.scviewer.database.test</module>
|
<module>../com.minres.scviewer.database.test</module>
|
||||||
<module>../com.minres.scviewer.database.ui</module>
|
<module>../com.minres.scviewer.database.ui</module>
|
||||||
<module>../com.minres.scviewer.database.ui.swt</module>
|
<module>../com.minres.scviewer.database.ui.swt</module>
|
||||||
|
|
Loading…
Reference in New Issue