Skip to content

Commit

Permalink
Merge pull request #150 from ftsrg/fptype-fix
Browse files Browse the repository at this point in the history
FPType grammar fix (#148)
  • Loading branch information
leventeBajczi authored Nov 30, 2021
2 parents 7fc3f5c + 970e714 commit 811e180
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 26 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ buildscript {

allprojects {
group = "hu.bme.mit.inf.theta"
version = "3.0.0"
version = "3.0.1"

apply(from = rootDir.resolve("gradle/shared-with-buildSrc/mirrors.gradle.kts"))
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
main process cfa {
var x : fp[8:24]
var x : fp[8,24]

init loc L0
loc L1
Expand Down
10 changes: 5 additions & 5 deletions subprojects/cfa/cfa-analysis/src/test/resources/fp1.cfa
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
main process cfa {
var f2 : fp[5:11]
var f3 : fp[11:53]
var f4 : fp[11:53]
var f2 : fp[5,11]
var f3 : fp[11,53]
var f4 : fp[11,53]
var b1 : bv[4]

init loc L1
Expand All @@ -13,9 +13,9 @@ main process cfa {
error loc ERR

L1 -> L2 { f2 := 5'b10010.10'd0 }
L2 -> L3 { f3 := fptofp[11:53][RNE] f2 }
L2 -> L3 { f3 := fptofp[11,53][RNE] f2 }
L3 -> L4 { b1 := 4'd8 }
L4 -> L5 { f4 := fpfrombv[11:53][u][RNE] b1 }
L4 -> L5 { f4 := fpfrombv[11,53][u][RNE] b1 }
L5 -> END { assume f3 = f4 }
L5 -> ERR { assume not (f3 = f4) }
}
8 changes: 4 additions & 4 deletions subprojects/cfa/cfa-analysis/src/test/resources/fp2.cfa
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
main process cfa {
var f2 : fp[2:3]
var f3 : fp[2:3]
var f4 : fp[2:3]
var f5 : fp[2:3]
var f2 : fp[2,3]
var f3 : fp[2,3]
var f4 : fp[2,3]
var f5 : fp[2,3]

init loc L1
loc L2
Expand Down
2 changes: 1 addition & 1 deletion subprojects/cfa/cfa/src/main/antlr/CfaDsl.g4
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ SIGNEDNESS
;

FP_TYPE_DECL
: LBRACK NAT COLON NAT RBRACK
: LBRACK NAT COMMA NAT RBRACK
;

FP_ROUNDINGMODE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ private int getBvSize(String text) {
}

private int getExp(String text) {
Pattern pattern = Pattern.compile("\\[([0-9]*):([0-9]*)]");
Pattern pattern = Pattern.compile("\\[([0-9]*),([0-9]*)]");
Matcher matcher = pattern.matcher(text);
if (matcher.find())
{
Expand All @@ -884,7 +884,7 @@ private int getExp(String text) {
}

private int getSignificand(String text) {
Pattern pattern = Pattern.compile("\\[([0-9]*):([0-9]*)]");
Pattern pattern = Pattern.compile("\\[([0-9]*),([0-9]*)]");
Matcher matcher = pattern.matcher(text);
if (matcher.find())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public Type visitFpType(FpTypeContext ctx) {
}

private int getExp(String text) {
Pattern pattern = Pattern.compile("\\[([0-9]*):([0-9]*)]");
Pattern pattern = Pattern.compile("\\[([0-9]*),([0-9]*)]");
Matcher matcher = pattern.matcher(text);
if (matcher.find())
{
Expand All @@ -104,7 +104,7 @@ private int getExp(String text) {
}

private int getSignificand(String text) {
Pattern pattern = Pattern.compile("\\[([0-9]*):([0-9]*)]");
Pattern pattern = Pattern.compile("\\[([0-9]*),([0-9]*)]");
Matcher matcher = pattern.matcher(text);
if (matcher.find())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,15 @@ public static Collection<Object[]> data() {

{"/bv.cfa", 1, 6, 6, 6},

{"/bv2.cfa", 1, 6, 6, 6}
{"/bv2.cfa", 1, 6, 6, 6},

{"/bv3.cfa", 1, 6, 6, 6},

{"/bv4.cfa", 2, 7, 8, 8},

{"/fp1.cfa", 4, 7, 6, 6},

{"/fp2.cfa", 4, 7, 6, 6}
});
}

Expand Down
10 changes: 5 additions & 5 deletions subprojects/cfa/cfa/src/test/resources/fp1.cfa
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
main process cfa {
var f2 : fp[5:11]
var f3 : fp[11:53]
var f4 : fp[11:53]
var f2 : fp[5,11]
var f3 : fp[11,53]
var f4 : fp[11,53]
var b1 : bv[4]

init loc L1
Expand All @@ -13,9 +13,9 @@ main process cfa {
error loc ERR

L1 -> L2 { f2 := 5'b10010.10'd0 }
L2 -> L3 { f3 := fptofp[11:53][RNE] f2 }
L2 -> L3 { f3 := fptofp[11,53][RNE] f2 }
L3 -> L4 { b1 := 4'd8 }
L4 -> L5 { f4 := fpfrombv[11:53][u][RNE] b1 }
L4 -> L5 { f4 := fpfrombv[11,53][u][RNE] b1 }
L5 -> END { assume f3 = f4 }
L5 -> ERR { assume not (f3 = f4) }
}
8 changes: 4 additions & 4 deletions subprojects/cfa/cfa/src/test/resources/fp2.cfa
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
main process cfa {
var f2 : fp[2:3]
var f3 : fp[2:3]
var f4 : fp[2:3]
var f5 : fp[2:3]
var f2 : fp[2,3]
var f3 : fp[2,3]
var f4 : fp[2,3]
var f5 : fp[2,3]

init loc L1
loc L2
Expand Down

0 comments on commit 811e180

Please sign in to comment.