data/full_repos/permissive/48004801/ServoCommander.srcs/sources_1/new/Components.v
1: b'%Warning-MULTITOP: data/full_repos/permissive/48004801/ServoCommander.srcs/sources_1/new/Components.v:75: Multiple top level modules\n                                                                                                        : ... Suggest see manual; fix the duplicates, or use --top-module to select top.\n                   ... Use "/* verilator lint_off MULTITOP */" and lint_on around source to disable this message.\n                                                                                                        : ... Top module \'PositionMux\'\nmodule PositionMux(\n       ^~~~~~~~~~~\n                                                                                                        : ... Top module \'SweepPosition\'\nmodule SweepPosition(\n       ^~~~~~~~~~~~~\n                                                                                                        : ... Top module \'AngleToPWM\'\nmodule AngleToPWM(\n       ^~~~~~~~~~\n%Error: data/full_repos/permissive/48004801/ServoCommander.srcs/sources_1/new/Components.v:57: Cannot find file containing module: \'Segment\'\nSegment U0 (\n^~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/48004801/ServoCommander.srcs/sources_1/new,data/full_repos/permissive/48004801/Segment\n             data/full_repos/permissive/48004801/ServoCommander.srcs/sources_1/new,data/full_repos/permissive/48004801/Segment.v\n             data/full_repos/permissive/48004801/ServoCommander.srcs/sources_1/new,data/full_repos/permissive/48004801/Segment.sv\n             Segment\n             Segment.v\n             Segment.sv\n             obj_dir/Segment\n             obj_dir/Segment.v\n             obj_dir/Segment.sv\n%Warning-WIDTH: data/full_repos/permissive/48004801/ServoCommander.srcs/sources_1/new/Components.v:66: Operator SHIFTL expects 11 bits on the LHS, but LHS\'s VARREF \'pin_pos\' generates 10 bits.\n                                                                                                     : ... In instance PositionMux\n  1: out_pos = (pin_pos << 1) | 1\'b1;\n                        ^~\n%Warning-WIDTH: data/full_repos/permissive/48004801/ServoCommander.srcs/sources_1/new/Components.v:66: Operator OR expects 11 bits on the RHS, but RHS\'s CONST \'1\'h1\' generates 1 bits.\n                                                                                                     : ... In instance PositionMux\n  1: out_pos = (pin_pos << 1) | 1\'b1;\n                              ^\n%Warning-WIDTH: data/full_repos/permissive/48004801/ServoCommander.srcs/sources_1/new/Components.v:146: Operator ASSIGN expects 2 bits on the Assign RHS, but Assign RHS\'s CONST \'3\'h0\' generates 3 bits.\n                                                                                                      : ... In instance AngleToPWM\n  state = 3\'b0;\n        ^\n%Warning-WIDTH: data/full_repos/permissive/48004801/ServoCommander.srcs/sources_1/new/Components.v:161: Operator ASSIGN expects 2 bits on the Assign RHS, but Assign RHS\'s CONST \'3\'h1\' generates 3 bits.\n                                                                                                      : ... In instance AngleToPWM\n    state = 3\'h1;\n          ^\n%Warning-WIDTH: data/full_repos/permissive/48004801/ServoCommander.srcs/sources_1/new/Components.v:168: Operator ASSIGN expects 2 bits on the Assign RHS, but Assign RHS\'s CONST \'3\'h2\' generates 3 bits.\n                                                                                                      : ... In instance AngleToPWM\n     state = 3\'h2;\n           ^\n%Warning-WIDTH: data/full_repos/permissive/48004801/ServoCommander.srcs/sources_1/new/Components.v:176: Operator ASSIGN expects 2 bits on the Assign RHS, but Assign RHS\'s CONST \'3\'h0\' generates 3 bits.\n                                                                                                      : ... In instance AngleToPWM\n     state = 3\'h0;\n           ^\n%Warning-WIDTH: data/full_repos/permissive/48004801/ServoCommander.srcs/sources_1/new/Components.v:150: Operator GT expects 32 or 12 bits on the LHS, but LHS\'s VARREF \'pos\' generates 11 bits.\n                                                                                                      : ... In instance AngleToPWM\n else if(pos > 2500 || pos < 0) begin\n             ^\n%Warning-WIDTH: data/full_repos/permissive/48004801/ServoCommander.srcs/sources_1/new/Components.v:100: Operator ASSIGN expects 11 bits on the Assign RHS, but Assign RHS\'s CONST \'10\'h0\' generates 10 bits.\n                                                                                                      : ... In instance SweepPosition\n  pos = 10\'d0;\n      ^\n%Warning-WIDTH: data/full_repos/permissive/48004801/ServoCommander.srcs/sources_1/new/Components.v:104: Operator SHIFTL expects 11 bits on the LHS, but LHS\'s VARREF \'speed\' generates 3 bits.\n                                                                                                      : ... In instance SweepPosition\n  pos = pos + (speed << 1);\n                     ^~\n%Warning-WIDTH: data/full_repos/permissive/48004801/ServoCommander.srcs/sources_1/new/Components.v:111: Operator SHIFTL expects 11 bits on the LHS, but LHS\'s VARREF \'speed\' generates 3 bits.\n                                                                                                      : ... In instance SweepPosition\n  pos = pos - (speed << 1);\n                     ^~\n%Error: Exiting due to 1 error(s), 11 warning(s)\n'
module PositionMux(
	input wire [1:0] ctrl,
	input wire [RC_SIGNAL_WIDTH-1:0] sweep_pos,
	input wire [PIN_POS_WIDTH-1:0] pin_pos,
	input wire [RC_SIGNAL_WIDTH-1:0] ser_pos,
	output reg [RC_SIGNAL_WIDTH-1:0] out_pos
);


parameter RC_SIGNAL_WIDTH = 11;
parameter PIN_POS_WIDTH = 10;
parameter BCD_WIDTH = 4;

parameter POSITION_FILE_WIDTH = 32;
parameter POSITION_WIDTH = 11;
parameter PWMS = 4;

wire valid;
wire [RC_SIGNAL_WIDTH-1:0] segment_pos;

Segment U0 (
    .in(pin_pos),
    .out(segment_pos),
    .valid(valid)
);

always @(*) begin
	case(ctrl)
		0: out_pos = sweep_pos;
		1: out_pos = (pin_pos << 1) | 1'b1;
		2: out_pos = segment_pos;
		3: out_pos = ser_pos;
		default: out_pos = sweep_pos;
	endcase
end

endmodule
module PositionMux(
	input wire [1:0] ctrl,
	input wire [RC_SIGNAL_WIDTH-1:0] sweep_pos,
	input wire [PIN_POS_WIDTH-1:0] pin_pos,
	input wire [RC_SIGNAL_WIDTH-1:0] ser_pos,
	output reg [RC_SIGNAL_WIDTH-1:0] out_pos
);



parameter RC_SIGNAL_WIDTH = 11;
parameter PIN_POS_WIDTH = 10;
parameter BCD_WIDTH = 4;

parameter POSITION_FILE_WIDTH = 32;
parameter POSITION_WIDTH = 11;
parameter PWMS = 4;

wire valid;
wire [RC_SIGNAL_WIDTH-1:0] segment_pos;

Segment U0 (
    .in(pin_pos),
    .out(segment_pos),
    .valid(valid)
);

always @(*) begin
	case(ctrl)
		0: out_pos = sweep_pos;
		1: out_pos = (pin_pos << 1) | 1'b1;
		2: out_pos = segment_pos;
		3: out_pos = ser_pos;
		default: out_pos = sweep_pos;
	endcase
end

endmodule