Closed nblei closed 3 months ago
@dalance
One thing that is strange about this is that EnumItem
s are not evaluate
d. When are symbols supposed to be evaluated?
Evaluation is executed at symbol table resolve. https://github.com/veryl-lang/veryl/blob/68c3593a1c5a53bbc2fdfdae4173270b048b7513/crates/analyzer/src/symbol_table.rs#L173
But it may be unnecessary. I think calling symbol.found.evaluate()
is sufficient when it is necessary.
If the symbol is already evalated, it returns the cached evaluated
, and if not, it evaluates at the call time.
Therefore, the code of evaluator.rs
can be simplified like below:
// from
if let Some(evaluated) = symbol.found.evaluated.get() {
evaluated
} else {
symbol.found.evaluate()
}
// to
symbol.found.evaluate()
For SystemVerilog, there is the limitation below for unassigned enum labels following the enum label with x/z value.
From IEEE 1800-2023 6.19.2 Enumerated type ranges
I think you need to check if this limitation is satisfied.
@nblei I think this PR can be merged. Is it ok with you?
@taichi-ishitani I think this change is about evaluating enum value, and your suggestion seems to be about requirement of additional check for enum declaration. So could you create a new issue for it?
@taichi-ishitani I think this change is about evaluating enum value, and your suggestion seems to be about requirement of additional check for enum declaration. So could you create a new issue for it?
Sure, I will create a new ticket.
@nblei I think this PR can be merged. Is it ok with you?
Yes.
Allows
EnumMember
s with 'x' or 'z' values to beFactor
s in assignment operations insideif_reset
blocks.Previously,
would result in an error because of the don't care bits in
State::Idle
.