8 #ifdef __DOL_ETHZ_GEN__
10 using sc_core::sc_port;
13 /************************************************************************
14 * do not add code to this header
15 ************************************************************************/
18 * Define the DOL process handler scheme.
19 * - Local variables are defined in structure LocalState. Local
20 * variables may vary from different processes.
21 * - The ProcessInit function pointer points to a function which
22 * initializes a process.
23 * - The ProcessFire function pointer points to a function which
24 * performs the actual computation. The communication between
25 * processes is inside the ProcessFire function.
26 * - The WPTR is a placeholder for callback. One can just
30 //structure for local memory of process
31 typedef struct _local_states *LocalState;
33 //additional behavioral functions could be declared here
34 typedef void (*ProcessInit)(struct _process*);
35 typedef int (*ProcessFire)(struct _process*);
41 typedef struct _process {
45 WPTR wptr; //placeholder for wrapper instance
49 //macros to deal with iterated ports
51 ******************************************************
52 * The HdS code is needed to replace the current ETHZ *
54 ******************************************************
56 * Macro to create a variable to store a port name.
58 * @param name name of the variable
60 #ifdef __DOL_ETHZ_GEN__
61 #define CREATEPORTVAR(name) sc_port<sc_interface> *name
63 #define CREATEPORTVAR(name) // Hds Code
67 * Create the port name of an iterated port based on its basename and the
70 * @param port buffer where the result is stored (created using
72 * @param base basename of the port
73 * @param number_of_indices number of dimensions of the port
74 * @param index_range_pairs index and range values for each dimension
76 #define CREATEPORT(port, base, number_of_indices, index_range_pairs...) \
77 createPort(&port, base, number_of_indices, index_range_pairs)
79 int getIndex(const char* string, char* tokens, int indexNumber);
82 ******************************************************
83 * The HdS code is needed to replace the current ETHZ *
85 ******************************************************
87 #ifdef __DOL_ETHZ_GEN__
88 template <class interface>
89 sc_port<interface> *createPort(sc_port<interface> **port,
91 int number_of_indices,
92 int index0, int range0) {
93 *port = &((static_cast<sc_port<interface> *>(base))[index0]);
94 return &((static_cast<sc_port<interface> *>(base))[index0]);
97 template <class interface>
98 sc_port<interface> *createPort(sc_port<interface> **port,
100 int number_of_indices,
101 int index0, int range0,
102 int index1, int range1) {
103 *port = &((static_cast<sc_port<interface> *>(base))[
104 index0 * range1 + index1]);
105 return &((static_cast<sc_port<interface> *>(base))[
106 index0 * range1 + index1]);
109 template <class interface>
110 sc_port<interface> *createPort(sc_port<interface> **port,
112 int number_of_indices,
113 int index0, int range0,
114 int index1, int range1,
115 int index2, int range2) {
116 *port = &((static_cast<sc_port<interface> *>(base))[
117 index0 * range1 * range2 + index1 * range0 + index2]);
118 return &((static_cast<sc_port<interface> *>(base))[
119 index0 * range1 * range2 + index1 * range0 + index2]);
122 template <class interface>
123 sc_port<interface> *createPort(sc_port<interface> **port,
125 int number_of_indices,
126 int index0, int range0,
127 int index1, int range1,
128 int index2, int range2,
129 int index3, int range3) {
130 *port = &((static_cast<sc_port<interface> *>(base))[
131 index0 * range1 * range2 * range3
132 + index1 * range2 * range3 + index2 * range3 + index3]);
133 return &((static_cast<sc_port<interface> *>(base))[
134 index0 * range1 * range2 * range3
135 + index1 * range2 * range3 + index2 * range3 + index3]);
138 #define createPort() //HdS code