data/full_repos/permissive/102955443/encode.v
1: b'%Warning-WIDTH: data/full_repos/permissive/102955443/encode.v:14: Operator SUB expects 7 bits on the LHS, but LHS\'s VARREF \'value\' generates 5 bits.\n                                                                : ... In instance encode.coutput\n   val = value - ring_position + rotor;\n               ^\n                ... Use "/* verilator lint_off WIDTH */" and lint_on around source to disable this message.\n%Warning-WIDTH: data/full_repos/permissive/102955443/encode.v:14: Operator SUB expects 7 bits on the RHS, but RHS\'s VARREF \'ring_position\' generates 5 bits.\n                                                                : ... In instance encode.coutput\n   val = value - ring_position + rotor;\n               ^\n%Warning-WIDTH: data/full_repos/permissive/102955443/encode.v:14: Operator ADD expects 7 bits on the RHS, but RHS\'s VARREF \'rotor\' generates 5 bits.\n                                                                : ... In instance encode.coutput\n   val = value - ring_position + rotor;\n                               ^\n%Warning-WIDTH: data/full_repos/permissive/102955443/encode.v:16: Operator ADD expects 7 bits on the LHS, but LHS\'s VARREF \'value\' generates 5 bits.\n                                                                : ... In instance encode.coutput\n   val = value + ring_position - rotor;\n               ^\n%Warning-WIDTH: data/full_repos/permissive/102955443/encode.v:16: Operator ADD expects 7 bits on the RHS, but RHS\'s VARREF \'ring_position\' generates 5 bits.\n                                                                : ... In instance encode.coutput\n   val = value + ring_position - rotor;\n               ^\n%Warning-WIDTH: data/full_repos/permissive/102955443/encode.v:16: Operator SUB expects 7 bits on the RHS, but RHS\'s VARREF \'rotor\' generates 5 bits.\n                                                                : ... In instance encode.coutput\n   val = value + ring_position - rotor;\n                               ^\n%Error: data/full_repos/permissive/102955443/encode.v:38: Cannot find file containing module: \'rotorEncode\'\n rotorEncode #(.REVERSE(REVERSE)) rotEncode(.code(calculated_input),.val(outval),.rotor_type(rotor_type));\n ^~~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/102955443,data/full_repos/permissive/102955443/rotorEncode\n             data/full_repos/permissive/102955443,data/full_repos/permissive/102955443/rotorEncode.v\n             data/full_repos/permissive/102955443,data/full_repos/permissive/102955443/rotorEncode.sv\n             rotorEncode\n             rotorEncode.v\n             rotorEncode.sv\n             obj_dir/rotorEncode\n             obj_dir/rotorEncode.v\n             obj_dir/rotorEncode.sv\n%Error: Exiting due to 1 error(s), 6 warning(s)\n'
module calculate_val #(
	parameter INPUT = 1
) (
	input [4:0] value,
	input [4:0] rotor,
	output reg [4:0] out,
	input [4:0] ring_position
);
	reg signed [6:0] val = 7'b0000000;

	always @* 
	begin		
		if (INPUT==1)
			val = value - ring_position + rotor;
		else
			val = value + ring_position - rotor;

		if (val < 0    ) val = val + 7'd26;
		if (val > 7'd25) val = val - 7'd26;
		out = val[4:0];
	end
endmodule
module calculate_val #(
	parameter INPUT = 1
) (
	input [4:0] value,
	input [4:0] rotor,
	output reg [4:0] out,
	input [4:0] ring_position
);

	reg signed [6:0] val = 7'b0000000;

	always @* 
	begin		
		if (INPUT==1)
			val = value - ring_position + rotor;
		else
			val = value + ring_position - rotor;

		if (val < 0    ) val = val + 7'd26;
		if (val > 7'd25) val = val - 7'd26;
		out = val[4:0];
	end
endmodule