以前课题用的是友晶的DE2-70,现在重拾FPGA,选了一款性价比高的DE2。恰逢闲来无事,于是尝试将各个Verilog模块翻译成VHDL,半算回顾以前的知识,半算练习VHDL。

Verilog 01

  1. module SEG7_LUT ( oSEG,iDIG );
  2. input [:] iDIG;
  3. output [:] oSEG;
  4. reg [:] oSEG;
  5.  
  6. always @(iDIG)
  7. begin
  8. case(iDIG)
  9. 'h1: oSEG = 7'b1111001; // ---t----
  10. 'h2: oSEG = 7'b0100100; // | |
  11. 'h3: oSEG = 7'b0110000; // lt rt
  12. 'h4: oSEG = 7'b0011001; // | |
  13. 'h5: oSEG = 7'b0010010; // ---m----
  14. 'h6: oSEG = 7'b0000010; // | |
  15. 'h7: oSEG = 7'b1111000; // lb rb
  16. 'h8: oSEG = 7'b0000000; // | |
  17. 'h9: oSEG = 7'b0011000; // ---b----
  18. 'ha: oSEG = 7'b0001000;
  19. 'hb: oSEG = 7'b0000011;
  20. 'hc: oSEG = 7'b1000110;
  21. 'hd: oSEG = 7'b0100001;
  22. 'he: oSEG = 7'b0000110;
  23. 'hf: oSEG = 7'b0001110;
  24. 'h0: oSEG = 7'b1000000;
  25. endcase
  26. end
  27.  
  28. endmodule

VHDL 01

  1. library IEEE;
  2. use ieee.std_logic_1164.all;
  3.  
  4. 4 --! 7-segment displays
  5. entity SEG7_LUT is
  6. port
  7. (
  8. iDIG : in std_logic_vector( downto );
  9. oSEG : out std_logic_vector ( downto )
  10. );
  11. end SEG7_LUT;
  12.  
  13. architecture fpga of SEG7_LUT is
  14.  
  15. begin
  16.  
  17. pseg: process(iDIG)
  18. begin
  19. case iDIG is
  20. when "" =>
  21. oSEG <= "";
  22. when "" =>
  23. oSEG <= "";
  24. when "" =>
  25. oSEG <= "";
  26. when "" =>
  27. oSEG <= "";
  28. when "" =>
  29. oSEG <= "";
  30. when "" =>
  31. oSEG <= "";
  32. when "" =>
  33. oSEG <= "";
  34. when "" =>
  35. oSEG <= "";
  36. when "" =>
  37. oSEG <= "";
  38. when "" =>
  39. oSEG <= "";
  40. when "" =>
  41. oSEG <= "";
  42. when "" =>
  43. oSEG <= "";
  44. when "" =>
  45. oSEG <= "";
  46. when "" =>
  47. oSEG <= "";
  48. when "" =>
  49. oSEG <= "";
  50. when "" =>
  51. oSEG <= "";
  52.  
  53. end case;
  54.  
  55. end process;
  56.  
  57. end fpga;

Verilog 02

  1. module SEG7_LUT_8 (oSEG0,oSEG1,oSEG2,oSEG3,oSEG4,oSEG5,oSEG6,oSEG7,iDIG );
  2. input [:] iDIG;
  3. output [:] oSEG0,oSEG1,oSEG2,oSEG3,oSEG4,oSEG5,oSEG6,oSEG7;
  4.  
  5. SEG7_LUT u0 ( oSEG0,iDIG[:] );
  6. SEG7_LUT u1 ( oSEG1,iDIG[:] );
  7. SEG7_LUT u2 ( oSEG2,iDIG[:] );
  8. SEG7_LUT u3 ( oSEG3,iDIG[:] );
  9. SEG7_LUT u4 ( oSEG4,iDIG[:] );
  10. SEG7_LUT u5 ( oSEG5,iDIG[:] );
  11. SEG7_LUT u6 ( oSEG6,iDIG[:] );
  12. SEG7_LUT u7 ( oSEG7,iDIG[:] );
  13.  
  14. endmodule

VHDL 02

  1. library IEEE;
  2. use ieee.std_logic_1164.all;
  3.  
  4. 4 --! oSEG0 ~ oSEG7
  5. entity SEG7_LUT_8 is
  6. port
  7. (
  8. iDIG : in std_logic_vector( downto );
  9. oSEG0 : out std_logic_vector ( downto );
  10. oSEG1 : out std_logic_vector ( downto );
  11. oSEG2 : out std_logic_vector ( downto );
  12. oSEG3 : out std_logic_vector ( downto );
  13. oSEG4 : out std_logic_vector ( downto );
  14. oSEG5 : out std_logic_vector ( downto );
  15. oSEG6 : out std_logic_vector ( downto );
  16. oSEG7 : out std_logic_vector ( downto )
  17. );
  18. end SEG7_LUT_8;
  19.  
  20. --! architecture
  21. architecture fpga of SEG7_LUT_8 is
  22.  
  23. begin
  24.  
  25. U0 : entity SEG7_LUT port map(oSEG => oSEG0,iDIG => iDIG( downto ));
  26. U1 : entity SEG7_LUT port map(oSEG => oSEG1,iDIG => iDIG( downto ));
  27. U2 : entity SEG7_LUT port map(oSEG => oSEG2,iDIG => iDIG( downto ));
  28. U3 : entity SEG7_LUT port map(oSEG => oSEG3,iDIG => iDIG( downto ));
  29. U4 : entity SEG7_LUT port map(oSEG => oSEG4,iDIG => iDIG( downto ));
  30. U5 : entity SEG7_LUT port map(oSEG => oSEG5,iDIG => iDIG( downto ));
  31. U6 : entity SEG7_LUT port map(oSEG => oSEG6,iDIG => iDIG( downto ));
  32. U7 : entity SEG7_LUT port map(oSEG => oSEG7,iDIG => iDIG( downto ));
  33.  
  34. end fpga;

