data/full_repos/permissive/176628218/store_module.v
'utf-8' codec can't decode byte 0xbb in position 953: invalid start byte
data/verilator_xmls/7706616b-db00-4492-aa70-df36959c1334.xml
module Store_FSM(
    input clk_dvid,
    input reset,
    input cancel,
    input ten_yuan,
    input one_yuan,
	 input two_yuan,
	 input five_yuan,
    input sel_p0,
    input sel_p1,
	 input sel_p2,
    input sel_p3,
    input [31:0]delay,
    output reg [2:0]status,
    output reg [7:0]current_money,
    output reg [3:0]price,
    output reg display_hello,
	 output reg display_price
    );
    

    reg [31:0]time_count;
    

    reg cancel_pressed,  clear_flag, one_pressed,two_pressed,five_pressed, ten_pressed;    
    reg sel0_pressed, sel1_pressed,sel2_pressed,sel3_pressed;
    initial begin
        status = 3'b000;
        current_money = 0;
        price = 0;
        time_count = 0;
        cancel_pressed = 0; 
        sel0_pressed = 0;
        sel1_pressed = 0;
		  sel2_pressed = 0;
        sel3_pressed = 0;
        clear_flag = 0;
        one_pressed = 0;
		  two_pressed = 0;
		  five_pressed = 0;
        ten_pressed = 0;
        display_hello = 1;
		  display_price = 0;
    end
    

    always@ (posedge one_yuan or posedge clear_flag) begin
        if (clear_flag == 1) begin
            one_pressed = 0;
        end 
        else begin
            one_pressed = 1;
        end
    end 

    always@ (posedge two_yuan or posedge clear_flag) begin
        if (clear_flag == 1) begin
            two_pressed = 0;
        end
        else begin
            two_pressed = 1;
        end
    end	 

    always@ (posedge five_yuan or posedge clear_flag) begin
        if (clear_flag == 1) begin
            five_pressed = 0;
        end
        else begin
            five_pressed = 1;
        end
    end

    always@ (posedge ten_yuan or posedge clear_flag) begin
        if (clear_flag == 1) begin
            ten_pressed = 0;
        end
        else begin
            ten_pressed = 1;
        end
    end
    

    always@ (posedge cancel or posedge clear_flag) begin
        if (clear_flag == 1) begin
            cancel_pressed = 0;
        end
        else if (status != 3'b001) begin
            cancel_pressed = 1;
        end
    end
    

    always@ (posedge sel_p0 or posedge clear_flag) begin
        if (clear_flag == 1) begin
            sel0_pressed = 0;
        end
        else begin
            sel0_pressed = 1;
        end
    end
    

    always@ (posedge sel_p1 or posedge clear_flag) begin
        if (clear_flag == 1) begin
            sel1_pressed = 0;
        end
        else begin
            sel1_pressed = 1;
        end
    end
    

    always@ (posedge sel_p2 or posedge clear_flag) begin
        if (clear_flag == 1) begin
            sel2_pressed = 0;
        end
        else begin
            sel2_pressed = 1;
        end
    end
	 

    always@ (posedge sel_p3 or posedge clear_flag) begin
        if (clear_flag == 1) begin
            sel3_pressed = 0;
        end
        else  begin
            sel3_pressed = 1;
        end
    end
    

    always@ (posedge clk_dvid) begin
        if (reset) begin

            status = 3'b001;
            display_hello = 1;
            current_money = 0;
        end
        
        if (status == 3'b001 || status == 3'b000) begin

            display_hello = 1;
        end
        else begin
            display_hello = 0;
        end
         
        if (clear_flag == 1) begin
                clear_flag = 0;
        end
        


        if (cancel_pressed == 1) begin
                status = 3'b110;
                time_count = 0; 
                clear_flag = 1;
        end
        

        if (sel0_pressed == 1) begin
            if(current_money > 1)
            begin
                clear_flag = 1;
                price = 1;
                time_count = 0;
                status = 3'b101;
                current_money = current_money - 1;
            end
            else begin
				clear_flag = 1;
            time_count = 0;
            status = 3'b010;
				display_price = 1;
            end
        end
        

        if (sel1_pressed == 1) begin
            if(current_money > 2)
            begin
                clear_flag = 1;
                price = 2;
                time_count = 0;
                status = 3'b101;
                current_money = current_money - 2;
            end
            else begin
				clear_flag = 1;
            time_count = 0;
            status = 3'b010;
				display_price = 1;
            end
        end
        

        if (sel2_pressed == 1) begin
            if(current_money > 3)
            begin
                clear_flag = 1;
                price = 3;
                time_count = 0;
                status = 3'b101;
                current_money = current_money - 3;
            end
            else begin
				clear_flag = 1;
            time_count = 0;
            status = 3'b010;
				display_price = 1;
            end
        end
        

        if (sel3_pressed == 1) begin
            if(current_money > 5)
            begin
                clear_flag = 1;
                price = 5;
                time_count = 0;
                status = 3'b101;
                current_money = current_money - 5;
            end
            else begin
				clear_flag = 1;
            time_count = 0;
            status = 3'b010;
				display_price = 1;
            end
        end
        

        if (one_pressed == 1) begin
                clear_flag = 1;
                current_money = current_money + 1;
                status = 3'b100;
					 time_count = 0;
					 display_price = 0;
        end

        if (two_pressed == 1) begin
                clear_flag = 1;
                current_money = current_money + 2;
                status = 3'b100;
					 time_count = 0;
					 display_price = 0;
        end

        if (five_pressed == 1) begin
                clear_flag = 1;
                current_money = current_money + 5;
                status = 3'b100;
					 time_count = 0;
					 display_price = 0;
        end

        if (ten_pressed == 1) begin
                clear_flag = 1;
                current_money = current_money + 10;
                status = 3'b100;
					 time_count = 0;
					 display_price = 0;
        end
        

        time_count = time_count + 1;
        if (time_count == delay) begin

            if (status == 3'b101) begin

                status = 3'b011;
                time_count = 0;
                price = 0;
					 display_price = 0;
            end
            else if (status == 3'b110) begin

                status = 3'b001;
                current_money = 0;
                price = 0;
					 display_price = 0;

            end
            else if (status == 3'b010) begin

                status = 3'b100;
					 time_count = 0;
					 display_price = 0;
            end
				else if (status == 3'b011) begin

                status = 3'b100;
					 time_count = 0;
					 display_price = 0;
            end
				else if (status == 3'b100) begin

                status = 3'b011;
					 time_count = 0;
					 display_price = 1;
				end
        end        
    end
    
    
endmodule
module Store_FSM(
    input clk_dvid,
    input reset,
    input cancel,
    input ten_yuan,
    input one_yuan,
	 input two_yuan,
	 input five_yuan,
    input sel_p0,
    input sel_p1,
	 input sel_p2,
    input sel_p3,
    input [31:0]delay,
    output reg [2:0]status,
    output reg [7:0]current_money,
    output reg [3:0]price,
    output reg display_hello,
	 output reg display_price
    );

    

    reg [31:0]time_count;
    

    reg cancel_pressed,  clear_flag, one_pressed,two_pressed,five_pressed, ten_pressed;    
    reg sel0_pressed, sel1_pressed,sel2_pressed,sel3_pressed;
    initial begin
        status = 3'b000;
        current_money = 0;
        price = 0;
        time_count = 0;
        cancel_pressed = 0; 
        sel0_pressed = 0;
        sel1_pressed = 0;
		  sel2_pressed = 0;
        sel3_pressed = 0;
        clear_flag = 0;
        one_pressed = 0;
		  two_pressed = 0;
		  five_pressed = 0;
        ten_pressed = 0;
        display_hello = 1;
		  display_price = 0;
    end
    

    always@ (posedge one_yuan or posedge clear_flag) begin
        if (clear_flag == 1) begin
            one_pressed = 0;
        end 
        else begin
            one_pressed = 1;
        end
    end 

    always@ (posedge two_yuan or posedge clear_flag) begin
        if (clear_flag == 1) begin
            two_pressed = 0;
        end
        else begin
            two_pressed = 1;
        end
    end	 

    always@ (posedge five_yuan or posedge clear_flag) begin
        if (clear_flag == 1) begin
            five_pressed = 0;
        end
        else begin
            five_pressed = 1;
        end
    end

    always@ (posedge ten_yuan or posedge clear_flag) begin
        if (clear_flag == 1) begin
            ten_pressed = 0;
        end
        else begin
            ten_pressed = 1;
        end
    end
    

    always@ (posedge cancel or posedge clear_flag) begin
        if (clear_flag == 1) begin
            cancel_pressed = 0;
        end
        else if (status != 3'b001) begin
            cancel_pressed = 1;
        end
    end
    

    always@ (posedge sel_p0 or posedge clear_flag) begin
        if (clear_flag == 1) begin
            sel0_pressed = 0;
        end
        else begin
            sel0_pressed = 1;
        end
    end
    

    always@ (posedge sel_p1 or posedge clear_flag) begin
        if (clear_flag == 1) begin
            sel1_pressed = 0;
        end
        else begin
            sel1_pressed = 1;
        end
    end
    

    always@ (posedge sel_p2 or posedge clear_flag) begin
        if (clear_flag == 1) begin
            sel2_pressed = 0;
        end
        else begin
            sel2_pressed = 1;
        end
    end
	 

    always@ (posedge sel_p3 or posedge clear_flag) begin
        if (clear_flag == 1) begin
            sel3_pressed = 0;
        end
        else  begin
            sel3_pressed = 1;
        end
    end
    

    always@ (posedge clk_dvid) begin
        if (reset) begin

            status = 3'b001;
            display_hello = 1;
            current_money = 0;
        end
        
        if (status == 3'b001 || status == 3'b000) begin

            display_hello = 1;
        end
        else begin
            display_hello = 0;
        end
         
        if (clear_flag == 1) begin
                clear_flag = 0;
        end
        


        if (cancel_pressed == 1) begin
                status = 3'b110;
                time_count = 0; 
                clear_flag = 1;
        end
        

        if (sel0_pressed == 1) begin
            if(current_money > 1)
            begin
                clear_flag = 1;
                price = 1;
                time_count = 0;
                status = 3'b101;
                current_money = current_money - 1;
            end
            else begin
				clear_flag = 1;
            time_count = 0;
            status = 3'b010;
				display_price = 1;
            end
        end
        

        if (sel1_pressed == 1) begin
            if(current_money > 2)
            begin
                clear_flag = 1;
                price = 2;
                time_count = 0;
                status = 3'b101;
                current_money = current_money - 2;
            end
            else begin
				clear_flag = 1;
            time_count = 0;
            status = 3'b010;
				display_price = 1;
            end
        end
        

        if (sel2_pressed == 1) begin
            if(current_money > 3)
            begin
                clear_flag = 1;
                price = 3;
                time_count = 0;
                status = 3'b101;
                current_money = current_money - 3;
            end
            else begin
				clear_flag = 1;
            time_count = 0;
            status = 3'b010;
				display_price = 1;
            end
        end
        

        if (sel3_pressed == 1) begin
            if(current_money > 5)
            begin
                clear_flag = 1;
                price = 5;
                time_count = 0;
                status = 3'b101;
                current_money = current_money - 5;
            end
            else begin
				clear_flag = 1;
            time_count = 0;
            status = 3'b010;
				display_price = 1;
            end
        end
        

        if (one_pressed == 1) begin
                clear_flag = 1;
                current_money = current_money + 1;
                status = 3'b100;
					 time_count = 0;
					 display_price = 0;
        end

        if (two_pressed == 1) begin
                clear_flag = 1;
                current_money = current_money + 2;
                status = 3'b100;
					 time_count = 0;
					 display_price = 0;
        end

        if (five_pressed == 1) begin
                clear_flag = 1;
                current_money = current_money + 5;
                status = 3'b100;
					 time_count = 0;
					 display_price = 0;
        end

        if (ten_pressed == 1) begin
                clear_flag = 1;
                current_money = current_money + 10;
                status = 3'b100;
					 time_count = 0;
					 display_price = 0;
        end
        

        time_count = time_count + 1;
        if (time_count == delay) begin

            if (status == 3'b101) begin

                status = 3'b011;
                time_count = 0;
                price = 0;
					 display_price = 0;
            end
            else if (status == 3'b110) begin

                status = 3'b001;
                current_money = 0;
                price = 0;
					 display_price = 0;

            end
            else if (status == 3'b010) begin

                status = 3'b100;
					 time_count = 0;
					 display_price = 0;
            end
				else if (status == 3'b011) begin

                status = 3'b100;
					 time_count = 0;
					 display_price = 0;
            end
				else if (status == 3'b100) begin

                status = 3'b011;
					 time_count = 0;
					 display_price = 1;
				end
        end        
    end
    
    
endmodule