forked from p4lang/p4c
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow shifts with constant signed positive amounts (p4lang#3303)
* Allow shifts with constant signed positive amounts Signed-off-by: Mihai Budiu <[email protected]>
- Loading branch information
1 parent
627ca2f
commit f5ee442
Showing
12 changed files
with
101 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include <core.p4> | ||
|
||
bit<4> func(in bit<4> l) | ||
{ | ||
const int<6> tt = 1; | ||
return l << tt; | ||
} | ||
|
||
parser p(out bit<4> result) { | ||
state start { | ||
result = func(1); | ||
transition accept; | ||
} | ||
} | ||
|
||
parser P(out bit<4> r); | ||
package top(P p); | ||
|
||
top(p()) main; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <core.p4> | ||
|
||
bit<4> func(in bit<4> l) { | ||
const int<6> tt = 6s1; | ||
return l << 6w1; | ||
} | ||
parser p(out bit<4> result) { | ||
state start { | ||
result = func(4w1); | ||
transition accept; | ||
} | ||
} | ||
|
||
parser P(out bit<4> r); | ||
package top(P p); | ||
top(p()) main; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include <core.p4> | ||
|
||
parser p(out bit<4> result) { | ||
@name("p.l_0") bit<4> l; | ||
@name("p.hasReturned") bool hasReturned; | ||
@name("p.retval") bit<4> retval; | ||
state start { | ||
l = 4w1; | ||
hasReturned = false; | ||
hasReturned = true; | ||
retval = l << 6w1; | ||
result = retval; | ||
transition accept; | ||
} | ||
} | ||
|
||
parser P(out bit<4> r); | ||
package top(P p); | ||
top(p()) main; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include <core.p4> | ||
|
||
parser p(out bit<4> result) { | ||
state start { | ||
result = 4w2; | ||
transition accept; | ||
} | ||
} | ||
|
||
parser P(out bit<4> r); | ||
package top(P p); | ||
top(p()) main; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <core.p4> | ||
|
||
bit<4> func(in bit<4> l) { | ||
const int<6> tt = 1; | ||
return l << tt; | ||
} | ||
parser p(out bit<4> result) { | ||
state start { | ||
result = func(1); | ||
transition accept; | ||
} | ||
} | ||
|
||
parser P(out bit<4> r); | ||
package top(P p); | ||
top(p()) main; | ||
|
Empty file.