Home News People Research Study Search

Institute for Computing Systems Architecture

HASE Userguide

Hase++ manual - predicates

The predicates can be used to filter incoming events and to select the one which we are expecting. The criterion can be the incoming port (sim_from_port), the tag carried by the event(sim_type_p) or any user-defined predicate.
In order to define your own predicate you must define a class which extends the sim_predicate class and override the int match(sim_event & ev) method.

SIM_ANY

This is a constant available in any Hase++ project. The predicate matches any event. Only useful when using the sim_select command:
sim_select(SIM_ANY, ev); // will dequeue any event.

sim_from_port

Constructor:
sim_from_port(sim_port & p)
This predicate checks if an event comes from the port given in the constructor.
Example:
sim_port alua;
sim_event ev;

sim_from_port ina(alua);

if (sim_waiting(ev, ina)>0)
// execute some behaviour when receiving an event from the port alua.

sim_type_p

Constructors:
sim_type_p(int type1)
sim_type_p(int type1, int type2)
sim_type_p(int type1, int type2, int type3)
sim_type_p(int type1, int type2, int type3, int type4)
This predicate checks if an event is carrying on the type1, type2, type3 or type4 tags. A constructor with an array of int should be added soon.
Example:
sim_type_p expected(CLOCK, MEMORY);
sim_event ev;
if (sim_waiting(ev, expected)>0))
// execute some behaviour when receiving an event carrying either the tag CLOCK or the tag MEMORY.


Home : Research : Groups : Hase : Manuals : Hasepp 

Please contact our webadmin with any comments or changes.
Unless explicitly stated otherwise, all material is copyright © The University of Edinburgh.