From 0713fba033113c5751233ee5d60682cbe08dba18 Mon Sep 17 00:00:00 2001
From: Vipin Thomas <vipin.thomas@stud.th-deg.de>
Date: Mon, 21 Jun 2021 11:39:46 +0000
Subject: [PATCH] Update pixel.cpp

---
 pixel.cpp | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/pixel.cpp b/pixel.cpp
index 1950682..d543e38 100644
--- a/pixel.cpp
+++ b/pixel.cpp
@@ -63,7 +63,9 @@ void pixel(ap_int<32> selector,
 
         case 1:
 
-            if((count_streams >= 3 * (position1 - 1)) && (count_streams < 3 * (position2))){
+            ascii=0;
+            if((count_streams >= 3 * (position1 - 1)) && (count_streams < 3 * (position2)-1)){
+                
                 
                 decrypt(pkt.data);
             
@@ -115,12 +117,15 @@ final_char= final_char*10+bit;
 }
 
 int convertBinInt(long long n) {
-    int dec = 0, i = 0, rem;
+    int dec = 0, i = 7,b, rem;
     while (n != 0) {
         rem = n % 10;
-        n /= 10;
+        b=pow(10,i);
+        n =n % b;
+         printf(" %lld\n", n);
         dec += rem * pow(2, i);
-        ++i;
+        printf(" %d\n", dec);
+        --i;
     }
     return dec;
 }
-- 
GitLab