1 / 88

基本逻辑电路: 组合逻辑电路、 时序逻辑电路 3.9.1 组合逻辑电路设计

基本逻辑电路: 组合逻辑电路、 时序逻辑电路 3.9.1 组合逻辑电路设计 简单门电路、编码器、译码器、 加法器、多路选择器、三态门等。. 3.9 基本逻辑电路设计. 1 、基本门电路. 2 、编码器 设计一个 8 输入优先级编码器, y0 级别最低, y7 级别最高;输出为 3 位编码。. 方法 1 : 利用 if 多选择语句自顶向下的优先特性.

Download Presentation

基本逻辑电路: 组合逻辑电路、 时序逻辑电路 3.9.1 组合逻辑电路设计

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 基本逻辑电路: 组合逻辑电路、 时序逻辑电路 3.9.1 组合逻辑电路设计 简单门电路、编码器、译码器、 加法器、多路选择器、三态门等。 3.9 基本逻辑电路设计

  2. 1、基本门电路

  3. 2、编码器 设计一个 8 输入优先级编码器,y0 级别最低, y7 级别最高;输出为3位编码。

  4. 方法1:利用 if 多选择语句自顶向下的优先特性

  5. 方法2:进程内为顺序语句,最先描述优先级最低,最后描述优先级最高,可实现优先级编码。方法2:进程内为顺序语句,最先描述优先级最低,最后描述优先级最高,可实现优先级编码。

  6. 方法3:利用条件赋值语句 architecture behavior of priority is begin vec <= “111” when y7 = ‘1’ else “110” when y6 = ‘1’ else “101” when y5 = ‘1’ else “100” when y4 = ‘1’ else “011” when y3 = ‘1’ else “010” when y2 = ‘1’ else “001” when y1 = ‘1’ else “000” when y0 = ‘1’ else “XXX”; end behavior;

  7. 3、译码器 译码器是编码器的逆过程。如 3-8 译码器:

  8. 方法1:使用逻辑左移运算符 library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity decoder is port(inp : in std_logic_vector(2 downto 0); outp : out std_logic_vector(7 downto 0)); end decoder; architecture rtl of decoder is begin outp<=“00000001” sll(conv_integer(inp)); end rtl;

  9. 方法2:使用process语句 library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity decoder is port(inp : in std_logic_vector(2 downto 0); outp : out std_logic_vector(7 downto 0)); end decoder; architecture rtl of decoder is begin process(inp) begin outp<=(others=>’0’); outp(conv_integer(inp))<=‘1’; end process; end rtl;

  10. 方法3:使用 case 语句实现。

  11. 译码输出低有效

  12. 方法4:使用条件赋值语句

  13. 3-8译码器仿真结果: 译码输出低有效

  14. 4、加法器 带进位的 4位加法器符号如下:

  15. 方法1:用for – loop语句实现

  16. 方法2:直接使用加法“+”函数:

  17. 加法器仿真结果:

  18. 5、多路选择器 前面用 if 语句、case 语句、条 件赋值语句、选择赋值语句分别描 述过 4 选 1 选择器。 6、三态门及总线缓冲器 VHDL语言通过指定大写的 Z 值表示高阻状态 a : std_logic; a_bus : std_logic_vector(7 downto 0); 指定高阻状态如下: a <= ‘Z’ ; a_bus <= “ZZZZZZZZ” ;

  19. 1)三态门电路描述

  20. 三态门仿真结果:

  21. 2)单向总线缓冲器

  22. 3)双向总线缓冲器

  23. 3.9.2 时序逻辑电路设计 触发器、寄存器、计数器、分频器、 信号发生器等。 一、时序电路特殊信号的描述 时钟信号和复位信号 1、时钟信号描述 常用的描述方式: 1)进程的敏感信号是时钟信号,在进程内部 用if 语句描述时钟的边沿条件。

  24. 如: process (clock_signal) begin if (clock_edge_condition) then signal_out <= signal_in ; ┇ 其它时序语句 ┇ end if ; end process ;

  25. 2)在进程中用 wait until 语句描述时钟信号,此 时进程将没有敏感信号。 如: process begin wait until (clock_edge_condition) ; signal_out <= signal_in ; ┇ 其它时序语句 ┇ end process ;

  26. 注意: a. 在对时钟边沿说明时,一定要注明是上升沿 还是下降沿。 b. 一个进程中只能描述一个时钟信号。 c. Wait until 语句只能放在进程的最前面或 最后面。 3)时钟边沿的描述 时钟上升沿: (clock’event and clock = ‘1’) 时钟下降沿: (clock’event and clock = ‘0’)

  27. 2、触发器的复位信号描述 1)同步复位:在只有以时钟为敏感信号的 进程中定义。 如:process (clock_signal) begin if (clock_edge_condition) then if (reset_condition) then signal_out <= reset_value ; else signal_out <= signal_in ; ┇ end if ; end if ; end process ;

  28. 2)异步复位:进程的敏感信号表中除时钟信 号外,还有复位信号。 如:process (reset_signal, clock_signal) begin if (reset_condition) then signal_out <= reset_value; elsif (clock_edge_condition) then signal_out <= signal_in ; ┇ end if ; end process ;

  29. 二、常用时序电路设计 1、触发器(Flip_Flop) 1)D触发器

  30. 异步置位/复位D触发器

  31. 同步复位D触发器

  32. 比较:异步置位的锁存器(Latch)

  33. 2)T触发器 library ieee; use ieee.std_logic_1164.all; entity t_ff is port(t, clk : in std_logic; q : buffer std_logic); end t_ff; architecture rtl of t_ff is begin process(clk) begin if clk’event and clk=‘1’ then q<=not q; end if; end process; end rtl;

  34. 3)RS触发器 library ieee; use ieee.std_logic_1164.all; entity rs_ff is port(r, s, clk : in std_logic; q, qn : buffer std_logic); end rs_ff; architecture rtl of rs_ff is begin

  35. process(r, s, clk) begin if clk’event and clk=‘1’ then if s = ‘1’ and r = ‘0’ then q<=‘0’; qn<=‘1’; elsif s=‘0’ and r=‘1’ then q<=‘1’; qn<=‘0’; elsif s=‘0’ and r=‘0’ then q<=q; qn<=qn; else null; end if; end if; end process; end rtl;

  36. 2、寄存器 8位串行输入、串行输出移位寄存器:

  37. 8位移位寄存器描述(结构描述)

  38. 8位移位寄存器直接用信号连接描述

  39. 移位寄存器仿真结果:

  40. 3、计数器 计数器分为:同步计数器 异步计数器 (1)同步计数器 同步计数器指在时钟脉冲(计数脉冲)的控 制下,构成计数器的各触发器状态同时发生变化 的计数器。

  41. 带允许端的十二进制计数器

  42. 可逆计数器(加减计数器)

  43. 可逆计数器仿真结果:

  44. 例:六十进制(分、秒)计数器

More Related