102 #include <hls_stream.h>
113 #define AXIS_RAW_WIDTH_AT_10GE 64
114 #define ARW AXIS_RAW_WIDTH_AT_10GE
147 template <
class TypeIn,
class TypeOut>
149 hls::stream<TypeIn>& si,
150 hls::stream<TypeOut>& so)
152 #pragma HLS PIPELINE II=1 enable_flush
153 #pragma HLS INLINE off
193 case 64-1 :
return byteSwap64(
tdata.range(leHi, leLo));
break;
194 case 32-1 :
return byteSwap32(
tdata.range(leHi, leLo));
break;
195 case 16-1 :
return byteSwap16(
tdata.range(leHi, leLo));
break;
196 case 8-1 :
return (
tdata.range(leHi, leLo));
break;
199 std::cout <<
"ASSERT - AxisRaw::getTData() - Unsupported range.\n"; assert(
false);
209 case 8-1 :
return bitSwap8(
tkeep.range(leHi, leLo));
break;
210 case 4-1 :
return bitSwap4(
tkeep.range(leHi, leLo));
break;
211 case 2-1 :
return bitSwap2(
tkeep.range(leHi, leLo));
break;
212 case 1-1 :
return (
tkeep[leLo]);
break;
215 std::cout <<
"ASSERT - AxisRaw::getTKeep() - Unsupported range.\n"; assert(
false);
230 case 64 :
tdata = byteSwap64(
data);
break;
231 default : std::cout <<
"ASSERT - AxisRaw::setTData() - Unsupported Axis raw width.\n";
break;
241 case 64 :
tkeep = bitSwap8(keep);
break;
242 default : std::cout <<
"ASSERT - AxisRaw::setTKeep() - Unsupported Axis raw width.\n";
break;
261 return tdata.range(leHi, leLo);
265 return tkeep.range(leHi, leLo);
273 tdata.range(leHi, leLo) =
data.range(leHi-leLo, 0);
277 tkeep.range(leHi, leLo) = keep;
328 case 64 :
tdata.range(
ARW/2-1, 0) = byteSwap32(halfData);
break;
329 default : std::cout <<
"ASSERT - AxisRaw::setTDataHi() - Unsupported Axis raw width.\n";
break;
339 case 64 :
tdata.range(
ARW-1,
ARW/2) = byteSwap32(halfData);
break;
340 default : std::cout <<
"ASSERT - AxisRaw::setTDataLo() - Unsupported Axis raw width.\n";
break;
350 case 64 :
tkeep(
ARW/8/2-1, 0) = bitSwap4(halfKeep);
break;
351 default : std::cout <<
"ASSERT - AxisRaw::setTKeepHi() - Unsupported Axis raw width.\n";
break;
361 case 64 :
tkeep(
ARW/8-1,
ARW/8/2) = bitSwap4(halfKeep);
break;
362 default : std::cout <<
"ASSERT - AxisRaw::setTKeepLo() - Unsupported Axis raw width.\n";
break;
384 tdata.range(63, 32) =
data.range(63, 32);
400 case 0x00:
tdata.range(leHi+8*0, leLo+8*0) = 0x00;
401 case 0x01:
tdata.range(leHi+8*1, leLo+8*1) = 0x00;
402 case 0x03:
tdata.range(leHi+8*2, leLo+8*2) = 0x00;
403 case 0x07:
tdata.range(leHi+8*3, leLo+8*3) = 0x00;
404 case 0x0F:
tdata.range(leHi+8*4, leLo+8*4) = 0x00;
405 case 0x1F:
tdata.range(leHi+8*5, leLo+8*5) = 0x00;
406 case 0x3F:
tdata.range(leHi+8*6, leLo+8*6) = 0x00;
407 case 0x7F:
tdata.range(leHi+8*7, leLo+8*7) = 0x00;
453 case 0x01:
return 1;
break;
454 case 0x03:
return 2;
break;
455 case 0x07:
return 3;
break;
456 case 0x0F:
return 4;
break;
457 case 0x1F:
return 5;
break;
458 case 0x3F:
return 6;
break;
459 case 0x7F:
return 7;
break;
460 case 0xFF:
return 8;
break;
467 ap_uint<2> bitSwap2(ap_uint<2> inputVector)
const {
468 return (inputVector.range(0,1));
471 ap_uint<4> bitSwap4(ap_uint<4> inputVector)
const {
472 return (inputVector.range(0,3));
475 ap_uint<8> bitSwap8(ap_uint<8> inputVector)
const {
476 return (inputVector.range(0,7));
479 ap_uint<16> byteSwap16(ap_uint<16> inputVector)
const {
480 return (inputVector.range(7,0), inputVector(15, 8));
483 ap_uint<32> byteSwap32(ap_uint<32> inpDWord)
const {
484 return (inpDWord.range( 7, 0), inpDWord.range(15, 8),
485 inpDWord.range(23,16), inpDWord.range(31, 24));
488 ap_uint<64> byteSwap64(ap_uint<64> inpQWord)
const {
489 return (inpQWord.range( 7, 0), inpQWord(15, 8),
490 inpQWord.range(23,16), inpQWord(31, 24),
491 inpQWord.range(39,32), inpQWord(47, 40),
492 inpQWord.range(55,48), inpQWord(63, 56));
void setTLast(tLast last)
void setTDataHi(tDataHalf halfData)
void setTDataLo(tDataHalf halfData)
tData getTData(int leHi=64 -1, int leLo=0) const
AxisRaw(LE_tData tdata, LE_tKeep tkeep, LE_tLast tlast)
tDataHalf getTDataLo() const
LE_tKeep getLE_TKeep(int leHi=64/8-1, int leLo=0) const
void setTKeepLo(tKeepHalf halfKeep)
tKeepHalf getTKeepHi() const
LE_tData getLE_TData(int leHi=64 -1, int leLo=0) const
LE_tDataHalf getLE_TDataLo() const
void setLE_TDataLo(LE_tData data)
void setLE_TLast(LE_tLast last)
void setLE_TDataHi(LE_tData data)
void setTKeepHi(tKeepHalf halfKeep)
void setLE_TData(LE_tData data, int leHi=64 -1, int leLo=0)
void setTKeep(tKeep keep)
LE_tDataHalf getLE_TDataHi() const
tKeep getTKeep(int leHi=64/8-1, int leLo=0) const
void setTData(tData data)
tDataHalf getTDataHi() const
void setLE_TKeep(LE_tKeep keep, int leHi=64/8-1, int leLo=0)
tKeepHalf getTKeepLo() const
LE_tLast getLE_TLast() const
void pAxisRawCast(hls::stream< TypeIn > &si, hls::stream< TypeOut > &so)
AxisRaw cast - Casts an AxisRaw stream to/from an AxisRaw derived class.
ap_uint< 64/16 > tKeepHalf
ap_uint< 64/2 > tDataHalf
ap_uint< 64/2 > LE_tDataHalf