Skip to content

Commit 2a59430

Browse files
authored
Merge pull request #596 from diffblue/json-trace-fixup
fixes for JSON traces
2 parents 99e4e60 + 8759366 commit 2a59430

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

regression/ebmc/traces/json1.desc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
CORE
2+
json1.v
3+
--bound 10 --json-result -
4+
^ "identifier": "Verilog::main\.property\.p1",$
5+
^ "status": "REFUTED",$
6+
^ "trace": \{$
7+
^ "states": \[ \[$
8+
^ "lhs": "main\.data",$
9+
^ "lhs_type": "\[31:0\]",$
10+
^ "value": "1"$
11+
^ "value": "2"$
12+
^EXIT=10$
13+
^SIGNAL=0$
14+
--
15+
^warning: ignoring

regression/ebmc/traces/json1.v

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module main(input clk);
2+
3+
reg [31:0] data;
4+
initial data = 1;
5+
6+
always @(posedge clk)
7+
data = data + 1;
8+
9+
always assert p1: data == 1;
10+
11+
endmodule

src/trans-netlist/trans_trace.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,9 @@ jsont json(const trans_tracet &trace, const namespacet &ns)
294294
DATA_INVARIANT(a.lhs.id() == ID_symbol, "assignment lhs must be symbol");
295295
const symbolt &symbol = ns.lookup(to_symbol_expr(a.lhs));
296296

297+
if(symbol.is_auxiliary)
298+
continue; // drop
299+
297300
std::string lhs_string = from_expr(ns, symbol.name, a.lhs);
298301

299302
std::string value_string =
@@ -307,14 +310,20 @@ jsont json(const trans_tracet &trace, const namespacet &ns)
307310
json_assignment["display_name"] =
308311
json_stringt(id2string(symbol.display_name()));
309312
json_assignment["value"] = json_stringt(value_string);
310-
json_assignment["type"] = json_stringt(type_string);
313+
json_assignment["lhs_type"] = json_stringt(type_string);
311314
json_assignment["mode"] = json_stringt(id2string(symbol.mode));
315+
json_assignment["state_var"] = jsont::json_boolean(symbol.is_state_var);
312316

313317
if(a.location.is_not_nil())
314318
json_assignment["location"] = json(a.location);
319+
320+
json_assignments.push_back(std::move(json_assignment));
315321
}
316322

317323
json_states.push_back(std::move(json_assignments));
324+
325+
if(state.property_failed)
326+
break; // done
318327
}
319328

320329
return std::move(json_trace);

0 commit comments

Comments
 (0)