data/full_repos/permissive/183580645/docs/MU500-manual/MU500-RXSET01/2_サンプル回路/FPGA/FPGA_stopwatch/watch_body.v
1: b'%Warning-WIDTH: data/full_repos/permissive/183580645/docs/MU500-manual/MU500-RXSET01/2_\xe3\x82\xb5\xe3\x83\xb3\xe3\x83\x97\xe3\x83\xab\xe5\x9b\x9e\xe8\xb7\xaf/FPGA/FPGA_stopwatch/watch_body.v:251: Operator ASSIGNDLY expects 4 bits on the Assign RHS, but Assign RHS\'s CONST \'1\'h0\' generates 1 bits.\n                                                                                                                                              : ... In instance watch_body\n      COUNT_B <= 1\'b0;\n              ^~\n                ... Use "/* verilator lint_off WIDTH */" and lint_on around source to disable this message.\n%Warning-WIDTH: data/full_repos/permissive/183580645/docs/MU500-manual/MU500-RXSET01/2_\xe3\x82\xb5\xe3\x83\xb3\xe3\x83\x97\xe3\x83\xab\xe5\x9b\x9e\xe8\xb7\xaf/FPGA/FPGA_stopwatch/watch_body.v:352: Operator ASSIGNDLY expects 4 bits on the Assign RHS, but Assign RHS\'s CONST \'1\'h0\' generates 1 bits.\n                                                                                                                                              : ... In instance watch_body\n   COUNT_C <= 1\'b0;\n           ^~\n%Warning-WIDTH: data/full_repos/permissive/183580645/docs/MU500-manual/MU500-RXSET01/2_\xe3\x82\xb5\xe3\x83\xb3\xe3\x83\x97\xe3\x83\xab\xe5\x9b\x9e\xe8\xb7\xaf/FPGA/FPGA_stopwatch/watch_body.v:386: Operator ASSIGNDLY expects 4 bits on the Assign RHS, but Assign RHS\'s CONST \'1\'h0\' generates 1 bits.\n                                                                                                                                              : ... In instance watch_body\n      COUNT_C <= 1\'b0;\n              ^~\n%Warning-WIDTH: data/full_repos/permissive/183580645/docs/MU500-manual/MU500-RXSET01/2_\xe3\x82\xb5\xe3\x83\xb3\xe3\x83\x97\xe3\x83\xab\xe5\x9b\x9e\xe8\xb7\xaf/FPGA/FPGA_stopwatch/watch_body.v:503: Operator LTE expects 4 bits on the RHS, but RHS\'s CONST \'1\'h0\' generates 1 bits.\n                                                                                                                                              : ... In instance watch_body\n    if( COUNT_D <= 1\'b0 )begin\n                ^~\n%Error: Exiting due to 4 warning(s)\n'
module watch_body (

	  		CLK,
	  		RSTN,
	  		PSW_SIG,
	  		SEC_SIG,


	  		SEG_A_VAL,
			SEG_B_VAL,
			SEG_C_VAL,
			SEG_D_VAL
	);


input  CLK;
input  RSTN;
input  [3:0] PSW_SIG;
input  SEC_SIG;


output [3:0] SEG_A_VAL,SEG_B_VAL,SEG_C_VAL,SEG_D_VAL;


reg  MOVE_FLG;

reg  PLUS_A, MINUS_A;
reg  [3:0] COUNT_A, COUNT_B, COUNT_C, COUNT_D;
reg  CARRY_A, CARRY_B, CARRY_C;
reg  DOWN_A,  DOWN_B,  DOWN_C;
reg  SEC_SIG_1D,SEC_SIG_2D,SEC_SIG_3D;

