module pacman(CLOCK, btn_up, btn_down, btn_left, btn_right, bit_sel, segment, V_sync, H_sync, RGB_red, RGB_blue, RGB_green);
input CLOCK;
//input RESET;
input btn_up;
input btn_down;
input btn_left;
input btn_right;
output [3:0] bit_sel;
output [7:0] segment;
output V_sync;
output H_sync;
output [3:0] RGB_red;
output [3:0] RGB_blue;
output [3:0] RGB_green;
parameter c_CLOCK_FREQ = 40_000_000;
wire s_GameClock;
wire s_VGAClock;
wire s_Locked;
wire s_Reset;
wire [2:0] s_Color;
wire [15:0] s_Score;
wire [31:0] s_HPos;
wire [31:0] s_VPos;
wire s_Move;
wire [3:0] s_Direction;
clk_wizard clock_wizard(
.clk0_out(s_VGAClock),
.reset(1'b0),
.extlock(s_Locked),
.refclk(CLOCK)
);
assign s_Reset = (~s_Locked);
picture_ctrl U_controller(
.pic_clk(s_VGAClock),
.p_GameClock(s_GameClock),
.p_Reset(s_Reset),
.x_pix(s_HPos),
.y_pix(s_VPos),
.pic_dir(s_Direction),
.pic_move(s_Move),
.pic_rgb(s_Color),
.dis_score(s_Score)
);
ssd_controller #(c_CLOCK_FREQ) U_seg(
.p_Reset(s_Reset),
.pic_clk(s_VGAClock),
.p_Data(s_Score),
.o_bit_sel(bit_sel),
.o_segment(segment)
);
io U_btn(
.pic_clk(s_VGAClock),
.p_Reset(s_Reset),
.btn_up(btn_up),
.btn_down(btn_down),
.btn_left(btn_left),
.btn_right(btn_right),
.o_Clock(s_GameClock),
.o_Move(s_Move),
.o_Direction(s_Direction)
);
vga_driver U_vga(
.pic_clk(s_VGAClock),
.p_Reset(s_Reset),
.p_Color(s_Color),
.H_position(s_HPos),
.V_position(s_VPos),
.VGA_hsync_o(H_sync),
.VGA_vsync_o(V_sync),
.VGA_R(RGB_red),
.VGA_G(RGB_green),
.VGA_B(RGB_blue)
);
endmodule