public void ParseDumpVars() { Scope scope = new Scope(ScopeType.Module, "tester1"); Scope[] scopes = { scope }; IDeclCmd[] expectedDecls = new IDeclCmd[] { scope, new VarDef(VarType.Wire, 4, "'", "values_2/in", scopes), new VarDef(VarType.Wire, 4, "(", "values_1", scopes), new VarDef(VarType.Wire, 1, "-", "clock", scopes), new VarDef(VarType.Wire, 4, ".", "values_0", scopes), new UpScope() }; ISimCmd[] expectedSimCmds = new ISimCmd[] { new DumpVars(new List <VarValue>() { new BinaryVarValue(new BitState[] { BitState.Zero, BitState.Zero, BitState.Zero, BitState.Zero }, new List <VarDef>() { (VarDef)expectedDecls[1] }, true), new BinaryVarValue(new BitState[] { BitState.Zero, BitState.Zero, BitState.Zero, BitState.Zero }, new List <VarDef>() { (VarDef)expectedDecls[4] }, true), new BinaryVarValue(new BitState[] { BitState.Zero, BitState.Zero, BitState.Zero, BitState.Zero }, new List <VarDef>() { (VarDef)expectedDecls[2] }, true), new BinaryVarValue(new BitState[] { BitState.Zero }, new List <VarDef>() { (VarDef)expectedDecls[3] }, true) }) }; string vcdString = @" $scope module tester1 $end $var wire 4 ' values_2/in $end $var wire 4 ( values_1 $end $var wire 1 - clock $end $var wire 4 . values_0 $end $upscope $end $enddefinitions $end $dumpvars b0000 ' b0000 . b0000 ( 0- $end"; VCD vcd = Parse.FromString(vcdString); TestTools.VerifyDeclarations(expectedDecls, vcd.Declarations); TestTools.VerifySimCmds(expectedSimCmds, vcd.GetSimulationCommands().ToArray()); }
public void ParseSimTime() { ISimCmd[] expectedSimCmds = new ISimCmd[] { new SimTime(0), new SimTime(53) }; string vcdString = @" $enddefinitions $end #0 #53"; VCD vcd = Parse.FromString(vcdString); TestTools.VerifySimCmds(expectedSimCmds, vcd.GetSimulationCommands().ToArray()); }
public void ParseVectorBinarySize2ValueChange() { IDeclCmd[] expectedDecls = new IDeclCmd[] { new VarDef(VarType.Wire, 2, "b1", "b1", Array.Empty <Scope>()) }; ISimCmd[] expectedSimCmds = new ISimCmd[] { new BinaryVarValue(new BitState[] { BitState.Zero, BitState.Zero }, new List <VarDef>() { (VarDef)expectedDecls[0] }, true) }; string vcdString = @$ " $var wire 2 b1 b1 $end $enddefinitions $end b00 b1"; VCD vcd = Parse.FromString(vcdString); TestTools.VerifyDeclarations(expectedDecls, vcd.Declarations); TestTools.VerifySimCmds(expectedSimCmds, vcd.GetSimulationCommands().ToArray()); }