data/full_repos/permissive/119715647/sim/gameFunct/BlockShift.v
 line:19: before: "="
data/verilator_xmls/3598a784-98f9-45e5-bdb2-458388ca9156.xml
module BlockShift(start, blockLoc, stopBtn, adjClkPulse, newBlockLoc, startNext);
	input start;
	input [7:0] blockLoc;
	input stopBtn;
	input adjClkPulse;
	output [7:0] newBlockLoc;
	output reg startNext;

	reg [7:0] tempBlock;
	reg [7:0] strBlock;

	reg [1:0] state;
	parameter s_init = 0, s_shift = 1, s_pause = 2;
	reg enable, direction;
	reg [2:0] xCount;

	always @ (posedge adjClkPulse) begin



		if(start == 1) begin


			case(state)
				s_init: begin
					if(enable == 1) begin
						tempBlock <= blockLoc;
						enable <= 0;
					end
					state <= s_shift;
				end
				s_shift: begin
					if (stopBtn == 1) begin
						state <= s_pause;

					end
					else begin
						if(direction == 0) begin
							xCount <= xCount + 1;
							tempBlock <= tempBlock >> 1;
						end
						else if(direction == 1)begin
							xCount <= xCount - 1;
							tempBlock <= tempBlock << 1;
							if(tempBlock == 8'b1000000) begin
								direction <= 0;
							end
						end
						if (xCount == 6)begin
							direction <= 1;
						end
						else if (xCount == 0) begin
							direction <= 0;
						end
						state <= s_shift;
					end
				end
				s_pause: begin
					strBlock <= tempBlock;
					startNext <= 1;
					state <= s_pause;
				end
				default: begin
					enable <= 1;
					xCount <= 0;
					direction <= 0;
					state <= s_init;
				end
			endcase
		end
		else begin
			tempBlock <= 8'b00000000;
			startNext <= 0;
		end
	end

	assign newBlockLoc = tempBlock;

endmodule
module BlockShift(start, blockLoc, stopBtn, adjClkPulse, newBlockLoc, startNext);

	input start;
	input [7:0] blockLoc;
	input stopBtn;
	input adjClkPulse;
	output [7:0] newBlockLoc;
	output reg startNext;

	reg [7:0] tempBlock;
	reg [7:0] strBlock;

	reg [1:0] state;
	parameter s_init = 0, s_shift = 1, s_pause = 2;
	reg enable, direction;
	reg [2:0] xCount;

	always @ (posedge adjClkPulse) begin



		if(start == 1) begin


			case(state)
				s_init: begin
					if(enable == 1) begin
						tempBlock <= blockLoc;
						enable <= 0;
					end
					state <= s_shift;
				end
				s_shift: begin
					if (stopBtn == 1) begin
						state <= s_pause;

					end
					else begin
						if(direction == 0) begin
							xCount <= xCount + 1;
							tempBlock <= tempBlock >> 1;
						end
						else if(direction == 1)begin
							xCount <= xCount - 1;
							tempBlock <= tempBlock << 1;
							if(tempBlock == 8'b1000000) begin
								direction <= 0;
							end
						end
						if (xCount == 6)begin
							direction <= 1;
						end
						else if (xCount == 0) begin
							direction <= 0;
						end
						state <= s_shift;
					end
				end
				s_pause: begin
					strBlock <= tempBlock;
					startNext <= 1;
					state <= s_pause;
				end
				default: begin
					enable <= 1;
					xCount <= 0;
					direction <= 0;
					state <= s_init;
				end
			endcase
		end
		else begin
			tempBlock <= 8'b00000000;
			startNext <= 0;
		end
	end

	assign newBlockLoc = tempBlock;

endmodule