data/full_repos/permissive/183345139/common/hba_arbiter.v
data/verilator_xmls/5fd989f4-d0d9-4ae6-8f4b-b463d073b57d.xml
module hba_arbiter
(
    input wire hba_clk,
    input wire hba_reset,

    input wire hba_select,
    input wire [3:0] hba_mrequest,
    output reg [3:0] hba_mgrant
);

always @ (posedge hba_clk)
begin
    if (hba_reset) begin
        hba_mgrant <= 0;
    end else begin

        if (hba_select | (|hba_mgrant) ) begin

            hba_mgrant <= 0;
        end else begin


            if (hba_mrequest[0]) begin
                hba_mgrant[0] <= 1;
            end else if (hba_mrequest[1]) begin
                hba_mgrant[1] <= 1;
            end else if (hba_mrequest[2]) begin
                hba_mgrant[2] <= 1;
            end else if (hba_mrequest[3]) begin
                hba_mgrant[3] <= 1;
            end
        end
    end
end

endmodule
module hba_arbiter
(
    input wire hba_clk,
    input wire hba_reset,

    input wire hba_select,
    input wire [3:0] hba_mrequest,
    output reg [3:0] hba_mgrant
);


always @ (posedge hba_clk)
begin
    if (hba_reset) begin
        hba_mgrant <= 0;
    end else begin

        if (hba_select | (|hba_mgrant) ) begin

            hba_mgrant <= 0;
        end else begin


            if (hba_mrequest[0]) begin
                hba_mgrant[0] <= 1;
            end else if (hba_mrequest[1]) begin
                hba_mgrant[1] <= 1;
            end else if (hba_mrequest[2]) begin
                hba_mgrant[2] <= 1;
            end else if (hba_mrequest[3]) begin
                hba_mgrant[3] <= 1;
            end
        end
    end
end

endmodule