WAL Programmer Manual

0.6.2a


4. Groups and Scopes

This section describes functions for analyzing waveforms based on the design hierarchy and related signals. Hardware designs often contain a lot of structural redundancy. This can be exploited since it enables us to write expressions in a generic way. For example, many modules have handshaking interfaces, thus if we write a generic handshaking program that can be applied to all handshaking interfaces in a design we can reduce replicated code.
WAL supports two ways of writing generic code, groups and scopes.

Groups

(groups posts*) ↦ (list?)
  posts : symbol?, string?
	
Returns all partial signal names pre for which pre + post for every post in posts is a valid signal name.
For example, (groups '("valid" "ready")) evaluated on the waveform below would return the two groups '("top.in_" "top.out_") . This is correct, since top.in_ready and top.in_valid for the input group and top.in_ready as well as top.in_ready for the output group are vlaid signal names.
(in-groups groups expr) ↦ (list?)
groups : list?
  expr : WAL expression
	
Evaluates expr in every group in groups. When an expression is evaluated in a group, the group is prepended to every signal name that starts with #. For example, #_ready would be expanded to top.in_ready if evaluated in group top.in from the waveform shown before.
Example:
The following example shows how the in-groups function can be used to find all transactions on all handshaking interfaces in the waveform. For the groups we use the groups as returned from the example call to groups before. The variable CG is a special variable that returns the current group.
(in-groups '("top.in_" "top.out_")
  (print CG ":")
  (whenever (&& top.clk (! top.reset) #ready #valid)
    (print INDEX)))
	    
(resolve-group name) ↦ (int?)
  name : (symbol?)
	
Evaluates the signal name appended by CG and returns the signal value at the current INDEX. For example, (resolve-group #valid) evaluated in group top.in_ would evaluate signal top.in_valid. The # macro can be used instead of the resolve-group function.
 #name ↦ (resolve-group name)
  name : (symbol?)
	
A shorthand for the resolve-group function.