File tree Expand file tree Collapse file tree 6 files changed +64
-0
lines changed Expand file tree Collapse file tree 6 files changed +64
-0
lines changed Original file line number Diff line number Diff line change 1+ namespace pfloat {
2+ function f(int<4> x) : int<3> {
3+ chp {
4+ self := int(x{0}, 3)
5+ }
6+ }
7+
8+ export
9+ defproc test() {
10+ int<15> x;
11+ chp {
12+ x := 123;
13+ log(f(x));
14+ log(int(7, 3) - f(x))
15+ }
16+ }
17+ }
18+
19+ defproc test()
20+ {
21+ pfloat::test t;
22+ }
Original file line number Diff line number Diff line change 1+ namespace pfloat {
2+ export
3+ template<pint EXP,MAN>
4+ deftype float(int<1> sign; int<EXP> exponent; int<MAN> significand) {
5+ methods {
6+ function is_infinite() : bool {
7+ chp {
8+ self := exponent = (1 << EXP) - 1 & significand = 0
9+ }
10+ }
11+
12+ function is_finite() : bool {
13+ chp {
14+ // self := ~(exponent = (1 << EXP) - 1 & significand != 0)
15+ self := is_infinite()
16+ }
17+ }
18+ }
19+ }
20+
21+ export
22+ defproc test() {
23+ float<1,5> y;
24+ chp {
25+ y := float<1,5>(0);
26+ [ y.is_finite() -> log("here ")
27+ [] else -> log ("there ")
28+ ]
29+ }
30+ }
31+ }
32+
33+
34+ defproc test()
35+ {
36+ pfloat::test t;
37+ }
Original file line number Diff line number Diff line change 1+ WARNING: test<>: substituting chp model (requested prs, not found)
Original file line number Diff line number Diff line change 1+ [ 10] <t> 1
2+ [ 10] <t> 6
Original file line number Diff line number Diff line change 1+ WARNING: test<>: substituting chp model (requested prs, not found)
Original file line number Diff line number Diff line change 1+ [ 10] <t> there
You can’t perform that action at this time.
0 commit comments