data/full_repos/permissive/183580645/docs/MU500-manual/MU500-RXSET01/2_サンプル回路/FPGA-CPU/FPGA_counter/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-CPU/FPGA_counter/watch_body.v:208: 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                ... 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-CPU/FPGA_counter/watch_body.v:302: 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 2 warning(s)\n'
module watch_body (

  	CLK,
  	RSTN,
  	RST_PULS,
	INC_PULS,
	DEC_PULS,


  	SEG_A_VAL,
	SEG_B_VAL,
	SEG_C_VAL,
	SEG_D_VAL
);


input  CLK;
input  RSTN;
input  RST_PULS;
input  INC_PULS;
input  DEC_PULS;


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


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  [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
			COUNT_A <= 4'd0;
		end
		else if( RST_PULS == 1'b1 )begin
  			COUNT_A <= 4'd0;
		end

		else if( INC_PULS == 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( DEC_PULS == 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
 



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

		else if( INC_PULS == 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




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

		else if( DEC_PULS == 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	




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

		else 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




	always@( posedge CLK or negedge RSTN) begin
  		if( !RSTN )begin
			CARRY_B <= 1'b0;
		end
		else if( RST_PULS == 1'b1 )begin
			CARRY_B <= 1'b0;
		end
		else 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




	always@( posedge CLK or negedge RSTN) begin
  		if( !RSTN )begin
			DOWN_B <= 1'b0;
		end
		else if( RST_PULS == 1'b1 )begin
			DOWN_B <= 1'b0;
		end
		
		else 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




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

		else 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




	always@( posedge CLK or negedge RSTN) begin
  		if( !RSTN )begin
			CARRY_C <= 1'b0;
		end
		else if( RST_PULS == 1'b1 )begin
			CARRY_C <= 1'b0;
		end
		
		else 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




	always@( posedge CLK or negedge RSTN) begin
  		if( !RSTN )begin
			DOWN_C <= 1'b0;
		end
		else if( RST_PULS == 1'b1 )begin
			DOWN_C <= 1'b0;
		end	
		else 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
		



	always@( posedge CLK or negedge RSTN) begin
 		if( !RSTN )begin
			COUNT_D <= 4'd0;
		end
		else if( RST_PULS == 1'b1 )begin
			COUNT_D <= 4'd0;
		end
		
		else 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




	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( RST_PULS == 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( RST_PULS == 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( RST_PULS == 1'b1)begin
			COUNT_C_1D <= 4'd0;
		end
		else begin
			COUNT_C_1D <= COUNT_C;
		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,
  	RST_PULS,
	INC_PULS,
	DEC_PULS,


  	SEG_A_VAL,
	SEG_B_VAL,
	SEG_C_VAL,
	SEG_D_VAL
);



input  CLK;
input  RSTN;
input  RST_PULS;
input  INC_PULS;
input  DEC_PULS;


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


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  [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
			COUNT_A <= 4'd0;
		end
		else if( RST_PULS == 1'b1 )begin
  			COUNT_A <= 4'd0;
		end

		else if( INC_PULS == 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( DEC_PULS == 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
 



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

		else if( INC_PULS == 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




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

		else if( DEC_PULS == 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	




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

		else 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




	always@( posedge CLK or negedge RSTN) begin
  		if( !RSTN )begin
			CARRY_B <= 1'b0;
		end
		else if( RST_PULS == 1'b1 )begin
			CARRY_B <= 1'b0;
		end
		else 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




	always@( posedge CLK or negedge RSTN) begin
  		if( !RSTN )begin
			DOWN_B <= 1'b0;
		end
		else if( RST_PULS == 1'b1 )begin
			DOWN_B <= 1'b0;
		end
		
		else 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




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

		else 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




	always@( posedge CLK or negedge RSTN) begin
  		if( !RSTN )begin
			CARRY_C <= 1'b0;
		end
		else if( RST_PULS == 1'b1 )begin
			CARRY_C <= 1'b0;
		end
		
		else 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




	always@( posedge CLK or negedge RSTN) begin
  		if( !RSTN )begin
			DOWN_C <= 1'b0;
		end
		else if( RST_PULS == 1'b1 )begin
			DOWN_C <= 1'b0;
		end	
		else 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
		



	always@( posedge CLK or negedge RSTN) begin
 		if( !RSTN )begin
			COUNT_D <= 4'd0;
		end
		else if( RST_PULS == 1'b1 )begin
			COUNT_D <= 4'd0;
		end
		
		else 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




	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( RST_PULS == 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( RST_PULS == 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( RST_PULS == 1'b1)begin
			COUNT_C_1D <= 4'd0;
		end
		else begin
			COUNT_C_1D <= COUNT_C;
		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