diff --git a/hdl/common/network_stack.sv b/hdl/common/network_stack.sv index 4a9f79ac4fd4a66cd522ced2374d2c2fefcba86b..d056e152022d20168bd8e43b1b38da1061c80da1 100755 --- a/hdl/common/network_stack.sv +++ b/hdl/common/network_stack.sv @@ -1594,222 +1594,54 @@ icmpv6_server_ip icmpv6_server_inst ( * Slices */ // ARP Input Slice -generate -if (WIDTH==64) begin -axis_register_slice_64 axis_register_arp_in_slice( +register_slice_wrapper #(.WIDTH(WIDTH)) axis_register_arp_in_slice( .aclk(net_clk), .aresetn(net_aresetn), - .s_axis_tvalid(axis_iph_to_arp_slice.valid), - .s_axis_tready(axis_iph_to_arp_slice.ready), - .s_axis_tdata(axis_iph_to_arp_slice.data), - .s_axis_tkeep(axis_iph_to_arp_slice.keep), - .s_axis_tlast(axis_iph_to_arp_slice.last), - .m_axis_tvalid(axis_arp_slice_to_arp.valid), - .m_axis_tready(axis_arp_slice_to_arp.ready), - .m_axis_tdata(axis_arp_slice_to_arp.data), - .m_axis_tkeep(axis_arp_slice_to_arp.keep), - .m_axis_tlast(axis_arp_slice_to_arp.last) + .s_axis(axis_iph_to_arp_slice), + .m_axis(axis_arp_slice_to_arp) ); // ICMP Input Slice -axis_register_slice_64 axis_register_icmp_in_slice( +register_slice_wrapper #(.WIDTH(WIDTH)) axis_register_icmp_in_slice( .aclk(net_clk), .aresetn(net_aresetn), - .s_axis_tvalid(axis_iph_to_icmp_slice.valid), - .s_axis_tready(axis_iph_to_icmp_slice.ready), - .s_axis_tdata(axis_iph_to_icmp_slice.data), - .s_axis_tkeep(axis_iph_to_icmp_slice.keep), - .s_axis_tlast(axis_iph_to_icmp_slice.last), - .m_axis_tvalid(axis_icmp_slice_to_icmp.valid), - .m_axis_tready(axis_icmp_slice_to_icmp.ready), - .m_axis_tdata(axis_icmp_slice_to_icmp.data), - .m_axis_tkeep(axis_icmp_slice_to_icmp.keep), - .m_axis_tlast(axis_icmp_slice_to_icmp.last) + .s_axis(axis_iph_to_icmp_slice), + .m_axis(axis_icmp_slice_to_icmp) ); // UDP Input Slice -axis_register_slice_64 axis_register_upd_in_slice( +register_slice_wrapper #(.WIDTH(WIDTH)) axis_register_upd_in_slice( .aclk(net_clk), .aresetn(net_aresetn), -.s_axis_tvalid(axis_iph_to_udp_slice.valid), -.s_axis_tready(axis_iph_to_udp_slice.ready), -.s_axis_tdata(axis_iph_to_udp_slice.data), -.s_axis_tkeep(axis_iph_to_udp_slice.keep), -.s_axis_tlast(axis_iph_to_udp_slice.last), -.m_axis_tvalid(axis_udp_slice_to_udp.valid), -.m_axis_tready(axis_udp_slice_to_udp.ready), -.m_axis_tdata(axis_udp_slice_to_udp.data), -.m_axis_tkeep(axis_udp_slice_to_udp.keep), -.m_axis_tlast(axis_udp_slice_to_udp.last) +.s_axis(axis_iph_to_udp_slice), +.m_axis(axis_udp_slice_to_udp) ); // UDP Output Slice -axis_register_slice_64 axis_register_upd_out_slice( +register_slice_wrapper #(.WIDTH(WIDTH)) axis_register_upd_out_slice( .aclk(net_clk), .aresetn(net_aresetn), -.s_axis_tvalid(axis_udp_to_udp_slice.valid), -.s_axis_tready(axis_udp_to_udp_slice.ready), -.s_axis_tdata(axis_udp_to_udp_slice.data), -.s_axis_tkeep(axis_udp_to_udp_slice.keep), -.s_axis_tlast(axis_udp_to_udp_slice.last), -.m_axis_tvalid(axis_udp_slice_to_merge.valid), -.m_axis_tready(axis_udp_slice_to_merge.ready), -.m_axis_tdata(axis_udp_slice_to_merge.data), -.m_axis_tkeep(axis_udp_slice_to_merge.keep), -.m_axis_tlast(axis_udp_slice_to_merge.last) +.s_axis(axis_udp_to_udp_slice), +.m_axis(axis_udp_slice_to_merge) ); // TOE Input Slice -axis_register_slice_64 axis_register_toe_in_slice( +register_slice_wrapper #(.WIDTH(WIDTH)) axis_register_toe_in_slice( .aclk(net_clk), .aresetn(net_aresetn), -.s_axis_tvalid(axis_iph_to_toe_slice.valid), -.s_axis_tready(axis_iph_to_toe_slice.ready), -.s_axis_tdata(axis_iph_to_toe_slice.data), -.s_axis_tkeep(axis_iph_to_toe_slice.keep), -.s_axis_tlast(axis_iph_to_toe_slice.last), -.m_axis_tvalid(axis_toe_slice_to_toe.valid), -.m_axis_tready(axis_toe_slice_to_toe.ready), -.m_axis_tdata(axis_toe_slice_to_toe.data), -.m_axis_tkeep(axis_toe_slice_to_toe.keep), -.m_axis_tlast(axis_toe_slice_to_toe.last) +.s_axis(axis_iph_to_toe_slice), +.m_axis(axis_toe_slice_to_toe) ); // ROCE Input Slice -axis_register_slice_64 axis_register_roce_in_slice( +register_slice_wrapper #(.WIDTH(WIDTH)) axis_register_roce_in_slice( .aclk(net_clk), .aresetn(net_aresetn), -.s_axis_tvalid(axis_iph_to_roce_slice.valid), -.s_axis_tready(axis_iph_to_roce_slice.ready), -.s_axis_tdata(axis_iph_to_roce_slice.data), -.s_axis_tkeep(axis_iph_to_roce_slice.keep), -.s_axis_tlast(axis_iph_to_roce_slice.last), -.m_axis_tvalid(axis_roce_slice_to_roce.valid), -.m_axis_tready(axis_roce_slice_to_roce.ready), -.m_axis_tdata(axis_roce_slice_to_roce.data), -.m_axis_tkeep(axis_roce_slice_to_roce.keep), -.m_axis_tlast(axis_roce_slice_to_roce.last) +.s_axis(axis_iph_to_roce_slice), +.m_axis(axis_roce_slice_to_roce) ); // ROCE Output Slice -axis_register_slice_64 axis_register_roce_out_slice( +register_slice_wrapper #(.WIDTH(WIDTH)) axis_register_roce_out_slice( .aclk(net_clk), .aresetn(net_aresetn), -.s_axis_tvalid(axis_roce_to_roce_slice.valid), -.s_axis_tready(axis_roce_to_roce_slice.ready), -.s_axis_tdata(axis_roce_to_roce_slice.data), -.s_axis_tkeep(axis_roce_to_roce_slice.keep), -.s_axis_tlast(axis_roce_to_roce_slice.last), -.m_axis_tvalid(axis_roce_slice_to_merge.valid), -.m_axis_tready(axis_roce_slice_to_merge.ready), -.m_axis_tdata(axis_roce_slice_to_merge.data), -.m_axis_tkeep(axis_roce_slice_to_merge.keep), -.m_axis_tlast(axis_roce_slice_to_merge.last) +.s_axis(axis_roce_to_roce_slice), +.m_axis(axis_roce_slice_to_merge) ); -end -if (WIDTH==512) begin -axis_register_slice_512 axis_register_arp_in_slice( - .aclk(net_clk), - .aresetn(net_aresetn), - .s_axis_tvalid(axis_iph_to_arp_slice.valid), - .s_axis_tready(axis_iph_to_arp_slice.ready), - .s_axis_tdata(axis_iph_to_arp_slice.data), - .s_axis_tkeep(axis_iph_to_arp_slice.keep), - .s_axis_tlast(axis_iph_to_arp_slice.last), - .m_axis_tvalid(axis_arp_slice_to_arp.valid), - .m_axis_tready(axis_arp_slice_to_arp.ready), - .m_axis_tdata(axis_arp_slice_to_arp.data), - .m_axis_tkeep(axis_arp_slice_to_arp.keep), - .m_axis_tlast(axis_arp_slice_to_arp.last) -); - // ICMP Input Slice -//axis_register_slice_512 axis_register_icmp_in_slice( -axis_512_to_64_converter icmp_in_data_converter ( - .aclk(net_clk), - .aresetn(net_aresetn), - .s_axis_tvalid(axis_iph_to_icmp_slice.valid), - .s_axis_tready(axis_iph_to_icmp_slice.ready), - .s_axis_tdata(axis_iph_to_icmp_slice.data), - .s_axis_tkeep(axis_iph_to_icmp_slice.keep), - .s_axis_tlast(axis_iph_to_icmp_slice.last), - .m_axis_tvalid(axis_icmp_slice_to_icmp.valid), - .m_axis_tready(axis_icmp_slice_to_icmp.ready), - .m_axis_tdata(axis_icmp_slice_to_icmp.data), - .m_axis_tkeep(axis_icmp_slice_to_icmp.keep), - .m_axis_tlast(axis_icmp_slice_to_icmp.last) -); - // UDP Input Slice -axis_register_slice_512 axis_register_upd_in_slice( -.aclk(net_clk), -.aresetn(net_aresetn), -.s_axis_tvalid(axis_iph_to_udp_slice.valid), -.s_axis_tready(axis_iph_to_udp_slice.ready), -.s_axis_tdata(axis_iph_to_udp_slice.data), -.s_axis_tkeep(axis_iph_to_udp_slice.keep), -.s_axis_tlast(axis_iph_to_udp_slice.last), -.m_axis_tvalid(axis_udp_slice_to_udp.valid), -.m_axis_tready(axis_udp_slice_to_udp.ready), -.m_axis_tdata(axis_udp_slice_to_udp.data), -.m_axis_tkeep(axis_udp_slice_to_udp.keep), -.m_axis_tlast(axis_udp_slice_to_udp.last) -); - // UDP Output Slice -axis_register_slice_512 axis_register_upd_out_slice( -.aclk(net_clk), -.aresetn(net_aresetn), -.s_axis_tvalid(axis_udp_to_udp_slice.valid), -.s_axis_tready(axis_udp_to_udp_slice.ready), -.s_axis_tdata(axis_udp_to_udp_slice.data), -.s_axis_tkeep(axis_udp_to_udp_slice.keep), -.s_axis_tlast(axis_udp_to_udp_slice.last), -.m_axis_tvalid(axis_udp_slice_to_merge.valid), -.m_axis_tready(axis_udp_slice_to_merge.ready), -.m_axis_tdata(axis_udp_slice_to_merge.data), -.m_axis_tkeep(axis_udp_slice_to_merge.keep), -.m_axis_tlast(axis_udp_slice_to_merge.last) -); - // TOE Input Slice -axis_register_slice_512 axis_register_toe_in_slice( -.aclk(net_clk), -.aresetn(net_aresetn), -.s_axis_tvalid(axis_iph_to_toe_slice.valid), -.s_axis_tready(axis_iph_to_toe_slice.ready), -.s_axis_tdata(axis_iph_to_toe_slice.data), -.s_axis_tkeep(axis_iph_to_toe_slice.keep), -.s_axis_tlast(axis_iph_to_toe_slice.last), -.m_axis_tvalid(axis_toe_slice_to_toe.valid), -.m_axis_tready(axis_toe_slice_to_toe.ready), -.m_axis_tdata(axis_toe_slice_to_toe.data), -.m_axis_tkeep(axis_toe_slice_to_toe.keep), -.m_axis_tlast(axis_toe_slice_to_toe.last) -); -// ROCE Input Slice -axis_register_slice_512 axis_register_roce_in_slice( -.aclk(net_clk), -.aresetn(net_aresetn), -.s_axis_tvalid(axis_iph_to_roce_slice.valid), -.s_axis_tready(axis_iph_to_roce_slice.ready), -.s_axis_tdata(axis_iph_to_roce_slice.data), -.s_axis_tkeep(axis_iph_to_roce_slice.keep), -.s_axis_tlast(axis_iph_to_roce_slice.last), -.m_axis_tvalid(axis_roce_slice_to_roce.valid), -.m_axis_tready(axis_roce_slice_to_roce.ready), -.m_axis_tdata(axis_roce_slice_to_roce.data), -.m_axis_tkeep(axis_roce_slice_to_roce.keep), -.m_axis_tlast(axis_roce_slice_to_roce.last) -); -// ROCE Output Slice -axis_register_slice_512 axis_register_roce_out_slice( -.aclk(net_clk), -.aresetn(net_aresetn), -.s_axis_tvalid(axis_roce_to_roce_slice.valid), -.s_axis_tready(axis_roce_to_roce_slice.ready), -.s_axis_tdata(axis_roce_to_roce_slice.data), -.s_axis_tkeep(axis_roce_to_roce_slice.keep), -.s_axis_tlast(axis_roce_to_roce_slice.last), -.m_axis_tvalid(axis_roce_slice_to_merge.valid), -.m_axis_tready(axis_roce_slice_to_merge.ready), -.m_axis_tdata(axis_roce_slice_to_merge.data), -.m_axis_tkeep(axis_roce_slice_to_merge.keep), -.m_axis_tlast(axis_roce_slice_to_merge.last) -); -end -endgenerate - /* * Network Controller diff --git a/hdl/common/register_slice_wrapper.sv b/hdl/common/register_slice_wrapper.sv new file mode 100644 index 0000000000000000000000000000000000000000..497f40d71e1054e9fd6fb13eb3e69a6ce2ac5246 --- /dev/null +++ b/hdl/common/register_slice_wrapper.sv @@ -0,0 +1,82 @@ +`timescale 1ns / 1ps +`default_nettype none + +module register_slice_wrapper #( + parameter WIDTH = 64 +) ( + input wire aclk, + input wire aresetn, + axi_stream.slave s_axis, + axi_stream.master m_axis +); + + +generate +if(WIDTH==64) begin +axis_register_slice_64 slice_inst( + .aclk(aclk), + .aresetn(aresetn), + .s_axis_tvalid(s_axis.valid), + .s_axis_tready(s_axis.ready), + .s_axis_tdata(s_axis.data), + .s_axis_tkeep(s_axis.keep), + .s_axis_tlast(s_axis.last), + .m_axis_tvalid(m_axis.valid), + .m_axis_tready(m_axis.ready), + .m_axis_tdata(m_axis.data), + .m_axis_tkeep(m_axis.keep), + .m_axis_tlast(m_axis.last) +); +end +if(WIDTH==128) begin +axis_register_slice_128 slice_inst( + .aclk(aclk), + .aresetn(aresetn), + .s_axis_tvalid(s_axis.valid), + .s_axis_tready(s_axis.ready), + .s_axis_tdata(s_axis.data), + .s_axis_tkeep(s_axis.keep), + .s_axis_tlast(s_axis.last), + .m_axis_tvalid(m_axis.valid), + .m_axis_tready(m_axis.ready), + .m_axis_tdata(m_axis.data), + .m_axis_tkeep(m_axis.keep), + .m_axis_tlast(m_axis.last) +); +end +if(WIDTH==256) begin +axis_register_slice_256 slice_inst( + .aclk(aclk), + .aresetn(aresetn), + .s_axis_tvalid(s_axis.valid), + .s_axis_tready(s_axis.ready), + .s_axis_tdata(s_axis.data), + .s_axis_tkeep(s_axis.keep), + .s_axis_tlast(s_axis.last), + .m_axis_tvalid(m_axis.valid), + .m_axis_tready(m_axis.ready), + .m_axis_tdata(m_axis.data), + .m_axis_tkeep(m_axis.keep), + .m_axis_tlast(m_axis.last) +); +end +if(WIDTH==512) begin +axis_register_slice_512 slice_inst( + .aclk(aclk), + .aresetn(aresetn), + .s_axis_tvalid(s_axis.valid), + .s_axis_tready(s_axis.ready), + .s_axis_tdata(s_axis.data), + .s_axis_tkeep(s_axis.keep), + .s_axis_tlast(s_axis.last), + .m_axis_tvalid(m_axis.valid), + .m_axis_tready(m_axis.ready), + .m_axis_tdata(m_axis.data), + .m_axis_tkeep(m_axis.keep), + .m_axis_tlast(m_axis.last) +); +end +endgenerate + +endmodule +`default_nettype wire \ No newline at end of file diff --git a/hls/arp_server_subnet/arp_server_subnet.cpp b/hls/arp_server_subnet/arp_server_subnet.cpp index 289b53264f54fdf0d1795ec7c27f13fcf05b0dae..9489ca8a013c2c534aa42b255fb035f454b537d5 100644 --- a/hls/arp_server_subnet/arp_server_subnet.cpp +++ b/hls/arp_server_subnet/arp_server_subnet.cpp @@ -129,7 +129,7 @@ void generate_arp_pkg( hls::stream<arpReplyMeta>& arpReplyMetaFifo, if (WIDTH > ARP_HEADER_SIZE) { - sendWord.keep = lenToKeep(ARP_HEADER_SIZE); + sendWord.keep = lenToKeep((ARP_HEADER_SIZE/8)); sendWord.last = 1; gap_state = IDLE; } diff --git a/hls/arp_server_subnet/arp_server_subnet.hpp b/hls/arp_server_subnet/arp_server_subnet.hpp index b676e8b161a5dbe57641e36b7c8c93889ce90501..d6fd448db6cde801771f223d2b094244ddfd7eb6 100644 --- a/hls/arp_server_subnet/arp_server_subnet.hpp +++ b/hls/arp_server_subnet/arp_server_subnet.hpp @@ -165,7 +165,9 @@ void arp_server_subnet( hls::stream<net_axis<WIDTH> >& arpDataIn, hls::stream<net_axis<WIDTH> >& arpDataOut, hls::stream<arpTableReply>& macIpEncode_rsp, hls::stream<arpTableReply>& hostIpEncode_rsp, - ap_uint<48> myMacAddress, - ap_uint<32> myIpAddress); + ap_uint<48> myMacAddress, + ap_uint<32> myIpAddress, + ap_uint<16>& regRequestCount, + ap_uint<16>& regReplyCount); #endif \ No newline at end of file diff --git a/hls/arp_server_subnet/make.tcl.in b/hls/arp_server_subnet/make.tcl.in index 168c5222b0ecb8bd57a62af0e728d2fe2b526668..4e1413239e04d1c82390f3f9ad387290c86b0801 100644 --- a/hls/arp_server_subnet/make.tcl.in +++ b/hls/arp_server_subnet/make.tcl.in @@ -11,7 +11,8 @@ add_files ${CMAKE_CURRENT_SOURCE_DIR}/../axi_utils.cpp add_files ${CMAKE_CURRENT_SOURCE_DIR}/arp_server_subnet.cpp -cflags "-I${CMAKE_CURRENT_BINARY_DIR}" -#add_files -tb test_arp_server_subnet.cpp +add_files -tb ${CMAKE_CURRENT_SOURCE_DIR}/test_arp_server_subnet.cpp -cflags "-I${CMAKE_CURRENT_BINARY_DIR}" + #Check which command @@ -20,7 +21,7 @@ set command [lindex $argv 2] if {$command == "synthesis"} { csynth_design } elseif {$command == "csim"} { - csim_design + csim_design -clean -argv {${CMAKE_CURRENT_SOURCE_DIR}/in.dat ${CMAKE_CURRENT_SOURCE_DIR}/out.dat} } elseif {$command == "ip"} { export_design -format ip_catalog -ipname "arp_server_subnet" -display_name "ARP Subnet Server" -description "Replies to ARP queries and resolves IP addresses." -vendor "ethz.systems.fpga" -version "1.1" } elseif {$command == "installip"} { diff --git a/hls/arp_server_subnet/test_arp_server_subnet.cpp b/hls/arp_server_subnet/test_arp_server_subnet.cpp index e605d70f778f5ef11fc9a3c2345f5379267dd032..23c88948e360aeb07c3ed16637e4b24a3b59d718 100644 --- a/hls/arp_server_subnet/test_arp_server_subnet.cpp +++ b/hls/arp_server_subnet/test_arp_server_subnet.cpp @@ -26,25 +26,23 @@ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABI OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.// Copyright (c) 2015 Xilinx, Inc. ************************************************/ - +#include <arp_server_subnet_config.hpp> #include "arp_server_subnet.hpp" -int main() +int main(int argc, char* argv[]) { hls::stream<net_axis<64> > arpDataIn64("arpDataIn64"); - hls::stream<net_axis<128> > arpDataIn128("arpDataIn128"); - hls::stream<net_axis<256> > arpDataIn256("arpDataIn256"); - hls::stream<axiWord> arpDataIn("arpDataIn"); + hls::stream<net_axis<DATA_WIDTH> > arpDataIn("arpDataIn"); hls::stream<ap_uint<32> > macIpEncode_req("macIpEncode_req"); hls::stream<ap_uint<32> > hostIpEncode_req("hostIpEncode_req"); hls::stream<net_axis<64> > arpDataOut64("arpDataOut64"); - hls::stream<net_axis<128> > arpDataOut128("arpDataOut128"); - hls::stream<net_axis<256> > arpDataOut256("arpDataOut256"); - hls::stream<axiWord> arpDataOut("arpDataOut"); + hls::stream<net_axis<DATA_WIDTH> > arpDataOut("arpDataOut"); hls::stream<arpTableReply> macIpEncode_rsp("macIpEncode_rsp"); hls::stream<arpTableReply> hostIpEncode_rsp("hostIpEncode_rsp"); + ap_uint<16> regRequestCount; + ap_uint<16> regReplyCount; std::ifstream inputFile; std::ofstream outputFile; @@ -52,14 +50,22 @@ int main() static ap_uint<32> ipAddress = 0x01010101; static ap_uint<48> macAddress = 0xE59D02350A00; - inputFile.open("../../../../in.dat"); + std::cout << "Running test for " << DATA_WIDTH << "bit width" << std::endl; + + if (argc != 3) + { + std::cout << "Not input and output file specified as argument\n"; + return -1; + } + + inputFile.open(argv[1]);//"../../../../in.dat"); //inputFile.open("../../../../queryReply.dat"); if (!inputFile) { std::cout << "Error: could not open test input file." << std::endl; } - outputFile.open("../../../../out.dat"); + outputFile.open(argv[2]);//"../../../../out.dat"); if (!outputFile) { std::cout << "Error: could not open test output file." << std::endl; @@ -81,34 +87,23 @@ int main() int count = 0; while (count < 250) { - arp_server_subnet( arpDataIn, + arp_server_subnet<DATA_WIDTH>( arpDataIn, macIpEncode_req, hostIpEncode_req, arpDataOut, macIpEncode_rsp, hostIpEncode_rsp, macAddress, - ipAddress); + ipAddress, + regRequestCount, + regReplyCount); if (count == 50) { macIpEncode_req.write(0x0a010101); } -#if (AXI_WIDTH == 512) - convertStreamToDoubleWidth(arpDataIn64, arpDataIn128); - convertStreamToDoubleWidth(arpDataIn128, arpDataIn256); - convertStreamToDoubleWidth(arpDataIn256, arpDataIn); - convertStreamToHalfWidth<512, 951>(arpDataOut, arpDataOut256); - convertStreamToHalfWidth<256, 952>(arpDataOut256, arpDataOut128); - convertStreamToHalfWidth<128, 953>(arpDataOut128, arpDataOut64); -#else - if (!arpDataIn64.empty()) { - arpDataIn.write(arpDataIn64.read()); - } - if (!arpDataOut.empty()) { - arpDataOut64.write(arpDataOut.read()); - } -#endif + convertStreamWidth<64, 941>(arpDataIn64, arpDataIn); + convertStreamWidth<DATA_WIDTH, 951>(arpDataOut, arpDataOut64); count++; } diff --git a/hls/axi_utils.hpp b/hls/axi_utils.hpp index 9e6c54d8b34348937cdac073907c5c264aab74e0..b4074520902d194a9bef2e90c815b371169221a2 100644 --- a/hls/axi_utils.hpp +++ b/hls/axi_utils.hpp @@ -307,15 +307,17 @@ void reduceStreamWidth(hls::stream<net_axis<W> >& input, hls::stream<net_axis<W/ temp.keep = currWord.keep(((W/D)/8)-1, 0); temp.last = (currWord.keep[(W/8)/D] == 0); //(currWord.keep((W/8)-1, (W/8)/2) == 0); output.write(temp); - //shift word - currWord.data(W-(W/D)-1, 0) = currWord.data(W-1, W/D); - currWord.keep((W/8)-((W/8)/D)-1, 0) = currWord.keep((W/8)-1, (W/8)/D); if (currWord.keep[(W/8)/D]) { count = 1; fsmState = SECOND; } + + //shift word + currWord.data(W-(W/D)-1, 0) = currWord.data(W-1, W/D); + currWord.keep((W/8)-((W/8)/D)-1, 0) = currWord.keep((W/8)-1, (W/8)/D); + currWord.keep((W/8)-1, (W/8)-((W/8)/D)) = 0; } break; case SECOND: @@ -333,6 +335,8 @@ void reduceStreamWidth(hls::stream<net_axis<W> >& input, hls::stream<net_axis<W/ //shift word currWord.data(W-(W/D)-1, 0) = currWord.data(W-1, W/D); currWord.keep((W/8)-((W/8)/D)-1, 0) = currWord.keep((W/8)-1, (W/8)/D); + currWord.keep((W/8)-1, (W/8)-((W/8)/D)) = 0; + count++; if (count == D || temp.last)