From e87f3b1ec301de6d7bfd255407027fccb6cc73b9 Mon Sep 17 00:00:00 2001 From: Vipin Thomas <vipin.thomas@stud.th-deg.de> Date: Fri, 4 Jun 2021 18:58:45 +0000 Subject: [PATCH] Update pixel.cpp --- pixel.cpp | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/pixel.cpp b/pixel.cpp index edd9813..b765624 100644 --- a/pixel.cpp +++ b/pixel.cpp @@ -5,35 +5,48 @@ using namespace std; typedef ap_axis<32,0,0,0> pkt_t; -static int counter = 0; -static bool flag=false; - +static int count = 0; +static int count_streams = 0; +static bool flag = false; +static int p_count = 3; void pixel( - ap_int<32> w, + ap_int<32> position, + ap_int<32> stream_count, hls::stream< pkt_t > &din, hls::stream< pkt_t > &dout ) { #pragma HLS INTERFACE ap_ctrl_none port=return - #pragma HLS INTERFACE s_axilite port=w + #pragma HLS INTERFACE s_axilite port=position + #pragma HLS INTERFACE s_axilite port=stream_count #pragma HLS INTERFACE axis port=din #pragma HLS INTERFACE axis port=dout pkt_t pkt=din.read(); + count_streams++; - - if(counter==w){ - pkt.data*=2; - flag=true; - counter=0; + if(p_count==0){ + count = 0; + flag=true; + } + if(count == position || count == position+1 || count == position+2){ + pkt.data -= 1; + p_count--; } else if(!flag){ - counter++; + count++; } - // pending: have to make count=0 when TLAST signal is active - for w not in the range of 0 to n(size of the array) + + if (count_streams == stream_count){ + count_streams = 0; + flag = false; + } + + // pending: have to make count=0 when TLAST signal is active - for w not in the range of 0 to n(size of the array) dout.write(pkt); } + -- GitLab