cleans interfaces up

This commit is contained in:
2023-02-27 13:07:10 +01:00
parent bba4349e1e
commit 299f76323f
16 changed files with 73 additions and 45 deletions

View File

@ -33,6 +33,37 @@ public class BitVector implements IEvent {
packedValues[i] = 0;
}
public static BitVector fromString(int netWidth, String value){
BitVector bv = new BitVector(netWidth);
int stringIndex = 0;
for (int convertedIndex = netWidth -1; convertedIndex >=0; convertedIndex--) {
if(convertedIndex<value.length()) {
switch (value.charAt(stringIndex++)) {
case 'z':
bv.setValue(convertedIndex, BitValue.Z);
break;
case '1':
bv.setValue(convertedIndex, BitValue.ONE);
break;
case '0':
bv.setValue(convertedIndex, BitValue.ZERO);
break;
case 'x':
bv.setValue(convertedIndex, BitValue.X);
break;
default:
bv.setValue(convertedIndex, BitValue.X);
}
} else {
bv.setValue(convertedIndex, BitValue.ZERO);
}
}
return bv;
}
/**
* Sets the value.
*

View File

@ -78,4 +78,11 @@ public interface IWaveform extends IHierNode {
*/
public int getRowCount();
/**
* Gets the width.
*
* @return the width
*/
public int getWidth();
}

View File

@ -55,7 +55,7 @@ public interface IWaveformDbLoader {
* @param inputFile the input file
* @throws InputFormatException the input format exception
*/
public void load(IWaveformDb db, File inputFile) throws InputFormatException;
public void load(File inputFile) throws InputFormatException;
/**
* Gets the max time.

View File

@ -135,7 +135,7 @@ public class WaveformDb extends HierNode implements IWaveformDb, PropertyChangeL
IWaveformDbLoader loader = loaderFactory.getLoader();
loader.addPropertyChangeListener(this);
try {
loader.load(this, inp);
loader.load(inp);
} catch (Exception e) {
LOG.error("error loading file "+inp.getName(), e);
retval=false;