//-------------------------------------------------------------------------------------------------- // // Title : Light_Game // Design : Lab7_part2 // Author : cse // Company : uw // //------------------------------------------------------------------------------------------------- // // File : Light_Game.v // Generated : Tue Nov 18 12:38:04 2003 // From : interface description file // By : Itf2Vhdl ver. 1.20 // //------------------------------------------------------------------------------------------------- // // Description : // //------------------------------------------------------------------------------------------------- `timescale 1ps / 1ps //{{ Section below this comment is automatically maintained // and may be overwritten //{module {Light_Game}} module Light_Game (LEDS, LPB, RPB, CLK, RESET); input LPB ; input RPB ; input CLK ; input RESET; output [6:0] LEDS ; reg [6:0] position; reg left; reg right; wire L, R; assign L = ~left && LPB; assign R = ~right && RPB; assign LEDS = position; always @(posedge CLK) begin left <= LPB; right <= RPB; if (RESET) position <= 7'b0001000; else if ((position == 7'b0000001) || (position == 7'b1000000)) ; else if (L) position <= position << 1; else if (R) position <= position >> 1; end endmodule