WalCompatOperators
class WalCompatOperators
@brief Operators that upstream WAL (ics-jku/wal) has and WAL++ lacked.
Semantics were pinned by running each form against upstream 0.9.1 rather than inferred from its source, and the conformance run in tests/conformance/ keeps them honest.
Several of these are renames rather than new capability: mod is %, average is
mean, int? is is-int. They are registered as their own operators rather than
aliases in a table, so each one's argument checking and error message reads the same
as the rest of the codebase.
Operators receive their arguments unevaluated and call eval() themselves, so the
control-flow forms below work without touching the evaluator's special-form dispatch.
do and fn are the exceptions: they are spellings of begin and lambda and are
handled there.
Functions
| Name | Description |
|---|---|
| eval_body | Evaluate args[from..] in order and return the last value (nil if none). |
| register_variables | Upstream's set and get, which are not WAL++'s set! / get-signal. |
| register_trace_analysis | Operators that sweep the trace rather than reading one index. |
| register_scopes_and_groups | Scopes and groups. |
| name_of | A symbol or string argument, as a plain name. |
| qualify | Join a scope and a leaf name. |
| mirror | Mirror the current scope/group into a global, as upstream's CS and CG. |
| restore | Put every trace back where it was before a sweep. |
| register_arrays | Upstream's arrays: string-keyed, insertion-ordered, MUTABLE maps. These are not WAL++'s existing array-ref/array-set list helpers, which index a list positionally. Upstream's array is a dict, shared by reference, so (seta a ...) is visible through every binding holding the same array. |
Function Details
eval_body
static Value eval_body(SEval& eval, const std::vector<Value>& args, size_t from)
Evaluate args[from..] in order and return the last value (nil if none).
mirror
static void mirror(SEval& eval, const std::string& name, const std::string& value)
Mirror the current scope/group into a global, as upstream's CS and CG.
name_of
static std::string name_of(const Value& v, const char* who)
A symbol or string argument, as a plain name.
qualify
static std::string qualify(SEval& eval, const std::string& scope, const std::string& leaf)
Join a scope and a leaf name. A scope that is really a group (not a node in the hierarchy) is already a prefix, so it takes no separator.
register_arrays
static void register_arrays(OperatorRegistry& registry)
Upstream's arrays: string-keyed, insertion-ordered, MUTABLE maps.
These are not WAL++'s existing array-ref/array-set list helpers, which index
a list positionally. Upstream's array is a dict, shared by reference, so
(seta a ...) is visible through every binding holding the same array.
register_scopes_and_groups
static void register_scopes_and_groups(OperatorRegistry& registry)
Scopes and groups.
A scope is a node in the design hierarchy ("tb.dut"); a group is a common
prefix shared by several signals ("tb.dut.axi_"), which is how WAL talks about
a bus whose members are separate signals. SEval has carried current_scope
and current_group since the beginning with nothing setting them, and the
trace side already parsed scope_names; this connects all three.
Upstream mirrors the current scope and group into the global variables CS and CG so scripts can read them, and this does the same.
register_trace_analysis
static void register_trace_analysis(OperatorRegistry& registry)
Operators that sweep the trace rather than reading one index.
Each saves every trace's index, walks to the end, and restores the indices, so the caller's position is unchanged -- upstream does the same, and scripts rely on being able to call these mid-analysis.
register_variables
static void register_variables(OperatorRegistry& registry)
Upstream's set and get, which are not WAL++'s set! / get-signal.
restore
static void restore(SEval& eval, const std::unordered_map<std::string, int>& saved)
Put every trace back where it was before a sweep.