data/full_repos/permissive/446128190/rtl/Bitlet_FindMax.v
1: b'%Error: data/full_repos/permissive/446128190/rtl/Bitlet_FindMax.v:12: Cannot find include file: Bitlet_Defs.vh\n`include "Bitlet_Defs.vh" \n         ^~~~~~~~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/446128190/rtl,data/full_repos/permissive/446128190/Bitlet_Defs.vh\n             data/full_repos/permissive/446128190/rtl,data/full_repos/permissive/446128190/Bitlet_Defs.vh.v\n             data/full_repos/permissive/446128190/rtl,data/full_repos/permissive/446128190/Bitlet_Defs.vh.sv\n             Bitlet_Defs.vh\n             Bitlet_Defs.vh.v\n             Bitlet_Defs.vh.sv\n             obj_dir/Bitlet_Defs.vh\n             obj_dir/Bitlet_Defs.vh.v\n             obj_dir/Bitlet_Defs.vh.sv\n%Error: data/full_repos/permissive/446128190/rtl/Bitlet_FindMax.v:24: Define or directive not defined: \'`Wid_exs\'\n    input       [N_input*`Wid_exs-1:0]  Esum_vec,\n                         ^~~~~~~~\n%Error: data/full_repos/permissive/446128190/rtl/Bitlet_FindMax.v:26: Define or directive not defined: \'`Wid_exs\'\n    output reg  [`Wid_exs-1:0]          Emax\n                 ^~~~~~~~\n%Error: data/full_repos/permissive/446128190/rtl/Bitlet_FindMax.v:29: Define or directive not defined: \'`Wid_exs\'\nwire    [`Wid_exs-1:0]          pmax;\n         ^~~~~~~~\n%Error: data/full_repos/permissive/446128190/rtl/Bitlet_FindMax.v:63: Define or directive not defined: \'`Wid_exs\'\nBitlet_MaxTree #(.N(N_input), .W(`Wid_exs)) UMAXTREE\n                                 ^~~~~~~~\n%Error: Exiting due to 5 error(s)\n'
module Bitlet_FindMax
#(
    parameter   N_input = 16,
    parameter   P_input = 4
)
(
    input                               clk,
    input                               rst_n,
    input                               flush,
    input                               Esum_vld,
    input       [N_input*`Wid_exs-1:0]  Esum_vec,
    output reg                          Emax_vld,
    output reg  [`Wid_exs-1:0]          Emax
);

wire    [`Wid_exs-1:0]          pmax;
wire                            pmax_vld;
reg     [$clog2(P_input)-1:0]   max_cnt;

always @(posedge clk or negedge rst_n)
begin
    if (!rst_n)
        max_cnt <= 'b0;
    else if (flush)
        max_cnt <= 'b0;
    else if (pmax_vld)
        max_cnt <= max_cnt+1;
end

always @(posedge clk or negedge rst_n)
begin
    if (!rst_n)
        Emax    <= 'b0;
    else if (flush)
        Emax    <= 'b0;
    else if (pmax_vld&&(pmax>Emax))
        Emax    <= pmax;
end

always @(posedge clk or negedge rst_n)
begin
    if (!rst_n)
        Emax_vld    <= 1'b0;
    else if (pmax_vld&&(max_cnt==(P_input-1)))
        Emax_vld    <= 1'b1;
    else if (Emax_vld)
        Emax_vld    <= 1'b0;
end

Bitlet_MaxTree #(.N(N_input), .W(`Wid_exs)) UMAXTREE
(
    .clk(clk),
    .rst_n(rst_n),
    .DI_vld(Esum_vld),
    .DI_vec(Esum_vec),
    .MAX_vld(pmax_vld),
    .MAX(pmax)
);

endmodule
module Bitlet_FindMax
#(
    parameter   N_input = 16,
    parameter   P_input = 4
)
(
    input                               clk,
    input                               rst_n,
    input                               flush,
    input                               Esum_vld,
    input       [N_input*`Wid_exs-1:0]  Esum_vec,
    output reg                          Emax_vld,
    output reg  [`Wid_exs-1:0]          Emax
);


wire    [`Wid_exs-1:0]          pmax;
wire                            pmax_vld;
reg     [$clog2(P_input)-1:0]   max_cnt;

always @(posedge clk or negedge rst_n)
begin
    if (!rst_n)
        max_cnt <= 'b0;
    else if (flush)
        max_cnt <= 'b0;
    else if (pmax_vld)
        max_cnt <= max_cnt+1;
end

always @(posedge clk or negedge rst_n)
begin
    if (!rst_n)
        Emax    <= 'b0;
    else if (flush)
        Emax    <= 'b0;
    else if (pmax_vld&&(pmax>Emax))
        Emax    <= pmax;
end

always @(posedge clk or negedge rst_n)
begin
    if (!rst_n)
        Emax_vld    <= 1'b0;
    else if (pmax_vld&&(max_cnt==(P_input-1)))
        Emax_vld    <= 1'b1;
    else if (Emax_vld)
        Emax_vld    <= 1'b0;
end

Bitlet_MaxTree #(.N(N_input), .W(`Wid_exs)) UMAXTREE
(
    .clk(clk),
    .rst_n(rst_n),
    .DI_vld(Esum_vld),
    .DI_vec(Esum_vec),
    .MAX_vld(pmax_vld),
    .MAX(pmax)
);

endmodule