data/full_repos/permissive/162251494/GuitarHero.v
 line:149: before: "."
1: b'%Warning-WIDTH: data/full_repos/permissive/162251494/GuitarHero.v:187: Value too large for 6 bit number: 101000\n  else if(x_counter >= 6\'d101000 & y_counter < 7\'b1111000) begin\n                       ^~~~~~~~~\n                ... Use "/* verilator lint_off WIDTH */" and lint_on around source to disable this message.\n%Warning-WIDTH: data/full_repos/permissive/162251494/GuitarHero.v:453: Operator EQ expects 32 or 5 bits on the LHS, but LHS\'s VARREF \'state\' generates 4 bits.\n                                                                     : ... In instance GuitarHero.pFSM0\n  else if(state == 16) begin\n                ^~\n%Warning-WIDTH: data/full_repos/permissive/162251494/GuitarHero.v:278: Operator LTE expects 32 or 4 bits on the LHS, but LHS\'s VARREF \'counter\' generates 1 bits.\n                                                                     : ... In instance GuitarHero.gsm0\n  else if (counter <= 9 & ~loss) begin\n                   ^~\n%Warning-WIDTH: data/full_repos/permissive/162251494/GuitarHero.v:317: Bit extraction of var[9:0] requires 4 bit index, not 1 bits.\n                                                                     : ... In instance GuitarHero.gsm0\n   c1Draw <= {c1Curr[28:0], c1Pattern[counter]};\n                                     ^\n%Warning-WIDTH: data/full_repos/permissive/162251494/GuitarHero.v:318: Bit extraction of var[9:0] requires 4 bit index, not 1 bits.\n                                                                     : ... In instance GuitarHero.gsm0\n   c2Draw <= {c2Curr[28:0], c2Pattern[counter]};\n                                     ^\n%Warning-WIDTH: data/full_repos/permissive/162251494/GuitarHero.v:319: Bit extraction of var[9:0] requires 4 bit index, not 1 bits.\n                                                                     : ... In instance GuitarHero.gsm0\n   c3Draw <= {c3Curr[28:0], c3Pattern[counter]};\n                                     ^\n%Warning-WIDTH: data/full_repos/permissive/162251494/GuitarHero.v:320: Bit extraction of var[9:0] requires 4 bit index, not 1 bits.\n                                                                     : ... In instance GuitarHero.gsm0\n   c4Draw <= {c4Curr[28:0], c4Pattern[counter]};\n                                     ^\n%Warning-WIDTH: data/full_repos/permissive/162251494/GuitarHero.v:315: Operator LTE expects 32 or 4 bits on the LHS, but LHS\'s VARREF \'counter\' generates 1 bits.\n                                                                     : ... In instance GuitarHero.gsm0\n  else if (counter <= 9 & ~loss) begin\n                   ^~\n%Warning-WIDTH: data/full_repos/permissive/162251494/GuitarHero.v:349: Operator GT expects 32 or 4 bits on the LHS, but LHS\'s VARREF \'counter\' generates 1 bits.\n                                                                     : ... In instance GuitarHero.gsm0\n  if (counter > 9) begin\n              ^\n%Warning-WIDTH: data/full_repos/permissive/162251494/GuitarHero.v:170: Operator ADD expects 8 bits on the LHS, but LHS\'s SEL generates 6 bits.\n                                                                     : ... In instance GuitarHero.p0\n assign X_out[7:0] = x_counter[5:0] + column[1:0]*6\'b101000;\n                                    ^\n%Error: data/full_repos/permissive/162251494/GuitarHero.v:79: Cannot find file containing module: \'keyboard\'\n keyboard kb(.keyboard_clk(PS2_CLK), .keyboard_data(PS2_DAT), .clock50(CLOCK_50), .reset(0), .read(read), .scan_ready(scan_ready), .scan_code(scan_code));\n ^~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/162251494,data/full_repos/permissive/162251494/keyboard\n             data/full_repos/permissive/162251494,data/full_repos/permissive/162251494/keyboard.v\n             data/full_repos/permissive/162251494,data/full_repos/permissive/162251494/keyboard.sv\n             keyboard\n             keyboard.v\n             keyboard.sv\n             obj_dir/keyboard\n             obj_dir/keyboard.v\n             obj_dir/keyboard.sv\n%Error: data/full_repos/permissive/162251494/GuitarHero.v:80: Cannot find file containing module: \'oneshot\'\n oneshot pulse(.pulse_out(read), .trigger_in(scan_ready), .clk(CLOCK_50));\n ^~~~~~~\n%Error: data/full_repos/permissive/162251494/GuitarHero.v:133: Cannot find file containing module: \'vga_adapter\'\n vga_adapter VGA(\n ^~~~~~~~~~~\n%Error: Exiting due to 3 error(s), 10 warning(s)\n'
module GuitarHero(LEDR, CLOCK_50, PS2_CLK, PS2_DAT, HEX0, HEX1, HEX2, KEY, SW,

		VGA_CLK,
		VGA_HS,
		VGA_VS,
		VGA_BLANK_N,
		VGA_SYNC_N,
		VGA_R,
		VGA_G,
		VGA_B
		);
	

	output			VGA_CLK;
	output			VGA_HS;
	output			VGA_VS;
	output			VGA_BLANK_N;
	output			VGA_SYNC_N;
	output	[7:0]	VGA_R;
	output	[7:0]	VGA_G;
	output	[7:0]	VGA_B;
	

	input [3:0] KEY;
	input [9:0] SW;
	
	output [6:0] HEX0;
	output [6:0] HEX1;
	output [6:0] HEX2;
	output [3:0] LEDR;
	

	input CLOCK_50;
	wire game_state_clock;
	wire pattern_clock;
	

	reg [29:0] c1Curr;
	reg [29:0] c2Curr;
	reg [29:0] c3Curr;
	reg [29:0] c4Curr;
	
	wire [29:0] c1CurrWire;
	wire [29:0] c2CurrWire;
	wire [29:0] c3CurrWire;
	wire [29:0] c4CurrWire;
	
	wire [3:0] score_p1;
	wire [3:0] score_p2;
	

	wire [2:0] load_A;
	wire [2:0] load_B;
	wire [2:0] load_C;
	wire [2:0] load_D;
	
	wire [9:0] c1Pattern;
	wire [9:0] c2Pattern;
	wire [9:0] c3Pattern;
	wire [9:0] c4Pattern;


	wire [3:0] randomNumber;
	

	input PS2_DAT, PS2_CLK;
	wire [7:0] scan_code;
	wire read, scan_ready;
	reg [7:0] scan_history [1:2];
	

	always @(posedge scan_ready)
		begin
		scan_history [2] <= scan_history [1];
		scan_history [1] <= scan_code;
	end
	

	keyboard kb(.keyboard_clk(PS2_CLK), .keyboard_data(PS2_DAT), .clock50(CLOCK_50), .reset(0), .read(read), .scan_ready(scan_ready), .scan_code(scan_code));
	oneshot pulse(.pulse_out(read), .trigger_in(scan_ready), .clk(CLOCK_50));
	

	wire a_key = ((scan_history[1] == 'h1c) && (scan_history[2][7:4] != 'hF));
	wire s_key = ((scan_history[1] == 'h1b) && (scan_history[2][7:4] != 'hF));
	wire l_key = ((scan_history[1] == 'h4b) && (scan_history[2][7:4] != 'hF));
	wire sc_key = ((scan_history[1] == 'h4c) && (scan_history[2][7:4] != 'hF));
	

	assign LEDR[3] = a_key;
	assign LEDR[2] = s_key;
	assign LEDR[1] = l_key;
	assign LEDR[0] = sc_key;
	

	slow_clock c0(CLOCK_50, game_state_clock, 36'd15_000_000);
	slow_clock c1(CLOCK_50, pattern_clock, 36'd150_000_000);


	RandomNumberGenerator rng0(.clock(game_state_clock), .seed(32'b00001111001110000100000101000001), .number(randomNumber[3:0]));
	
	PatternFSM pFSM0(pattern_clock, randomNumber[3:0], load_A[2:0], load_B[2:0], load_C[2:0], load_D[2:0]);
	PatternDatapath pd0(load_A[2:0], load_B[2:0], load_C[2:0], load_D[2:0], c1Pattern[9:0], c2Pattern[9:0], c3Pattern[9:0], c4Pattern[9:0]);
	GameStateManager gsm0(.p1_key1(a_key), .p1_key2(s_key), .p2_key1(l_key), .p2_key2(sc_key), 
								 .c1Curr(c1Curr[29:0]), .c2Curr(c2Curr[29:0]), .c3Curr(c3Curr[29:0]), .c4Curr(c4Curr[29:0]), 
								 .c1Pattern(c1Pattern[9:0]), .c2Pattern(c2Pattern[9:0]), .c3Pattern(c3Pattern[9:0]), .c4Pattern(c4Pattern[9:0]), 
								 .clock(game_state_clock), .reset(SW[0]), 
								 .score_p1(score_p1[3:0]), .score_p2(score_p2[3:0]), 
								 .c1Draw(c1CurrWire[29:0]), .c2Draw(c2CurrWire[29:0]), .c3Draw(c3CurrWire[29:0]), .c4Draw(c4CurrWire[29:0]));
	

	always @ (*) begin
		c1Curr [29:0] <= c1CurrWire[29:0];
		c2Curr [29:0] <= c2CurrWire[29:0];
		c3Curr [29:0] <= c3CurrWire[29:0];
		c4Curr [29:0] <= c4CurrWire[29:0];

	end
	

	hex_decoder hex0(score_p1[3:0], HEX0[6:0]);
	hex_decoder hex1(score_p2[3:0], HEX1[6:0]);
	hex_decoder hex2(randomNumber[3:0], HEX2[6:0]);


	wire [2:0] colour;
	wire [7:0] x;
	wire [6:0] y;
	wire writeEn;




	vga_adapter VGA(
			.resetn(KEY[1]),
			.clock(CLOCK_50),
			.colour(colour),
			.x(x),
			.y(y),
			.plot(1),

			.VGA_R(VGA_R),
			.VGA_G(VGA_G),
			.VGA_B(VGA_B),
			.VGA_HS(VGA_HS),
			.VGA_VS(VGA_VS),
			.VGA_BLANK(VGA_BLANK_N),
			.VGA_SYNC(VGA_SYNC_N),
			.VGA_CLK(VGA_CLK));
		defparam VGA.RESOLUTION = "160x120";
		defparam VGA.MONOCHROME = "FALSE";
		defparam VGA.BITS_PER_COLOUR_CHANNEL = 1;
		defparam VGA.BACKGROUND_IMAGE = "black.mif";
			


	VGAPlotter p0(.clock(CLOCK_50), .reset(KEY[1]), .c1(c1Curr[29:0]), .c2(c2Curr[29:0]), .c3(c3Curr[29:0]), .c4(c4Curr[29:0]), 
						.Y_out(y[6:0]), .X_out(x[7:0]), .colour_out(colour[2:0]), .draw(writeEn) );
						
endmodule
module GuitarHero(LEDR, CLOCK_50, PS2_CLK, PS2_DAT, HEX0, HEX1, HEX2, KEY, SW,

		VGA_CLK,
		VGA_HS,
		VGA_VS,
		VGA_BLANK_N,
		VGA_SYNC_N,
		VGA_R,
		VGA_G,
		VGA_B
		);

	

	output			VGA_CLK;
	output			VGA_HS;
	output			VGA_VS;
	output			VGA_BLANK_N;
	output			VGA_SYNC_N;
	output	[7:0]	VGA_R;
	output	[7:0]	VGA_G;
	output	[7:0]	VGA_B;
	

	input [3:0] KEY;
	input [9:0] SW;
	
	output [6:0] HEX0;
	output [6:0] HEX1;
	output [6:0] HEX2;
	output [3:0] LEDR;
	

	input CLOCK_50;
	wire game_state_clock;
	wire pattern_clock;
	

	reg [29:0] c1Curr;
	reg [29:0] c2Curr;
	reg [29:0] c3Curr;
	reg [29:0] c4Curr;
	
	wire [29:0] c1CurrWire;
	wire [29:0] c2CurrWire;
	wire [29:0] c3CurrWire;
	wire [29:0] c4CurrWire;
	
	wire [3:0] score_p1;
	wire [3:0] score_p2;
	

	wire [2:0] load_A;
	wire [2:0] load_B;
	wire [2:0] load_C;
	wire [2:0] load_D;
	
	wire [9:0] c1Pattern;
	wire [9:0] c2Pattern;
	wire [9:0] c3Pattern;
	wire [9:0] c4Pattern;


	wire [3:0] randomNumber;
	

	input PS2_DAT, PS2_CLK;
	wire [7:0] scan_code;
	wire read, scan_ready;
	reg [7:0] scan_history [1:2];
	

	always @(posedge scan_ready)
		begin
		scan_history [2] <= scan_history [1];
		scan_history [1] <= scan_code;
	end
	

	keyboard kb(.keyboard_clk(PS2_CLK), .keyboard_data(PS2_DAT), .clock50(CLOCK_50), .reset(0), .read(read), .scan_ready(scan_ready), .scan_code(scan_code));
	oneshot pulse(.pulse_out(read), .trigger_in(scan_ready), .clk(CLOCK_50));
	

	wire a_key = ((scan_history[1] == 'h1c) && (scan_history[2][7:4] != 'hF));
	wire s_key = ((scan_history[1] == 'h1b) && (scan_history[2][7:4] != 'hF));
	wire l_key = ((scan_history[1] == 'h4b) && (scan_history[2][7:4] != 'hF));
	wire sc_key = ((scan_history[1] == 'h4c) && (scan_history[2][7:4] != 'hF));
	

	assign LEDR[3] = a_key;
	assign LEDR[2] = s_key;
	assign LEDR[1] = l_key;
	assign LEDR[0] = sc_key;
	

	slow_clock c0(CLOCK_50, game_state_clock, 36'd15_000_000);
	slow_clock c1(CLOCK_50, pattern_clock, 36'd150_000_000);


	RandomNumberGenerator rng0(.clock(game_state_clock), .seed(32'b00001111001110000100000101000001), .number(randomNumber[3:0]));
	
	PatternFSM pFSM0(pattern_clock, randomNumber[3:0], load_A[2:0], load_B[2:0], load_C[2:0], load_D[2:0]);
	PatternDatapath pd0(load_A[2:0], load_B[2:0], load_C[2:0], load_D[2:0], c1Pattern[9:0], c2Pattern[9:0], c3Pattern[9:0], c4Pattern[9:0]);
	GameStateManager gsm0(.p1_key1(a_key), .p1_key2(s_key), .p2_key1(l_key), .p2_key2(sc_key), 
								 .c1Curr(c1Curr[29:0]), .c2Curr(c2Curr[29:0]), .c3Curr(c3Curr[29:0]), .c4Curr(c4Curr[29:0]), 
								 .c1Pattern(c1Pattern[9:0]), .c2Pattern(c2Pattern[9:0]), .c3Pattern(c3Pattern[9:0]), .c4Pattern(c4Pattern[9:0]), 
								 .clock(game_state_clock), .reset(SW[0]), 
								 .score_p1(score_p1[3:0]), .score_p2(score_p2[3:0]), 
								 .c1Draw(c1CurrWire[29:0]), .c2Draw(c2CurrWire[29:0]), .c3Draw(c3CurrWire[29:0]), .c4Draw(c4CurrWire[29:0]));
	

	always @ (*) begin
		c1Curr [29:0] <= c1CurrWire[29:0];
		c2Curr [29:0] <= c2CurrWire[29:0];
		c3Curr [29:0] <= c3CurrWire[29:0];
		c4Curr [29:0] <= c4CurrWire[29:0];

	end
	

	hex_decoder hex0(score_p1[3:0], HEX0[6:0]);
	hex_decoder hex1(score_p2[3:0], HEX1[6:0]);
	hex_decoder hex2(randomNumber[3:0], HEX2[6:0]);


	wire [2:0] colour;
	wire [7:0] x;
	wire [6:0] y;
	wire writeEn;




	vga_adapter VGA(
			.resetn(KEY[1]),
			.clock(CLOCK_50),
			.colour(colour),
			.x(x),
			.y(y),
			.plot(1),

			.VGA_R(VGA_R),
			.VGA_G(VGA_G),
			.VGA_B(VGA_B),
			.VGA_HS(VGA_HS),
			.VGA_VS(VGA_VS),
			.VGA_BLANK(VGA_BLANK_N),
			.VGA_SYNC(VGA_SYNC_N),
			.VGA_CLK(VGA_CLK));
		defparam VGA.RESOLUTION = "160x120";
		defparam VGA.MONOCHROME = "FALSE";
		defparam VGA.BITS_PER_COLOUR_CHANNEL = 1;
		defparam VGA.BACKGROUND_IMAGE = "black.mif";
			


	VGAPlotter p0(.clock(CLOCK_50), .reset(KEY[1]), .c1(c1Curr[29:0]), .c2(c2Curr[29:0]), .c3(c3Curr[29:0]), .c4(c4Curr[29:0]), 
						.Y_out(y[6:0]), .X_out(x[7:0]), .colour_out(colour[2:0]), .draw(writeEn) );
						
endmodule