data/full_repos/permissive/147265957/src/sellerctrl.v
None: at end of input
data/verilator_xmls/0c5ba0ff-1ea5-482f-88c3-b0e6b2cbab10.xml
module sellerctrl(
    rst, clk, start, cancel, rmb10, rmb1, sel25, sel5, runled, occupyled, drinkled,
    returnled, subsig, hellomux, submux, money, accurst, acculock
);
    input rst;
    input clk;
    input start;
    input cancel;
    input sel25;
    input sel5;
    input rmb10;
    input rmb1;
    input [7:0] money;
    output reg runled;
    output reg occupyled;
    output reg drinkled;
    output reg returnled;
    output reg subsig;
    output reg hellomux;
    output reg submux;
    output reg accurst;
    output reg acculock;
    reg [2:0] currstat, nxstat;
    reg [31:0] cnt;
    reg lastrmb1;
    initial lastrmb1 = 0;
    initial currstat = 0;
    initial nxstat = 0;
    initial cnt = 0;

    always @(currstat, rmb10, rmb1, start, cancel, sel25, sel5, money) begin
        case(currstat)
            0: begin
                accurst = 1;
                runled = 1;
                occupyled = 0;
                drinkled = 0;
                returnled = 0;
                subsig = 0;
                hellomux = 0;
                submux = 0;
                acculock = 0;

                if(start) nxstat = 1;
                else nxstat = 0;
            end
            1: begin
                accurst = 0;
                runled = 1;
                occupyled = 1;
                drinkled = 0;
                returnled = 0;
                subsig = 0;
                hellomux = 1;
                submux = 0;
                acculock = 0;
                if(rmb1) nxstat = 2;
                else if(rmb10) nxstat = 4;
                else if(cancel) nxstat = 7;
                else nxstat = 1;
            end
            2: begin
                accurst = 0;
                runled = 1;
                occupyled = 1;
                drinkled = 0;
                returnled = 0;
                subsig = 0;
                hellomux = 1;
                acculock = 0;
                submux = 0;
                if(money >= 6) nxstat = 3;
                else if(rmb10) nxstat = 3;
                else if(cancel) nxstat = 7;
                else nxstat = 2;
            end
            3: begin
                accurst = 0;
                runled = 1;
                occupyled = 1;
                drinkled = 0;
                returnled = 0;
                subsig = 0;
                hellomux = 1;
                acculock = 0;
                submux = 0;
                if(sel25) nxstat = 5;
                else if(cancel) nxstat = 7;
                else nxstat = 3;
            end
            4: begin
                accurst = 0;
                runled = 1;
                occupyled = 1;
                drinkled = 0;
                returnled = 0;
                subsig = 0;
                acculock = 0;
                hellomux = 1;
                submux = 0;
                if(sel25) nxstat = 5;
                else if(sel5) nxstat = 6;
                else if(cancel) nxstat = 7;
                else nxstat = 4;
            end
            5: begin
                accurst = 0;
                runled = 1;
                occupyled = 1;
                drinkled = 1;
                returnled = 1;
                acculock = 1;
                subsig = 0;
                hellomux = 1;
                submux = 1;
                nxstat = 5;
            end
            6: begin
                accurst = 0;
                runled = 1;
                occupyled = 1;
                drinkled = 1;
                returnled = 1;
                acculock = 1;
                subsig = 1;
                hellomux = 1;
                submux = 1;
                nxstat = 6;
            end
            7: begin
                accurst = 0;
                runled = 1;
                occupyled = 1;
                drinkled = 0;
                acculock = 1;
                returnled = 1;
                subsig = 0;
                hellomux = 1;
                submux = 0;
                nxstat = 7;
            end
        endcase
        lastrmb1 = rmb1;
    end
    always @(posedge clk) begin
        if (rst) currstat = 0;
        else begin
            if(currstat != 7 && nxstat == 7) cnt = 0;
            else if(currstat != 5 && nxstat == 5) cnt = 0;
            else if(currstat != 6 && nxstat == 6) cnt = 0;
            cnt = cnt + 1;
            currstat = nxstat;
            if(cnt >= 500) begin
                if(currstat == 5) currstat = 0;
                else if(currstat == 6) currstat = 0;
                else if(currstat == 7) currstat = 0;
            end
        end
    end

