data/full_repos/permissive/469509877/rtl/TopStateMachineLogic.v
data/verilator_xmls/a22b4ef1-6842-4d8d-9e63-dd38e13545f1.xml
module TopStateMachineLogic(
    input clk,
    input btnUDLR,
    input btnC,
    input WinDetect,
    input LossDetect,
    input [3:0] Q,
    
    output reset,
    output btnCenable,
    output btnUDLRenable,
    output TimerEnable,
    output flashSlug,
    output flashBorder,
    output [3:0] D
    );
    
    assign D[0] = (Q[0] & ~WinDetect & ~LossDetect & ~btnC & ~btnUDLR) | (Q[0] & ~WinDetect & ~LossDetect & btnC) | (Q[2] & btnC) |
                  (Q[3] &  btnC) | (Q[0] & ~WinDetect & LossDetect) | (Q[0] & WinDetect & LossDetect) | (Q[0] & WinDetect & ~LossDetect);
    assign D[1] = (Q[0] & ~WinDetect & ~LossDetect & ~btnC & btnUDLR) | (Q[1] & ~WinDetect & ~LossDetect);
    assign D[2] = (Q[1] & ~WinDetect & LossDetect) | (Q[2] & ~btnC);
    assign D[3] = (Q[1] & WinDetect & ~LossDetect) | (Q[3] & ~btnC);
    
    assign reset = Q[0];
    assign btnCenable = ~Q[1];
    assign btnUDLRenable = Q[0] | Q[1];
    assign TimerEnable = Q[1];
    assign flashSlug = Q[2];
    assign flashBorder = Q[3];
    
    
endmodule
module TopStateMachineLogic(
    input clk,
    input btnUDLR,
    input btnC,
    input WinDetect,
    input LossDetect,
    input [3:0] Q,
    
    output reset,
    output btnCenable,
    output btnUDLRenable,
    output TimerEnable,
    output flashSlug,
    output flashBorder,
    output [3:0] D
    );

    
    assign D[0] = (Q[0] & ~WinDetect & ~LossDetect & ~btnC & ~btnUDLR) | (Q[0] & ~WinDetect & ~LossDetect & btnC) | (Q[2] & btnC) |
                  (Q[3] &  btnC) | (Q[0] & ~WinDetect & LossDetect) | (Q[0] & WinDetect & LossDetect) | (Q[0] & WinDetect & ~LossDetect);
    assign D[1] = (Q[0] & ~WinDetect & ~LossDetect & ~btnC & btnUDLR) | (Q[1] & ~WinDetect & ~LossDetect);
    assign D[2] = (Q[1] & ~WinDetect & LossDetect) | (Q[2] & ~btnC);
    assign D[3] = (Q[1] & WinDetect & ~LossDetect) | (Q[3] & ~btnC);
    
    assign reset = Q[0];
    assign btnCenable = ~Q[1];
    assign btnUDLRenable = Q[0] | Q[1];
    assign TimerEnable = Q[1];
    assign flashSlug = Q[2];
    assign flashBorder = Q[3];
    
    
endmodule