Skip to content

Commit 6abba63

Browse files
committed
Add SMV tests for ternary, toint and floor
1 parent ffebb82 commit 6abba63

4 files changed

Lines changed: 40 additions & 1 deletion

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
-- SMV description generated by Yosys 0.51+101 (git sha1 6bd6775c3, g++ 11.4.0-1ubuntu1~22.04.2 -Og -fPIC)
2+
MODULE main
3+
VAR
4+
_a : real; -- a
5+
_b : unsigned word[3]; -- b
6+
DEFINE
7+
_$itor$arithmetic#sv#7$2_Y := toint(resize(_b, 3));
8+
_c := _$itor$arithmetic#sv#7$2_Y + _a;
9+
_$itor$arithmetic#sv#8$5_Y := toint(resize(signed(_b), 3));
10+
_$add$arithmetic#sv#8$4_Y := _a + _$itor$arithmetic#sv#8$5_Y;
11+
_$eq$arithmetic#sv#8$6_Y := resize(word1(_c = _$add$arithmetic#sv#8$4_Y), 1);
12+
_$auto$rtlil#cc#2837#Not$9 := !resize(_$eq$arithmetic#sv#8$6_Y, 1);
13+
_$auto$rtlil#cc#2884#And$11 := resize(_$auto$rtlil#cc#2837#Not$9, 1) & resize(0ub1_1, 1);
14+
INVARSPEC bool(_$eq$arithmetic#sv#8$6_Y);
15+
-- end of yosys output
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
-- SMV description generated by Yosys 0.51+101 (git sha1 6bd6775c3, g++ 11.4.0-1ubuntu1~22.04.2 -Og -fPIC)
2+
MODULE main
3+
VAR
4+
_VIN : real; -- VIN
5+
_rst1 : unsigned word[1]; -- rst1
6+
_rst2 : unsigned word[1]; -- rst2
7+
DEFINE
8+
_delta := 1.00000000000000000 / 8.00000000000000000;
9+
_$div$maurice2024_adc#sv#46$14_Y := _VIN / _delta;
10+
_$floor$maurice2024_adc#sv#46$15_Y := signed word[3](floor(_$div$maurice2024_adc#sv#46$14_Y));
11+
INVARSPEC bool(word1(_$floor$maurice2024_adc#sv#46$15_Y = 0sb3_000));
12+
-- end of yosys output
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
MODULE main
2+
VAR
3+
a: boolean;
4+
b: boolean;
5+
c: boolean;
6+
d: boolean;
7+
DEFINE
8+
result := a ? 0.0 : b ? 1.0 : c ? 2.0 : d ? 3.0 : 4.0;
9+
INVARSPEC result < 5.0;

tests/encoders/test_encoder_inputs.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ const unordered_map<string, pono::ProverResult> smv_inputs(
3434
{ "combined-true.smv", pono::ProverResult::TRUE },
3535
{ "counter_yosys.smv", pono::ProverResult::FALSE },
3636
{ "counter_bitvector.smv", pono::ProverResult::FALSE },
37-
{ "counter_boolean.smv", pono::ProverResult::FALSE } });
37+
{ "counter_boolean.smv", pono::ProverResult::FALSE },
38+
{ "ternary.smv", pono::ProverResult::TRUE },
39+
{ "real_arithmetic.smv", pono::ProverResult::TRUE },
40+
{ "real_arithmetic_floor.smv", pono::ProverResult::FALSE } });
3841

3942
} // namespace pono_tests

0 commit comments

Comments
 (0)