endmodule
module sellerctrl(
    rst, clk, start, cancel, rmb10, rmb1, sel25, sel5, runled, occupyled, drinkled,
    returnled, subsig, hellomux, submux, money, accurst, acculock
);

    input rst;
    input clk;
    input start;
    input cancel;
    input sel25;
    input sel5;
    input rmb10;
    input rmb1;
    input [7:0] money;
    output reg runled;
    output reg occupyled;
    output reg drinkled;
    output reg returnled;
    output reg subsig;
    output reg hellomux;
    output reg submux;
    output reg accurst;
    output reg acculock;
    reg [2:0] currstat, nxstat;
    reg [31:0] cnt;
    reg lastrmb1;
    initial lastrmb1 = 0;
    initial currstat = 0;
    initial nxstat = 0;
    initial cnt = 0;

    always @(currstat, rmb10, rmb1, start, cancel, sel25, sel5, money) begin
        case(currstat)
            0: begin
                accurst = 1;
                runled = 1;
                occupyled = 0;
                drinkled = 0;
                returnled = 0;
                subsig = 0;
                hellomux = 0;
                submux = 0;
                acculock = 0;

                if(start) nxstat = 1;
                else nxstat = 0;
            end
            1: begin
                accurst = 0;
                runled = 1;
                occupyled = 1;
                drinkled = 0;
                returnled = 0;
                subsig = 0;
                hellomux = 1;
                submux = 0;
                acculock = 0;
                if(rmb1) nxstat = 2;
                else if(rmb10) nxstat = 4;
                else if(cancel) nxstat = 7;
                else nxstat = 1;
            end
            2: begin
                accurst = 0;
                runled = 1;
                occupyled = 1;
                drinkled = 0;
                returnled = 0;
                subsig = 0;
                hellomux = 1;
                acculock = 0;
                submux = 0;
                if(money >= 6) nxstat = 3;
                else if(rmb10) nxstat = 3;
                else if(cancel) nxstat = 7;
                else nxstat = 2;
            end
            3: begin
                accurst = 0;
                runled = 1;
                occupyled = 1;
                drinkled = 0;
                returnled = 0;
                subsig = 0;
                hellomux = 1;
                acculock = 0;
                submux = 0;
                if(sel25) nxstat = 5;
                else if(cancel) nxstat = 7;
                else nxstat = 3;
            end
            4: begin
                accurst = 0;
                runled = 1;
                occupyled = 1;
                drinkled = 0;
                returnled = 0;
                subsig = 0;
                acculock = 0;
                hellomux = 1;
                submux = 0;
                if(sel25) nxstat = 5;
                else if(sel5) nxstat = 6;
                else if(cancel) nxstat = 7;
                else nxstat = 4;
            end
            5: begin
                accurst = 0;
                runled = 1;
                occupyled = 1;
                drinkled = 1;
                returnled = 1;
                acculock = 1;
                subsig = 0;
                hellomux = 1;
                submux = 1;
                nxstat = 5;
            end
            6: begin
                accurst = 0;
                runled = 1;
                occupyled = 1;
                drinkled = 1;
                returnled = 1;
                acculock = 1;
                subsig = 1;
                hellomux = 1;
                submux = 1;
                nxstat = 6;
            end
            7: begin
                accurst = 0;
                runled = 1;
                occupyled = 1;
                drinkled = 0;
                acculock = 1;
                returnled = 1;
                subsig = 0;
                hellomux = 1;
                submux = 0;
                nxstat = 7;
            end
        endcase
        lastrmb1 = rmb1;
    end
    always @(posedge clk) begin
        if (rst) currstat = 0;
        else begin
            if(currstat != 7 && nxstat == 7) cnt = 0;
            else if(currstat != 5 && nxstat == 5) cnt = 0;
            else if(currstat != 6 && nxstat == 6) cnt = 0;
            cnt = cnt + 1;
            currstat = nxstat;
            if(cnt >= 500) begin
                if(currstat == 5) currstat = 0;
                else if(currstat == 6) currstat = 0;
                else if(currstat == 7) currstat = 0;
            end
        end
    end

endmodule