|
- module main( //十六进制共阴数码管段码译码器
- input A, //地址A(低位)
- input B, //地址B
- input C, //地址C
- input D, //地址D(高位)
- input H, //小数点
- output QA, //段码A
- output QB, //段码B
- output QC, //段码C
- output QD, //段码D
- output QE, //段码E
- output QF, //段码F
- output QG, //段码G
- output QH //段码(小数点)
- );
- assign QH = H;
- function [6:0] display; //7段16进制共阴数码管段码查询
- input [3:0] hex;
- begin
- case(hex)
- 4'h0:display = 7'h3F;
- 4'h1:display = 7'h06;
- 4'h2:display = 7'h5B;
- 4'h3:display = 7'h4F;
- 4'h4:display = 7'h66;
- 4'h5:display = 7'h6D;
- 4'h6:display = 7'h7D;
- 4'h7:display = 7'h07;
- 4'h8:display = 7'h7F;
- 4'h9:display = 7'h6F;
- 4'hA:display = 7'h77;
- 4'hB:display = 7'h7C;
- 4'hC:display = 7'h39;
- 4'hD:display = 7'h5E;
- 4'hE:display = 7'h79;
- 4'hF:display = 7'h71;
- endcase
- end
- endfunction
- assign {QG,QF,QE,QD,QC,QB,QA} = display({D,C,B,A});
- endmodule
复制代码
|
|