data/full_repos/permissive/17590431/rtl/gost89_cfb.v
1: b'%Warning-MULTITOP: data/full_repos/permissive/17590431/rtl/gost89_cfb.v:43: Multiple top level modules\n                                                                          : ... Suggest see manual; fix the duplicates, or use --top-module to select top.\n                   ... Use "/* verilator lint_off MULTITOP */" and lint_on around source to disable this message.\n                                                                          : ... Top module \'gost89_cfb\'\nmodule gost89_cfb(\n       ^~~~~~~~~~\n                                                                          : ... Top module \'gost89_cfb_encrypt\'\nmodule gost89_cfb_encrypt(\n       ^~~~~~~~~~~~~~~~~~\n                                                                          : ... Top module \'gost89_cfb_decrypt\'\nmodule gost89_cfb_decrypt(\n       ^~~~~~~~~~~~~~~~~~\n%Warning-IMPLICIT: data/full_repos/permissive/17590431/rtl/gost89_cfb.v:99: Signal definition not found, creating implicitly: \'reset_ecb\'\n  assign reset_ecb = load_ecb;\n         ^~~~~~~~~\n%Warning-IMPLICIT: data/full_repos/permissive/17590431/rtl/gost89_cfb.v:59: Signal definition not found, creating implicitly: \'reset_ecb\'\n  assign reset_ecb = load_ecb;\n         ^~~~~~~~~\n%Error: data/full_repos/permissive/17590431/rtl/gost89_cfb.v:101: Cannot find file containing module: \'gost89_ecb_encrypt\'\n  gost89_ecb_encrypt\n  ^~~~~~~~~~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/17590431/rtl,data/full_repos/permissive/17590431/gost89_ecb_encrypt\n             data/full_repos/permissive/17590431/rtl,data/full_repos/permissive/17590431/gost89_ecb_encrypt.v\n             data/full_repos/permissive/17590431/rtl,data/full_repos/permissive/17590431/gost89_ecb_encrypt.sv\n             gost89_ecb_encrypt\n             gost89_ecb_encrypt.v\n             gost89_ecb_encrypt.sv\n             obj_dir/gost89_ecb_encrypt\n             obj_dir/gost89_ecb_encrypt.v\n             obj_dir/gost89_ecb_encrypt.sv\n%Error: data/full_repos/permissive/17590431/rtl/gost89_cfb.v:61: Cannot find file containing module: \'gost89_ecb_encrypt\'\n  gost89_ecb_encrypt\n  ^~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/17590431/rtl/gost89_cfb.v:20: Cannot find file containing module: \'gost89_ecb_encrypt\'\n  gost89_ecb_encrypt\n  ^~~~~~~~~~~~~~~~~~\n%Error: Exiting due to 3 error(s), 3 warning(s)\n'
module gost89_cfb(
  input              clk,
  input              reset,
  input              mode,
  input              load_data,
  input      [511:0] sbox,
  input      [255:0] key,
  input      [63:0]  in,
  output reg [63:0]  out,
  output reg         busy
);
  reg  [63:0] gamma;
  reg  [63:0] in_value;
  wire [63:0] out_ecb;
  wire        reset_ecb, load_ecb, busy_ecb;

  assign load_ecb = !reset && load_data;
  assign reset_ecb = load_ecb;

  gost89_ecb_encrypt
    ecb_encrypt(clk, reset_ecb, load_ecb, sbox, key, gamma, out_ecb, busy_ecb);

  always @(posedge clk) begin
    if (reset && !load_data) begin
      gamma <= in;
      busy <= 0;
    end

    if (!reset & load_data) begin
      in_value <= in;
      busy <= 1;
    end

    if (!reset && !load_data && !busy_ecb && busy) begin
      if (mode) gamma <= in_value;
      else      gamma <= out_ecb ^ in_value;
      out   <= out_ecb ^ in_value;
      busy  <= 0;
    end
  end
endmodule
module gost89_cfb(
  input              clk,
  input              reset,
  input              mode,
  input              load_data,
  input      [511:0] sbox,
  input      [255:0] key,
  input      [63:0]  in,
  output reg [63:0]  out,
  output reg         busy
);

  reg  [63:0] gamma;
  reg  [63:0] in_value;
  wire [63:0] out_ecb;
  wire        reset_ecb, load_ecb, busy_ecb;

  assign load_ecb = !reset && load_data;
  assign reset_ecb = load_ecb;

  gost89_ecb_encrypt
    ecb_encrypt(clk, reset_ecb, load_ecb, sbox, key, gamma, out_ecb, busy_ecb);

  always @(posedge clk) begin
    if (reset && !load_data) begin
      gamma <= in;
      busy <= 0;
    end

    if (!reset & load_data) begin
      in_value <= in;
      busy <= 1;
    end

    if (!reset && !load_data && !busy_ecb && busy) begin
      if (mode) gamma <= in_value;
      else      gamma <= out_ecb ^ in_value;
      out   <= out_ecb ^ in_value;
      busy  <= 0;
    end
  end
endmodule