data/full_repos/permissive/447976230/fpga/usrp3/top/x400/ip/eth_100g_bd/eth_100g_axis2lbus.sv
1: b'%Error: data/full_repos/permissive/447976230/fpga/usrp3/top/x400/ip/eth_100g_bd/eth_100g_axis2lbus.sv:17: syntax error, unexpected IDENTIFIER, expecting PACKAGE-IDENTIFIER or STRING\nimport PkgEth100gLbus::*;\n       ^~~~~~~~~~~~~~\n%Error: Exiting due to 1 error(s)\n'
module eth_100g_axi2lbus #(
   parameter FIFO_DEPTH = 5,
   parameter NUM_SEG = 4
)
(


  AxiStreamIf.slave  axis,



  input  logic  lbus_rdy,
  output lbus_t lbus_out [NUM_SEG-1:0]

);

  localparam SEG_DATA_WIDTH = DATA_WIDTH/NUM_SEG;
  localparam SEG_BYTES      = SEG_DATA_WIDTH/8;
  localparam SEG_MTY_WIDTH  = $clog2(SEG_BYTES);


  lbus_t lbus_d [NUM_SEG-1:0];


  logic found_last;


  logic              axis_tready_i;
  assign axis.tready = axis_tready_i | lbus_rdy;

  always @(posedge axis.clk) begin
    axis_tready_i <= lbus_rdy;
  end


  AxiStreamIf #(.DATA_WIDTH(SEG_DATA_WIDTH),.USER_WIDTH($clog2(SEG_BYTES)))
    seg_axi (axis.clk, axis.rst);
  assign seg_axi.tlast = 1'b1;

  logic [NUM_SEG:0] valid;
  assign valid[NUM_SEG] = 1'b0;

  genvar b;
  genvar s;
  generate begin : lbus_gen
    for (s=0; s < NUM_SEG; s=s+1) begin : segment_loop

      for (b = 0; b < DATA_WIDTH/32; b=b+1) begin : byte_loop
        assign lbus_d[s].data[b*8 +: 8] = axis.tdata[((s+1)*(DATA_WIDTH/NUM_SEG)-8-(b*8)) +: 8];
      end : byte_loop

      assign valid[s] =  (| axis.tkeep[s*SEG_BYTES +: SEG_BYTES]) & axis.tvalid;

      assign lbus_d[s].ena = valid[s] & axis.tready;


      assign lbus_d[s].eop = (valid[s] ^ valid[s+1]) & axis.tlast;

      assign lbus_d[s].err = valid[s] & axis.tuser;

      always_comb begin
        if (lbus_d[s].eop) begin
          lbus_d[s].mty = SEG_BYTES - seg_axi.keep2trailing(axis.tkeep[s*SEG_BYTES+: SEG_BYTES]);
        end else begin
          lbus_d[s].mty = 'b0;
        end
      end

      if (s==0) begin
        assign lbus_d[s].sop = found_last & axis.tvalid & axis.tready;
      end else begin
        assign lbus_d[s].sop = 1'b0;
      end

      always_ff @(posedge axis.clk) begin
        lbus_out[s].data <= lbus_d[s].data;
        lbus_out[s].ena  <= lbus_d[s].ena;
        lbus_out[s].sop  <= lbus_d[s].sop;
        lbus_out[s].eop  <= lbus_d[s].eop;
        lbus_out[s].err  <= lbus_d[s].err;
        lbus_out[s].mty  <= lbus_d[s].mty;
      end

    end : segment_loop
  end : lbus_gen
  endgenerate




  always_ff @(posedge axis.clk) begin : sop_sm
   if(axis.rst) begin
      found_last <= 1'b1;
   end else begin
      if(axis.tvalid & axis.tlast & axis.tready) found_last <= 1'b1;
      else if(axis.tvalid & axis.tready)         found_last <= 1'b0;
    end
  end : sop_sm

endmodule
module eth_100g_axi2lbus #(
   parameter FIFO_DEPTH = 5,
   parameter NUM_SEG = 4
)
(


  AxiStreamIf.slave  axis,



  input  logic  lbus_rdy,
  output lbus_t lbus_out [NUM_SEG-1:0]

);


  localparam SEG_DATA_WIDTH = DATA_WIDTH/NUM_SEG;
  localparam SEG_BYTES      = SEG_DATA_WIDTH/8;
  localparam SEG_MTY_WIDTH  = $clog2(SEG_BYTES);


  lbus_t lbus_d [NUM_SEG-1:0];


  logic found_last;


  logic              axis_tready_i;
  assign axis.tready = axis_tready_i | lbus_rdy;

  always @(posedge axis.clk) begin
    axis_tready_i <= lbus_rdy;
  end


  AxiStreamIf #(.DATA_WIDTH(SEG_DATA_WIDTH),.USER_WIDTH($clog2(SEG_BYTES)))
    seg_axi (axis.clk, axis.rst);
  assign seg_axi.tlast = 1'b1;

  logic [NUM_SEG:0] valid;
  assign valid[NUM_SEG] = 1'b0;

  genvar b;
  genvar s;
  generate begin : lbus_gen
    for (s=0; s < NUM_SEG; s=s+1) begin : segment_loop

      for (b = 0; b < DATA_WIDTH/32; b=b+1) begin : byte_loop
        assign lbus_d[s].data[b*8 +: 8] = axis.tdata[((s+1)*(DATA_WIDTH/NUM_SEG)-8-(b*8)) +: 8];
      end : byte_loop

      assign valid[s] =  (| axis.tkeep[s*SEG_BYTES +: SEG_BYTES]) & axis.tvalid;

      assign lbus_d[s].ena = valid[s] & axis.tready;


      assign lbus_d[s].eop = (valid[s] ^ valid[s+1]) & axis.tlast;

      assign lbus_d[s].err = valid[s] & axis.tuser;

      always_comb begin
        if (lbus_d[s].eop) begin
          lbus_d[s].mty = SEG_BYTES - seg_axi.keep2trailing(axis.tkeep[s*SEG_BYTES+: SEG_BYTES]);
        end else begin
          lbus_d[s].mty = 'b0;
        end
      end

      if (s==0) begin
        assign lbus_d[s].sop = found_last & axis.tvalid & axis.tready;
      end else begin
        assign lbus_d[s].sop = 1'b0;
      end

      always_ff @(posedge axis.clk) begin
        lbus_out[s].data <= lbus_d[s].data;
        lbus_out[s].ena  <= lbus_d[s].ena;
        lbus_out[s].sop  <= lbus_d[s].sop;
        lbus_out[s].eop  <= lbus_d[s].eop;
        lbus_out[s].err  <= lbus_d[s].err;
        lbus_out[s].mty  <= lbus_d[s].mty;
      end

    end : segment_loop
  end : lbus_gen
  endgenerate




  always_ff @(posedge axis.clk) begin : sop_sm
   if(axis.rst) begin
      found_last <= 1'b1;
   end else begin
      if(axis.tvalid & axis.tlast & axis.tready) found_last <= 1'b1;
      else if(axis.tvalid & axis.tready)         found_last <= 1'b0;
    end
  end : sop_sm

endmodule