/usr/include/freehdl/kernel-attributes.hh is in libfreehdl0-dev 0.0.7-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | #ifndef FREEHDL_KERNEL_ATTRIBUTES_H
#define FREEHDL_KERNEL_ATTRIBUTES_H
/* *************************************************************
* Function kind attributes for signals
* ************************************************************* */
/* Event attribute for a scalar signal! Note that sinfo must reference
* a scalar signal! */
inline int attr_scalar_EVENT (sig_info_core *sinfo)
{
extern kernel_class kernel;
return kernel.get_cycle_id() == sinfo->readers[0]->last_event_cycle_id;
}
/* Last_event attribute for a scalar signal! Note that sinfo must
* reference a scalar signal! */
inline vtime attr_scalar_LAST_EVENT (sig_info_core *sinfo)
{
if (fqueue<long long int, vtime>::key (sinfo->readers[0]->last_event_tr_item) < 0)
return L3std_Q8standard_I4time_INFO.high_bound;
else
return kernel.get_sim_time () -
fqueue<long long int, vtime>::key (sinfo->readers[0]->last_event_tr_item);
}
/* Event attribute for a composite signal! */
int attr_composite_EVENT(sig_info_core *sinfo, acl *a);
/* Last_event attribute for a composite signal! */
vtime attr_composite_LAST_EVENT (sig_info_core *sinfo, acl *a);
/* Active attribute for a scalar signal! Note that sinfo must reference
* a scalar signal! */
inline int attr_scalar_ACTIVE (sig_info_core *sinfo)
{
extern kernel_class kernel;
const reader_info &rinfo = *sinfo->readers[0];
const int cycle_id = kernel.get_cycle_id();
return (cycle_id == rinfo.last_event_cycle_id) || (cycle_id == rinfo.last_active_cycle_id);
}
/* Active attribute for a composite signal! */
int attr_composite_ACTIVE (sig_info_core *sinfo, acl *a);
/* Last vaue attribute for a scalar signal! Note that sinfo must
* reference a scalar signal! */
template<class T>
T attr_scalar_LAST_VALUE (sig_info_core *sinfo)
{
const reader_info &rinfo = *sinfo->readers[0];
return (T&)fqueue<long long int, vtime>::content (rinfo.last_value_tr_item);
}
/* Attribute LAST_VALUE applied on a scalar part of a composite
* signal! */
template<class T>
T attr_composite_LAST_VALUE (sig_info_core *sinfo, acl *a)
{
int start = 0, end = 0;
// Convert acl to start and end index for the reader_info array
sinfo->type->acl_to_index(a, start, end);
const reader_info &rinfo = *sinfo->readers [start];
return (T&)fqueue<long long int, vtime>::content (rinfo.last_value_tr_item);
}
/* Composite LAST_VALUE attribute for a composite signal! Note that
* "value" is the part of the signal which is referenced by acl
* "a". Moreover, "value" contains the *current* signal value. */
template<class T>
T attr_composite_LAST_VALUE (sig_info_core *sinfo, acl *a, T value)
{
int start = 0, end = 0;
// Convert acl to start and end index for the reader_info array
sinfo->type->acl_to_index (a, start, end);
// First, determine the most recent event time of all considered
// scalar readers
vtime most_recent_event_time = LONG_LONG_MIN;
for (int i = start; i <= end; i++) {
const reader_info &rinfo = *sinfo->readers[i];
most_recent_event_time =
max(most_recent_event_time, fqueue<long long int, vtime>::key (rinfo.last_value_tr_item));
}
// For each scalar element for which the last event time is equal to
// the most recent event time: copy the "last value" into the
// corresponding element. Note that "value" is initialized with the
// current value of the signal.
for (int i = start, j = 0; i <= end; i++, j++) {
const reader_info &rinfo = *sinfo->readers[i];
type_info_interface *scalar_type = sinfo->type->get_info(i);
if (most_recent_event_time == fqueue<long long int, vtime>::key (rinfo.last_value_tr_item))
scalar_type->copy (value.info->type_info_interface::element((void*)&value, j),
&fqueue<long long int, vtime>::content (rinfo.last_value_tr_item));
}
return value;
}
#endif
|