已阅读5页,还剩3页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
顶层设计程序library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;entity JIA is PORT(clockin: in std_logic; resetin:in std_logic; kbin : in std_logic_vector(3 downto 0); kbout : out std_logic_vector(2 downto 0); segment_out : out STD_LOGIC_VECTOR(6 downto 0); sweepout : out STD_LOGIC_VECTOR(3 downto 0); end JIA;architecture Behavioral of JIA is COMPONENT keyboard isport(clk,reset : in std_logic; kb_in : in std_logic_vector(3 downto 0); c,d: out std_logic_vector(3 downto 0); seg1,seg2 : out std_logic_vector(6 downto 0); swo,so: out std_logic; kb_out : out std_logic_vector(2 downto 0); END COMPONENT; COMPONENT add isport ( a,b: in std_logic_vector(3 downto 0); s1,s2: in std_logic;s: out std_logic_vector(4 downto 0); END COMPONENT;COMPONENT yima isport(Clock,reset : in std_logic; seg3,seg4 : out std_logic_vector(6 downto 0); sin: in std_logic_vector(4 downto 0); END COMPONENT;signal e,k: STD_LOGIC;signal f,g : std_logic_vector(3 downto 0);signal h : std_logic_vector(4 downto 0);signal segment_out1 : STD_LOGIC_VECTOR(6 downto 0);signal segment_out2 : STD_LOGIC_VECTOR(6 downto 0);signal segment_out3 : STD_LOGIC_VECTOR(6 downto 0);signal segment_out4 : STD_LOGIC_VECTOR(6 downto 0); type state_type is (z0,z1,z2,z3);signal state: state_type;signal div:std_logic_vector(26 downto 0):=(others=0);signal clk:std_logic; BEGIN process(clockin) begin if rising_edge(clockin) then div=79999 then div0);end if;if div=39999 thenclk=1;else clkstatestatestatestateclockin,kb_in=kbin,reset=resetin,c=f,d=g,swo=e,so=k,seg1=segment_out1, kb_out=kbout,seg2=segment_out2); u2: add PORT MAP(a=f,b=g,s=h,s1=k,s2=e); u3: yima PORT MAP(Clock=clockin,sin=h,reset=resetin,seg3=segment_out3,seg4=segment_out4); with state seLectsweepout=1110 when z0, 1101 when z1, 1011 when z2, 0111 when z3; with state seLectsegment_out 0);signal clkdiv:std_logic;signal kb_out_s:std_logic_vector(2 downto 0):=010;signal kb_in_s:std_logic_vector(3 downto 0):=0001;signal m,c1,d1 : std_logic_vector(3 downto 0):=0000;beginkb_out = not kb_out_s;kb_in_s = not kb_in ;c = c1 ;d = d1 ;process(clk) begin if rising_edge(clk) then div=div+1;end if;end process;clkdiv= div(14) ;process(clkdiv)begin if (clkdivevent and clkdiv=1) then kb_out_sm =0000;swo =0;so m =0001;swo =0;so m =0010;swo =0;so m =0011;swo =0;so m =0100;swo =0;so m =0101;swo =0;so m =0110;swo =0;so m =0111;swo =0;so m =1000;swo =0;so m =1001;swo =0;so swo =1; c1 so =1; d1 null; end case; end if; end process;process(clk)begin if(reset=0)then seg1 seg1 seg1 seg1 seg1 seg1 seg1 seg1 seg1 seg1 seg1 null; end case; end if; end process; process(clk)begin if(reset=0)then seg2 seg2 seg2 seg2 seg2 seg2 seg2 seg2 seg2 seg2 seg2 null; end case; end if; end process; end Behavioral;加法实现library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;entity add isport ( a,b: in std_logic_vector(3 downto 0); s1,s2: in std_logic;s: out std_logic_vector(4 downto 0);end entity;architecture Behavioral of add is signal aa,bb,ss:std_logic_vector(4 downto 0);beginaa=0& a;bb=0& b;process(aa,bb,s1,s2)begin if (s1=1 and s2=1) thenss= aa+bb; end if; s=ss;end process;end Behavioral;译码显示library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;entity yima isport(Clock,reset : in std_logic; seg3,seg4 : out std_logic_vector(6 downto 0); sin: in std_logic_vector(4 downto 0); end yima;architecture Behavioral of yima is beginprocess(Clock,sin) begin if(reset=0)then seg3 =1000000; seg4 seg3 =1000000;seg4 seg3 =1000000;seg4 seg3 =1000000;seg4 seg3 =1000000;seg4 seg3 =1000000;seg4 seg3 =1000000;seg4 seg3 =1000000;seg4 seg3 =1000000;seg4 seg3 =1000000;seg4 seg3 =1000000;seg4 seg3 =1111001;seg4 seg
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 《GBT 35409-2017 电子商务平台商家入驻审核规范》专题研究报告
- 呼吸专科护士在营养支持中的指导策略
- 合并糖尿病的高血压患者血压季节性波动与综合管理方案评价
- 医学教育者教学礼仪实践
- 可穿戴设备在电子健康档案中的数据质量控制策略
- 2025年国际海运运输补充合同
- 2025年安徽港口集团芜湖有限公司招聘13人笔试备考试题附答案
- 2025年湖南中共怀化市委党校招聘工作人员6人参考题库附答案
- 取栓术后早期脑水肿的阶梯性干预方案
- 原醛症与慢性腹泻:营养支持策略
- 具有履行合同所必须的设备和专业技术能力的声明函8篇
- 洗车设备管理制度
- GB/Z 15166.8-2025高压交流熔断器第8部分:应用导则
- DB43T1027-2015 近自然森林可持续经营技术规程
- 2025-2030全球膜处理系统行业调研及趋势分析报告
- 《以平和的心态迎接期末考试》班会课件
- 新苏教版一年级数学下册第一单元第1课时《9加几》教案
- 小班冬季疾病预防
- 2025年公司搬迁方案计划
- 鞋和靴用乳膏产品生产技术现状
- 锅炉设备巡检与保养方案
评论
0/150
提交评论