module rotate (input clk, input reset, input rotRight, input rotLeft, output [2:0] lights); reg A, B, C; assign lights = { A, B, C }; always @(posedge clk) begin if (reset) A <= 0; else if (rotRight) A <= C; else if (rotLeft) A <= B; end always @(posedge clk) begin if (reset) B <= 1; else if (rotRight) B <= A; else if (rotLeft) B <= C; end always @(posedge clk) begin if (reset) C <= 0; else if (rotRight) C <= B; else if (rotLeft) C <= A; end endmodule // rotate module rotate (input clk, input reset, input rotRight, input rotLeft, output [2:0] lights); reg A, B, C; assign lights = { A, B, C }; always @(posedge clk) begin if (reset) begin A <= 0; B <= 1; C <= 0; end else if (rotRight) begin A <= C; B <= A; C <= B; end else if (rotLeft) begin A <= B; B <= C; C <= A; end end // always @ (posedge clk) endmodule // rotate module rotate (input clk, input reset, input rotRight, input rotLeft, output reg [2:0] lights); always @(posedge clk) begin if (reset) begin lights <= 3'b000; end else if (rotRight) lights <= { lights[0], lights[2:1] }; else if (rotLeft) lights <= { lights[1:0], lights[2] }; end // always @ (posedge clk) endmodule // rotate