拨码开关控制LED灯/*-------------------------------------------------------- -- Engineer: zhrscut -- Create Date: -- Module Name: -- Tool Versions: Quartus_II 9.1 -- 欢迎加入 EEPW ,FPGA 开发板 DIY 活动 --------------------------------------------------------*/ module switch_key(clk,led,key); input clk; input[1:0] key; output[7:0] led; reg[7:0] led_r; always @(posedge clk) begin if(key==0) led_r else if(key==1) led_r else if(key==2) led_r else led_r end assign led=led_r; endmodule ……