




已阅读5页,还剩8页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
微型计算机原理及应用技术编程程序目录:2分频电路N分频电路(8选一为例)多进制加法计数器基本D触发器数据选择器(四选一)异步复位可逆计数器优先编码器2分频电路library ieee;use ieee.std_logic_1164.all;entity fredvider1 isport(clock:in std_logic;clkout:out std_logic);end;architecture behavior of fredvider1 issignal clk:std_logic;begin process(clock) begin if rising_edge(clock) then clk=not clk; end if; end process; clkout=clk;end;N分频电路(8选一为例)library ieee;use ieee.std_logic_1164.all;entity fredevider8 isport (clkin:in std_logic; clkout:out std_logic);end;architecture bhv of fredevider8 isconstant n:integer:=3;signal counter:integer range 0 to N;signal clk:std_logic;begin process(clkin) begin if rising_edge(clkin) then if counter = n then counter =0; clk = not clk; else counter = counter+1; end if; end if;end process;clkout = clk;end;多进制加法计数器library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity count2 is port (cp,res:in std_logic; ql,qh:out std_logic_vector(3 downto 0);end;architecture bhv of count2 issignal qnl,qnh:std_logic_vector(3 downto 0);beginprocess(cp,res) begin if res = 1 then qnl=0000;qnh=0000; elsif rising_edge(cp) then if qnl=0011 and qnh=0010 then qnl=0000; qnh=0000; elsif qnl=1001 then qnl=0000;qnh=qnh+1; else qnl=qnl+1; end if; end if;end process; ql = qnl; qh = qnh;end;基本D触发器library ieee;use ieee.std_logic_1164.all;entity dff1 is port( d: in std_logic; clk: in std_logic; q: out std_logic);end;architecture bhv of dff1 is signal qn: std_logic;beginprocess(clk) begin if rising_edge(clk) then qn=d; end if;end process;q= qn;end;异步复位的D触发器library ieee;use ieee.std_logic_1164.all;entity dff2 isport(D,clk,clr: in std_logic; Q: out std_logic); 定义输入、输出端口end entity dff2;architecture one of dff2 isbegin process(clk,D,clr) 进程敏感信号 begin if clr=1 then Q=0; Elsif clkevent and clk=1 then 时钟触发状态 Q=D; end if; end process;end architecture one;同步复位的D触发器library ieee;use ieee.std_logic_1164.all;entity dff1 isport(D,clk,clr: in std_logic;Q: out std_logic); 定义输入、输出端口end entity dff1;architecture one of dff1 isbeginprocess(clk,D,clr) 进程敏感信号Beginif clkevent and clk=1 then 时钟控制优先 if clr=1 then Q=0; else Qclkoutclkoutclkoutclkoutclkout =0; end case; end process;end;异步复位可逆计数器library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity count1 is port (cp,res,dir:in std_logic; q:out std_logic_vector(3 downto 0);end;architecture bhv of count1 issignal qn:std_logic_vector(3 downto 0);beginprocess(cp,res) begin if res = 1 then qn=0000; elsif rising_edge(cp) then if dir=0 then qn=qn+1; else qn=qn-1; end if; end if; q = qn;end process;end;优先编码器library ieee;use ieee.std_logic_1164.all;entity encoder isport(en:in std_logic;i:in std_logic_vector(7 downto 0);a:out std_logic_vector(2 downto 0);idle:out std_logic);end;architecture behacior of encoder isbegin process(en,i) begin if en = 1 then if i(7) = 1 then a=111; idle=0; elsif i(6) = 1 then a=110; idle=0; elsif i(5) = 1 then a=101; idle=0; elsif i(4) = 1 then a=100; idle=0; elsif i(3) = 1 then a=011; idle=0; elsif i(2) = 1 then
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 考点攻克苏科版八年级物理下册《物质的物理属性》综合测评练习题(含答案详解)
- 护理纠纷的考试题及答案
- 平度初三中考试卷及答案
- 2025近五年初会考试真题及答案
- 烘焙工坊考试题及答案
- 2025换届考试真题及答案详解
- 广西安全员证题库考试试题及答案
- 四级考试第一套试卷及答案
- 彬县二年级考试试题及答案
- 2025年自考本科电力系统分析考试题及答案
- 应急知识技能与能力培训课件
- 2025中级注册安全工程师《专业实务-道路运输安全》案例 50 问
- 2025湖北襄阳老河口市清源供水有限公司招聘5人考试模拟试题及答案解析
- 2025年河南省文化旅游投资集团有限公司权属企业社会招聘52人笔试参考题库附答案解析
- 2025云南昆明元朔建设发展有限公司第一批收费员招聘20人考试参考试题及答案解析
- 智能化设备在板材加工中的应用-洞察及研究
- 第9课《天上有颗“南仁东星”》 课件 2025-2026学年统编版语文八年级上册
- 2025秋统编版(2024)小学道德与法治三年级上册(全册)课时练习及答案(附目录)
- 停车场工程招投标书范本
- 陕西省中小学教师校本研修30问
- 网关防火墙tn-sg3000x800产品白皮书
评论
0/150
提交评论