From e3d177beb03d5e61bc88c064adc8813251cda617 Mon Sep 17 00:00:00 2001
From: Daniela Genius <genius@debussy.soc.lip6.fr>
Date: Tue, 18 Jul 2017 17:25:41 +0200
Subject: [PATCH] bugfix

---
 .../caba/source/src/vci_mwmr_stats.cpp        | 26 ++++++++++++++-----
 MPSoC/src/asyncchannel.c                      |  5 ++--
 2 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/MPSoC/soclib/soclib/module/test_control_component/vci_mwmr_stats/caba/source/src/vci_mwmr_stats.cpp b/MPSoC/soclib/soclib/module/test_control_component/vci_mwmr_stats/caba/source/src/vci_mwmr_stats.cpp
index f1922b2ace..62a87be503 100644
--- a/MPSoC/soclib/soclib/module/test_control_component/vci_mwmr_stats/caba/source/src/vci_mwmr_stats.cpp
+++ b/MPSoC/soclib/soclib/module/test_control_component/vci_mwmr_stats/caba/source/src/vci_mwmr_stats.cpp
@@ -67,11 +67,25 @@ tmpl()::VciMwmrStats(
     for ( typename std::vector<std::string>::const_iterator i = fifo_name.begin();
           i != fifo_name.end();
           ++i ) {
+        const std::string name = (*i)+"_status";
+        const soclib::common::BinaryFileSymbol *sym = loader.get_symbol_by_name(name);
+        if ( ! sym || sym->name() != name ) {
+            std::cerr << this->name() << " name not found: " << name << std::endl;
+            continue;
+        }
+        typename vci_param::fast_addr_t addr = sym->address();
+        std::cout << " mwmr fifo with status address " << addr << std::endl;
+        m_mwmr_info.push_back( mwmr_info_t(addr, *i) );
+    }
 
-const std::string name2 = (*i);
-loader.get_symbol_by_name(name2);
-const soclib::common::BinaryFileSymbol *sym2 = loader.get_symbol_by_name(name2);
-std::cout << " mwmr fifo with address " << sym2->address() << std::endl;
+    /*    for ( typename std::vector<std::string>::const_iterator i = fifo_name.begin();
+          i != fifo_name.end();
+          ++i ) {
+
+        const std::string name2 = (*i);
+        loader.get_symbol_by_name(name2);
+        const soclib::common::BinaryFileSymbol *sym2 = loader.get_symbol_by_name(name2);
+        std::cout << " mwmr fifo with address " << sym2->address() << std::endl;
 
         const std::string name = (*i)+"_status";
         const soclib::common::BinaryFileSymbol *sym = loader.get_symbol_by_name(name);
@@ -82,7 +96,7 @@ std::cout << " mwmr fifo with address " << sym2->address() << std::endl;
         typename vci_param::fast_addr_t addr = sym->address();
         std::cout << " mwmr fifo with status address " << addr << std::endl;
         m_mwmr_info.push_back( mwmr_info_t(addr, *i) );
-    }
+        }*/
 }
 
 tmpl()::~VciMwmrStats()
@@ -145,7 +159,7 @@ tmpl(void)::handle_txn(const VciLoggerElem<vci_param> &elem, const mwmr_info_t &
         //prefix(elem, mwmr) << "WDATA" << std::hex<< wdata<<std::endl;
        
         //if ( wdata == 0x1) {  
-        if ( wdata >= 1 ) {  
+             if ( wdata >= 1 ) {  
             if ( rdata == vci_param::STORE_COND_ATOMIC ){ 
                
                 prefix(elem, mwmr) << "lock_take" << std::endl;
diff --git a/MPSoC/src/asyncchannel.c b/MPSoC/src/asyncchannel.c
index 7a440768ea..4e1ddea7dd 100755
--- a/MPSoC/src/asyncchannel.c
+++ b/MPSoC/src/asyncchannel.c
@@ -96,7 +96,7 @@ void destroyAsyncchannel(asyncchannel *asyncch) {
     debugInt("asyncchannel read: address \n",channel->mwmr_fifo);
     debugInt("asyncchannel fifo->depth \n",channel->mwmr_fifo->depth);
     debugInt("asyncchannel fifo->width \n",channel->mwmr_fifo->width);
-    debugInt("asyncchannel msg size \n",sizeof(*msg));
+    debugInt("asyncchannel msg size \n",channel->mwmr_fifo->width);
     // async_read(channel->mwmr_fifo, &msg, 1);
     async_read(channel->mwmr_fifo, &msg, channel->mwmr_fifo->width);
     return msg;
@@ -111,7 +111,7 @@ void destroyAsyncchannel(asyncchannel *asyncch) {
 
   channel->currentNbOfMessages = channel->currentNbOfMessages -1;
   previous->next = NULL;
-  debugInt("before async read 1\n");
+
   debugInt("asyncchannel address \n",channel->mwmr_fifo);
   debugInt("asyncchannel fifo->depth \n",channel->mwmr_fifo->depth);
   debugInt("asyncchannel fifo->width \n",channel->mwmr_fifo->width);
@@ -136,6 +136,7 @@ void addMessageToAsyncChannel(asyncchannel *channel, message *msg) {
   debugInt("asyncchannel->fifo rptr \n", channel->mwmr_fifo->status->rptr);
   debugInt("asyncchannel->fifo wptr \n", channel->mwmr_fifo->status->wptr);
   //async_write(channel->mwmr_fifo, &msg, 1 );
+  debugInt("asyncchannel fifo->width \n",channel->mwmr_fifo->width);
   debugInt("asyncchannel msg size \n", channel->mwmr_fifo->width);
   async_write(channel->mwmr_fifo, &msg, channel->mwmr_fifo->width);//DG 13.6. *msg au lieu de msg//DG 18.07. fifo width
 }
-- 
GitLab