VHDL大小写不敏感 eqcomp4 vhd 文件名和实体 名一致 库 eqcomp4 is a four bit equality comparator Library ieee 包 use IEEE. td logic 1164.a f: 实体一 entity egcomp4is port(a, b: in std logic vector(3 downto 0) 每行;结尾 equal out std logic) end egcomp4 关键字end后跟 实体名 构造体一 architecture dataflow of eqcomp44is begin 关键字 begin equal <-=1 when a=b else 0 End dataflow 关键字end后跟 构造体名
--eqcomp4 is a four bit equality comparator Library IEEE; use IEEE.std_logic_1164.all; entity eqcomp4 is port(a, b:in std_logic_vector(3 downto 0); equal :out std_logic); end eqcomp4; architecture dataflow of eqcomp4 is begin equal <= ‘1’ when a=b else ‘0’; End dataflow; VHDL 大小写不敏感 eqcomp4.vhd 包 实体 构造体 文件名和实体 名一致 每行;结尾 关键字begin 关键字end后跟 实体名 关键字end后跟 构造体名 库
实体( Entity ●描述此设计功能输入输出端口(Port) ●在层次化设计时,Pot为模块之间的接口 ●在芯片级,则代表具体芯片的管脚 Entity eqcomp4 is port(a, b: in std logic vector(3 downto 0) equal: out std logic end egcomp4 A[3.0 equa B[3.0]
实体(Entity) ⚫ 描述此设计功能输入输出端口(Port) ⚫ 在层次化设计时,Port为模块之间的接口 ⚫ 在芯片级,则代表具体芯片的管脚 A[3..0] B[3..0] equal Entity eqcomp4 is port(a, b: in std_logic_vector(3 downto 0); equal:out std_logic ); end eqcomp4;
实体一一端口的模式 ●输入( Input) ●输出( Output) ●双向( Inout):可代替所有其他模式, 但降低了程序的可读性,一般用于与 CPU的数据总线接口 ●缓冲( Buffer):与 Output类似,但允许 该管脚名作为一些逻辑的输入信号
实体--端口的模式 ⚫ 输入(Input) ⚫ 输出(Output) ⚫ 双向(Inout):可代替所有其他模式, 但降低了程序的可读性,一般用于与 CPU的数据总线接口 ⚫ 缓冲(Buffer):与Output类似,但允许 该管脚名作为一些逻辑的输入信号
Out与 Buffer的区别 ● Entity testl is ● Entity test2 is port(a: in std logic port(a: in std logic b.c: out std logic b: buffer std logic c Out std logic end testl end test2 architecture a of test l is begin architecture a of test2 is b<= not(a) begin c<= b:--Error b<=not(a) end a C<=b end a
Out与Buffer的区别 ⚫ Entity test1 is port(a: in std_logic; b,c: out std_logic ); end test1; architecture a of test1 is begin b <= not(a); c <= b;--Error end a; ⚫ Entity test2 is port(a: in std_logic; b : buffer std_logic; c: out std_logic ); end test2; architecture a of test2 is begin b <= not(a); c <= b; end a;
结构体( Architecture) ●描述实体的行为 ●结构体有三种描述方式 为描述( behaviora) 数据流描述( dataflow) 结构化描述( structural)
结构体(Architecture) ⚫ 描述实体的行为 ⚫ 结构体有三种描述方式 – 行为描述(behavioral) – 数据流描述(dataflow) – 结构化描述(structural)