data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v
 line:266: before: "signed"
1: b'%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:19: Cannot find include file: common_defines.v\n `include "common_defines.v" \n          ^~~~~~~~~~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source,data/full_repos/permissive/114714167/common_defines.v\n             data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source,data/full_repos/permissive/114714167/common_defines.v.v\n             data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source,data/full_repos/permissive/114714167/common_defines.v.sv\n             common_defines.v\n             common_defines.v.v\n             common_defines.v.sv\n             obj_dir/common_defines.v\n             obj_dir/common_defines.v.v\n             obj_dir/common_defines.v.sv\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:31: Define or directive not defined: \'`PID_RATE_BIT_WIDTH\'\n     output reg signed  [`PID_RATE_BIT_WIDTH-1:0]  rate_out,\n                         ^~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:32: Define or directive not defined: \'`DEBUG_WIRE_BIT_WIDTH\'\n     output wire    [`DEBUG_WIRE_BIT_WIDTH-1:0]DEBUG_WIRE,  \n                     ^~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:33: Define or directive not defined: \'`RATE_BIT_WIDTH\'\n     input  wire signed [`RATE_BIT_WIDTH-1:0]     angle_error,\n                         ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:34: Define or directive not defined: \'`RATE_BIT_WIDTH\'\n     input  wire signed [`RATE_BIT_WIDTH-1:0]     target_rotation,\n                         ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:35: Define or directive not defined: \'`IMU_VAL_BIT_WIDTH\'\n      input  wire signed [`IMU_VAL_BIT_WIDTH-1:0]   actual_rotation,\n                          ^~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:42: Define or directive not defined: \'`OPS_BIT_WIDTH\'\n reg signed [`OPS_BIT_WIDTH-1:0]\n             ^~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:66: Define or directive not defined: \'`DEBUG_WIRE_BIT_WIDTH\'\n assign DEBUG_WIRE = rotation_total[`DEBUG_WIRE_BIT_WIDTH-1:0];\n                                    ^~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:79: Define or directive not defined: \'`FALSE\'\n   pid_active   <= `FALSE;\n                   ^~~~~~\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:79: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n   pid_active   <= `FALSE;\n                         ^\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:80: Define or directive not defined: \'`FALSE\'\n   pid_complete  <= `FALSE;\n                    ^~~~~~\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:80: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n   pid_complete  <= `FALSE;\n                          ^\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:81: Define or directive not defined: \'`ALL_ZERO_2BYTE\'\n   rate_out   <= `ALL_ZERO_2BYTE;\n                 ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:81: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n   rate_out   <= `ALL_ZERO_2BYTE;\n                                ^\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:86: Define or directive not defined: \'`FALSE\'\n     pid_active    <= `FALSE;\n                      ^~~~~~\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:86: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n     pid_active    <= `FALSE;\n                            ^\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:87: Define or directive not defined: \'`TRUE\'\n     pid_complete   <= `TRUE;\n                       ^~~~~\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:87: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n     pid_complete   <= `TRUE;\n                            ^\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:90: Define or directive not defined: \'`TRUE\'\n     pid_active     <= `TRUE;\n                       ^~~~~\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:90: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n     pid_active     <= `TRUE;\n                            ^\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:91: Define or directive not defined: \'`FALSE\'\n     pid_complete    <= `FALSE;\n                        ^~~~~~\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:91: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n     pid_complete    <= `FALSE;\n                              ^\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:97: Define or directive not defined: \'`TRUE\'\n     pid_active     <= `TRUE;\n                       ^~~~~\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:97: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n     pid_active     <= `TRUE;\n                            ^\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:98: Define or directive not defined: \'`FALSE\'\n     pid_complete    <= `FALSE;\n                        ^~~~~~\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:98: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n     pid_complete    <= `FALSE;\n                              ^\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:103: Define or directive not defined: \'`TRUE\'\n     pid_active     <= `TRUE;\n                       ^~~~~\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:103: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n     pid_active     <= `TRUE;\n                            ^\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:104: Define or directive not defined: \'`FALSE\'\n     pid_complete    <= `FALSE;\n                        ^~~~~~\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:104: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n     pid_complete    <= `FALSE;\n                              ^\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:108: Define or directive not defined: \'`TRUE\'\n     pid_active     <= `TRUE;\n                       ^~~~~\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:108: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n     pid_active     <= `TRUE;\n                            ^\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:109: Define or directive not defined: \'`FALSE\'\n     pid_complete    <= `FALSE;\n                        ^~~~~~\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:109: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n     pid_complete    <= `FALSE;\n                              ^\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:113: Define or directive not defined: \'`TRUE\'\n     pid_active     <= `TRUE;\n                       ^~~~~\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:113: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n     pid_active     <= `TRUE;\n                            ^\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:114: Define or directive not defined: \'`TRUE\'\n     pid_complete    <= `TRUE;\n                        ^~~~~\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:114: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n     pid_complete    <= `TRUE;\n                             ^\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:123: Define or directive not defined: \'`FALSE\'\n     pid_active     <= `FALSE;\n                       ^~~~~~\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:123: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n     pid_active     <= `FALSE;\n                             ^\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:124: Define or directive not defined: \'`FALSE\'\n     pid_complete    <= `FALSE;\n                        ^~~~~~\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:124: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n     pid_complete    <= `FALSE;\n                              ^\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:125: Define or directive not defined: \'`ALL_ZERO_2BYTE\'\n     rate_out     <= `ALL_ZERO_2BYTE;\n                     ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:125: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n     rate_out     <= `ALL_ZERO_2BYTE;\n                                    ^\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:175: Define or directive not defined: \'`RATE_BIT_WIDTH\'\nfunction automatic signed [`RATE_BIT_WIDTH-1:0] scale_val;\n                           ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:176: Define or directive not defined: \'`RATE_BIT_WIDTH\'\n input reg signed [`RATE_BIT_WIDTH-1:0]  val;\n                   ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:177: Define or directive not defined: \'`OPS_BIT_WIDTH\'\n input reg signed [`OPS_BIT_WIDTH-1:0]    k_mult;\n                   ^~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:178: Define or directive not defined: \'`SHIFT_OP_BIT_WIDTH\'\n input reg signed [`SHIFT_OP_BIT_WIDTH-1:0] k_shift;\n                   ^~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/114714167/Source-Code/Drone2/impl1/source/pid.v:204: Define or directive not defined: \'`RATE_BIT_WIDTH\'\n   scale_val = $signed(scaled[`RATE_BIT_WIDTH-1:0]);\n                              ^~~~~~~~~~~~~~~\n%Error: Exiting due to 49 error(s)\n%Error: Exiting due to too many errors encountered; --error-limit=50\n'
function automatic signed [`RATE_BIT_WIDTH-1:0] scale_val;
	input reg signed [`RATE_BIT_WIDTH-1:0]		val;
	input reg signed [`OPS_BIT_WIDTH-1:0]	  	k_mult;
	input reg signed [`SHIFT_OP_BIT_WIDTH-1:0]	k_shift;

	reg signed [31:0]
		val_32,
		scaled;

	localparam
		SHIFT_BACK 	= 7'd16,
		ZERO_PAD	= 16'd0;

	localparam signed [31:0]
		OVERFLOW_PROTECTION_MIN = 32'shFFFF8000,
		OVERFLOW_PROTECTION_MAX = 32'sh00007FFF;

	begin

		val_32 = $signed({val, ZERO_PAD}) >>> SHIFT_BACK;

		scaled = (val_32 * k_mult) >>> k_shift;


		if (scaled <= OVERFLOW_PROTECTION_MIN)
			scale_val = OVERFLOW_PROTECTION_MIN;
		else if (scaled >= OVERFLOW_PROTECTION_MAX)
			scale_val = OVERFLOW_PROTECTION_MAX;
		else
			scale_val = $signed(scaled[`RATE_BIT_WIDTH-1:0]);
	end
endfunction
function automatic signed [`RATE_BIT_WIDTH-1:0] scale_val;

	input reg signed [`RATE_BIT_WIDTH-1:0]		val;
	input reg signed [`OPS_BIT_WIDTH-1:0]	  	k_mult;
	input reg signed [`SHIFT_OP_BIT_WIDTH-1:0]	k_shift;

	reg signed [31:0]
		val_32,
		scaled;

	localparam
		SHIFT_BACK 	= 7'd16,
		ZERO_PAD	= 16'd0;

	localparam signed [31:0]
		OVERFLOW_PROTECTION_MIN = 32'shFFFF8000,
		OVERFLOW_PROTECTION_MAX = 32'sh00007FFF;

	begin

		val_32 = $signed({val, ZERO_PAD}) >>> SHIFT_BACK;

		scaled = (val_32 * k_mult) >>> k_shift;


		if (scaled <= OVERFLOW_PROTECTION_MIN)
			scale_val = OVERFLOW_PROTECTION_MIN;
		else if (scaled >= OVERFLOW_PROTECTION_MAX)
			scale_val = OVERFLOW_PROTECTION_MAX;
		else
			scale_val = $signed(scaled[`RATE_BIT_WIDTH-1:0]);
	end
endfunction