DE2之7-segment displays的更多相关文章

  1. (2017浙江省赛E)Seven Segment Display

    Seven Segment Display Time Limit: 2 Seconds      Memory Limit: 65536 KB A seven segment display, or ...

  2. 2017浙江省赛 E - Seven Segment Display ZOJ - 3962

    地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3962 题目: A seven segment display, or ...

  3. ZOJ 3962 Seven Segment Display 16进制的八位数加n。求加的过程中所有的花费。显示[0,F]有相应花费。

    Seven Segment Display Time Limit: Seconds Memory Limit: KB A seven segment display, or seven segment ...

  4. ZOJ 3962 E.Seven Segment Display / The 14th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple E.数位dp

    Seven Segment Display Time Limit: 1 Second      Memory Limit: 65536 KB A seven segment display, or s ...

  5. [转]oracle EBS 基础100问

    from:http://www.cnblogs.com/xiaoL/p/3593691.html  http://f.dataguru.cn/thread-51057-1-1.html 1001 OR ...

  6. zoj3954 详细讲解 排序比较单词法

    Seven-Segment Display Time Limit: 1 Second      Memory Limit:65536 KB A seven segment display, or se ...

  7. [笔记]学习EBS建议有的知识

    http://f.dataguru.cn/thread-51057-1-1.html ORACLE EBS学习的其他资源有哪四个? ORACLE OPEN WORLD大会是不是一个市场营销活动? Or ...

  8. kafka的log存储解析——topic的分区partition分段segment以及索引等

    转自:http://blog.csdn.net/jewes/article/details/42970799 引言 Kafka中的Message是以topic为基本单位组织的,不同的topic之间是相 ...

  9. ORA-10635: Invalid segment or tablespace type

    上周星期天在迁移数据时,碰到了ORA-10635: Invalid segment or tablespace type 错误,当时的操作环境如下: 操作系统版本: [oracle@xxxxx scr ...

随机推荐

  1. windows下db2的一些使用心得(不含安装)

    1.安装完成后开始菜单栏里会有一个 DB2 Command Window - Administrator 打开这个命令窗口 2.db2 db2,启动 3.list databse directory ...

  2. Maven学习总结(28)——Maven+Nexus+Myeclipse集成

    Maven简介 Maven 是一个基于项目对象模型(POM)的,提倡约定优于配置(ConventionOver Configuration)的,跨平台的项目管理和构建自动化工具. 首先它是一个优秀的构 ...

  3. Leetcode 30.与所有单词相关联的子串

    与所有单词相关联的字串 给定一个字符串 s 和一些长度相同的单词 words.在 s 中找出可以恰好串联 words 中所有单词的子串的起始位置. 注意子串要与 words 中的单词完全匹配,中间不能 ...

  4. DSP广告系统架构及关键技术解析(转)

    广告和网络游戏是互联网企业主要的盈利模式 广告是广告主通过媒体以尽可能低成本的方式与用户达成接触的商业行为.也就是说按照某种市场意图接触相应人群,影响其中潜在用户,使其选择广告主产品的几率增加,或对广 ...

  5. 【ACM】hdu_1091_A+BIII_201307261112

    A+B for Input-Output Practice (III)Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/327 ...

  6. Javascript如何实现继承?

    前言 我这篇文章会误人子弟,我把继承跟构造函数实例化搞混了,汗!要想搞清楚JS的继承机制,看下大牛写的文章:http://www.cnblogs.com/dolphinX/p/3307903.html ...

  7. portmap 和 rpc程序

    Portmap 是为RPC 程序服务的. 每一个RPC server程序启动的时候要向portmap程序注册.这样portmap程序就知道这些RPC server监听在哪个端口. 而RPC clien ...

  8. ural 1468

    写了好久,不知道为什么不过,也不清楚到底卡在哪里... 只好看别人的代码,感觉除了HASH不一样外,倒没什么特别之处.同时参考那论文写的.. http://blog.csdn.net/jyysc201 ...

  9. poj 1068 Parencodings(模拟)

    转载请注明出处:viewmode=contents">http://blog.csdn.net/u012860063?viewmode=contents 题目链接:http://poj ...

  10. C++智能指针--auto_ptr指针

    auto_ptr是C++标准库提供的类模板,头文件<memory>,auto_ptr对象通过初始化指向由new创建的动态内存,它是这块内存的拥有者,一块内存不能同一时候被分给两个拥有者.当 ...