reg  [3:0] COUNT_A_1D, COUNT_A_2D,COUNT_A_3D;
reg  [3:0] COUNT_B_1D, COUNT_B_2D;
reg  [3:0] COUNT_C_1D;





	always@( posedge CLK or negedge RSTN) begin
		if( !RSTN ) begin
			MOVE_FLG <= 1'b0;
	  	end

	  	else if( PSW_SIG[0] == 1'b1) begin
	    	 MOVE_FLG <= ~MOVE_FLG;
	  	end
      	else if( PSW_SIG[1] == 1'b1 )begin
			MOVE_FLG <= 1'b0;
		end
	 	else begin
	    	 MOVE_FLG <= MOVE_FLG;
	  	end
	end




	always@( posedge CLK or negedge RSTN) begin
  		if( !RSTN )begin
			PLUS_A  <= 1'b0;
     		MINUS_A <= 1'b0;
		end

    	else if( PSW_SIG[2] == 1'b1 )begin
      		PLUS_A  <= 1'b1;
			MINUS_A <= 1'b0;
    	end
		else if( PSW_SIG[3] == 1'b1 )begin
      		PLUS_A  <= 1'b0;
			MINUS_A <= 1'b1;
		end
		else begin
			PLUS_A  <= 1'b0;
			MINUS_A <= 1'b0;
		end
	end
	



	always@( posedge CLK or negedge RSTN) begin
  		if( !RSTN )begin
			COUNT_A <= 4'd0;
		end
		else if( PSW_SIG[1] == 1'b1 )begin
  			COUNT_A <= 4'd0;
		end


		else if( MOVE_FLG == 1'b0 )begin
			if( PLUS_A == 1'b1 )begin
				if( COUNT_A >= 4'd9 )begin
					COUNT_A <= 4'd0;
				end
				else begin
					COUNT_A <= COUNT_A + 4'd1;
				end
			end
			else if( MINUS_A == 1'b1 )begin
				if( COUNT_A <= 4'd0 )begin
					COUNT_A <= 4'd9;
				end
				else begin
					COUNT_A <= COUNT_A - 4'd1;
				end
			end
			else begin
				COUNT_A <= COUNT_A;
			end
		end
		

		else begin
			if( SEC_SIG == 1'b1 )begin
				if( COUNT_A >= 4'd9 )begin
					COUNT_A <= 4'd0;
				end
				else begin
					COUNT_A <= COUNT_A + 4'd1;
				end
			end
			else begin
				COUNT_A <= COUNT_A;
			end
		end
	end




	always@( posedge CLK or negedge RSTN) begin
  		if( !RSTN )begin
			CARRY_A <= 1'b0;
		end
		else if( PSW_SIG[1] == 1'b1 )begin
  			CARRY_A <= 1'b0;
		end


		else if( MOVE_FLG == 1'b0 )begin
			if( PLUS_A == 1'b1 )begin
				if( COUNT_A >= 4'd9 )begin
					CARRY_A <= 1'b1;
				end
				else begin
					CARRY_A <= 1'b0;
				end
			end
			else begin
				CARRY_A <= 1'b0;
			end
		end


		else begin
			if( SEC_SIG == 1'b1 )begin
				if( COUNT_A >= 4'd9 )begin
					CARRY_A <= 1'b1;
				end
				else begin
					CARRY_A <= 1'b0;
				end
			end
			else begin
				CARRY_A <= 1'b0;
			end
		end
	end




	always@( posedge CLK or negedge RSTN) begin
  		if( !RSTN )begin
			DOWN_A <= 1'b0;
		end
		else if( PSW_SIG[1] == 1'b1 )begin
  			DOWN_A <= 1'b0;
		end


		else if( MOVE_FLG == 1'b0 )begin
			if( MINUS_A == 1'b1 )begin
				if( COUNT_A <= 4'd0 )begin
					DOWN_A <= 1'b1;
				end
				else begin
					DOWN_A <= 1'b0;
				end
			end
			else begin
				DOWN_A <= 1'b0;
			end
		end
		

		else begin
			DOWN_A <= 1'b0;
		end
	end




	always@( posedge CLK or negedge RSTN) begin
  		if( !RSTN )begin
			COUNT_B <= 4'd0;
		end
		else if( PSW_SIG[1] == 1'b1 )begin
			COUNT_B <= 4'd0;
		end


		else if( MOVE_FLG == 1'b0 )begin
			if( CARRY_A == 1'b1 )begin
				if( COUNT_B >= 4'd9 )begin
					COUNT_B <= 4'd0;
				end
				else begin
					COUNT_B <= COUNT_B + 4'd1;
				end
			end
			else if( DOWN_A == 1'b1 )begin
				if( COUNT_B <= 4'd0 )begin
					COUNT_B <= 4'd9;
				end
				else begin
					COUNT_B <= COUNT_B - 4'd1;
				end
			end
			else begin
				COUNT_B <= COUNT_B;
			end
		end
		

		else begin							
			if( SEC_SIG_1D == 1'b1 )begin
				if( CARRY_A == 1'b1 )begin
					if( COUNT_B >= 4'd9 )begin
						COUNT_B <= 1'b0;
					end
					else begin
						COUNT_B <= COUNT_B + 4'd1;
					end
				end
				else begin
					COUNT_B <= COUNT_B;
				end
			end
			else begin
				COUNT_B <= COUNT_B;
			end
		end
	end





	always@( posedge CLK or negedge RSTN) begin
  		if( !RSTN )begin
			CARRY_B <= 1'b0;
		end
		else if( PSW_SIG[1] == 1'b1 )begin
			CARRY_B <= 1'b0;
		end
		

		else if( MOVE_FLG == 1'b0 )begin
			if( CARRY_A == 1'b1)begin
				if( COUNT_B >= 4'd9 )begin
						CARRY_B <= 1'b1;
				end
				else begin
					CARRY_B <= 1'b0;
				end
			end
			else begin
				CARRY_B <= 1'b0;
			end
		end


		else begin
			if( SEC_SIG_1D == 1'b1 )begin
				if( CARRY_A == 1'b1 )begin
					if( COUNT_B >= 4'd9 )begin
						CARRY_B <= 1'b1;
					end
					else begin
						CARRY_B <= 1'b0;
					end
				end
				else begin
					CARRY_B <= 1'b0;
				end
			end
			else begin
				CARRY_B <= 1'b0;
			end
		end
	end




	always@( posedge CLK or negedge RSTN) begin
  		if( !RSTN )begin
			DOWN_B <= 1'b0;
		end
		else if( PSW_SIG[1] == 1'b1 )begin
			DOWN_B <= 1'b0;
		end
		

		else if( MOVE_FLG == 1'b0 )begin
			if( DOWN_A == 1'b1 )begin
				if( COUNT_B <= 4'd0 )begin
					DOWN_B <= 1'b1;
				end
				else begin
					DOWN_B <= 1'b0;
				end
			end
			else begin
				DOWN_B <= 1'b0;
			end
		end
		

		else begin
			DOWN_B <= 1'b0;
		end
	end




	always@( posedge CLK or negedge RSTN) begin
  		if( !RSTN )begin
			COUNT_C <= 1'b0;
		end
		else if( PSW_SIG[1] == 1'b1 )begin
			COUNT_C <= 4'd0;
		end


		else if( MOVE_FLG == 1'b0 )begin
			if( CARRY_B == 1'b1 )begin
				if( COUNT_C >= 4'd9 )begin
					COUNT_C <= 4'd0;
				end
				else begin
					COUNT_C <= COUNT_C + 4'd1;
				end
			end
			else if( DOWN_B == 1'b1 )begin
				if( COUNT_C <= 4'd0 )begin
					COUNT_C <= 4'd9;
				end
				else begin
					COUNT_C <= COUNT_C - 4'd1;
				end
			end
			else begin
				COUNT_C <= COUNT_C;
			end
		end
		

		else begin
			if( SEC_SIG_2D == 1'b1 )begin
				if( CARRY_B == 1'b1 )begin
					if( COUNT_C >= 4'd9 )begin
						COUNT_C <= 1'b0;
					end
					else begin
						COUNT_C <= COUNT_C + 4'd1;
					end
				end
				else begin
					COUNT_C <= COUNT_C;
				end
			end
			else begin
				COUNT_C <= COUNT_C;
			end
		end
	end




	always@( posedge CLK or negedge RSTN) begin
  		if( !RSTN )begin
			CARRY_C <= 1'b0;
		end
		else if( PSW_SIG[1] == 1'b1 )begin
			CARRY_C <= 1'b0;
		end
		

		else if( MOVE_FLG == 1'b0 )begin
			if( CARRY_B == 1'b1)begin
				if( COUNT_C >= 4'd9 )begin
						CARRY_C <= 1'b1;
				end
				else begin
					CARRY_C <= 1'b0;
				end
			end
			else begin
				CARRY_C <= 1'b0;
			end
		end
		

		else begin
			if( SEC_SIG_2D == 1'b1 )begin
				if( CARRY_B == 1'b1 )begin
					if( COUNT_C >= 4'd9 )begin
						CARRY_C <= 1'b1;
					end
					else begin
						CARRY_C <= 1'b0;
					end
				end
				else begin
					CARRY_C <= 1'b0;
				end
			end
			else begin
				CARRY_C <= 1'b0;
			end
		end
	end




	always@( posedge CLK or negedge RSTN) begin
  		if( !RSTN )begin
			DOWN_C <= 1'b0;
		end
		else if( PSW_SIG[1] == 1'b1 )begin
			DOWN_C <= 1'b0;
		end
		

		else if( MOVE_FLG == 1'b0 )begin
			if( DOWN_B == 1'b1 )begin
				if( COUNT_C <= 4'd0 )begin
					DOWN_C <= 1'b1;
				end
				else begin
					DOWN_C <= 1'b0;
				end
			end
			else begin
				DOWN_C <= 1'b0;
			end
		end
		

		else begin
			DOWN_C <= 1'b0;
		end
	end




	always@( posedge CLK or negedge RSTN) begin
 		if( !RSTN )begin
			COUNT_D <= 4'd0;
		end
		else if( PSW_SIG[1] == 1'b1 )begin
			COUNT_D <= 4'd0;
		end
		

		else if( MOVE_FLG == 1'b0 )begin
			if( CARRY_C == 1'b1 )begin
				if( COUNT_D >= 4'd9 )begin
					COUNT_D <= 4'd0;
				end
				else begin
					COUNT_D <= COUNT_D + 4'd1;
				end
			end
			else if( DOWN_C == 1'b1 )begin
				if( COUNT_D <= 1'b0 )begin
					COUNT_D <= 4'd9;
				end
				else begin
					COUNT_D <= COUNT_D - 4'd1;
				end
			end
			else begin
				COUNT_D <= COUNT_D;
			end
		end


		else begin
			if( SEC_SIG_3D == 1'b1 )begin
				if( CARRY_C == 1'b1 )begin
					if( COUNT_D >= 4'd9 )begin
						COUNT_D <= 4'd0;
					end
					else begin
						COUNT_D <= COUNT_D + 4'd1;
					end
				end
				else begin
					COUNT_D <= COUNT_D;
				end
			end
			else begin
				COUNT_D <= COUNT_D;
			end
		end
	end






	always@( posedge CLK or negedge RSTN) begin
  		if( !RSTN )begin
			COUNT_A_1D <= 4'd0;
			COUNT_A_2D <= 4'd0;
			COUNT_A_3D <= 4'd0;
		end
		else if( PSW_SIG[1] == 1'b1 )begin
			COUNT_A_1D <= 4'd0;
			COUNT_A_2D <= 4'd0;
			COUNT_A_3D <= 4'd0;
		end
		else begin
			COUNT_A_1D <= COUNT_A;
			COUNT_A_2D <= COUNT_A_1D;
			COUNT_A_3D <= COUNT_A_2D;
		end
	end




	always@( posedge CLK or negedge RSTN) begin
  		if( !RSTN )begin
			COUNT_B_1D <= 4'd0;
			COUNT_B_2D <= 4'd0;
		end
		else if( PSW_SIG[1] == 1'b1)begin
			COUNT_B_1D <= 4'd0;
			COUNT_B_2D <= 4'd0;
		end
		else begin
			COUNT_B_1D <= COUNT_B;
			COUNT_B_2D <= COUNT_B_1D;
		end
	end




	always@( posedge CLK or negedge RSTN) begin
  		if( !RSTN )begin
			COUNT_C_1D <= 4'd0;
		end
		else if( PSW_SIG[1] == 1'b1)begin
			COUNT_C_1D <= 4'd0;
		end
		else begin
			COUNT_C_1D <= COUNT_C;
		end
	end




	always@( posedge CLK or negedge RSTN) begin
  		if( !RSTN )begin
			SEC_SIG_1D <= 1'b0;
			SEC_SIG_2D <= 1'b0;
			SEC_SIG_3D <= 1'b0;
		end
		else if( PSW_SIG[1] == 1'b1)begin
			SEC_SIG_1D <= 1'b0;
			SEC_SIG_2D <= 1'b0;
			SEC_SIG_3D <= 1'b0;
		end
		else begin
			SEC_SIG_1D <= SEC_SIG;
			SEC_SIG_2D <= SEC_SIG_1D;
			SEC_SIG_3D <= SEC_SIG_2D;
		end
	end

assign SEG_D_VAL = COUNT_A_3D;
assign SEG_C_VAL = COUNT_B_2D;
assign SEG_B_VAL = COUNT_C_1D;
assign SEG_A_VAL = COUNT_D;

endmodule
module watch_body (

	  		CLK,
	  		RSTN,
	  		PSW_SIG,
	  		SEC_SIG,


	  		SEG_A_VAL,
			SEG_B_VAL,
			SEG_C_VAL,
			SEG_D_VAL
	);



input  CLK;
input  RSTN;
input  [3:0] PSW_SIG;
input  SEC_SIG;


output [3:0] SEG_A_VAL,SEG_B_VAL,SEG_C_VAL,SEG_D_VAL;


reg  MOVE_FLG;

reg  PLUS_A, MINUS_A;
reg  [3:0] COUNT_A, COUNT_B, COUNT_C, COUNT_D;
reg  CARRY_A, CARRY_B, CARRY_C;
reg  DOWN_A,  DOWN_B,  DOWN_C;
reg  SEC_SIG_1D,SEC_SIG_2D,SEC_SIG_3D;

reg  [3:0] COUNT_A_1D, COUNT_A_2D,COUNT_A_3D;
reg  [3:0] COUNT_B_1D, COUNT_B_2D;
reg  [3:0] COUNT_C_1D;





	always@( posedge CLK or negedge RSTN) begin
		if( !RSTN ) begin
			MOVE_FLG <= 1'b0;
	  	end

	  	else if( PSW_SIG[0] == 1'b1) begin
	    	 MOVE_FLG <= ~MOVE_FLG;
	  	end
      	else if( PSW_SIG[1] == 1'b1 )begin
			MOVE_FLG <= 1'b0;
		end
	 	else begin
	    	 MOVE_FLG <= MOVE_FLG;
	  	end
	end




	always@( posedge CLK or negedge RSTN) begin
  		if( !RSTN )begin
			PLUS_A  <= 1'b0;
     		MINUS_A <= 1'b0;
		end

    	else if( PSW_SIG[2] == 1'b1 )begin
      		PLUS_A  <= 1'b1;
			MINUS_A <= 1'b0;
    	end
		else if( PSW_SIG[3] == 1'b1 )begin
      		PLUS_A  <= 1'b0;
			MINUS_A <= 1'b1;
		end
		else begin
			PLUS_A  <= 1'b0;
			MINUS_A <= 1'b0;
		end
	end
	



	always@( posedge CLK or negedge RSTN) begin
  		if( !RSTN )begin
			COUNT_A <= 4'd0;
		end
		else if( PSW_SIG[1] == 1'b1 )begin
  			COUNT_A <= 4'd0;
		end


		else if( MOVE_FLG == 1'b0 )begin
			if( PLUS_A == 1'b1 )begin
				if( COUNT_A >= 4'd9 )begin
					COUNT_A <= 4'd0;
				end
				else begin
					COUNT_A <= COUNT_A + 4'd1;
				end
			end
			else if( MINUS_A == 1'b1 )begin
				if( COUNT_A <= 4'd0 )begin
					COUNT_A <= 4'd9;
				end
				else begin
					COUNT_A <= COUNT_A - 4'd1;
				end
			end
			else begin
				COUNT_A <= COUNT_A;
			end
		end
		

		else begin
			if( SEC_SIG == 1'b1 )begin
				if( COUNT_A >= 4'd9 )begin
					COUNT_A <= 4'd0;
				end
				else begin
					COUNT_A <= COUNT_A + 4'd1;
				end
			end
			else begin
				COUNT_A <= COUNT_A;
			end
		end
	end




	always@( posedge CLK or negedge RSTN) begin
  		if( !RSTN )begin
			CARRY_A <= 1'b0;
		end
		else if( PSW_SIG[1] == 1'b1 )begin
  			CARRY_A <= 1'b0;
		end


		else if( MOVE_FLG == 1'b0 )begin
			if( PLUS_A == 1'b1 )begin
				if( COUNT_A >= 4'd9 )begin
					CARRY_A <= 1'b1;
				end
				else begin
					CARRY_A <= 1'b0;
				end
			end
			else begin
				CARRY_A <= 1'b0;
			end
		end


		else begin
			if( SEC_SIG == 1'b1 )begin
				if( COUNT_A >= 4'd9 )begin
					CARRY_A <= 1'b1;
				end
				else begin
					CARRY_A <= 1'b0;
				end
			end
			else begin
				CARRY_A <= 1'b0;
			end
		end
	end




	always@( posedge CLK or negedge RSTN) begin
  		if( !RSTN )begin
			DOWN_A <= 1'b0;
		end
		else if( PSW_SIG[1] == 1'b1 )begin
  			DOWN_A <= 1'b0;
		end


		else if( MOVE_FLG == 1'b0 )begin
			if( MINUS_A == 1'b1 )begin
				if( COUNT_A <= 4'd0 )begin
					DOWN_A <= 1'b1;
				end
				else begin
					DOWN_A <= 1'b0;
				end
			end
			else begin
				DOWN_A <= 1'b0;
			end
		end
		

		else begin
			DOWN_A <= 1'b0;
		end
	end




	always@( posedge CLK or negedge RSTN) begin
  		if( !RSTN )begin
			COUNT_B <= 4'd0;
		end
		else if( PSW_SIG[1] == 1'b1 )begin
			COUNT_B <= 4'd0;
		end


		else if( MOVE_FLG == 1'b0 )begin
			if( CARRY_A == 1'b1 )begin
				if( COUNT_B >= 4'd9 )begin
					COUNT_B <= 4'd0;
				end
				else begin
					COUNT_B <= COUNT_B + 4'd1;
				end
			end
			else if( DOWN_A == 1'b1 )begin
				if( COUNT_B <= 4'd0 )begin
					COUNT_B <= 4'd9;
				end
				else begin
					COUNT_B <= COUNT_B - 4'd1;
				end
			end
			else begin
				COUNT_B <= COUNT_B;
			end
		end
		

		else begin							
			if( SEC_SIG_1D == 1'b1 )begin
				if( CARRY_A == 1'b1 )begin
					if( COUNT_B >= 4'd9 )begin
						COUNT_B <= 1'b0;
					end
					else begin
						COUNT_B <= COUNT_B + 4'd1;
					end
				end
				else begin
					COUNT_B <= COUNT_B;
				end
			end
			else begin
				COUNT_B <= COUNT_B;
			end
		end
	end





	always@( posedge CLK or negedge RSTN) begin
  		if( !RSTN )begin
			CARRY_B <= 1'b0;
		end
		else if( PSW_SIG[1] == 1'b1 )begin
			CARRY_B <= 1'b0;
		end
		

		else if( MOVE_FLG == 1'b0 )begin
			if( CARRY_A == 1'b1)begin
				if( COUNT_B >= 4'd9 )begin
						CARRY_B <= 1'b1;
				end
				else begin
					CARRY_B <= 1'b0;
				end
			end
			else begin
				CARRY_B <= 1'b0;
			end
		end


		else begin
			if( SEC_SIG_1D == 1'b1 )begin
				if( CARRY_A == 1'b1 )begin
					if( COUNT_B >= 4'd9 )begin
						CARRY_B <= 1'b1;
					end
					else begin
						CARRY_B <= 1'b0;
					end
				end
				else begin
					CARRY_B <= 1'b0;
				end
			end
			else begin
				CARRY_B <= 1'b0;
			end
		end
	end




	always@( posedge CLK or negedge RSTN) begin
  		if( !RSTN )begin
			DOWN_B <= 1'b0;
		end
		else if( PSW_SIG[1] == 1'b1 )begin
			DOWN_B <= 1'b0;
		end
		

		else if( MOVE_FLG == 1'b0 )begin
			if( DOWN_A == 1'b1 )begin
				if( COUNT_B <= 4'd0 )begin
					DOWN_B <= 1'b1;
				end
				else begin
					DOWN_B <= 1'b0;
				end
			end
			else begin
				DOWN_B <= 1'b0;
			end
		end
		

		else begin
			DOWN_B <= 1'b0;
		end
	end




	always@( posedge CLK or negedge RSTN) begin
  		if( !RSTN )begin
			COUNT_C <= 1'b0;
		end
		else if( PSW_SIG[1] == 1'b1 )begin
			COUNT_C <= 4'd0;
		end


		else if( MOVE_FLG == 1'b0 )begin
			if( CARRY_B == 1'b1 )begin
				if( COUNT_C >= 4'd9 )begin
					COUNT_C <= 4'd0;
				end
				else begin
					COUNT_C <= COUNT_C + 4'd1;
				end
			end
			else if( DOWN_B == 1'b1 )begin
				if( COUNT_C <= 4'd0 )begin
					COUNT_C <= 4'd9;
				end
				else begin
					COUNT_C <= COUNT_C - 4'd1;
				end
			end
			else begin
				COUNT_C <= COUNT_C;
			end
		end
		

		else begin
			if( SEC_SIG_2D == 1'b1 )begin
				if( CARRY_B == 1'b1 )begin
					if( COUNT_C >= 4'd9 )begin
						COUNT_C <= 1'b0;
					end
					else begin
						COUNT_C <= COUNT_C + 4'd1;
					end
				end
				else begin
					COUNT_C <= COUNT_C;
				end
			end
			else begin
				COUNT_C <= COUNT_C;
			end
		end
	end




	always@( posedge CLK or negedge RSTN) begin
  		if( !RSTN )begin
			CARRY_C <= 1'b0;
		end
		else if( PSW_SIG[1] == 1'b1 )begin
			CARRY_C <= 1'b0;
		end
		

		else if( MOVE_FLG == 1'b0 )begin
			if( CARRY_B == 1'b1)begin
				if( COUNT_C >= 4'd9 )begin
						CARRY_C <= 1'b1;
				end
				else begin
					CARRY_C <= 1'b0;
				end
			end
			else begin
				CARRY_C <= 1'b0;
			end
		end
		

		else begin
			if( SEC_SIG_2D == 1'b1 )begin
				if( CARRY_B == 1'b1 )begin
					if( COUNT_C >= 4'd9 )begin
						CARRY_C <= 1'b1;
					end
					else begin
						CARRY_C <= 1'b0;
					end
				end
				else begin
					CARRY_C <= 1'b0;
				end
			end
			else begin
				CARRY_C <= 1'b0;
			end
		end
	end




	always@( posedge CLK or negedge RSTN) begin
  		if( !RSTN )begin
			DOWN_C <= 1'b0;
		end
		else if( PSW_SIG[1] == 1'b1 )begin
			DOWN_C <= 1'b0;
		end
		

		else if( MOVE_FLG == 1'b0 )begin
			if( DOWN_B == 1'b1 )begin
				if( COUNT_C <= 4'd0 )begin
					DOWN_C <= 1'b1;
				end
				else begin
					DOWN_C <= 1'b0;
				end
			end
			else begin
				DOWN_C <= 1'b0;
			end
		end
		

		else begin
			DOWN_C <= 1'b0;
		end
	end




	always@( posedge CLK or negedge RSTN) begin
 		if( !RSTN )begin
			COUNT_D <= 4'd0;
		end
		else if( PSW_SIG[1] == 1'b1 )begin
			COUNT_D <= 4'd0;
		end
		

		else if( MOVE_FLG == 1'b0 )begin
			if( CARRY_C == 1'b1 )begin
				if( COUNT_D >= 4'd9 )begin
					COUNT_D <= 4'd0;
				end
				else begin
					COUNT_D <= COUNT_D + 4'd1;
				end
			end
			else if( DOWN_C == 1'b1 )begin
				if( COUNT_D <= 1'b0 )begin
					COUNT_D <= 4'd9;
				end
				else begin
					COUNT_D <= COUNT_D - 4'd1;
				end
			end
			else begin
				COUNT_D <= COUNT_D;
			end
		end


		else begin
			if( SEC_SIG_3D == 1'b1 )begin
				if( CARRY_C == 1'b1 )begin
					if( COUNT_D >= 4'd9 )begin
						COUNT_D <= 4'd0;
					end
					else begin
						COUNT_D <= COUNT_D + 4'd1;
					end
				end
				else begin
					COUNT_D <= COUNT_D;
				end
			end
			else begin
				COUNT_D <= COUNT_D;
			end
		end
	end






	always@( posedge CLK or negedge RSTN) begin
  		if( !RSTN )begin
			COUNT_A_1D <= 4'd0;
			COUNT_A_2D <= 4'd0;
			COUNT_A_3D <= 4'd0;
		end
		else if( PSW_SIG[1] == 1'b1 )begin
			COUNT_A_1D <= 4'd0;
			COUNT_A_2D <= 4'd0;
			COUNT_A_3D <= 4'd0;
		end
		else begin
			COUNT_A_1D <= COUNT_A;
			COUNT_A_2D <= COUNT_A_1D;
			COUNT_A_3D <= COUNT_A_2D;
		end
	end




	always@( posedge CLK or negedge RSTN) begin
  		if( !RSTN )begin
			COUNT_B_1D <= 4'd0;
			COUNT_B_2D <= 4'd0;
		end
		else if( PSW_SIG[1] == 1'b1)begin
			COUNT_B_1D <= 4'd0;
			COUNT_B_2D <= 4'd0;
		end
		else begin
			COUNT_B_1D <= COUNT_B;
			COUNT_B_2D <= COUNT_B_1D;
		end
	end




	always@( posedge CLK or negedge RSTN) begin
  		if( !RSTN )begin
			COUNT_C_1D <= 4'd0;
		end
		else if( PSW_SIG[1] == 1'b1)begin
			COUNT_C_1D <= 4'd0;
		end
		else begin
			COUNT_C_1D <= COUNT_C;
		end
	end




	always@( posedge CLK or negedge RSTN) begin
  		if( !RSTN )begin
			SEC_SIG_1D <= 1'b0;
			SEC_SIG_2D <= 1'b0;
			SEC_SIG_3D <= 1'b0;
		end
		else if( PSW_SIG[1] == 1'b1)begin
			SEC_SIG_1D <= 1'b0;
			SEC_SIG_2D <= 1'b0;
			SEC_SIG_3D <= 1'b0;
		end
		else begin
			SEC_SIG_1D <= SEC_SIG;
			SEC_SIG_2D <= SEC_SIG_1D;
			SEC_SIG_3D <= SEC_SIG_2D;
		end
	end

assign SEG_D_VAL = COUNT_A_3D;
assign SEG_C_VAL = COUNT_B_2D;
assign SEG_B_VAL = COUNT_C_1D;
assign SEG_A_VAL = COUNT_D;

endmodule