data/full_repos/permissive/202080108/src/stack.v
 line:40: before: "="
1: b'%Error: data/full_repos/permissive/202080108/src/stack.v:9: Cannot find include file: stack.vh\n`include "stack.vh" \n         ^~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/202080108/src,data/full_repos/permissive/202080108/stack.vh\n             data/full_repos/permissive/202080108/src,data/full_repos/permissive/202080108/stack.vh.v\n             data/full_repos/permissive/202080108/src,data/full_repos/permissive/202080108/stack.vh.sv\n             stack.vh\n             stack.vh.v\n             stack.vh.sv\n             obj_dir/stack.vh\n             obj_dir/stack.vh.v\n             obj_dir/stack.vh.sv\n%Error: data/full_repos/permissive/202080108/src/stack.v:27: Define or directive not defined: \'`EMPTY\'\n  output reg [1:0] status = `EMPTY,   \n                            ^~~~~~\n%Error: data/full_repos/permissive/202080108/src/stack.v:27: syntax error, unexpected \',\', expecting TYPE-IDENTIFIER\n  output reg [1:0] status = `EMPTY,   \n                                  ^\n%Error: data/full_repos/permissive/202080108/src/stack.v:28: Define or directive not defined: \'`NONE\'\n  output reg [1:0] error  = `NONE     \n                            ^~~~~\n%Error: data/full_repos/permissive/202080108/src/stack.v:29: syntax error, unexpected \')\', expecting TYPE-IDENTIFIER\n);\n^\n%Error: data/full_repos/permissive/202080108/src/stack.v:36: syntax error, unexpected assign\n  assign tos = stack[index-1];\n  ^~~~~~\n%Error: data/full_repos/permissive/202080108/src/stack.v:41: Define or directive not defined: \'`FULL\'\n      status <= `FULL;\n                ^~~~~\n%Error: data/full_repos/permissive/202080108/src/stack.v:43: Define or directive not defined: \'`EMPTY\'\n      status <= `EMPTY;\n                ^~~~~~\n%Error: data/full_repos/permissive/202080108/src/stack.v:45: Define or directive not defined: \'`NONE\'\n      status <= `NONE;\n                ^~~~~\n%Error: data/full_repos/permissive/202080108/src/stack.v:49: Define or directive not defined: \'`NONE\'\n    error <= `NONE;\n             ^~~~~\n%Error: data/full_repos/permissive/202080108/src/stack.v:56: Define or directive not defined: \'`PUSH\'\n        `PUSH:\n        ^~~~~\n%Error: data/full_repos/permissive/202080108/src/stack.v:60: Define or directive not defined: \'`OVERFLOW\'\n            error <= `OVERFLOW;\n                     ^~~~~~~~~\n%Error: data/full_repos/permissive/202080108/src/stack.v:70: Define or directive not defined: \'`POP\'\n        `POP:\n        ^~~~\n%Error: data/full_repos/permissive/202080108/src/stack.v:73: Define or directive not defined: \'`UNDERFLOW\'\n            error <= `UNDERFLOW;\n                     ^~~~~~~~~~\n%Error: data/full_repos/permissive/202080108/src/stack.v:79: Define or directive not defined: \'`REPLACE\'\n        `REPLACE:\n        ^~~~~~~~\n%Error: data/full_repos/permissive/202080108/src/stack.v:82: Define or directive not defined: \'`UNDERFLOW\'\n            error <= `UNDERFLOW;\n                     ^~~~~~~~~~\n%Error: Exiting due to 16 error(s)\n'
module stack
#(
  parameter WIDTH = 8,
  parameter DEPTH = 3
)
(
  input clk,
  input reset,

  input  [      1:0] op,
  input  [WIDTH-1:0] data,
  output [WIDTH-1:0] tos,

  output reg [1:0] status = `EMPTY,
  output reg [1:0] error  = `NONE
);

  localparam MAX_STACK = (1 << DEPTH+1) - 1;

  reg [WIDTH-1:0] stack [0:MAX_STACK-1];
  reg [  DEPTH:0] index = 0;

  assign tos = stack[index-1];


  always @* begin
    if(index == MAX_STACK)
      status <= `FULL;
    else if(index == 0)
      status <= `EMPTY;
    else
      status <= `NONE;
  end

  always @(posedge clk) begin
    error <= `NONE;

    if (reset)
      index <= 0;

    else
      case(op)
        `PUSH:
        begin

          if (index == MAX_STACK)
            error <= `OVERFLOW;


          else begin
            stack[index] <= data;

            index <= index + 1;
          end
        end

        `POP:
        begin
          if (index-data <= 0)
            error <= `UNDERFLOW;

          else
            index <= index - (1+data);
        end

        `REPLACE:
        begin
          if (index == 0)
            error <= `UNDERFLOW;

          else
            stack[index-1] <= data;
        end
      endcase
  end

endmodule
module stack
#(
  parameter WIDTH = 8,
  parameter DEPTH = 3
)
(
  input clk,
  input reset,

  input  [      1:0] op,
  input  [WIDTH-1:0] data,
  output [WIDTH-1:0] tos,

  output reg [1:0] status = `EMPTY,
  output reg [1:0] error  = `NONE
);


  localparam MAX_STACK = (1 << DEPTH+1) - 1;

  reg [WIDTH-1:0] stack [0:MAX_STACK-1];
  reg [  DEPTH:0] index = 0;

  assign tos = stack[index-1];


  always @* begin
    if(index == MAX_STACK)
      status <= `FULL;
    else if(index == 0)
      status <= `EMPTY;
    else
      status <= `NONE;
  end

  always @(posedge clk) begin
    error <= `NONE;

    if (reset)
      index <= 0;

    else
      case(op)
        `PUSH:
        begin

          if (index == MAX_STACK)
            error <= `OVERFLOW;


          else begin
            stack[index] <= data;

            index <= index + 1;
          end
        end

        `POP:
        begin
          if (index-data <= 0)
            error <= `UNDERFLOW;

          else
            index <= index - (1+data);
        end

        `REPLACE:
        begin
          if (index == 0)
            error <= `UNDERFLOW;

          else
            stack[index-1] <= data;
        end
      endcase
  end

endmodule