Skip to content

Commit 25d1348

Browse files
committed
debug
1 parent c59b39a commit 25d1348

File tree

4 files changed

+33
-19
lines changed

4 files changed

+33
-19
lines changed

src/main/scala/uclid/ConcreteSimulator.scala

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ case object Panic extends CmdsMod
6565
2. UninterpretedType
6666
3. FunctionCall
6767
4. evaluateBoolExpr
68+
5. Json input support
6869
*/
6970

7071
sealed abstract class ConcreteValue{
@@ -125,9 +126,10 @@ object ConcreteSimulator {
125126
var undetCount: Int = 0;
126127
var cntInt:Int = 0;
127128
var terminateInt: Int = 0;
128-
129+
var proofResults: ListBuffer[CheckResult] = ListBuffer[CheckResult]()
129130
//util
130131
val random = new Random()
132+
131133
case class ConcreteContext() {
132134
var varMap: scala.collection.mutable.Map[Identifier, ConcreteValue] = collection.mutable.Map();
133135
var varTypeMap: scala.collection.mutable.Map[Identifier, Type] = collection.mutable.Map();
@@ -143,13 +145,11 @@ object ConcreteSimulator {
143145
else if (inputMap.contains(variable)) inputMap(variable)
144146
else{
145147
ConcreteUndef()
146-
}
147-
}
148+
}}
148149
def write (variable: Identifier, value: ConcreteValue) {
149150
if (varMap.contains(variable)) varMap(variable) = value
150151
else if (inputMap.contains(variable)) inputMap(variable) = value
151-
else throw new Error(f"Variable ${variable.toString} not found in context")
152-
}
152+
else throw new Error(f"Variable ${variable.toString} not found in context")}
153153
def updateVar (lhs: Lhs, value: ConcreteValue) {
154154
defaultLog.debug("Update "+lhs.toString+" With Value "+value.toString)
155155
lhs match {
@@ -247,9 +247,7 @@ object ConcreteSimulator {
247247
varMap.-(variable_name)
248248
}}
249249

250-
def extendVarJson(frame:Int, vars: List[(Identifier, Type)]): Unit= {
251-
;}
252-
250+
def extendVarJson(frame:Int, vars: List[(Identifier, Type)]): Unit= {;}
253251
def assignUndefVar(vars: List[(Identifier, Type)],isInput: Boolean): Unit = {
254252
if(isInput){
255253
var retContext = inputMap;
@@ -439,9 +437,7 @@ object ConcreteSimulator {
439437
case _ => {
440438
throw new Error("Hit unimplemented code part")
441439
}
442-
}
443-
444-
}
440+
} }
445441

446442
//function gathring value as we want
447443
def generateValue(cValue:ConcreteValue,uclidType:Type,isInput:Boolean): ConcreteValue={
@@ -588,8 +584,7 @@ object ConcreteSimulator {
588584
case _ => ConcreteUndef()
589585
}
590586
}
591-
}
592-
}
587+
}}
593588
//private Functions
594589
def updateRecordValue(fields: List[Identifier], value: ConcreteValue,
595590
recordValue: ConcreteValue) : ConcreteRecord = {
@@ -643,11 +638,9 @@ object ConcreteSimulator {
643638
}
644639
for (variable <- vars){
645640
println(variable._1+": "+ConcreteSimulator.evaluate_expr(this,variable._1).toString)
646-
}}
647-
}
641+
}}}
642+
648643

649-
var proofResults: ListBuffer[CheckResult] = ListBuffer[CheckResult]()
650-
651644
def execute (module: Module, config: UclidMain.Config) : List[CheckResult] = {
652645
terminate = false;
653646
proofResults.clear();
@@ -853,7 +846,8 @@ object ConcreteSimulator {
853846
}
854847
}
855848
case ConcreteUndef() => {
856-
true
849+
terminate = true
850+
return false
857851
}
858852
case _ => throw new NotImplementedError("Should not touch this line")
859853
}

test/concrete/concrete-0.ucl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/*
2+
Test-conctete-0:
3+
1. test of property failure
4+
*/
15
module main
26
{
37
var a : integer;
@@ -8,7 +12,6 @@ module main
812
}
913
next {
1014
a' = a + 1;
11-
// assert(a !=3);
1215
}
1316
property jump_a: a!=3;
1417

test/concrete/concrete-1.ucl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/*
2+
concrete-1.ucl
3+
1. test of type of enum
4+
2. test of procedure with modifies
5+
3. test of assert
6+
*/
17
module main
28
{
39
type color_t = enum { red, blue };

test/concrete/concrete-2.ucl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/*
2+
concrete-2.ucl
3+
1. test of array
4+
2. test of assert
5+
3. test of touching undefine variable
6+
*/
17
module main
28
{
39
type num_t = integer;
@@ -7,11 +13,16 @@ module main
713
init {
814
numbers[true] = 0;
915
zero = numbers[true];
16+
17+
// assert(read == 0);
1018
}
1119

1220
next {
21+
zero' = zero + read;
1322
}
1423

24+
// property p1: read == 1;
25+
1526
control {
1627
v = concrete (5);
1728
check;

0 commit comments

Comments
 (0)