Closed rudynicolop closed 1 year ago
I'm very confused about your changes. Maybe we should have a discussion. First, what is BigValue.v? I believe it's something we have deliberately removed in P4light.
I'm very confused about your changes. Maybe we should have a discussion. First, what is BigValue.v? I believe it's something we have deliberately removed in P4light.
I want Match
to use ValueSet
instead of Expression
.
I had to split Value.v
into 2 files, now Value.v
and BigValue.v
. There was a potential circular dependency when attempting to make Match
and MatchPreT
use upon ValueSet
.
ValueSet
depends on Value
(Value.v
) and Match
(Syntax.v
). Match
and MatchPreT
depend upon ValueSet
(formerly Value.v
now Syntax.v
).ValueLvalue
, ValueTable
) formerly in Value.v
now in BigValue.v
depend upon on Syntax.v
.If ValueSet.v
were to remain in Value.v
, then Syntax.v
could not use ValueSet
in Match
b/c ValueLvalue
and ValueTable
are in Value.v
and they use Syntax.v
.
If ValueSet
moves to Syntax.v
then now Syntax.v
depends upon Value.v
which already depends upon Syntax.v
becayse of ValueLvalue
and ValueTable
.
To resolve this I moved ValueSet
to Syntax.v
, and moved the remaining definitions such as ValueLvalue
and ValueTable
to a new file BigValue.v
(I didn't know what to call it there's probably a better name). So now Value.v
<- Syntax.v
<- BigValue.v
.
I am all for making Match use ValueSet instead of Expression. But parametrizing match over values and having to inject little helper functions to deal with its type parameters everywhere smells like over-engineering to me. Targets only use P4light values right now and we should stay consistent with that convention.
Why ValueSet
has a constructor of unevaluated match expressions?
| ValSetValueSet (size: N) (members: list (list (@Syntax.Match tags_t))) (sets: list ValueSet).
Wait, yeah. Matches should have expressions in them and should not appear in run-time state. Matches should evaluate to ValueSets and appear in run-time state. We've got it mixed up.
Should Target.v
use ValueSet
instead of Match
then?
Why
ValueSet
has a constructor of unevaluated match expressions?| ValSetValueSet (size: N) (members: list (list (@Syntax.Match tags_t))) (sets: list ValueSet).
I have no idea 😅. What should members
be?
It might clarify matters to call these things PatternExpr
and PatternValue
instead of Match
and ValueSet
.
I think this branch's changes got out of hand. I propose instead:
Match
and MatchPreT
are left unchanged from before this branch (still using expressions).Match
is removed from ValueSet
.ValueSet
is used in place of Match
in Target.v
.I'll delete this branch and start a new one.
I think this branch's changes got out of hand. I propose instead:
Match
andMatchPreT
are left unchanged from before this branch (still using expressions).Match
is removed fromValueSet
.ValueSet
is used in place ofMatch
inTarget.v
.I'll delete this branch and start a new one.
I'm on board with this 👍
I think this branch's changes got out of hand. I propose instead:
Match
andMatchPreT
are left unchanged from before this branch (still using expressions).Match
is removed fromValueSet
.ValueSet
is used in place ofMatch
inTarget.v
.I'll delete this branch and start a new one.
Yes. This is also what I think.
In progress pull request for p4light
Match
,MatchPreT
, andValueSet
.These changes are to make
Match
andMatchPreT
useValueSet
instead ofExpression
.Match
andMatchPreT
are parameterized by the data type for p4 types and value sets/patterns. In p4light syntax and semantics this is always instantiated withP4Type
andValueSet
. This is to enable a broader interface forTarget.v
that does not rely upon p4light data types.I'm currently stuck refactoring
exec_match
inSemantics.v
.Match
usesValueSet
for mask and range operands butValueSet
usesValueBase
for mask and range operands.Match
used to useExpression
and evaluate the expressions to values for this but in changing it toValueSet
it's not as straightforward to "evaluate" aValueSet
to a value. ShouldValueSet
useValueSet
for mask and range?