@@ -57,6 +57,7 @@ struct img_initiator: sc_module
5757
5858 // Create transaction and allocate it
5959 tlm::tlm_generic_payload* transaction = memory_manager.allocate ();
60+ transaction->acquire ();
6061 img_generic_extension* img_ext = new img_generic_extension;
6162 img_ext->transaction_number = this ->transaction_number ++;
6263
@@ -124,7 +125,6 @@ struct img_initiator: sc_module
124125
125126 // Begin Request
126127 phase = tlm::BEGIN_REQ;
127- transaction->acquire ();
128128 transaction->get_extension (img_ext);
129129 cur_command = transaction->get_command ();
130130 dbgmodprint (" BEGIN_REQ SENT TRANS ID %0d" , img_ext->transaction_number );
@@ -136,7 +136,7 @@ struct img_initiator: sc_module
136136 case tlm::TLM_ACCEPTED: {
137137 dbgmodprint (" %s received -> Transaction ID %d" , " TLM_ACCEPTED" , img_ext->transaction_number );
138138 check_transaction (*transaction);
139- transaction->release ();
139+ // transaction->release();
140140 // Initiator only cares about sending the transaction, doesnt need to wait for response (non-blocking)
141141 break ;
142142 }
@@ -149,7 +149,9 @@ struct img_initiator: sc_module
149149 }
150150
151151 // Wait for response transaction
152- wait (transaction_received_e);
152+ if (transaction->get_command () == tlm::TLM_READ_COMMAND) {
153+ wait (transaction_received_e);
154+ }
153155 // -----------DEBUG-----------
154156 dbgmodprint (" [DEBUG1] Reading at Initiator: " );
155157 for (int i = 0 ; i < transaction->get_data_length ()/sizeof (int ); ++i){
@@ -168,7 +170,6 @@ struct img_initiator: sc_module
168170 {
169171 // Call event queue
170172 m_peq.notify (trans, phase, delay);
171- dbgmodprint (" HERE" );
172173 return tlm::TLM_ACCEPTED;
173174 }
174175
@@ -181,10 +182,6 @@ struct img_initiator: sc_module
181182 switch (phase) {
182183 case tlm::BEGIN_RESP: {
183184
184- dbgmodprint (" HERE3" );
185-
186- trans.acquire ();
187-
188185 check_transaction (trans);
189186
190187 // Initiator dont care about confirming resp transaction. So nothing else to do.
@@ -197,8 +194,6 @@ struct img_initiator: sc_module
197194 printf (" \n " );
198195 // -----------DEBUG-----------
199196
200- dbgmodprint (" HERE3" );
201-
202197 transaction_received_e.notify ();
203198 // -----------DEBUG-----------
204199 dbgmodprint (" [DEBUG] Reading at Initiator: " );
@@ -207,7 +202,6 @@ struct img_initiator: sc_module
207202 }
208203 printf (" \n " );
209204 // -----------DEBUG-----------
210- dbgmodprint (" HERE10" );
211205 break ;
212206 }
213207 default : {
0 commit comments