data/full_repos/permissive/48004801/ServoCommander.srcs/sources_1/new/SerialServo.v
1: b"%Error: data/full_repos/permissive/48004801/ServoCommander.srcs/sources_1/new/SerialServo.v:60: Cannot find file containing module: 'ExtToIntSync'\nExtToIntSync U0(\n^~~~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/48004801/ServoCommander.srcs/sources_1/new,data/full_repos/permissive/48004801/ExtToIntSync\n             data/full_repos/permissive/48004801/ServoCommander.srcs/sources_1/new,data/full_repos/permissive/48004801/ExtToIntSync.v\n             data/full_repos/permissive/48004801/ServoCommander.srcs/sources_1/new,data/full_repos/permissive/48004801/ExtToIntSync.sv\n             ExtToIntSync\n             ExtToIntSync.v\n             ExtToIntSync.sv\n             obj_dir/ExtToIntSync\n             obj_dir/ExtToIntSync.v\n             obj_dir/ExtToIntSync.sv\n%Error: data/full_repos/permissive/48004801/ServoCommander.srcs/sources_1/new/SerialServo.v:67: Cannot find file containing module: 'ExtToIntSync'\nExtToIntSync U1(\n^~~~~~~~~~~~\n%Error: data/full_repos/permissive/48004801/ServoCommander.srcs/sources_1/new/SerialServo.v:74: Cannot find file containing module: 'AngleToPWM'\nAngleToPWM U2 (\n^~~~~~~~~~\n%Error: Exiting due to 3 error(s)\n"
module SerialServo(
	input wire clk100MHz,
	input wire clk1MHz,
	input wire rst,
	input wire ext_clk,
	input wire ext_flush,
	input wire serial,
	input wire [CHANNEL_WIDTH-1:0] channel,
	output reg pwm
);

parameter POSITION_WIDTH = 11;
parameter CHANNEL_WIDTH = 5;
parameter BUFFER_LENGTH = 16;

reg [BUFFER_LENGTH-1:0] buffer;
reg [CHANNEL_WIDTH-1:0] channel_select;
reg [POSITION_WIDTH-1:0] position;

reg [CHANNEL_WIDTH-1:0] ser_channel;
reg [POSITION_WIDTH-1:0] ser_pos;

wire clk;
wire flush;

ExtToIntSync U0(
	.clk(clk100MHz),
	.rst(rst),
	.ext_signal(ext_clk),
	.int_signal(clk)
);

ExtToIntSync U1(
	.clk(clk100MHz),
	.rst(rst),
	.ext_signal(ext_flush),
	.int_signal(flush)
);

AngleToPWM U2 (
	.pos(position),
	.clk1MHz(clk1MHz),
	.rst(rst),
	.pwm(empty)
);

integer ptr;

always @(posedge clk or posedge rst) begin
	if(rst) begin
		position = 0;
        buffer = 0;
        ptr = 0;
	end
	else if(!flush) begin
		if(ptr < 15) begin
			buffer[(BUFFER_LENGTH-1)-ptr] = serial;
			ptr = ptr + 1;
		end
		else begin

			channel_select = buffer[BUFFER_LENGTH-1:BUFFER_LENGTH-5]; 

			position = buffer[BUFFER_LENGTH-6:0]; 



			ser_pos = position;
			pwm = ext_clk;

			ser_channel = channel_select;

			buffer = 0;
			ptr = 0;
		end
	end
	else begin
        position = 0;
        buffer = 0;
        ptr = 0;
	end
end

endmodule
module SerialServo(
	input wire clk100MHz,
	input wire clk1MHz,
	input wire rst,
	input wire ext_clk,
	input wire ext_flush,
	input wire serial,
	input wire [CHANNEL_WIDTH-1:0] channel,
	output reg pwm
);


parameter POSITION_WIDTH = 11;
parameter CHANNEL_WIDTH = 5;
parameter BUFFER_LENGTH = 16;

reg [BUFFER_LENGTH-1:0] buffer;
reg [CHANNEL_WIDTH-1:0] channel_select;
reg [POSITION_WIDTH-1:0] position;

reg [CHANNEL_WIDTH-1:0] ser_channel;
reg [POSITION_WIDTH-1:0] ser_pos;

wire clk;
wire flush;

ExtToIntSync U0(
	.clk(clk100MHz),
	.rst(rst),
	.ext_signal(ext_clk),
	.int_signal(clk)
);

ExtToIntSync U1(
	.clk(clk100MHz),
	.rst(rst),
	.ext_signal(ext_flush),
	.int_signal(flush)
);

AngleToPWM U2 (
	.pos(position),
	.clk1MHz(clk1MHz),
	.rst(rst),
	.pwm(empty)
);

integer ptr;

always @(posedge clk or posedge rst) begin
	if(rst) begin
		position = 0;
        buffer = 0;
        ptr = 0;
	end
	else if(!flush) begin
		if(ptr < 15) begin
			buffer[(BUFFER_LENGTH-1)-ptr] = serial;
			ptr = ptr + 1;
		end
		else begin

			channel_select = buffer[BUFFER_LENGTH-1:BUFFER_LENGTH-5]; 

			position = buffer[BUFFER_LENGTH-6:0]; 



			ser_pos = position;
			pwm = ext_clk;

			ser_channel = channel_select;

			buffer = 0;
			ptr = 0;
		end
	end
	else begin
        position = 0;
        buffer = 0;
        ptr = 0;
	end
end

endmodule