教学课件PPT电路设计应用实例.ppt_第1页
教学课件PPT电路设计应用实例.ppt_第2页
教学课件PPT电路设计应用实例.ppt_第3页
教学课件PPT电路设计应用实例.ppt_第4页
教学课件PPT电路设计应用实例.ppt_第5页
已阅读5页,还剩24页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

第3章电路设计应用实例,电子科学学院,电子科学学院,主要内容,3.5 百进制加法计数器,3.4 编码器设计,3.3 分频器设计,3.2 双向电路和三态控制电路设计,3.1 带有并行置位的移动寄存器,电子科学学院,3.1 带有并行置位的移位寄存器,load,qb,din70,0,1,1,1,0,0,1,0,1,1,11000111,1,电子科学学院,3.1 带有并行置位的移位寄存器,architecture behav of shfrt is begin process (clk, load) variable reg8 : std_logic_vector(7 downto 0); begin if clkevent and clk = 1 then if load = 1 then - 装载新数据 reg8 := din; else reg8(6 downto 0) := reg8(7 downto 1); end if; end if; qb = reg8(0); end process; - 输出最低位 end behav;,library ieee; use ieee.std_logic_1164.all; entity shfrt is port ( clk,load : in std_logic; din : in std_logic_vector(7 downto 0); qb : out std_logic ); end shfrt;,电子科学学院,3.1 带有并行置位的移位寄存器,电子科学学院,主要内容,3.5 百进制加法计数器,3.4 编码器设计,3.3 分频器设计,3.2 双向电路和三态控制电路设计,3.1 带有并行置位的移动寄存器,电子科学学院,3.2双向电路和三态控制电路设计,3.2.1 三态门设计,1,0,高阻,1,0,高阻,architecture bhv of tri_s is begin process(enable,datain) begin if enable = 1 then dataout = datain ; else dataout =“zzzzzzzz“ ; end if ; end process; end bhv;,library ieee; use ieee.std_logic_1164.all; entity tri_s is port ( enable : in std_logic; datain : in std_logic_vector(7 downto 0); dataout : out std_logic_vector(7 downto 0); end tri_s ;,z 高阻态,电子科学学院,3.2.2 三态总线设计,总线控制端,总线输出端,数 据 输 入 端,0,电子科学学院,3.2.2 三态总线设计,library ieee; use ieee.std_logic_1164.all; entity tristate2 is port ( datain3, datain2, datain1, datain0 : in std_logic_vector (7 downto 0); enable : in std_logic_vector(1 downto 0); output : out std_logic_vector (7 downto 0); end tristate2 ;,architecture multiple_drivers of tristate2 is begin process(enable, datain3, datain2, datain1, datain0 ) begin if enable = “00“ then output z); end if ; if enable = “01“ then output z); end if ; if enable = “10“ then output z); end if ; if enable = “11“ then output z); end if ; end process; end multiple_drivers;,进程中顺序语句对同一信号多次赋值, 只执行最后一条。,电子科学学院,3.2.2 三态总线设计,断开,电子科学学院,architecture body_tri of tristate2 is begin q z) ; q z) ; q z) ; q z) ; end body_tri;,3.2.2 三态总线设计,并行语句中对同一信号多次赋值, 只能在设计三态电路时可以使用。,电子科学学院,三态门,1,0,3.2.3 双向端口设计,电子科学学院,architecture one of bi_state is begin process(control,input,io) begin if (control=0) then output= io;io = “zzzzzzzz“; else io=input;output=“zzzzzzzz“; end if; end process; end one;,library ieee; use ieee.std_logic_1164.all; entity bi_state is port (control: in std_logic; input: in std_logic_vector(7 downto 0); io : inout std_logic_vector(7 downto 0); output: out std_logic_vector(7 downto 0); end bi_state;,3.2.3 双向端口设计,电子科学学院,3.2.3 双向端口设计,电子科学学院,主要内容,3.5 百进制加法计数器,3.4 编码器设计,3.3 分频器设计,3.2 双向电路和三态控制电路设计,3.1 带有并行置位的移动寄存器,电子科学学院,3.3 分频器设计,分频器,基准信号,分频信号,电子科学学院,基准信号,分频信号,1周期,2周期,二分频(占空比50%),3.3.1 偶数分频器设计,1周期,四分频(占空比50%),4周期,电子科学学院,3.3.1偶数分频器设计,architecture one of clk_div1 is begin process(clk_in) variable countq:std_logic_vector(3 downto 0); variable clk_outq:std_logic:=0; begin if (clk_inevent and clk_in=1) then if (countq=“0001“) then countq:=“0000“; clk_outq:=not clk_outq; else countq:=countq+1; end if; end if; clk_out=clk_outq; end process; end one;,library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; entity clk_div1 is port(clk_in:in std_logic; clk_out:out std_logic); end clk_div1;,countq,1,0,clk_outq,1,0,四分频,电子科学学院,7周期,3.3.2奇数分频器设计,clk_in,clk_out,clk1,clk2,七分频(占空比50%),电子科学学院,library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; entity clk_div3 is port (clk_in:in std_logic; clk_out:out std_logic); end clk_div3;,architecture one of clk_div3 is signal clk1,clk2:std_logic; begin process(clk_in) variable cnt1:integer range 0 to 6; begin if rising_edge(clk_in) then if cnt16 then cnt1:=cnt1+1; else cnt1:=0; end if; if cnt13 then clk1=1; else clk1=0; end if; end if; end process;,process (clk_in) variable cnt2:integer range 0 to 6; begin if falling_edge(clk_in) then if cnt26 then cnt2:=cnt2+1; else cnt2:=0; end if; if cnt23 then clk2=1; else clk2=0; end if; end if; end process; clk_out=clk1 or clk2; end one;,3.3.2奇数分频器设计,cnt1,1,clk1,2,3,4,5,6,0,电子科学学院,主要内容,3.5 百进制加法计数器,3.4 编码器设计,3.3 分频器设计,3.2 双向电路和三态控制电路设计,3.1 带有并行置位的移动寄存器,电子科学学院,3.4 8-3 优先编码器,8-3 优先编码器真值表,注:表中的“x”为任意,类似vhdl中的“”值。,电子科学学院,architecture behav of coder is begin process (din) begin if (din(7)=0) then output = “000“ ; elsif (din(6)=0) then output = “100“ ; elsif (din(5)=0) then output = “010“ ; elsif (din(4)=0) then output = “110“ ; elsif (din(3)=0) then output = “001“ ; elsif (din(2)=0) then output = “101“ ; elsif (din(1)=0) then output = “011“ ; else output = “111“ ; end if ; end process ; end behav;,3.4 8-3 优先编码器,library ieee; use ieee.std_logic_1164.all; entity coder is port ( din : in std_logic_vector(0 to 7); output : out std_logic_vector(0 to 2) ); end coder;,优先级,电子科学学院,architecture behav of coder is begin output = “000“ when ( din(7)=0)else “100“ when (din(6)=0) else “010“ when(din(5)=0) else “110“ when (din(4)=0) else “001“ when (din(3)=0) else “101“ when (din(2)=0) else “011“ when(din(1)=0) else “111“ ; end behav;,3.4 8-3 优先编码器,优先级,电子科学学院,主要内容,3.5 百进制加法计数器,3.4 编码器设计,3.3 分频器设计,3.2 双向电路和三态控制电路设计,3.1 带有并行置位的移动寄存器,电子科学学院,3.5 百进制加法计数器,个位,十位,进位,时钟,4位矢量,4位矢量,电子科学学院,architecture art of jsq is begin process(rst,en,clk) variable a2,a1: std_logic_vector(3 downto 0); begin if rst=1 then a2:=“0000“; a1:=“0000“; elsif (clkevent and clk=1) then if en=1 then if a2=“1001“ and a1=“1001“ then count=1; else count=0; end if; if a1=“1001“ then a1:=“0000“; if a2=“1001“ then a2:=“0000“; else a2:=a2+1; end if; else a1:=a1+1; end if; end if; end if; aa2=a2; aa1=a1; end process; end art;,library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.a

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论