Skip to content
Snippets Groups Projects
Commit fc50dcb0 authored by Vipin Thomas's avatar Vipin Thomas
Browse files

Update pixel.cpp

parent c170036e
No related branches found
No related tags found
No related merge requests found
...@@ -21,24 +21,22 @@ int convertBinInt(long long n); ...@@ -21,24 +21,22 @@ int convertBinInt(long long n);
void decrypt(int data); void decrypt(int data);
void toAscii(char *c); void toAscii(char *c);
int getDecimal(int n); int getDecimal(int n);
pkt_t tmpA;
void pixel(ap_int<32> &in_decimal, void pixel(ap_int<32> &in_decimal,
ap_int<32> selector, ap_int<32> selector,
ap_int<32> position1, ap_int<32> stream_count,
ap_int<32> position2,
hls::stream< pkt_t > &din, hls::stream< pkt_t > &din,
hls::stream< pkt_t > &dout hls::stream< pkt_t > &dout
) { ) {
#pragma HLS INTERFACE ap_ctrl_none port=return #pragma HLS INTERFACE ap_ctrl_none port=return
#pragma HLS INTERFACE s_axilite port=in_decimal #pragma HLS INTERFACE s_axilite port=in_decimal
#pragma HLS INTERFACE s_axilite port=selector #pragma HLS INTERFACE s_axilite port=selector
#pragma HLS INTERFACE s_axilite port=position1 #pragma HLS INTERFACE s_axilite port=stream_count
#pragma HLS INTERFACE s_axilite port=position2
#pragma HLS INTERFACE axis port=din #pragma HLS INTERFACE axis port=din
#pragma HLS INTERFACE axis port=dout #pragma HLS INTERFACE axis port=dout
pkt_t pkt=din.read(); din >> tmpA;
// toAscii(key); // toAscii(key);
switch(selector) switch(selector)
{ {
...@@ -49,7 +47,6 @@ void pixel(ap_int<32> &in_decimal, ...@@ -49,7 +47,6 @@ void pixel(ap_int<32> &in_decimal,
decNum = in_decimal; decNum = in_decimal;
} }
//123456321 //123456321
if((count_streams >= (position1 - 1)) && (count_streams < position2)){
// addNum=0; // addNum=0;
addNum=0; addNum=0;
if(decimalCounter % 8 == 0){ if(decimalCounter % 8 == 0){
...@@ -67,24 +64,21 @@ void pixel(ap_int<32> &in_decimal, ...@@ -67,24 +64,21 @@ void pixel(ap_int<32> &in_decimal,
// decNum = decNum/1000; // decNum = decNum/1000;
// } // }
if(pkt.data % 2 == 0 && addNum == 1){ if(tmpA.data % 2 == 0 && addNum == 1){
pkt.data += 1; tmpA.data += 1;
}else if(pkt.data % 2 != 0 && addNum == 0){ }else if(tmpA.data % 2 != 0 && addNum == 0){
pkt.data -= 1; tmpA.data -= 1;
} }
decimalCounter++; decimalCounter++;
}
break; break;
case 1: case 1:
if((count_streams >= (position1 - 1)) && (count_streams < position2)){
decrypt(pkt.data); decrypt(tmpA.data);
decimalCounter++; decimalCounter++;
if(decimalCounter == 8){ if(decimalCounter == 8){
decimalOut=decimalOut*100+convertBinInt(final_char); decimalOut=decimalOut*100+convertBinInt(final_char);
...@@ -93,7 +87,6 @@ void pixel(ap_int<32> &in_decimal, ...@@ -93,7 +87,6 @@ void pixel(ap_int<32> &in_decimal,
} }
}
break; break;
default: default:
...@@ -102,7 +95,7 @@ void pixel(ap_int<32> &in_decimal, ...@@ -102,7 +95,7 @@ void pixel(ap_int<32> &in_decimal,
count_streams++; count_streams++;
if (count_streams == position2-1){ if (count_streams == stream_count){
count_streams = 0; count_streams = 0;
charIn=0; charIn=0;
addNum=0; addNum=0;
...@@ -115,7 +108,13 @@ void pixel(ap_int<32> &in_decimal, ...@@ -115,7 +108,13 @@ void pixel(ap_int<32> &in_decimal,
} }
dout.write(pkt); if(count_streams == stream_count){
tmpA.last = 1;
}
tmpA.strb = 0xf;
dout << tmpA;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment