If-else in always blocks
📖 Scenario: You are designing a simple digital circuit that controls an LED based on a switch input. The LED should turn on when the switch is pressed and turn off when it is not pressed.
🎯 Goal: Build a Verilog module that uses an always block with if-else statements to control an LED output based on a switch input.
📋 What You'll Learn
Create a module named
led_control with inputs and outputsUse an
always block triggered by the switch inputUse
if-else inside the always block to set the LED outputPrint the LED output value at the end
💡 Why This Matters
🌍 Real World
Controlling LEDs or other devices based on input signals is common in digital electronics and embedded systems.
💼 Career
Understanding if-else in always blocks is essential for hardware design engineers working with FPGA or ASIC development.
Progress0 / 4 steps