Skip to content

Instantly share code, notes, and snippets.

@cs8425
Created April 14, 2012 10:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cs8425/2383514 to your computer and use it in GitHub Desktop.
Save cs8425/2383514 to your computer and use it in GitHub Desktop.
2bit_to_8LED
module led8( select, d );
input[2:0] select;
output[7:0] d;
wire[2:0] select;
reg[7:0] d;
always @( select or d )
begin
d = 8'b00000000; //全部關掉後再開啟單顆
case( select )
0 : d[0] = 1;
1 : d[1] = 1;
2 : d[2] = 1;
3 : d[3] = 1;
4 : d[4] = 1;
5 : d[5] = 1;
6 : d[6] = 1;
7 : d[7] = 1;
endcase
end
endmodule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment