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

Verilog 01

 module SEG7_LUT    (    oSEG,iDIG    );
input [:] iDIG;
output [:] oSEG;
reg [:] oSEG; always @(iDIG)
begin
case(iDIG)
'h1: oSEG = 7'b1111001; // ---t----
'h2: oSEG = 7'b0100100; // | |
'h3: oSEG = 7'b0110000; // lt rt
'h4: oSEG = 7'b0011001; // | |
'h5: oSEG = 7'b0010010; // ---m----
'h6: oSEG = 7'b0000010; // | |
'h7: oSEG = 7'b1111000; // lb rb
'h8: oSEG = 7'b0000000; // | |
'h9: oSEG = 7'b0011000; // ---b----
'ha: oSEG = 7'b0001000;
'hb: oSEG = 7'b0000011;
'hc: oSEG = 7'b1000110;
'hd: oSEG = 7'b0100001;
'he: oSEG = 7'b0000110;
'hf: oSEG = 7'b0001110;
'h0: oSEG = 7'b1000000;
endcase
end endmodule

VHDL 01

 library IEEE;
use ieee.std_logic_1164.all; 4 --! 7-segment displays
entity SEG7_LUT is
port
(
iDIG : in std_logic_vector( downto );
oSEG : out std_logic_vector ( downto )
);
end SEG7_LUT; architecture fpga of SEG7_LUT is begin pseg: process(iDIG)
begin
case iDIG is
when "" =>
oSEG <= "";
when "" =>
oSEG <= "";
when "" =>
oSEG <= "";
when "" =>
oSEG <= "";
when "" =>
oSEG <= "";
when "" =>
oSEG <= "";
when "" =>
oSEG <= "";
when "" =>
oSEG <= "";
when "" =>
oSEG <= "";
when "" =>
oSEG <= "";
when "" =>
oSEG <= "";
when "" =>
oSEG <= "";
when "" =>
oSEG <= "";
when "" =>
oSEG <= "";
when "" =>
oSEG <= "";
when "" =>
oSEG <= ""; end case; end process; end fpga;

Verilog 02

 module SEG7_LUT_8 (oSEG0,oSEG1,oSEG2,oSEG3,oSEG4,oSEG5,oSEG6,oSEG7,iDIG );
input [:] iDIG;
output [:] oSEG0,oSEG1,oSEG2,oSEG3,oSEG4,oSEG5,oSEG6,oSEG7; SEG7_LUT u0 ( oSEG0,iDIG[:] );
SEG7_LUT u1 ( oSEG1,iDIG[:] );
SEG7_LUT u2 ( oSEG2,iDIG[:] );
SEG7_LUT u3 ( oSEG3,iDIG[:] );
SEG7_LUT u4 ( oSEG4,iDIG[:] );
SEG7_LUT u5 ( oSEG5,iDIG[:] );
SEG7_LUT u6 ( oSEG6,iDIG[:] );
SEG7_LUT u7 ( oSEG7,iDIG[:] ); endmodule

VHDL 02

 library IEEE;
use ieee.std_logic_1164.all; 4 --! oSEG0 ~ oSEG7
entity SEG7_LUT_8 is
port
(
iDIG : in std_logic_vector( downto );
oSEG0 : out std_logic_vector ( downto );
oSEG1 : out std_logic_vector ( downto );
oSEG2 : out std_logic_vector ( downto );
oSEG3 : out std_logic_vector ( downto );
oSEG4 : out std_logic_vector ( downto );
oSEG5 : out std_logic_vector ( downto );
oSEG6 : out std_logic_vector ( downto );
oSEG7 : out std_logic_vector ( downto )
);
end SEG7_LUT_8; --! architecture
architecture fpga of SEG7_LUT_8 is begin U0 : entity SEG7_LUT port map(oSEG => oSEG0,iDIG => iDIG( downto ));
U1 : entity SEG7_LUT port map(oSEG => oSEG1,iDIG => iDIG( downto ));
U2 : entity SEG7_LUT port map(oSEG => oSEG2,iDIG => iDIG( downto ));
U3 : entity SEG7_LUT port map(oSEG => oSEG3,iDIG => iDIG( downto ));
U4 : entity SEG7_LUT port map(oSEG => oSEG4,iDIG => iDIG( downto ));
U5 : entity SEG7_LUT port map(oSEG => oSEG5,iDIG => iDIG( downto ));
U6 : entity SEG7_LUT port map(oSEG => oSEG6,iDIG => iDIG( downto ));
U7 : entity SEG7_LUT port map(oSEG => oSEG7,iDIG => iDIG( downto )); 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. Sencha Touch 2.1学习图表Chart概述

    Extjs.chart提供了可视化展现数据的能力,每个图表可以绑定到数据模型Ext.data.Store上, 并随着数据的变换可以自动的更新图表 一个图表对象包括图标风格.坐标(axes).序列(se ...

  2. [bzoj2060][Usaco2010 Nov]Visiting Cows 拜访奶牛_树形dp

    Visiting Cows 拜访奶牛 bzoj-2060 Usaco-2010 Nov 题目大意:题目链接. 注释:略. 想法:看起来像支配集. 只是看起来像而已. 状态:dp[pos][flag]表 ...

  3. [转]十五天精通WCF——第一天 三种Binding让你KO80%的业务

    转眼wcf技术已经出现很多年了,也在.net界混的风生水起,同时.net也是一个高度封装的框架,作为在wcf食物链最顶端的我们所能做的任务已经简单的不能再简单了, 再简单的话马路上的大妈也能写wcf了 ...

  4. UVA 10905

    这题一开始比较错了.两字符串比较应该是 ab和ba两字符串连接起来比较,谁在前面大就排前面. #include <iostream> #include <cstdio> #in ...

  5. keras 与tensorflow 混合使用

    keras 与tensorflow 混合使用 tr:nth-child(odd) > td, .table-striped tbody > tr:nth-child(odd) > t ...

  6. Retrofit网络框架入门使用

    1.简单介绍 retrofit事实上就是对okhttp做了进一步一层封装优化. 我们仅仅须要通过简单的配置就能使用retrofit来进行网络请求了. Retrofit能够直接返回Bean对象,比如假设 ...

  7. 把握linux内核设计思想系列

    [版权声明:尊重原创,转载请保留出处:blog.csdn.net/shallnet,文章仅供学习交流,请勿用于商业用途] 本专栏分析linux内核的设计实现,包含系统调用.中断.下半部机制.时间管理. ...

  8. WEB开发面试题

    1.HTML的全称:   2.HTML的结构:   3.经常使用标签:                   4.CSS的全称: 5.CSS的作用:   6.CSS中创建Class的语法:        ...

  9. erlang Unicode 处理

    最近在使用erlang做游戏服务器,而字符串在服务器编程中的地位是十分重要的,于是便想仔细研究下字符编码,以及erlang下的字符串处理.先从Unicode开始吧.... [Unicode] Unic ...

  10. c#面试题总结

    using System; class A { public A() { PrintFields(); } public virtual void PrintFields(){} } class B: ...