d触发器电路全加器.pptx
文本预览下载声明
目的;主要内容;library ieee;
use ieee.std_logic_1164.all;
entity dff1 is
port(clk,d: in std_logic;
q: out std_logic);
end;
architecture bhv of dff1 is
signal q1:std_logic;
begin
process(clk)
begin
if(clkevent and clk=1)then
q1=d;
end if;
end process;
q=q1;
end;;STD_LOGIC标准逻辑位数据类型
STD_LOGIC比BIT包含的内容丰富和完整
BIT:’0’、’1’
STD_LOGIC;‘U’ -- Uninitialized (未初始化的)
‘X’ -- Forcing Unknown (强未知的)
‘0’ -- Forcing 0 (强0)
‘1’ -- Forcing 1 (强1)
‘Z’ -- High Impedance (高阻态)
‘W’ -- Weak Unknown(弱未知的)
‘L’ -- Weak 0 (弱0)
‘H’ -- Weak 1 (弱1)
‘-’ -- Don‘t care (忽略); 库、程序包
std_logic、std_logic_vector:
定义在std_logic_1164.all程序包中,而此包由IEEE定义。
所以,使用到这两种数据类型时,需包含
library ieee;
use ieee.std_logic_1164.all;; SIGNAL 信号名: 数据类型 [:= 初始值] ;
区别:
signal:描述实体内部节点,不定义输入输出方向,在结构体中作为一个数据的暂存器,进行赋值。
端口:描述实体与外界的接口; Event信号属性函数
s’Event:如果在当前一个相当小的时间间隔内,事件发生了,则函数将返回”TURE”、否则返回”FLASE”
上升沿:clock’event and clock=‘1’;
下降沿:clock’event and clock=‘0’;
上升沿:rising_edge(clock);
下降沿:falling_edge(clock);;时钟的描述方法;architecture bhv of dff2 is
begin
process(clk)
begin
if(clkevent and clk=1)then
q=d;
end if;
end process;
end;; 不完整条件语句与时序电路
if(clkevent and clk=1)then
q1=d;
end if;;上升沿D触发器描述;
;
;
;
;
;
;;;……
architecture one of h_adder is
signal P: std_logic_vector(1 downto 0);
begin
P=ab;
process ( P )
begin
case P is
when 00=so=0;co=0;
when 01=so=1;co=0;
when 10=so=1;co=0;
when 11=so=0;co=1;
when others=null;
end case;
end process;
end;;;..... --以下是或门另一种结构体描述
architecture one of or_2 is
begin
c=a or b;
end;;
;元件例化语句; COMPONENT 元件名 IS
【GENERIC (类属表);】
PORT(端口名表);
END COMPONENT 元件名;
例化名:元件名 PORT MAP(
[元件端口名=]连接端口名,…);; [元件端口名=]连接端口名
其
显示全部