data/full_repos/permissive/455223995/src/slzw_lib.v
1: b'%Error: data/full_repos/permissive/455223995/src/slzw_lib.v:50: syntax error, unexpected byte, expecting IDENTIFIER or \'[\' or do or final\n  input   [7:0] byte,\n                ^~~~\n%Error: data/full_repos/permissive/455223995/src/slzw_lib.v:56: syntax error, unexpected \'[\', expecting "\'{"\nwire [13:0] num1 = {1\'b0, byte[4:0], byte[7:0]};\n                              ^\n%Error: data/full_repos/permissive/455223995/src/slzw_lib.v:62: syntax error, unexpected assign\nassign haddr      = num1 + num2;\n^~~~~~\n%Error: Exiting due to 3 error(s)\n'
module slzw_lifo
#(parameter
   DEPTH                       = 128,
   WIDTH                       = 8
)
(
  input                        clk,
  input                        reset_n,

  input                        clr,

  input                        push,
  input      [WIDTH-1:0]       wdata,

  input                        pop,
  output reg [WIDTH-1:0]       rdata,

  output reg                   empty,
  output                       full
);

localparam                     LOG2DEPTH = $clog2(DEPTH);

reg  [WIDTH-1:0]               mem [0:DEPTH-1];
reg  [LOG2DEPTH:0]             ptr;

wire [LOG2DEPTH:0]             ptr_minus1 = ptr - 1;

wire                           pushval    = push && ~full;
wire                           popval     = pop  && ptr != 0;

wire [LOG2DEPTH-1:0]           nextptr    = ptr + ((pushval & ~popval)  ? {{LOG2DEPTH{1'b0}}, 1'b1} :
                                                   (popval  & ~pushval) ? {LOG2DEPTH+1{1'b1}}       :
                                                                          {LOG2DEPTH+1{1'b0}});

assign                         full       = ptr[LOG2DEPTH];

always @(posedge clk `RESET)
begin
  if (reset_n == 1'b0)
  begin
    ptr                        <= {LOG2DEPTH-1{1'b0}};
    empty                      <= 1'b1;
  end
  else
  begin
    rdata                      <= mem[ptr_minus1];
    ptr                        <= nextptr & {LOG2DEPTH{~clr}};
    empty                      <= clr ?                               1'b0 :
                                  (popval  && ~pushval && ptr == 1) ? 1'b1 :
                                                                      empty;
    if (pushval)
    begin
      mem[ptr]                 <= wdata;
      empty                    <= 1'b0;
    end
  end
end

endmodule
module slzw_lifo
#(parameter
   DEPTH                       = 128,
   WIDTH                       = 8
)
(
  input                        clk,
  input                        reset_n,

  input                        clr,

  input                        push,
  input      [WIDTH-1:0]       wdata,

  input                        pop,
  output reg [WIDTH-1:0]       rdata,

  output reg                   empty,
  output                       full
);


localparam                     LOG2DEPTH = $clog2(DEPTH);

reg  [WIDTH-1:0]               mem [0:DEPTH-1];
reg  [LOG2DEPTH:0]             ptr;

wire [LOG2DEPTH:0]             ptr_minus1 = ptr - 1;

wire                           pushval    = push && ~full;
wire                           popval     = pop  && ptr != 0;

wire [LOG2DEPTH-1:0]           nextptr    = ptr + ((pushval & ~popval)  ? {{LOG2DEPTH{1'b0}}, 1'b1} :
                                                   (popval  & ~pushval) ? {LOG2DEPTH+1{1'b1}}       :
                                                                          {LOG2DEPTH+1{1'b0}});

assign                         full       = ptr[LOG2DEPTH];

always @(posedge clk `RESET)
begin
  if (reset_n == 1'b0)
  begin
    ptr                        <= {LOG2DEPTH-1{1'b0}};
    empty                      <= 1'b1;
  end
  else
  begin
    rdata                      <= mem[ptr_minus1];
    ptr                        <= nextptr & {LOG2DEPTH{~clr}};
    empty                      <= clr ?                               1'b0 :
                                  (popval  && ~pushval && ptr == 1) ? 1'b1 :
                                                                      empty;
    if (pushval)
    begin
      mem[ptr]                 <= wdata;
      empty                    <= 1'b0;
    end
  end
end

endmodule