data/full_repos/permissive/124999927/arith/multiply_accumulate.v
1: b'%Warning-PINMISSING: data/full_repos/permissive/124999927/arith/multiply_accumulate.v:44: Cell has missing pin: \'reset\'\n  ) u0(\n    ^~\n                     ... Use "/* verilator lint_off PINMISSING */" and lint_on around source to disable this message.\n%Warning-PINMISSING: data/full_repos/permissive/124999927/arith/multiply_accumulate.v:44: Cell has missing pin: \'data\'\n  ) u0(\n    ^~\n%Warning-PINMISSING: data/full_repos/permissive/124999927/arith/multiply_accumulate.v:44: Cell has missing pin: \'multi\'\n  ) u0(\n    ^~\n%Warning-PINMISSING: data/full_repos/permissive/124999927/arith/multiply_accumulate.v:44: Cell has missing pin: \'result\'\n  ) u0(\n    ^~\n%Warning-PINMISSING: data/full_repos/permissive/124999927/arith/multiply_accumulate.v:44: Cell has missing pin: \'overflow\'\n  ) u0(\n    ^~\n%Error: data/full_repos/permissive/124999927/arith/multiply_accumulate.v:48: Pin not found: \'opp_a\'\n    .opp_a(data),\n     ^~~~~\n%Error: data/full_repos/permissive/124999927/arith/multiply_accumulate.v:49: Pin not found: \'opp_b\'\n    .opp_b(multi),\n     ^~~~~\n%Error: data/full_repos/permissive/124999927/arith/multiply_accumulate.v:51: Pin not found: \'out\'\n    .out(product)\n     ^~~\n%Error: data/full_repos/permissive/124999927/arith/multiply_accumulate.v:43: Parameter pin not found: \'OPP_W\'\n                                                                           : ... Suggested alternative: \'I_OPP_W\'\n    .OPP_W(I_OPP_W)\n     ^~~~~\n%Error: Exiting due to 4 error(s), 5 warning(s)\n'
module multiply_accumulate(
  clk,
  aresetn,

  reset,

  data,
  multi,

  result,
  overflow
);
  parameter I_OPP_W = 4;
  parameter O_OPP_W = 2 * I_OPP_W;

  input clk;
  input aresetn;

  input reset;

  input [I_OPP_W - 1:0] data;
  input [I_OPP_W - 1:0] multi;

  output reg [O_OPP_W - 1:0] result;
  output reg overflow;

  wire [2 * I_OPP_W - 1:0] product;

  always@(posedge clk, negedge aresetn) begin
    if(aresetn == 0) begin
      result <= 0;
      overflow <= 0;
    end else if(reset == 1) begin
      result <= 0;
      overflow <= 0;
    end else begin
      result <= result + product;
      overflow <= result[O_OPP_W - 1] ^ product[2 * I_OPP_W - 1];
    end
  end

  multiply_accumulate#(
    .OPP_W(I_OPP_W)
  ) u0(
    .clk(clk),
    .aresetn(aresetn),

    .opp_a(data),
    .opp_b(multi),

    .out(product)
  );

endmodule
module multiply_accumulate(
  clk,
  aresetn,

  reset,

  data,
  multi,

  result,
  overflow
);

  parameter I_OPP_W = 4;
  parameter O_OPP_W = 2 * I_OPP_W;

  input clk;
  input aresetn;

  input reset;

  input [I_OPP_W - 1:0] data;
  input [I_OPP_W - 1:0] multi;

  output reg [O_OPP_W - 1:0] result;
  output reg overflow;

  wire [2 * I_OPP_W - 1:0] product;

  always@(posedge clk, negedge aresetn) begin
    if(aresetn == 0) begin
      result <= 0;
      overflow <= 0;
    end else if(reset == 1) begin
      result <= 0;
      overflow <= 0;
    end else begin
      result <= result + product;
      overflow <= result[O_OPP_W - 1] ^ product[2 * I_OPP_W - 1];
    end
  end

  multiply_accumulate#(
    .OPP_W(I_OPP_W)
  ) u0(
    .clk(clk),
    .aresetn(aresetn),

    .opp_a(data),
    .opp_b(multi),

    .out(product)
  );

endmodule