{"id":323,"date":"2026-09-15T23:26:35","date_gmt":"2026-09-15T23:26:35","guid":{"rendered":"https:\/\/bugzyard.com\/index.php\/2026\/09\/15\/project-1-space-force-x-disaster-strikes-complete-fpga-implementation-guide\/"},"modified":"2026-09-15T23:26:35","modified_gmt":"2026-09-15T23:26:35","slug":"project-1-space-force-x-disaster-strikes-complete-fpga-implementation-guide","status":"publish","type":"post","link":"https:\/\/bugzyard.com\/index.php\/2026\/09\/15\/project-1-space-force-x-disaster-strikes-complete-fpga-implementation-guide\/","title":{"rendered":"Project 1: Space Force X &#8211; Disaster Strikes | Complete FPGA Implementation Guide"},"content":{"rendered":"<h1 style=\"text-align: center; color: #1a237e; border-bottom: 4px solid #2196F3; padding-bottom: 20px;\">\ud83c\udfae PROJECT 1: SPACE FORCE X \u2014 DISASTER STRIKES<\/h1>\n<h2 style=\"color: #d32f2f; border-left: 5px solid #d32f2f; padding-left: 15px;\">Introduction<\/h2>\n<p style=\"font-size: 16px; line-height: 1.8;\">Space Force X: Disaster Strikes is an interactive space defense game implemented on the Basys3 FPGA development board. Players control a defensive tank positioned at the bottom of a VGA display screen to protect against waves of descending alien invaders. This intermediate-level project introduces students to complete embedded system design including Finite State Machines, real-time collision detection, synchronous hardware design patterns, and VGA display interfacing. Every pixel rendered, every collision detected, and every game state transition is a direct result of hardware logic circuits working in concert at the clock cycle level.<\/p>\n<h2 style=\"color: #2196F3; border-left: 5px solid #2196F3; padding-left: 15px;\">Project Overview<\/h2>\n<p style=\"font-size: 16px; line-height: 1.8;\">Space Force X simulates a classic top-down space defense scenario that mirrors real-world systems like air defense networks and threat detection systems. The gameplay takes place on a 640\u00d7480 pixel VGA display where time is measured in clock cycles. A player-controlled tank occupies the bottom 30 pixels of the screen. Above it, an enemy formation of aliens descends in organized rows. The objective is straightforward but demanding: destroy all alien invaders before any reach the tank&#8217;s position at Y=450 pixels. Success advances the player to progressively harder levels with increased speed and density.<\/p>\n<p style=\"font-size: 16px; line-height: 1.8;\">The beauty of this project lies in its architectural elegance. Rather than using a high-level programming language running on a processor, Space Force X employs dedicated hardware circuits for each function. The tank position is stored in a hardware register. Alien positions are managed by arrays of flip-flops. Collision detection happens combinatorially in the same nanosecond across all entities. The rendering happens in parallel, with every pixel decision made instantly based on current entity coordinates. This parallel processing capability demonstrates why FPGAs excel at real-time systems where responsiveness cannot be delayed by software execution times.<\/p>\n<p style=\"font-size: 16px; line-height: 1.8;\">The game implements a Mealy Finite State Machine with six distinct states: START_SCREEN (awaiting player input), PLAYING_LEVEL_1 (active gameplay on level one), PLAYING_LEVEL_2 (faster difficulty), LEVEL_ADVANCE (brief transition state), PAUSE_STATE (game frozen), and GAME_OVER (end screen). Each state has precisely defined entry conditions and exit conditions. State transitions happen synchronously on clock edges, ensuring deterministic behavior essential for reliable embedded systems. This FSM design teaches professional hardware architecture patterns used in aerospace, automotive, and industrial control applications.<\/p>\n<h2 style=\"color: #2196F3; border-left: 5px solid #2196F3; padding-left: 15px;\">What Project Does<\/h2>\n<p style=\"font-size: 16px; line-height: 1.8;\">The game begins with a START_SCREEN displaying &#8220;SPACE FORCE X&#8221; and waiting for keyboard input. The moment a player presses any key, the FSM transitions to PLAYING_LEVEL_1. The screen now displays a formation of 24 aliens arranged in 3 rows of 8, positioned at the top of the screen. Simultaneously, the tank appears at the bottom center, ready to defend. The player controls movement using arrow keys: A moves the tank left (decrements the tank_x register by 4 pixels per clock cycle), D moves right (increments tank_x by 4), and W fires a bullet upward. The tank cannot move beyond screen boundaries (X must remain between 0 and 600).<\/p>\n<p style=\"font-size: 16px; line-height: 1.8;\">As the game progresses, aliens move downward at a constant rate controlled by a movement counter. Every 8 clock cycles, all alien Y-coordinates decrement by 2 pixels, creating the illusion of smooth descent. When the player presses W, a new bullet object is created at the current tank X position and begins moving upward at 5 pixels per cycle. The collision detection module runs combinatorially every cycle, comparing every bullet&#8217;s position against every alien&#8217;s position. The moment a bullet&#8217;s X-coordinate matches an alien&#8217;s X-coordinate (within a 10-pixel tolerance) AND the bullet&#8217;s Y-coordinate falls within the alien&#8217;s Y range (20 pixels tall), a collision is instantly detected. The alien is removed from the playfield, the bullet is destroyed, and the score increments by 100 points. Visual feedback occurs immediately\u2014some implementations flash the hit location or change colors briefly.<\/p>\n<p style=\"font-size: 16px; line-height: 1.8;\">The game continues until one of two end conditions occurs: (1) All aliens are destroyed, triggering LEVEL_ADVANCE\u2014a brief 2-second pause displaying &#8220;LEVEL COMPLETE&#8221; before advancing to PLAYING_LEVEL_2 where aliens move 2\u00d7 faster; or (2) Any alien reaches Y=450 (the tank position), triggering an immediate loss of life. The player begins with 3 lives. Each alien reaching the bottom costs one life. When lives reach 0, the game transitions to GAME_OVER, displaying the final score and waiting for the player to press the reset button (U) to return to START_SCREEN. The pause button (P) can freeze the game at any time, maintaining all entity positions and FSM state until pressed again.<\/p>\n<h2 style=\"color: #2196F3; border-left: 5px solid #2196F3; padding-left: 15px;\">Hardware Requirements<\/h2>\n<table style=\"width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 15px;\">\n<tr style=\"background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white;\">\n<th style=\"border: 1px solid #ddd; padding: 15px; text-align: left;\"><strong>Component<\/strong><\/th>\n<th style=\"border: 1px solid #ddd; padding: 15px; text-align: left;\"><strong>Specification<\/strong><\/th>\n<th style=\"border: 1px solid #ddd; padding: 15px; text-align: left;\"><strong>Where to Buy<\/strong><\/th>\n<th style=\"border: 1px solid #ddd; padding: 15px; text-align: left;\"><strong>Approx Price<\/strong><\/th>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #ddd; padding: 15px;\"><strong>FPGA Board<\/strong><\/td>\n<td style=\"border: 1px solid #ddd; padding: 15px;\">Basys3 (Artix-7 XC7A35T)<\/td>\n<td style=\"border: 1px solid #ddd; padding: 15px;\">Digilent.com, Amazon, RS Components<\/td>\n<td style=\"border: 1px solid #ddd; padding: 15px;\">$99-120 USD<\/td>\n<\/tr>\n<tr style=\"background: #f9f9f9;\">\n<td style=\"border: 1px solid #ddd; padding: 15px;\"><strong>VGA Monitor<\/strong><\/td>\n<td style=\"border: 1px solid #ddd; padding: 15px;\">Any 640\u00d7480+ display with VGA input<\/td>\n<td style=\"border: 1px solid #ddd; padding: 15px;\">Local electronics, eBay, used market<\/td>\n<td style=\"border: 1px solid #ddd; padding: 15px;\">$30-80 USD (used)<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #ddd; padding: 15px;\"><strong>VGA Cable<\/strong><\/td>\n<td style=\"border: 1px solid #ddd; padding: 15px;\">15-pin D-sub VGA cable, minimum 2m<\/td>\n<td style=\"border: 1px solid #ddd; padding: 15px;\">Local computer shops, Amazon<\/td>\n<td style=\"border: 1px solid #ddd; padding: 15px;\">$5-15 USD<\/td>\n<\/tr>\n<tr style=\"background: #f9f9f9;\">\n<td style=\"border: 1px solid #ddd; padding: 15px;\"><strong>PS\/2 Keyboard<\/strong><\/td>\n<td style=\"border: 1px solid #ddd; padding: 15px;\">Standard PS\/2 connection (purple connector)<\/td>\n<td style=\"border: 1px solid #ddd; padding: 15px;\">Computer shops, eBay, local hardware stores<\/td>\n<td style=\"border: 1px solid #ddd; padding: 15px;\">$10-25 USD<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #ddd; padding: 15px;\"><strong>USB Power Cable<\/strong><\/td>\n<td style=\"border: 1px solid #ddd; padding: 15px;\">Micro-USB to USB-A (included with board)<\/td>\n<td style=\"border: 1px solid #ddd; padding: 15px;\">Included; any USB power supply<\/td>\n<td style=\"border: 1px solid #ddd; padding: 15px;\">Included \/ $5-10<\/td>\n<\/tr>\n<tr style=\"background: #f9f9f9;\">\n<td style=\"border: 1px solid #ddd; padding: 15px;\"><strong>Development Tools<\/strong><\/td>\n<td style=\"border: 1px solid #ddd; padding: 15px;\">Vivado Design Suite (free WebPACK edition)<\/td>\n<td style=\"border: 1px solid #ddd; padding: 15px;\">xilinx.com (free download)<\/td>\n<td style=\"border: 1px solid #ddd; padding: 15px;\">Free<\/td>\n<\/tr>\n<\/table>\n<p style=\"background: #FFF3E0; padding: 15px; border-left: 4px solid #FF9800; border-radius: 4px; margin: 20px 0;\"><strong>Total Estimated Cost:<\/strong> $150-250 USD. The FPGA board is reusable for all 8 projects, so it&#8217;s a one-time investment. Monitors and keyboards may already be available.<\/p>\n<h2 style=\"color: #2196F3; border-left: 5px solid #2196F3; padding-left: 15px;\">Input Specification<\/h2>\n<h3 style=\"color: #1976D2; margin-top: 30px;\">Type of Controls<\/h3>\n<table style=\"width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 15px;\">\n<tr style=\"background: #E3F2FD;\">\n<th style=\"border: 1px solid #90CAF9; padding: 12px; text-align: left;\"><strong>Input<\/strong><\/th>\n<th style=\"border: 1px solid #90CAF9; padding: 12px; text-align: left;\"><strong>Action<\/strong><\/th>\n<th style=\"border: 1px solid #90CAF9; padding: 12px; text-align: left;\"><strong>Hardware Response<\/strong><\/th>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #90CAF9; padding: 12px;\"><strong>A Key (Hold)<\/strong><\/td>\n<td style=\"border: 1px solid #90CAF9; padding: 12px;\">Move tank left<\/td>\n<td style=\"border: 1px solid #90CAF9; padding: 12px;\">tank_x \u2190 tank_x &#8211; 4 (each cycle)<\/td>\n<\/tr>\n<tr style=\"background: #f9f9f9;\">\n<td style=\"border: 1px solid #90CAF9; padding: 12px;\"><strong>D Key (Hold)<\/strong><\/td>\n<td style=\"border: 1px solid #90CAF9; padding: 12px;\">Move tank right<\/td>\n<td style=\"border: 1px solid #90CAF9; padding: 12px;\">tank_x \u2190 tank_x + 4 (each cycle)<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #90CAF9; padding: 12px;\"><strong>W Key (Press)<\/strong><\/td>\n<td style=\"border: 1px solid #90CAF9; padding: 12px;\">Fire bullet<\/td>\n<td style=\"border: 1px solid #90CAF9; padding: 12px;\">Create bullet at (tank_x, 420)<\/td>\n<\/tr>\n<tr style=\"background: #f9f9f9;\">\n<td style=\"border: 1px solid #90CAF9; padding: 12px;\"><strong>U Button (Press)<\/strong><\/td>\n<td style=\"border: 1px solid #90CAF9; padding: 12px;\">Reset game<\/td>\n<td style=\"border: 1px solid #90CAF9; padding: 12px;\">FSM \u2192 START_SCREEN, clear all<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #90CAF9; padding: 12px;\"><strong>P Button (Press)<\/strong><\/td>\n<td style=\"border: 1px solid #90CAF9; padding: 12px;\">Pause\/Resume<\/td>\n<td style=\"border: 1px solid #90CAF9; padding: 12px;\">FSM \u2192 PAUSE_STATE \/ resume<\/td>\n<\/tr>\n<\/table>\n<h3 style=\"color: #1976D2; margin-top: 30px;\">Control Details<\/h3>\n<p style=\"font-size: 16px; line-height: 1.8;\"><strong>Keyboard Input Processing:<\/strong> The PS\/2 keyboard continuously transmits scan codes to the FPGA&#8217;s PS\/2 interface module. The module converts these scan codes (which represent physical key positions) into ASCII values. The input handler monitors the ASCII values and sets digital flags: key_left, key_right, key_fire, key_pause, and key_reset. These flags persist as long as keys are held down, allowing smooth continuous movement.<\/p>\n<p style=\"font-size: 16px; line-height: 1.8;\"><strong>Debouncing:<\/strong> Mechanical switches bounce\u2014they make and break contact multiple times within a few milliseconds. Without debouncing, a single button press would register as multiple rapid presses. The debounce circuit uses a simple counter: after detecting an input transition, it waits 20ms (2,000,000 clock cycles at 100 MHz) before accepting another change. If the input returns to its original state within 20ms, it&#8217;s considered noise and ignored. Only changes that persist for 20ms are considered valid inputs.<\/p>\n<p style=\"font-size: 16px; line-height: 1.8;\"><strong>Multi-key Handling:<\/strong> The FPGA can detect multiple simultaneous key presses. A player can hold A to move left while pressing W to fire, and both actions execute immediately. This simultaneous input handling is one of the advantages of parallel hardware logic versus sequential software execution.<\/p>\n<h2 style=\"color: #2196F3; border-left: 5px solid #2196F3; padding-left: 15px;\">FSM Diagram<\/h2>\n<h3 style=\"color: #1976D2; margin-top: 30px;\">FSM State Transition Diagram<\/h3>\n<p><svg viewBox=\"0 0 1200 600\" style=\"border: 3px solid #333; width: 100%; margin: 20px 0; background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);\">\n  <defs>\n    <marker id=\"arrowhead\" markerWidth=\"10\" markerHeight=\"10\" refX=\"9\" refY=\"3\" orient=\"auto\">\n      <polygon points=\"0 0, 10 3, 0 6\" fill=\"#333\"\/>\n    <\/marker>\n  <\/defs><\/p>\n<p>  <!-- START_SCREEN -->\n  <circle cx=\"100\" cy=\"150\" r=\"60\" fill=\"#4CAF50\" stroke=\"#2E7D32\" stroke-width=\"3\"\/>\n  <text x=\"100\" y=\"145\" text-anchor=\"middle\" font-weight=\"bold\" font-size=\"14\" fill=\"white\">START<\/text>\n  <text x=\"100\" y=\"165\" text-anchor=\"middle\" font-size=\"12\" fill=\"white\">SCREEN<\/text><\/p>\n<p>  <!-- PLAYING_LEVEL_1 -->\n  <circle cx=\"400\" cy=\"150\" r=\"60\" fill=\"#2196F3\" stroke=\"#1565C0\" stroke-width=\"3\"\/>\n  <text x=\"400\" y=\"140\" text-anchor=\"middle\" font-weight=\"bold\" font-size=\"13\" fill=\"white\">PLAYING<\/text>\n  <text x=\"400\" y=\"158\" text-anchor=\"middle\" font-size=\"12\" fill=\"white\">LEVEL_1<\/text><\/p>\n<p>  <!-- LEVEL_ADVANCE -->\n  <circle cx=\"700\" cy=\"150\" r=\"60\" fill=\"#FF9800\" stroke=\"#E65100\" stroke-width=\"3\"\/>\n  <text x=\"700\" y=\"140\" text-anchor=\"middle\" font-weight=\"bold\" font-size=\"13\" fill=\"white\">LEVEL<\/text>\n  <text x=\"700\" y=\"158\" text-anchor=\"middle\" font-size=\"12\" fill=\"white\">ADVANCE<\/text><\/p>\n<p>  <!-- PLAYING_LEVEL_2 -->\n  <circle cx=\"1000\" cy=\"150\" r=\"60\" fill=\"#2196F3\" stroke=\"#1565C0\" stroke-width=\"3\"\/>\n  <text x=\"1000\" y=\"140\" text-anchor=\"middle\" font-weight=\"bold\" font-size=\"13\" fill=\"white\">PLAYING<\/text>\n  <text x=\"1000\" y=\"158\" text-anchor=\"middle\" font-size=\"12\" fill=\"white\">LEVEL_2<\/text><\/p>\n<p>  <!-- PAUSE_STATE -->\n  <circle cx=\"250\" cy=\"350\" r=\"60\" fill=\"#9C27B0\" stroke=\"#6A1B9A\" stroke-width=\"3\"\/>\n  <text x=\"250\" y=\"360\" text-anchor=\"middle\" font-weight=\"bold\" font-size=\"14\" fill=\"white\">PAUSE<\/text><\/p>\n<p>  <!-- GAME_OVER -->\n  <circle cx=\"550\" cy=\"350\" r=\"60\" fill=\"#F44336\" stroke=\"#C62828\" stroke-width=\"3\"\/>\n  <text x=\"550\" y=\"365\" text-anchor=\"middle\" font-weight=\"bold\" font-size=\"14\" fill=\"white\">GAME_OVER<\/text><\/p>\n<p>  <!-- Arrows with labels -->\n  <!-- START \u2192 PLAYING_LEVEL_1 -->\n  <path d=\"M 160 150 L 340 150\" stroke=\"#333\" stroke-width=\"2\" marker-end=\"url(#arrowhead)\"\/>\n  <text x=\"250\" y=\"135\" font-size=\"11\" font-weight=\"bold\" fill=\"#333\">any_key_press<\/text><\/p>\n<p>  <!-- PLAYING_LEVEL_1 \u2192 LEVEL_ADVANCE -->\n  <path d=\"M 460 150 L 640 150\" stroke=\"#333\" stroke-width=\"2\" marker-end=\"url(#arrowhead)\"\/>\n  <text x=\"550\" y=\"135\" font-size=\"11\" font-weight=\"bold\" fill=\"#333\">aliens_cleared<\/text><\/p>\n<p>  <!-- LEVEL_ADVANCE \u2192 PLAYING_LEVEL_2 -->\n  <path d=\"M 760 150 L 940 150\" stroke=\"#333\" stroke-width=\"2\" marker-end=\"url(#arrowhead)\"\/>\n  <text x=\"850\" y=\"135\" font-size=\"11\" font-weight=\"bold\" fill=\"#333\">2sec_delay_done<\/text><\/p>\n<p>  <!-- PLAYING_LEVEL_1 \u2192 PAUSE -->\n  <path d=\"M 350 180 L 280 300\" stroke=\"#9C27B0\" stroke-width=\"2\" stroke-dasharray=\"5,5\" marker-end=\"url(#arrowhead)\"\/>\n  <text x=\"310\" y=\"240\" font-size=\"11\" font-weight=\"bold\" fill=\"#9C27B0\">P_button<\/text><\/p>\n<p>  <!-- PAUSE \u2192 PLAYING_LEVEL_1 -->\n  <path d=\"M 290 320 L 360 200\" stroke=\"#9C27B0\" stroke-width=\"2\" stroke-dasharray=\"5,5\" marker-end=\"url(#arrowhead)\"\/>\n  <text x=\"310\" y=\"260\" font-size=\"11\" font-weight=\"bold\" fill=\"#9C27B0\">P_button<\/text><\/p>\n<p>  <!-- PLAYING_LEVEL_1 \u2192 GAME_OVER -->\n  <path d=\"M 380 200 L 470 300\" stroke=\"#F44336\" stroke-width=\"2\" marker-end=\"url(#arrowhead)\"\/>\n  <text x=\"400\" y=\"260\" font-size=\"11\" font-weight=\"bold\" fill=\"#F44336\">aliens_reach_bottom<\/text><\/p>\n<p>  <!-- PLAYING_LEVEL_2 \u2192 GAME_OVER (loop) -->\n  <path d=\"M 970 220 Q 850 290 610 320\" stroke=\"#F44336\" stroke-width=\"2\" marker-end=\"url(#arrowhead)\"\/>\n  <text x=\"880\" y=\"280\" font-size=\"11\" font-weight=\"bold\" fill=\"#F44336\">aliens_reach_bottom<\/text><\/p>\n<p>  <!-- GAME_OVER \u2192 START -->\n  <path d=\"M 500 290 Q 300 200 160 150\" stroke=\"#333\" stroke-width=\"2\" marker-end=\"url(#arrowhead)\"\/>\n  <text x=\"350\" y=\"230\" font-size=\"11\" font-weight=\"bold\" fill=\"#333\">U_button (reset)<\/text><\/p>\n<p>  <!-- Legend -->\n  <rect x=\"20\" y=\"480\" width=\"1160\" height=\"100\" fill=\"#f0f0f0\" stroke=\"#999\" stroke-width=\"1\" rx=\"5\"\/>\n  <text x=\"40\" y=\"510\" font-size=\"12\" font-weight=\"bold\" fill=\"#333\">State Descriptions:<\/text>\n  <text x=\"40\" y=\"535\" font-size=\"11\" fill=\"#333\"><tspan font-weight=\"bold\">START_SCREEN:<\/tspan> Display title, wait for input | <tspan font-weight=\"bold\">PLAYING_LEVEL_1\/2:<\/tspan> Active gameplay | <tspan font-weight=\"bold\">LEVEL_ADVANCE:<\/tspan> Transition state<\/text>\n  <text x=\"40\" y=\"560\" font-size=\"11\" fill=\"#333\"><tspan font-weight=\"bold\">PAUSE_STATE:<\/tspan> Game frozen | <tspan font-weight=\"bold\">GAME_OVER:<\/tspan> Show final score, wait for reset<\/text>\n<\/svg><\/p>\n<h3 style=\"color: #1976D2; margin-top: 30px;\">FSM Transitions (Detailed List)<\/h3>\n<div style=\"background: #E8F5E9; padding: 20px; border-left: 4px solid #4CAF50; border-radius: 4px; margin: 20px 0;\">\n<ul style=\"font-size: 15px; line-height: 2;\">\n<li><strong>START_SCREEN \u2192 PLAYING_LEVEL_1:<\/strong> Triggered when key_left OR key_right OR key_fire is high. Entry actions: Initialize alien array (24 aliens in 3\u00d78 formation at Y=40,90,140), set tank_x=300 (center), set score=0, set lives=3, clear bullet array.<\/li>\n<li><strong>PLAYING_LEVEL_1 \u2192 LEVEL_ADVANCE:<\/strong> Triggered when aliens_cleared signal is asserted (all aliens destroyed). Entry actions: Display &#8220;LEVEL CLEARED!&#8221; on screen, start 2-second timer, disable input processing.<\/li>\n<li><strong>LEVEL_ADVANCE \u2192 PLAYING_LEVEL_2:<\/strong> Triggered when advance_timer reaches 2 seconds. Entry actions: Initialize level 2 aliens (same 3\u00d78 formation but at Y=30,80,130), set alien_speed=5 pixels\/cycle, set bullet_speed=6 pixels\/cycle.<\/li>\n<li><strong>PLAYING_LEVEL_1 \u2192 GAME_OVER:<\/strong> Triggered when (aliens_reached_bottom==TRUE) OR (lives==0). Entry actions: Display &#8220;GAME OVER&#8221; and final score, disable input except reset button.<\/li>\n<li><strong>PLAYING_LEVEL_2 \u2192 GAME_OVER:<\/strong> Triggered when (aliens_reached_bottom==TRUE) OR (lives==0). Entry actions: Display &#8220;YOU WIN!&#8221; if all aliens cleared, OR &#8220;GAME OVER&#8221; if aliens reached bottom.<\/li>\n<li><strong>PLAYING_LEVEL_1 \u2194 PAUSE_STATE:<\/strong> Triggered when P_button pressed in PLAYING_LEVEL_1, player transitions to PAUSE_STATE. Triggered when P_button pressed in PAUSE_STATE, return to previous PLAYING state. During pause: game logic stops executing, display freezes at current frame, all entity positions held.<\/li>\n<li><strong>Any State \u2192 START_SCREEN:<\/strong> Triggered when U_button pressed. Clears all entities, resets counters, resets lives and score.<\/li>\n<\/ul>\n<\/div>\n<h3 style=\"color: #1976D2; margin-top: 30px;\">FSM Implementation (Verilog Code)<\/h3>\n<pre style=\"background: #263238; color: #aed581; padding: 20px; border-radius: 5px; overflow-x: auto; font-size: 12px; line-height: 1.5;\">\n<code>\/\/ ===== FSM Parameter Definition =====\nparameter START_SCREEN = 3'b000;\nparameter PLAYING_LEVEL_1 = 3'b001;\nparameter PLAYING_LEVEL_2 = 3'b010;\nparameter LEVEL_ADVANCE = 3'b011;\nparameter GAME_OVER = 3'b100;\nparameter PAUSE_STATE = 3'b101;\n\n\/\/ ===== State Registers =====\nreg [2:0] current_state, next_state;\nreg [31:0] state_timer;\nreg level_advance_done;\n\n\/\/ ===== Sequential Logic - State Updates =====\nalways @(posedge clk) begin\n  if (reset_button || power_on_reset)\n    current_state &lt;= START_SCREEN;\n  else\n    current_state &lt;= next_state;\nend\n\n\/\/ ===== Combinational Logic - Next State Determination =====\nalways @(*) begin\n  case (current_state)\n    START_SCREEN: begin\n      if (key_left || key_right || key_fire)\n        next_state = PLAYING_LEVEL_1;\n      else\n        next_state = START_SCREEN;\n    end\n    \n    PLAYING_LEVEL_1: begin\n      if (aliens_cleared)\n        next_state = LEVEL_ADVANCE;\n      else if (aliens_reached_bottom || lives == 0)\n        next_state = GAME_OVER;\n      else if (pause_button)\n        next_state = PAUSE_STATE;\n      else\n        next_state = PLAYING_LEVEL_1;\n    end\n    \n    LEVEL_ADVANCE: begin\n      if (state_timer > 200000000) \/\/ 2 seconds @ 100MHz\n        next_state = PLAYING_LEVEL_2;\n      else\n        next_state = LEVEL_ADVANCE;\n    end\n    \n    PLAYING_LEVEL_2: begin\n      if (aliens_cleared)\n        next_state = GAME_OVER; \/\/ Win condition\n      else if (aliens_reached_bottom || lives == 0)\n        next_state = GAME_OVER; \/\/ Lose condition\n      else if (pause_button)\n        next_state = PAUSE_STATE;\n      else\n        next_state = PLAYING_LEVEL_2;\n    end\n    \n    PAUSE_STATE: begin\n      if (pause_button)\n        next_state = (prev_state == PLAYING_LEVEL_1) ? PLAYING_LEVEL_1 : PLAYING_LEVEL_2;\n      else\n        next_state = PAUSE_STATE;\n    end\n    \n    GAME_OVER: begin\n      if (reset_button)\n        next_state = START_SCREEN;\n      else\n        next_state = GAME_OVER;\n    end\n    \n    default: next_state = START_SCREEN;\n  endcase\nend\n\n\/\/ ===== State Timer Management =====\nalways @(posedge clk) begin\n  if (current_state != LEVEL_ADVANCE)\n    state_timer &lt;= 32'd0;\n  else\n    state_timer &lt;= state_timer + 1'b1;\nend\n<\/code>\n<\/pre>\n<h2 style=\"color: #2196F3; border-left: 5px solid #2196F3; padding-left: 15px;\">Output Specification<\/h2>\n<h3 style=\"color: #1976D2; margin-top: 30px;\">VGA Display Details<\/h3>\n<table style=\"width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 15px;\">\n<tr style=\"background: #E3F2FD;\">\n<th style=\"border: 1px solid #90CAF9; padding: 12px; text-align: left;\"><strong>Parameter<\/strong><\/th>\n<th style=\"border: 1px solid #90CAF9; padding: 12px; text-align: left;\"><strong>Specification<\/strong><\/th>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #90CAF9; padding: 12px;\"><strong>Resolution<\/strong><\/td>\n<td style=\"border: 1px solid #90CAF9; padding: 12px;\">640\u00d7480 pixels @ 60 Hz refresh rate (pixel clock ~25 MHz)<\/td>\n<\/tr>\n<tr style=\"background: #f9f9f9;\">\n<td style=\"border: 1px solid #90CAF9; padding: 12px;\"><strong>Color Depth<\/strong><\/td>\n<td style=\"border: 1px solid #90CAF9; padding: 12px;\">12-bit RGB (4 bits Red, 4 bits Green, 4 bits Blue)<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #90CAF9; padding: 12px;\"><strong>Sync Signals<\/strong><\/td>\n<td style=\"border: 1px solid #90CAF9; padding: 12px;\">Horizontal sync (Hsync): 31.5 kHz, Vertical sync (Vsync): 60 Hz<\/td>\n<\/tr>\n<tr style=\"background: #f9f9f9;\">\n<td style=\"border: 1px solid #90CAF9; padding: 12px;\"><strong>Game Area<\/strong><\/td>\n<td style=\"border: 1px solid #90CAF9; padding: 12px;\">Y=30 to Y=470 (440 pixels playable height)<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #90CAF9; padding: 12px;\"><strong>Top HUD Bar<\/strong><\/td>\n<td style=\"border: 1px solid #90CAF9; padding: 12px;\">Y=0 to Y=29: Score (left), Level (center), Lives (right)<\/td>\n<\/tr>\n<\/table>\n<h3 style=\"color: #1976D2; margin-top: 30px;\">Display Information Breakdown<\/h3>\n<p><svg viewBox=\"0 0 640 100\" style=\"border: 2px solid #333; width: 100%; margin: 20px 0; background: #000;\">\n  <!-- Top bar background -->\n  <rect x=\"0\" y=\"0\" width=\"640\" height=\"30\" fill=\"#1a1a2e\"\/><\/p>\n<p>  <!-- Score section -->\n  <text x=\"20\" y=\"20\" fill=\"#00ff00\" font-size=\"12\" font-family=\"monospace\">SCORE: 1500<\/text><\/p>\n<p>  <!-- Level section (center) -->\n  <text x=\"320\" y=\"20\" text-anchor=\"middle\" fill=\"#00ff00\" font-size=\"12\" font-family=\"monospace\">LEVEL: 1<\/text><\/p>\n<p>  <!-- Lives section (right) -->\n  <text x=\"600\" y=\"20\" text-anchor=\"end\" fill=\"#00ff00\" font-size=\"12\" font-family=\"monospace\">LIVES: 3<\/text><\/p>\n<p>  <!-- Bottom border -->\n  <line x1=\"0\" y1=\"30\" x2=\"640\" y2=\"30\" stroke=\"#00ff00\" stroke-width=\"1\"\/>\n<p>  <!-- Color Legend -->\n  <text x=\"20\" y=\"60\" fill=\"#00ff00\" font-size=\"11\" font-family=\"monospace\">Tank: BLUE | Aliens: PINK | Bullets: WHITE | Background: BLACK<\/text>\n<\/svg><\/p>\n<p style=\"background: #FFF3E0; padding: 15px; border-left: 4px solid #FF9800; border-radius: 4px; margin: 20px 0;\"><strong>Color Palette:<\/strong> Tank = RGB (0000_1111_1111) Blue, Aliens = RGB (1111_0000_1111) Pink\/Magenta, Bullets = RGB (1111_1111_1111) White, Background = RGB (0000_0000_0000) Black<\/p>\n<h3 style=\"color: #1976D2; margin-top: 30px;\">Sensor Integration<\/h3>\n<p style=\"font-size: 16px; line-height: 1.8;\">Space Force X uses digital keyboard input only\u2014no analog sensors are integrated. The PS\/2 keyboard interface is fully digital, receiving scan codes as serial data over a synchronous clock line. Future enhancements could integrate analog joystick input through ADC (Analog-to-Digital Converter) modules, but the baseline project uses only the keyboard for simplicity and to focus on core game logic.<\/p>\n<h2 style=\"color: #2196F3; border-left: 5px solid #2196F3; padding-left: 15px;\">Game Flow Diagram<\/h2>\n<p><svg viewBox=\"0 0 800 950\" style=\"border: 3px solid #333; width: 100%; margin: 20px 0; background: linear-gradient(to bottom, #f5f7fa, #c3cfe2);\">\n  <defs>\n    <marker id=\"arrflow\" markerWidth=\"10\" markerHeight=\"10\" refX=\"9\" refY=\"3\" orient=\"auto\">\n      <polygon points=\"0 0, 10 3, 0 6\" fill=\"#333\"\/>\n    <\/marker>\n    <marker id=\"arrdec\" markerWidth=\"12\" markerHeight=\"12\" refX=\"10\" refY=\"6\" orient=\"auto\">\n      <polygon points=\"0 0, 12 6, 0 12\" fill=\"#d32f2f\"\/>\n    <\/marker>\n  <\/defs><\/p>\n<p>  <!-- START -->\n  <rect x=\"300\" y=\"20\" width=\"200\" height=\"50\" fill=\"#4CAF50\" stroke=\"#2E7D32\" stroke-width=\"2\" rx=\"5\"\/>\n  <text x=\"400\" y=\"50\" text-anchor=\"middle\" font-weight=\"bold\" fill=\"white\" font-size=\"13\">DISPLAY START SCREEN<\/text><\/p>\n<p>  <!-- Arrow down -->\n  <path d=\"M 400 70 L 400 110\" stroke=\"#333\" stroke-width=\"2\" marker-end=\"url(#arrflow)\"\/>\n<p>  <!-- WAIT INPUT -->\n  <rect x=\"300\" y=\"110\" width=\"200\" height=\"50\" fill=\"#FF9800\" stroke=\"#E65100\" stroke-width=\"2\" rx=\"5\"\/>\n  <text x=\"400\" y=\"140\" text-anchor=\"middle\" font-weight=\"bold\" fill=\"white\" font-size=\"13\">WAIT FOR INPUT<\/text><\/p>\n<p>  <!-- Arrow down -->\n  <path d=\"M 400 160 L 400 200\" stroke=\"#333\" stroke-width=\"2\" marker-end=\"url(#arrflow)\"\/>\n<p>  <!-- INIT LEVEL -->\n  <rect x=\"300\" y=\"200\" width=\"200\" height=\"50\" fill=\"#2196F3\" stroke=\"#1565C0\" stroke-width=\"2\" rx=\"5\"\/>\n  <text x=\"400\" y=\"230\" text-anchor=\"middle\" font-weight=\"bold\" fill=\"white\" font-size=\"13\">INIT LEVEL (Aliens, Tank)<\/text><\/p>\n<p>  <!-- Arrow down -->\n  <path d=\"M 400 250 L 400 290\" stroke=\"#333\" stroke-width=\"2\" marker-end=\"url(#arrflow)\"\/>\n<p>  <!-- MAIN GAME LOOP -->\n  <rect x=\"250\" y=\"290\" width=\"300\" height=\"80\" fill=\"#9C27B0\" stroke=\"#6A1B9A\" stroke-width=\"2\" rx=\"5\"\/>\n  <text x=\"400\" y=\"315\" text-anchor=\"middle\" font-weight=\"bold\" fill=\"white\" font-size=\"13\">MAIN GAME LOOP<\/text>\n  <text x=\"400\" y=\"335\" text-anchor=\"middle\" fill=\"white\" font-size=\"11\">Process Input | Update Positions<\/text>\n  <text x=\"400\" y=\"350\" text-anchor=\"middle\" fill=\"white\" font-size=\"11\">Check Collisions | Render Display<\/text><\/p>\n<p>  <!-- Side loop back arrow -->\n  <path d=\"M 250 330 Q 150 330 150 100 L 300 100\" stroke=\"#999\" stroke-width=\"2\" stroke-dasharray=\"4,4\" marker-end=\"url(#arrflow)\"\/>\n  <text x=\"100\" y=\"220\" font-size=\"10\" fill=\"#666\">Repeat Every Frame<\/text><\/p>\n<p>  <!-- Arrow down to decision -->\n  <path d=\"M 400 370 L 400 410\" stroke=\"#333\" stroke-width=\"2\" marker-end=\"url(#arrflow)\"\/>\n<p>  <!-- DECISION DIAMOND -->\n  <g id=\"diamond1\">\n    <polygon points=\"400,410 500,470 400,530 300,470\" fill=\"#FFE082\" stroke=\"#F57F17\" stroke-width=\"2\"\/>\n    <text x=\"400\" y=\"470\" text-anchor=\"middle\" font-weight=\"bold\" font-size=\"11\">Aliens<\/text>\n    <text x=\"400\" y=\"485\" text-anchor=\"middle\" font-weight=\"bold\" font-size=\"11\">Cleared?<\/text>\n  <\/g><\/p>\n<p>  <!-- YES path - Level Advance -->\n  <path d=\"M 500 470 L 620 470\" stroke=\"#4CAF50\" stroke-width=\"2\" marker-end=\"url(#arrflow)\"\/>\n  <text x=\"560\" y=\"460\" font-size=\"11\" font-weight=\"bold\" fill=\"#4CAF50\">YES<\/text><\/p>\n<p>  <rect x=\"620\" y=\"450\" width=\"140\" height=\"40\" fill=\"#4CAF50\" stroke=\"#2E7D32\" stroke-width=\"2\" rx=\"3\"\/>\n  <text x=\"690\" y=\"475\" text-anchor=\"middle\" font-weight=\"bold\" fill=\"white\" font-size=\"11\">LEVEL_ADVANCE<\/text><\/p>\n<path d=\"M 690 450 L 690 400\" stroke=\"#333\" stroke-width=\"2\" marker-end=\"url(#arrflow)\"\/>\n  <path d=\"M 690 400 L 200 400 L 200 100 L 300 100\" stroke=\"#333\" stroke-width=\"2\" marker-end=\"url(#arrflow)\"\/>\n<p>  <!-- NO path - Check Aliens Reached -->\n  <path d=\"M 400 530 L 400 570\" stroke=\"#d32f2f\" stroke-width=\"2\" marker-end=\"url(#arrdec)\"\/>\n  <text x=\"430\" y=\"555\" font-size=\"11\" font-weight=\"bold\" fill=\"#d32f2f\">NO<\/text><\/p>\n<p>  <!-- DECISION DIAMOND 2 -->\n  <g id=\"diamond2\">\n    <polygon points=\"400,570 500,630 400,690 300,630\" fill=\"#FFE082\" stroke=\"#F57F17\" stroke-width=\"2\"\/>\n    <text x=\"400\" y=\"625\" text-anchor=\"middle\" font-weight=\"bold\" font-size=\"10\">Aliens Reach<\/text>\n    <text x=\"400\" y=\"640\" text-anchor=\"middle\" font-weight=\"bold\" font-size=\"10\">Bottom?<\/text>\n  <\/g><\/p>\n<p>  <!-- YES - Game Over -->\n  <path d=\"M 500 630 L 620 630\" stroke=\"#F44336\" stroke-width=\"2\" marker-end=\"url(#arrflow)\"\/>\n  <text x=\"560\" y=\"620\" font-size=\"11\" font-weight=\"bold\" fill=\"#F44336\">YES<\/text><\/p>\n<p>  <rect x=\"620\" y=\"610\" width=\"140\" height=\"40\" fill=\"#F44336\" stroke=\"#C62828\" stroke-width=\"2\" rx=\"3\"\/>\n  <text x=\"690\" y=\"635\" text-anchor=\"middle\" font-weight=\"bold\" fill=\"white\" font-size=\"11\">GAME_OVER<\/text><\/p>\n<p>  <!-- NO - Continue loop -->\n  <path d=\"M 300 630 L 200 630 L 200 330 L 250 330\" stroke=\"#2196F3\" stroke-width=\"2\" marker-end=\"url(#arrflow)\"\/>\n  <text x=\"180\" y=\"480\" font-size=\"11\" font-weight=\"bold\" fill=\"#2196F3\">CONTINUE<\/text><\/p>\n<p>  <!-- Game Over -> Reset -->\n  <path d=\"M 690 650 L 690 750\" stroke=\"#333\" stroke-width=\"2\" marker-end=\"url(#arrflow)\"\/>\n<p>  <rect x=\"620\" y=\"750\" width=\"140\" height=\"50\" fill=\"#F44336\" stroke=\"#C62828\" stroke-width=\"2\" rx=\"3\"\/>\n  <text x=\"690\" y=\"770\" text-anchor=\"middle\" font-weight=\"bold\" fill=\"white\" font-size=\"11\">DISPLAY FINAL<\/text>\n  <text x=\"690\" y=\"788\" text-anchor=\"middle\" font-weight=\"bold\" fill=\"white\" font-size=\"11\">SCORE<\/text><\/p>\n<path d=\"M 690 800 L 690 850\" stroke=\"#333\" stroke-width=\"2\" marker-end=\"url(#arrflow)\"\/>\n<p>  <!-- Reset button input -->\n  <rect x=\"620\" y=\"850\" width=\"140\" height=\"50\" fill=\"#FF9800\" stroke=\"#E65100\" stroke-width=\"2\" rx=\"3\"\/>\n  <text x=\"690\" y=\"870\" text-anchor=\"middle\" font-weight=\"bold\" fill=\"white\" font-size=\"11\">WAIT FOR<\/text>\n  <text x=\"690\" y=\"888\" text-anchor=\"middle\" font-weight=\"bold\" fill=\"white\" font-size=\"11\">RESET<\/text><\/p>\n<path d=\"M 620 875 L 100 875 L 100 45 L 300 45\" stroke=\"#333\" stroke-width=\"2\" marker-end=\"url(#arrflow)\"\/>\n  <text x=\"150\" y=\"460\" font-size=\"10\" font-weight=\"bold\" fill=\"#333\">U button<\/text>\n<\/svg><\/p>\n<h2 style=\"color: #2196F3; border-left: 5px solid #2196F3; padding-left: 15px;\">Logic Components &#038; Concepts<\/h2>\n<h3 style=\"color: #1976D2; margin-top: 30px;\">Implementation Details<\/h3>\n<p style=\"font-size: 16px; line-height: 1.8;\">Space Force X requires multiple hardware modules working in concert. Each module has a specific responsibility and communicates with others through well-defined interfaces. This modular approach mirrors professional embedded system design.<\/p>\n<h3 style=\"color: #1976D2; margin-top: 30px;\">Building Blocks<\/h3>\n<div style=\"background: #E3F2FD; padding: 20px; border-radius: 5px; margin: 20px 0;\">\n<p style=\"font-size: 15px; line-height: 1.8;\"><strong>1. Input Handler Module<\/strong> \u2014 Receives PS\/2 scan codes, converts to ASCII, maintains key press registers. Output: key_left, key_right, key_fire, key_pause, key_reset signals.<\/p>\n<p style=\"font-size: 15px; line-height: 1.8;\"><strong>2. Game Logic Module<\/strong> \u2014 Processes movement, updates entity coordinates, manages game state. Combines: tank position updater, alien position updater, bullet position updater, scoring counter.<\/p>\n<p style=\"font-size: 15px; line-height: 1.8;\"><strong>3. Collision Detection Module<\/strong> \u2014 Compares bullet and alien positions every cycle, determines hits. Output: collision_detected, alien_to_remove, bullet_to_remove signals.<\/p>\n<p style=\"font-size: 15px; line-height: 1.8;\"><strong>4. Display Render Module<\/strong> \u2014 For each pixel (X,Y), determines correct color. Reads current entity positions from game logic, outputs 12-bit RGB color.<\/p>\n<p style=\"font-size: 15px; line-height: 1.8;\"><strong>5. VGA Timing Module<\/strong> \u2014 Generates horizontal and vertical sync signals, coordinates pixel clock with display refresh. Synchronizes display rendering to VGA standard.<\/p>\n<\/div>\n<h3 style=\"color: #1976D2; margin-top: 30px;\">Connecting Modules Together<\/h3>\n<p><svg viewBox=\"0 0 900 350\" style=\"border: 2px solid #333; width: 100%; margin: 20px 0; background: #f9f9f9;\">\n  <!-- Input Handler -->\n  <rect x=\"20\" y=\"80\" width=\"120\" height=\"80\" fill=\"#FF5722\" stroke=\"#333\" stroke-width=\"2\" rx=\"5\"\/>\n  <text x=\"80\" y=\"105\" text-anchor=\"middle\" font-weight=\"bold\" fill=\"white\" font-size=\"12\">INPUT<\/text>\n  <text x=\"80\" y=\"122\" text-anchor=\"middle\" fill=\"white\" font-size=\"11\">Handler<\/text>\n  <text x=\"80\" y=\"135\" text-anchor=\"middle\" fill=\"white\" font-size=\"10\">Keyboard<\/text>\n  <text x=\"80\" y=\"148\" text-anchor=\"middle\" fill=\"white\" font-size=\"10\">Buttons<\/text><\/p>\n<p>  <!-- Game Logic -->\n  <rect x=\"200\" y=\"40\" width=\"140\" height=\"160\" fill=\"#2196F3\" stroke=\"#333\" stroke-width=\"2\" rx=\"5\"\/>\n  <text x=\"270\" y=\"65\" text-anchor=\"middle\" font-weight=\"bold\" fill=\"white\" font-size=\"12\">GAME<\/text>\n  <text x=\"270\" y=\"80\" text-anchor=\"middle\" font-weight=\"bold\" fill=\"white\" font-size=\"12\">LOGIC<\/text>\n  <text x=\"270\" y=\"100\" text-anchor=\"middle\" fill=\"white\" font-size=\"10\">FSM, Position<\/text>\n  <text x=\"270\" y=\"115\" text-anchor=\"middle\" fill=\"white\" font-size=\"10\">Updates, Score<\/text>\n  <text x=\"270\" y=\"130\" text-anchor=\"middle\" fill=\"white\" font-size=\"10\">Management<\/text>\n  <text x=\"270\" y=\"145\" text-anchor=\"middle\" fill=\"white\" font-size=\"10\">Movement<\/text>\n  <text x=\"270\" y=\"160\" text-anchor=\"middle\" fill=\"white\" font-size=\"10\">Logic<\/text>\n  <text x=\"270\" y=\"175\" text-anchor=\"middle\" fill=\"white\" font-size=\"10\">State Control<\/text><\/p>\n<p>  <!-- Collision Detection -->\n  <rect x=\"420\" y=\"80\" width=\"130\" height=\"80\" fill=\"#FF9800\" stroke=\"#333\" stroke-width=\"2\" rx=\"5\"\/>\n  <text x=\"485\" y=\"105\" text-anchor=\"middle\" font-weight=\"bold\" fill=\"white\" font-size=\"12\">COLLISION<\/text>\n  <text x=\"485\" y=\"122\" text-anchor=\"middle\" font-weight=\"bold\" fill=\"white\" font-size=\"12\">DETECT<\/text>\n  <text x=\"485\" y=\"138\" text-anchor=\"middle\" fill=\"white\" font-size=\"10\">Hit Logic<\/text>\n  <text x=\"485\" y=\"151\" text-anchor=\"middle\" fill=\"white\" font-size=\"10\">Score Inc<\/text><\/p>\n<p>  <!-- Display Render -->\n  <rect x=\"620\" y=\"80\" width=\"130\" height=\"80\" fill=\"#4CAF50\" stroke=\"#333\" stroke-width=\"2\" rx=\"5\"\/>\n  <text x=\"685\" y=\"105\" text-anchor=\"middle\" font-weight=\"bold\" fill=\"white\" font-size=\"12\">DISPLAY<\/text>\n  <text x=\"685\" y=\"122\" text-anchor=\"middle\" font-weight=\"bold\" fill=\"white\" font-size=\"12\">RENDER<\/text>\n  <text x=\"685\" y=\"138\" text-anchor=\"middle\" fill=\"white\" font-size=\"10\">Pixel Color<\/text>\n  <text x=\"685\" y=\"151\" text-anchor=\"middle\" fill=\"white\" font-size=\"10\">Selection<\/text><\/p>\n<p>  <!-- VGA Timing -->\n  <rect x=\"795\" y=\"120\" width=\"85\" height=\"60\" fill=\"#9C27B0\" stroke=\"#333\" stroke-width=\"2\" rx=\"5\"\/>\n  <text x=\"837\" y=\"140\" text-anchor=\"middle\" font-weight=\"bold\" fill=\"white\" font-size=\"11\">VGA<\/text>\n  <text x=\"837\" y=\"155\" text-anchor=\"middle\" font-weight=\"bold\" fill=\"white\" font-size=\"11\">SYNC<\/text>\n  <text x=\"837\" y=\"168\" text-anchor=\"middle\" fill=\"white\" font-size=\"9\">Timing<\/text><\/p>\n<p>  <!-- Data Flow Arrows -->\n  <defs><marker id=\"dataarr\" markerWidth=\"10\" markerHeight=\"10\" refX=\"9\" refY=\"3\" orient=\"auto\"><polygon points=\"0 0, 10 3, 0 6\" fill=\"#333\"\/><\/marker><\/defs><\/p>\n<p>  <!-- Input -> Game Logic -->\n  <path d=\"M 140 120 L 200 120\" stroke=\"#333\" stroke-width=\"2\" marker-end=\"url(#dataarr)\"\/>\n  <text x=\"165\" y=\"110\" font-size=\"10\" fill=\"#333\">Keys<\/text><\/p>\n<p>  <!-- Game Logic -> Collision -->\n  <path d=\"M 340 120 L 420 120\" stroke=\"#333\" stroke-width=\"2\" marker-end=\"url(#dataarr)\"\/>\n  <text x=\"375\" y=\"110\" font-size=\"10\" fill=\"#333\">Positions<\/text><\/p>\n<p>  <!-- Collision -> Game Logic (feedback) -->\n  <path d=\"M 485 160 L 270 200\" stroke=\"#999\" stroke-width=\"2\" stroke-dasharray=\"4,4\" marker-end=\"url(#dataarr)\"\/>\n  <text x=\"350\" y=\"185\" font-size=\"10\" fill=\"#666\">Hit Info<\/text><\/p>\n<p>  <!-- Game Logic -> Display -->\n  <path d=\"M 340 120 L 620 120\" stroke=\"#333\" stroke-width=\"2\" marker-end=\"url(#dataarr)\"\/>\n  <text x=\"480\" y=\"110\" font-size=\"10\" fill=\"#333\">Entity Coords<\/text><\/p>\n<p>  <!-- Display -> VGA (pixel data) -->\n  <path d=\"M 750 120 L 795 120\" stroke=\"#333\" stroke-width=\"2\" marker-end=\"url(#dataarr)\"\/>\n  <text x=\"768\" y=\"110\" font-size=\"9\" fill=\"#333\">RGB<\/text><\/p>\n<p>  <!-- Feedback from VGA to Display -->\n  <path d=\"M 837 120 L 750 100\" stroke=\"#999\" stroke-width=\"2\" stroke-dasharray=\"4,4\" marker-end=\"url(#dataarr)\"\/>\n  <text x=\"795\" y=\"95\" font-size=\"9\" fill=\"#666\">H\/V Sync<\/text><\/p>\n<p>  <!-- Output to display -->\n  <rect x=\"620\" y=\"200\" width=\"130\" height=\"50\" fill=\"#E0E0E0\" stroke=\"#333\" stroke-width=\"2\" rx=\"5\"\/>\n  <text x=\"685\" y=\"220\" text-anchor=\"middle\" font-weight=\"bold\" fill=\"#333\" font-size=\"12\">VGA MONITOR<\/text>\n  <text x=\"685\" y=\"240\" text-anchor=\"middle\" fill=\"#333\" font-size=\"11\">640\u00d7480 Display<\/text><\/p>\n<path d=\"M 685 160 L 685 200\" stroke=\"#333\" stroke-width=\"2\" marker-end=\"url(#dataarr)\"\/>\n  <text x=\"705\" y=\"180\" font-size=\"10\" fill=\"#333\">Output<\/text>\n<\/svg><\/p>\n<h3 style=\"color: #1976D2; margin-top: 30px;\">Working of Main Modules<\/h3>\n<p style=\"font-size: 16px; line-height: 1.8;\"><strong>Input Handler Module Operation:<\/strong> The PS\/2 keyboard port sends data serially: one start bit, 8 data bits (the scan code), one parity bit, and one stop bit, all synchronized to a keyboard clock line. The input handler captures these bits into a shift register. When a complete byte is received (verified by parity check), it&#8217;s converted to ASCII. The ASCII value is latched into registers for key_left, key_right, key_fire, etc. These registers persist until a key-release code is received, allowing continuous key sensing.<\/p>\n<p style=\"font-size: 16px; line-height: 1.8;\"><strong>Game Logic Module Operation:<\/strong> Every clock cycle, the game logic checks the current FSM state. In PLAYING states, it reads the input registers (key_left, key_right, key_fire). If key_left is asserted and tank_x > 0, it decrements tank_x by 4. If key_right is asserted and tank_x < 600, it increments tank_x by 4. If key_fire is asserted and no bullet currently exists, it creates a new bullet at the current tank_x position. Alien positions are decremented every 8 clock cycles (using a modulo-8 counter). Score is incremented by the collision detection module's collision_increment signal.<\/p>\n<p style=\"font-size: 16px; line-height: 1.8;\"><strong>Collision Detection Module Operation:<\/strong> This module is purely combinational\u2014it needs no clock or state. Every clock cycle, it simultaneously compares every bullet position against every alien position. The logic is: for each bullet-alien pair, if (bullet_x within \u00b110 of alien_x) AND (bullet_y >= alien_y AND bullet_y <= alien_y+20), then collision = true. When a collision is found, the module sets collision_detected=1 and outputs the IDs of the bullet and alien to remove. The game logic module then removes these entities in the next clock cycle.<\/p>\n<h3 style=\"color: #1976D2; margin-top: 30px;\">Obstacle &#038; Collision Detection<\/h3>\n<p style=\"font-size: 16px; line-height: 1.8;\"><strong>Collision Algorithm:<\/strong> The collision detection uses a distance-based approach for circular objects (aliens) and rectangular boundary checking for the tank. For each bullet (modeled as a 2D point), the algorithm checks every alien (modeled as a circle with radius 10 pixels). The collision condition is:<\/p>\n<pre style=\"background: #f4f4f4; padding: 15px; border-left: 4px solid #FF9800; overflow-x: auto; font-size: 13px; margin: 15px 0;\">\n<code>collision = (|bullet_x - alien_x| &lt; 10) AND (bullet_y &gt;= alien_y) AND (bullet_y &lt;= alien_y + 20)<\/code>\n<\/pre>\n<p style=\"font-size: 16px; line-height: 1.8;\"><strong>Boundary Detection:<\/strong> The tank cannot move beyond X=0 or X=600 (leaving a 40-pixel margin from the 640-pixel width). This is enforced by the game logic: before updating tank_x, it checks boundaries.<\/p>\n<pre style=\"background: #f4f4f4; padding: 15px; border-left: 4px solid #FF9800; overflow-x: auto; font-size: 13px; margin: 15px 0;\">\n<code>if (key_left AND tank_x > 0) then tank_x &lt;= tank_x - 4\nif (key_right AND tank_x < 600) then tank_x &lt;= tank_x + 4<\/code>\n<\/pre>\n<p style=\"font-size: 16px; line-height: 1.8;\"><strong>Alien Reach Detection:<\/strong> After each alien position update, the game logic checks if any alien has reached Y >= 450. If so, the aliens_reached_bottom signal is asserted, triggering the FSM transition to GAME_OVER.<\/p>\n<h3 style=\"color: #1976D2; margin-top: 30px;\">Working of Main Idea with Pseudocode<\/h3>\n<p style=\"font-size: 16px; line-height: 1.8;\"><strong>Core Game Loop Pseudocode:<\/strong><\/p>\n<pre style=\"background: #263238; color: #aed581; padding: 20px; border-radius: 5px; overflow-x: auto; font-size: 12px; line-height: 1.6; margin: 15px 0;\">\n<code>\/\/ ===== MAIN GAME LOOP (executes every clock cycle) =====\n\nif (current_state == PLAYING_LEVEL_1 OR current_state == PLAYING_LEVEL_2) then\n  \n  \/\/ ===== INPUT PROCESSING =====\n  if (key_left AND tank_x > 0) then\n    tank_x &lt;= tank_x - 4\n  else if (key_right AND tank_x < 600) then\n    tank_x &lt;= tank_x + 4\n  end if\n  \n  if (key_fire AND bullet_count < MAX_BULLETS) then\n    create_bullet(tank_x, 420)\n    bullet_count &lt;= bullet_count + 1\n  end if\n  \n  \/\/ ===== POSITION UPDATES =====\n  for each active_bullet do\n    bullet.y &lt;= bullet.y - BULLET_SPEED\n    if (bullet.y < 0) then\n      destroy_bullet()\n    end if\n  end for\n  \n  \/\/ Alien movement (every 8 cycles)\n  alien_move_counter &lt;= alien_move_counter + 1\n  if (alien_move_counter == 8) then\n    for each active_alien do\n      alien.y &lt;= alien.y + ALIEN_SPEED\n    end for\n    alien_move_counter &lt;= 0\n  end if\n  \n  \/\/ ===== COLLISION DETECTION (Combinational) =====\n  for each bullet in bullets do\n    for each alien in aliens do\n      if (collision_detected(bullet, alien)) then\n        mark_bullet_for_removal(bullet)\n        mark_alien_for_removal(alien)\n        score &lt;= score + 100\n      end if\n    end for\n  end for\n  \n  \/\/ Remove marked entities\n  remove_all_marked_bullets()\n  remove_all_marked_aliens()\n  \n  \/\/ ===== WIN\/LOSE CONDITION CHECKS =====\n  if (aliens_cleared) then\n    FSM_state &lt;= LEVEL_ADVANCE\n  end if\n  \n  if (aliens_reached_bottom) then\n    lives &lt;= lives - 1\n    if (lives == 0) then\n      FSM_state &lt;= GAME_OVER\n    else\n      reset_level()\n    end if\n  end if\n  \nend if\n<\/code>\n<\/pre>\n<h3 style=\"color: #1976D2; margin-top: 30px;\">Rendering Display and Logic Implementation<\/h3>\n<p style=\"font-size: 16px; line-height: 1.8;\"><strong>Display Rendering Pipeline:<\/strong> The VGA module generates pixel coordinates (pixel_x, pixel_y) as it scans the display. For each coordinate, the render module determines the correct color to display. This is a purely combinational process \u2014 no registers, no state, just logic gates making instant decisions.<\/p>\n<pre style=\"background: #f4f4f4; padding: 15px; border-left: 4px solid #FF9800; overflow-x: auto; font-size: 12px; margin: 15px 0; line-height: 1.5;\">\n<code>\/\/ ===== DISPLAY RENDERING (Combinational - no clock) =====\n\nassign pixel_color = (is_in_score_bar) ? render_score_text :\n                     (is_in_tank) ? BLUE :\n                     (is_in_bullet) ? WHITE :\n                     (is_in_alien) ? PINK :\n                     BLACK;\n\n\/\/ ===== Detailed Pixel Decision Logic =====\n\nwire is_in_tank = (pixel_x >= tank_x) AND (pixel_x <= tank_x + 40) AND\n                  (pixel_y >= 450) AND (pixel_y <= 480);\n\nwire is_in_bullet = distance(pixel_x, pixel_y, bullet_x, bullet_y) < 2;\n\nwire is_in_alien = distance(pixel_x, pixel_y, alien_x, alien_y) < 15;\n\n\/\/ ===== Color Definitions =====\nparameter BLUE = 12'b0000_1111_1111;\nparameter PINK = 12'b1111_0000_1111;\nparameter WHITE = 12'b1111_1111_1111;\nparameter BLACK = 12'b0000_0000_0000;\nparameter GREEN_TEXT = 12'b0000_1111_0000;<\/code>\n<\/pre>\n<h3 style=\"color: #1976D2; margin-top: 30px;\">Key Algorithms<\/h3>\n<ul style=\"font-size: 15px; line-height: 2;\">\n<li><strong>Debounce Algorithm:<\/strong> Counter-based debounce using 20ms wait. Prevents noise from switch bouncing from generating multiple input events.<\/li>\n<li><strong>Collision Detection Algorithm:<\/strong> O(n\u00d7m) brute-force comparison of all bullets against all aliens. Acceptable because n,m are small (\u226420 each).<\/li>\n<li><strong>Movement Update Algorithm:<\/strong> Position-based movement using registers. Each entity stores X,Y coordinates as integers. Movement is calculated as: new_position = old_position \u00b1 speed.<\/li>\n<li><strong>FSM State Machine Algorithm:<\/strong> Mealy machine with current state register and next state combinatorial logic. Transitions occur on clock edges.<\/li>\n<li><strong>Pixel Rendering Algorithm:<\/strong> Hierarchical color selection using nested ternary operators. Evaluates entity containment in priority order: score bar \u2192 tank \u2192 bullets \u2192 aliens \u2192 background.<\/li>\n<\/ul>\n<h3 style=\"color: #1976D2; margin-top: 30px;\">Complex Logic<\/h3>\n<p style=\"font-size: 16px; line-height: 1.8;\"><strong>Multi-entity Collision System:<\/strong> The most complex logic is the simultaneous collision detection across all bullet-alien pairs. With up to 20 bullets and 24 aliens, this requires 480 parallel comparisons each clock cycle. Rather than sequential checking, the hardware performs all comparisons instantly using combinational logic. If any pair collides, the collision signals are asserted immediately.<\/p>\n<p style=\"font-size: 16px; line-height: 1.8;\"><strong>Synchronized Display Pipeline:<\/strong> The display rendering must stay perfectly synchronized with the VGA timing signals. The VGA module generates Hsync (horizontal) and Vsync (vertical) signals at precise intervals. The pixel colors must be valid at exactly the right time. Any timing violation causes visual artifacts (tearing, flickering). This synchronization is achieved through careful clock domain management and pipelining.<\/p>\n<p style=\"font-size: 16px; line-height: 1.8;\"><strong>State Transition Logic:<\/strong> The FSM transition logic must handle multiple simultaneous conditions. For example, in PLAYING_LEVEL_1, the next state depends on: aliens_cleared, aliens_reached_bottom, lives_remaining, and pause_button. The combinational logic must evaluate all conditions and select the correct next state. Priority is encoded through the case statement order.<\/p>\n<h2 style=\"color: #2196F3; border-left: 5px solid #2196F3; padding-left: 15px;\">Expected Screen Outputs<\/h2>\n<p><svg viewBox=\"0 0 640 480\" style=\"border: 3px solid #333; width: 100%; max-width: 640px; margin: 20px auto; background: #000;\">\n  <!-- Score bar -->\n  <rect x=\"0\" y=\"0\" width=\"640\" height=\"30\" fill=\"#1a1a2e\"\/>\n  <text x=\"20\" y=\"20\" fill=\"#00ff00\" font-size=\"13\" font-family=\"monospace\">Score: 1500  |  Level: 1  |  Lives: 3<\/text><\/p>\n<p>  <!-- Alien rows -->\n  <circle cx=\"50\" cy=\"60\" r=\"10\" fill=\"#ff1493\"\/><circle cx=\"110\" cy=\"60\" r=\"10\" fill=\"#ff1493\"\/><circle cx=\"170\" cy=\"60\" r=\"10\" fill=\"#ff1493\"\/><circle cx=\"230\" cy=\"60\" r=\"10\" fill=\"#ff1493\"\/><circle cx=\"290\" cy=\"60\" r=\"10\" fill=\"#ff1493\"\/><circle cx=\"350\" cy=\"60\" r=\"10\" fill=\"#ff1493\"\/><circle cx=\"410\" cy=\"60\" r=\"10\" fill=\"#ff1493\"\/><circle cx=\"470\" cy=\"60\" r=\"10\" fill=\"#ff1493\"\/><circle cx=\"530\" cy=\"60\" r=\"10\" fill=\"#ff1493\"\/><circle cx=\"590\" cy=\"60\" r=\"10\" fill=\"#ff1493\"\/><\/p>\n<p>  <circle cx=\"50\" cy=\"110\" r=\"10\" fill=\"#ff1493\"\/><circle cx=\"110\" cy=\"110\" r=\"10\" fill=\"#ff1493\"\/><circle cx=\"170\" cy=\"110\" r=\"10\" fill=\"#ff1493\"\/><circle cx=\"230\" cy=\"110\" r=\"10\" fill=\"#ff1493\"\/><circle cx=\"290\" cy=\"110\" r=\"10\" fill=\"#ff1493\"\/><circle cx=\"350\" cy=\"110\" r=\"10\" fill=\"#ff1493\"\/><circle cx=\"410\" cy=\"110\" r=\"10\" fill=\"#ff1493\"\/><circle cx=\"470\" cy=\"110\" r=\"10\" fill=\"#ff1493\"\/><circle cx=\"530\" cy=\"110\" r=\"10\" fill=\"#ff1493\"\/><circle cx=\"590\" cy=\"110\" r=\"10\" fill=\"#ff1493\"\/><\/p>\n<p>  <circle cx=\"50\" cy=\"160\" r=\"10\" fill=\"#ff1493\"\/><circle cx=\"110\" cy=\"160\" r=\"10\" fill=\"#ff1493\"\/><circle cx=\"170\" cy=\"160\" r=\"10\" fill=\"#ff1493\"\/><circle cx=\"230\" cy=\"160\" r=\"10\" fill=\"#ff1493\"\/><circle cx=\"290\" cy=\"160\" r=\"10\" fill=\"#ff1493\"\/><circle cx=\"350\" cy=\"160\" r=\"10\" fill=\"#ff1493\"\/><circle cx=\"410\" cy=\"160\" r=\"10\" fill=\"#ff1493\"\/><circle cx=\"470\" cy=\"160\" r=\"10\" fill=\"#ff1493\"\/><circle cx=\"530\" cy=\"160\" r=\"10\" fill=\"#ff1493\"\/><circle cx=\"590\" cy=\"160\" r=\"10\" fill=\"#ff1493\"\/><\/p>\n<p>  <!-- Bullets in flight -->\n  <line x1=\"100\" y1=\"400\" x2=\"100\" y2=\"220\" stroke=\"#ffffff\" stroke-width=\"2\"\/>\n  <line x1=\"320\" y1=\"350\" x2=\"320\" y2=\"100\" stroke=\"#ffffff\" stroke-width=\"2\"\/>\n<p>  <!-- Tank -->\n  <rect x=\"300\" y=\"430\" width=\"40\" height=\"30\" fill=\"#0066ff\"\/>\n  <rect x=\"305\" y=\"420\" width=\"30\" height=\"10\" fill=\"#0066ff\"\/><\/p>\n<p>  <!-- Border -->\n  <rect x=\"0\" y=\"30\" width=\"640\" height=\"450\" fill=\"none\" stroke=\"#00ff00\" stroke-width=\"1\"\/>\n<\/svg><\/p>\n<h2 style=\"color: #2196F3; border-left: 5px solid #2196F3; padding-left: 15px;\">Difficulty Progression<\/h2>\n<table style=\"width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 14px;\">\n<tr style=\"background: #2196F3; color: white;\">\n<th style=\"border: 1px solid #1565C0; padding: 12px;\"><strong>Level<\/strong><\/th>\n<th style=\"border: 1px solid #1565C0; padding: 12px;\"><strong>Alien Formation<\/strong><\/th>\n<th style=\"border: 1px solid #1565C0; padding: 12px;\"><strong>Alien Speed<\/strong><\/th>\n<th style=\"border: 1px solid #1565C0; padding: 12px;\"><strong>Bullet Speed<\/strong><\/th>\n<th style=\"border: 1px solid #1565C0; padding: 12px;\"><strong>Difficulty Curve<\/strong><\/th>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #ddd; padding: 12px;\"><strong>Level 1<\/strong><\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">8\u00d73 = 24 aliens<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">2 px\/cycle, every 8 cycles<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">5 px\/cycle upward<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">\u2b50 Introductory<\/td>\n<\/tr>\n<tr style=\"background: #f9f9f9;\">\n<td style=\"border: 1px solid #ddd; padding: 12px;\"><strong>Level 2<\/strong><\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">8\u00d73 = 24 aliens<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">4 px\/cycle, every 5 cycles<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">6 px\/cycle upward<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">\u2b50\u2b50 Moderate<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #ddd; padding: 12px;\"><strong>Level 3+ (Future)<\/strong><\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">10\u00d74 = 40 aliens<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">6 px\/cycle, every 3 cycles<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">7 px\/cycle upward<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">\u2b50\u2b50\u2b50 Challenging<\/td>\n<\/tr>\n<\/table>\n<h2 style=\"color: #2196F3; border-left: 5px solid #2196F3; padding-left: 15px;\">Key Hardware Utilization<\/h2>\n<table style=\"width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 14px;\">\n<tr style=\"background: #4CAF50; color: white;\">\n<th style=\"border: 1px solid #2E7D32; padding: 12px;\"><strong>Resource<\/strong><\/th>\n<th style=\"border: 1px solid #2E7D32; padding: 12px;\"><strong>Usage<\/strong><\/th>\n<th style=\"border: 1px solid #2E7D32; padding: 12px;\"><strong>Available (Basys3)<\/strong><\/th>\n<th style=\"border: 1px solid #2E7D32; padding: 12px;\"><strong>% Utilized<\/strong><\/th>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #ddd; padding: 12px;\"><strong>LUT (Look-Up Tables)<\/strong><\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">~3,600<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">20,800<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">17%<\/td>\n<\/tr>\n<tr style=\"background: #f9f9f9;\">\n<td style=\"border: 1px solid #ddd; padding: 12px;\"><strong>FF (Flip-Flops\/Registers)<\/strong><\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">~400<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">41,600<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">1%<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #ddd; padding: 12px;\"><strong>IO Blocks<\/strong><\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">~25<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">210<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">12%<\/td>\n<\/tr>\n<tr style=\"background: #f9f9f9;\">\n<td style=\"border: 1px solid #ddd; padding: 12px;\"><strong>BUFG (Global Buffers)<\/strong><\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">~8<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">32<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">25%<\/td>\n<\/tr>\n<\/table>\n<p style=\"background: #FFF3E0; padding: 15px; border-left: 4px solid #FF9800; border-radius: 4px; margin: 20px 0;\"><strong>LUT Usage Breakdown:<\/strong> Collision detection logic uses ~40%, Display rendering uses ~35%, Game logic\/FSM uses ~25%. The project is resource-efficient, leaving 83% of LUTs available for enhancements.<\/p>\n<h2 style=\"color: #2196F3; border-left: 5px solid #2196F3; padding-left: 15px;\">8-Week Implementation Breakdown<\/h2>\n<table style=\"width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 13px;\">\n<tr style=\"background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white;\">\n<th style=\"border: 1px solid #555; padding: 12px;\"><strong>Week<\/strong><\/th>\n<th style=\"border: 1px solid #555; padding: 12px;\"><strong>Module<\/strong><\/th>\n<th style=\"border: 1px solid #555; padding: 12px;\"><strong>Tasks<\/strong><\/th>\n<th style=\"border: 1px solid #555; padding: 12px;\"><strong>Deliverables<\/strong><\/th>\n<th style=\"border: 1px solid #555; padding: 12px;\"><strong>Est. Hours<\/strong><\/th>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #ddd; padding: 12px;\"><strong>Week 1<\/strong><\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">VGA Timing & Sync<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">\n\u2022 Study VGA standard timing<br \/>\n\u2022 Implement horizontal sync generator<br \/>\n\u2022 Implement vertical sync generator<br \/>\n\u2022 Implement pixel counter\n<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">Working VGA sync signals verified with oscilloscope<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">20<\/td>\n<\/tr>\n<tr style=\"background: #f9f9f9;\">\n<td style=\"border: 1px solid #ddd; padding: 12px;\"><strong>Week 2<\/strong><\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">Display Color Output<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">\n\u2022 Implement color ROM\/combinational logic<br \/>\n\u2022 Connect 12-bit RGB to VGA DAC<br \/>\n\u2022 Display solid colors (test pattern)<br \/>\n\u2022 Test on monitor\n<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">Colored rectangles displaying on monitor, no artifacts<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">18<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #ddd; padding: 12px;\"><strong>Week 3<\/strong><\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">Keyboard Input<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">\n\u2022 Study PS\/2 protocol<br \/>\n\u2022 Implement PS\/2 receiver<br \/>\n\u2022 Implement scan code to ASCII converter<br \/>\n\u2022 Add debounce circuit<br \/>\n\u2022 Test key detection\n<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">LEDs on FPGA board toggle with key presses<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">22<\/td>\n<\/tr>\n<tr style=\"background: #f9f9f9;\">\n<td style=\"border: 1px solid #ddd; padding: 12px;\"><strong>Week 4<\/strong><\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">Entity Rendering<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">\n\u2022 Implement tank sprite rendering<br \/>\n\u2022 Implement alien sprite rendering<br \/>\n\u2022 Implement bullet rendering<br \/>\n\u2022 Test all sprites on display\n<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">Tank, aliens, bullets visible on screen in correct colors<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">20<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #ddd; padding: 12px;\"><strong>Week 5<\/strong><\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">Entity Movement<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">\n\u2022 Implement tank movement logic<br \/>\n\u2022 Implement bullet movement<br \/>\n\u2022 Implement alien movement with counter<br \/>\n\u2022 Test smooth animation\n<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">Tank moves smoothly with A\/D keys, aliens descend, bullets ascend<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">18<\/td>\n<\/tr>\n<tr style=\"background: #f9f9f9;\">\n<td style=\"border: 1px solid #ddd; padding: 12px;\"><strong>Week 6<\/strong><\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">Collision Detection<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">\n\u2022 Implement collision comparator<br \/>\n\u2022 Test bullet-alien collision<br \/>\n\u2022 Test entity removal on hit<br \/>\n\u2022 Verify no false positives\n<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">Hitting aliens removes them, scoring works correctly<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">20<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #ddd; padding: 12px;\"><strong>Week 7<\/strong><\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">FSM & Game Logic<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">\n\u2022 Implement FSM state machine<br \/>\n\u2022 Implement game state transitions<br \/>\n\u2022 Implement win\/lose conditions<br \/>\n\u2022 Implement pause\/resume<br \/>\n\u2022 Test all state paths\n<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">Complete game flow: start \u2192 play \u2192 advance\/game over \u2192 reset<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">22<\/td>\n<\/tr>\n<tr style=\"background: #f9f9f9;\">\n<td style=\"border: 1px solid #ddd; padding: 12px;\"><strong>Week 8<\/strong><\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">Polish & Optimize<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">\n\u2022 Score\/Lives display<br \/>\n\u2022 Level indicator<br \/>\n\u2022 Game over screen<br \/>\n\u2022 Edge case testing<br \/>\n\u2022 Performance optimization<br \/>\n\u2022 Demo & documentation\n<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">Fully playable game, documentation complete, ready for showcase<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">16<\/td>\n<\/tr>\n<\/table>\n<p style=\"background: #E8F5E9; padding: 15px; border-left: 4px solid #4CAF50; border-radius: 4px; margin: 20px 0;\"><strong>Total Implementation Time:<\/strong> ~156 hours spread over 8 weeks. This includes design, coding, testing, debugging, and iteration.<\/p>\n<hr style=\"margin: 40px 0; border: none; border-top: 3px solid #4CAF50;\"\/>\n<p style=\"text-align: center; color: #666; font-size: 14px; margin: 30px 0;\"><em>End of Project 1 detailed guide. Projects 2-8 coming with equal comprehensive documentation.<\/em><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Complete detailed guide for Space Force X: Disaster Strikes with filled FSM diagrams, game flow diagrams, collision detection logic, rendering implementation, pseudocode, mock screens, and 8-week breakdown.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":0,"footnotes":"","_yoast_wpseo_title":"","_yoast_wpseo_metadesc":"","_yoast_wpseo_focuskw":"","rank_math_title":"","rank_math_description":"","rank_math_focus_keyword":"","_dpc-meta-title":"","_dpc-meta-description":"","_dpc-keyword":""},"categories":[68],"tags":[70,80,81,69,74,73,75,78,71],"class_list":["post-323","post","type-post","status-publish","format-standard","hentry","category-projects","tag-basys3","tag-collision-detection","tag-educational","tag-fpga","tag-fsm","tag-game-development","tag-hardware-design","tag-space-force-x","tag-verilog"],"_links":{"self":[{"href":"https:\/\/bugzyard.com\/index.php\/wp-json\/wp\/v2\/posts\/323","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bugzyard.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bugzyard.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bugzyard.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bugzyard.com\/index.php\/wp-json\/wp\/v2\/comments?post=323"}],"version-history":[{"count":0,"href":"https:\/\/bugzyard.com\/index.php\/wp-json\/wp\/v2\/posts\/323\/revisions"}],"wp:attachment":[{"href":"https:\/\/bugzyard.com\/index.php\/wp-json\/wp\/v2\/media?parent=323"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bugzyard.com\/index.php\/wp-json\/wp\/v2\/categories?post=323"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bugzyard.com\/index.php\/wp-json\/wp\/v2\/tags?post=323"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}