设为首页收藏本站淘宝杂货铺

从F到0 - From F to 0

 找回密码
 注册已关闭
搜索
查看: 132|回复: 0
收起左侧

Quartus Verilog HDL/FPGA 实现 十六进制(16进制)共阴7段数码管段码译码器 (带小数点)

[复制链接]
发表于 2023-9-24 17:29:43 | 显示全部楼层 |阅读模式
main.png
  1. module main(                //十六进制共阴数码管段码译码器
  2.         input A,                        //地址A(低位)
  3.         input B,                        //地址B
  4.         input C,                        //地址C
  5.         input D,                        //地址D(高位)
  6.         input H,                        //小数点
  7.         output QA,                //段码A
  8.         output QB,                //段码B
  9.         output QC,                //段码C
  10.         output QD,                //段码D
  11.         output QE,                //段码E
  12.         output QF,                //段码F
  13.         output QG,                //段码G
  14.         output QH                //段码(小数点)
  15. );

  16. assign QH = H;

  17. function [6:0] display;                        //7段16进制共阴数码管段码查询
  18.         input [3:0] hex;
  19.         begin
  20.         case(hex)
  21.                 4'h0:display = 7'h3F;
  22.                 4'h1:display = 7'h06;
  23.                 4'h2:display = 7'h5B;
  24.                 4'h3:display = 7'h4F;
  25.                 4'h4:display = 7'h66;
  26.                 4'h5:display = 7'h6D;
  27.                 4'h6:display = 7'h7D;
  28.                 4'h7:display = 7'h07;
  29.                 4'h8:display = 7'h7F;
  30.                 4'h9:display = 7'h6F;
  31.                 4'hA:display = 7'h77;
  32.                 4'hB:display = 7'h7C;
  33.                 4'hC:display = 7'h39;
  34.                 4'hD:display = 7'h5E;
  35.                 4'hE:display = 7'h79;
  36.                 4'hF:display = 7'h71;       
  37.         endcase
  38.         end
  39. endfunction

  40. assign {QG,QF,QE,QD,QC,QB,QA} = display({D,C,B,A});

  41. endmodule
复制代码

相关帖子

您需要登录后才可以回帖 登录 | 注册已关闭

本版积分规则

QQ|手机版|Archiver|从F到0 ( 蒙ICP备17002595号-1 )
蒙公网安备15010402000325号

腾讯云安全认证

GMT+8, 2024-4-27 17:20 , Processed in 1.248071 second(s), 22 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表