程式碼
unknown
abap
3 years ago
501 B
17
Indexable
//ex3 module lab9ex3(seg,dig,key); input [6:1]key; output reg[7:0]seg; output reg[7:0]dig; reg [3:0]value; always@(negedge key[3]&key[6]) begin dig=8'b00000000; if(key[3]==0) value<=value+1; if(key[6]==0||value==4'b1010) value<=0; case(value) 4'h1:seg=8'hf9; 4'h2:seg=8'ha4; 4'h3:seg=8'hb0; 4'h4:seg=8'h99; 4'h5:seg=8'h92; 4'h6:seg=8'h82; 4'h7:seg=8'hf8; 4'h8:seg=8'h80; 4'h9:seg=8'h90; default:seg=8'hc0; endcase end endmodule
Editor is loading...