1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| .v 文件 module sp6( input ext_clk_25m, input ext_rst_n, input[3:0] switch, output reg[7:0] led );
always @ (posedge ext_clk_25m or negedge ext_rst_n) if(!ext_rst_n) led <= 8'hff; else begin case(switch[2:0]) 3'b111: led <= 8'b1111_1111; 3'b110: led <= 8'b1111_1110; 3'b101: led <= 8'b1111_1101; 3'b100: led <= 8'b1111_1011; 3'b011: led <= 8'b1111_0111; 3'b010: led <= 8'b1110_1111; 3'b001: led <= 8'b1101_1111; 3'b000: led <= 8'b1011_1111; endcase end
endmodule
|