@@ -51,7 +51,6 @@ struct Ethernet_AMS_Signals {
5151 sca_tdf::sca_signal<double > mlt3_out_signal;
5252
5353 sca_tdf::sca_signal<bool > data_out_valid;
54- sca_tdf::sca_signal<sc_dt::sc_bv<4 >> data_out_signal;
5554 sca_tdf::sca_signal<sc_dt::sc_bv<4 >> data_out;
5655
5756 sca_tdf::sca_signal<bool > tmp_data_out_valid;
@@ -254,6 +253,8 @@ SC_MODULE(Tb_top)
254253 memory_DUT->backdoor_write (local_results, 3 * sizeof (char ), IMG_INPUT_ADDRESS_LO + ((i * IMAG_COLS * 3 ) + (j * 3 )));
255254 }
256255 }
256+
257+ dbgprint (" Saved image in memory" );
257258
258259 Mat grayImagePrevMem (IMAG_ROWS, IMAG_COLS, CV_8UC1);
259260 Mat filteredImagePrevMem (IMAG_ROWS, IMAG_COLS, CV_8UC1);
@@ -268,6 +269,8 @@ SC_MODULE(Tb_top)
268269 Mat detectedImageAfterMem (IMAG_ROWS, IMAG_COLS, CV_8UC1);
269270
270271 total_number_of_pixels = IMAG_ROWS * IMAG_COLS;
272+
273+ dbgprint (" Starting gray scale conversion" );
271274
272275 for (int i = 0 ; i < IMAG_ROWS; i++)
273276 {
@@ -331,6 +334,8 @@ SC_MODULE(Tb_top)
331334 local_count = 0 ;
332335 current_number_of_pixels = 0 ;
333336 next_target_of_completion = 10.0 ;
337+
338+ dbgprint (" Starting filtering the image" );
334339
335340 for (int i = 0 ; i < IMAG_ROWS; i++)
336341 {
@@ -381,8 +386,8 @@ SC_MODULE(Tb_top)
381386 if (local_count == 8 )
382387 {
383388 dbgmodprint (use_prints, " Before doing a write in TB" );
384- sanity_check_address (IMG_COMPRESSED_ADDRESS_LO + ((i * IMAG_COLS) + (local_group_count * 8 * sizeof (char ))), IMG_COMPRESSED_ADDRESS_LO, IMG_COMPRESSED_ADDRESS_LO + IMG_COMPRESSED_SIZE );
385- tb_initiator->write (local_results, IMG_COMPRESSED_ADDRESS_LO + ((i * IMAG_COLS) + (local_group_count * 8 * sizeof (char ))), 8 * sizeof (char ));
389+ sanity_check_address (IMG_INPROCESS_D_ADDRESS_LO + ((i * IMAG_COLS) + (local_group_count * 8 * sizeof (char ))), IMG_INPROCESS_D_ADDRESS_LO, IMG_INPROCESS_D_ADDRESS_LO + IMG_INPROCESS_D_SIZE );
390+ tb_initiator->write (local_results, IMG_INPROCESS_D_ADDRESS_LO + ((i * IMAG_COLS) + (local_group_count * 8 * sizeof (char ))), 8 * sizeof (char ));
386391 dbgmodprint (use_prints, " After doing a write in TB" );
387392 local_count = 0 ;
388393 local_group_count++;
@@ -404,14 +409,16 @@ SC_MODULE(Tb_top)
404409 for (int j = 0 ; j < IMAG_COLS; j++)
405410 {
406411 unsigned char * read_ptr;
407- memory_DUT->backdoor_read (read_ptr, 1 * sizeof (char ), IMG_COMPRESSED_ADDRESS_LO + ((i * IMAG_COLS) + j));
412+ memory_DUT->backdoor_read (read_ptr, 1 * sizeof (char ), IMG_INPROCESS_D_ADDRESS_LO + ((i * IMAG_COLS) + j));
408413 filteredImageAfterMem.at <uchar>(i, j) = *read_ptr;
409414 }
410415 }
411416
412417 local_count = 0 ;
413418 current_number_of_pixels = 0 ;
414419 next_target_of_completion = 10.0 ;
420+
421+ dbgprint (" Starting calculating sobel gradients of the image" );
415422
416423 for (int i = 0 ; i < IMAG_ROWS; i++)
417424 {
@@ -423,7 +430,7 @@ SC_MODULE(Tb_top)
423430 unsigned char * write_ptr;
424431 unsigned char * read_ptr;
425432
426- extract_window (i, j, IMG_COMPRESSED_ADDRESS_LO , local_window_ptr);
433+ extract_window (i, j, IMG_INPROCESS_D_ADDRESS_LO , local_window_ptr);
427434 for (int k = 9 ; k < 16 ; k++)
428435 {
429436 *(local_window_ptr + k) = 0 ;
@@ -540,6 +547,8 @@ SC_MODULE(Tb_top)
540547 local_count = 0 ;
541548 current_number_of_pixels = 0 ;
542549 next_target_of_completion = 10.0 ;
550+
551+ dbgprint (" Starting with the unification of the magnitude of the gradients of the image" );
543552
544553 for (int i = 0 ; i < IMAG_ROWS; i++)
545554 {
@@ -618,6 +627,8 @@ SC_MODULE(Tb_top)
618627 local_count = 0 ;
619628 current_number_of_pixels = 0 ;
620629 next_target_of_completion = 10.0 ;
630+
631+ dbgprint (" Starting with the compression of the image" );
621632
622633 for (int i = 0 ; i < IMAG_ROWS; i++)
623634 {
@@ -672,8 +683,8 @@ SC_MODULE(Tb_top)
672683 {
673684 local_results = reinterpret_cast <unsigned char *>(compression_results + (local_group_count * 8 * sizeof (char )));
674685 dbgmodprint (use_prints, " Before doing a write in TB" );
675- sanity_check_address (IMG_COMPRESSED_ADDRESS_LO + (local_group_count * 8 * sizeof (char )), IMG_COMPRESSED_ADDRESS_LO, IMG_COMPRESSED_ADDRESS_LO + IMG_COMPRESSED_SIZE );
676- tb_initiator->write (local_results, IMG_COMPRESSED_ADDRESS_LO + (local_group_count * 8 * sizeof (char )), 8 * sizeof (char ));
686+ sanity_check_address (IMG_OUTPUT_ADDRESS_LO + (local_group_count * 8 * sizeof (char )), IMG_OUTPUT_ADDRESS_LO, IMG_OUTPUT_ADDRESS_LO + IMG_OUTPUT_SIZE );
687+ tb_initiator->write (local_results, IMG_OUTPUT_ADDRESS_LO + (local_group_count * 8 * sizeof (char )), 8 * sizeof (char ));
677688 dbgmodprint (use_prints, " After doing a write in TB" );
678689 local_count = 0 ;
679690 local_group_count++;
@@ -692,8 +703,8 @@ SC_MODULE(Tb_top)
692703 {
693704 local_results = reinterpret_cast <unsigned char *>(compression_results + (local_group_count * 8 * sizeof (char )));
694705 dbgmodprint (use_prints, " Before doing a write in TB" );
695- sanity_check_address (IMG_COMPRESSED_ADDRESS_LO + (local_group_count * 8 * sizeof (char )), IMG_COMPRESSED_ADDRESS_LO, IMG_COMPRESSED_ADDRESS_LO + IMG_COMPRESSED_SIZE );
696- tb_initiator->write (local_results, IMG_COMPRESSED_ADDRESS_LO + (local_group_count * 8 * sizeof (char )), (compression_output_size % 8 ) * sizeof (char ));
706+ sanity_check_address (IMG_OUTPUT_ADDRESS_LO + (local_group_count * 8 * sizeof (char )), IMG_OUTPUT_ADDRESS_LO, IMG_OUTPUT_ADDRESS_LO + IMG_OUTPUT_SIZE );
707+ tb_initiator->write (local_results, IMG_OUTPUT_ADDRESS_LO + (local_group_count * 8 * sizeof (char )), (compression_output_size % 8 ) * sizeof (char ));
697708 dbgmodprint (use_prints, " After doing a write in TB" );
698709 local_count = 0 ;
699710 local_group_count++;
@@ -705,80 +716,27 @@ SC_MODULE(Tb_top)
705716 local_group_count = 0 ;
706717 current_number_of_pixels = 0 ;
707718 next_target_of_completion = 10.0 ;
708- for (int i = 0 ; i < compression_output_size; i++)
709- {
710- if (local_count == 0 )
711- {
712- unsigned char * read_ptr;
713- local_read = new unsigned char [8 ];
714-
715- dbgmodprint (use_prints, " Before doing a read in TB" );
716- tb_initiator->read (read_ptr, IMG_COMPRESSED + (local_group_count * 8 * sizeof (char )), 8 * sizeof (char ));
717- dbgmodprint (use_prints, " After doing a read in TB" );
718- memcpy (local_read, read_ptr, 8 * sizeof (char ));
719- delete[] read_ptr;
720- }
721-
722- local_count++;
723-
724- if (local_count == 8 )
725- {
726- unsigned char * write_ptr;
727- unsigned char * read_ptr;
728719
729- tb_initiator->read (read_ptr, ETHERNET_CHECK_DONE, 1 * sizeof (char ));
730- while (*read_ptr == 1 )
731- {
732- delete[] read_ptr;
733- wait (100 , SC_NS);
734- tb_initiator->read (read_ptr, ETHERNET_CHECK_DONE, 1 * sizeof (char ));
735- }
736-
737- write_ptr = new unsigned char [1 ];
738- *write_ptr = 1 ;
739- tb_initiator->write (local_read, ETHERNET_DATA_WR, 8 * sizeof (char ));
740- tb_initiator->write (write_ptr, ETHERNET_DATA_DONE, 1 * sizeof (char ));
741- delete[] write_ptr;
742- delete[] local_read;
743- local_count = 0 ;
744- local_group_count++;
745- }
746- }
747-
748- if (compression_output_size % 8 != 0 )
749- {
750- unsigned char * write_ptr;
751- unsigned char * read_ptr;
752-
753- tb_initiator->read (read_ptr, ETHERNET_CHECK_DONE, 1 * sizeof (char ));
754- while (*read_ptr == 1 )
755- {
756- delete[] read_ptr;
757- wait (100 , SC_NS);
758- tb_initiator->read (read_ptr, ETHERNET_CHECK_DONE, 1 * sizeof (char ));
759- }
760-
761- dbgmodprint (use_prints, " Before doing a read in TB" );
762- tb_initiator->read (read_ptr, IMG_COMPRESSED + (local_group_count * 8 * sizeof (char )), (compression_output_size % 8 ) * sizeof (char ));
763- dbgmodprint (use_prints, " After doing a read in TB" );
720+ unsigned char * read_ptr;
721+ unsigned char * write_ptr;
764722
765- write_ptr = new unsigned char [ 1 ] ;
766- *write_ptr = 1 ;
723+ dbgprint ( " Starting with the transmision of the image " ) ;
724+ dbgprint ( " Preparing to transmit %0d bytes " , compression_output_size) ;
767725
768- tb_initiator-> write (read_ptr, ETHERNET_DATA_WR, (compression_output_size % 8 ) * sizeof ( char )) ;
769- tb_initiator->write (write_ptr, ETHERNET_DATA_DONE, 1 * sizeof (char ));
726+ write_ptr = ( unsigned char *)&compression_output_size ;
727+ tb_initiator->write (write_ptr, IMG_OUTPUT_SIZE_ADDRESS_LO, sizeof (int ));
770728
771- delete[] write_ptr;
772- delete[] read_ptr;
773- }
729+ write_ptr = new unsigned char [1 ];
730+ *write_ptr = 1 ;
731+ tb_initiator->write (write_ptr, IMG_OUTPUT_DONE_ADDRESS_LO, sizeof (char ));
732+ delete[] write_ptr;
774733
775- unsigned char * read_ptr;
776- tb_initiator->read (read_ptr, ETHERNET_CHECK_DONE, 1 * sizeof (char ));
734+ tb_initiator->read (read_ptr, IMG_OUTPUT_STATUS_ADDRESS_LO, 1 * sizeof (char ));
777735 while (*read_ptr == 1 )
778736 {
779737 delete[] read_ptr;
780738 wait (100 , SC_NS);
781- tb_initiator->read (read_ptr, ETHERNET_CHECK_DONE , 1 * sizeof (char ));
739+ tb_initiator->read (read_ptr, IMG_OUTPUT_STATUS_ADDRESS_LO , 1 * sizeof (char ));
782740 }
783741
784742 dbgprint (" Finished with the transmision of the image" );
@@ -1078,7 +1036,6 @@ int sc_main(int, char*[])
10781036 sc_trace (wf, top.memory_DUT ->mem_we , " memory_we" );
10791037
10801038 sca_util::sca_trace (wf_ams, top.ethernetSignals .mlt3_out_signal , " mlt3_out" );
1081- sca_util::sca_trace (wf_ams, top.ethernetSignals .data_out_signal , " data_out_signal" );
10821039 sca_util::sca_trace (wf_ams, top.ethernetSignals .data_out_valid , " data_out_valid" );
10831040 sca_util::sca_trace (wf_ams, top.ethernetSignals .data_out , " data_out" );
10841041 sca_util::sca_trace (wf_ams, top.ethernetSignals .data_in , " pkt_gen_data_in" );
0 commit comments