第一次上机安排内容摘要:

end if。 end if。 end process。 end rtl。 architecture rtl of start is begin process(clk) variable count : integer range 0 to 7。 begin if (clk39。 event and clk=39。 139。 ) then count := count + 1。 if(count=0) then carryout = 39。 139。 else carryout = 39。 039。 end if。 end if。 end process。 end rtl。 信号与变量的区别 architecture a of start is signal tmp : std_logic。 begin process(a_bus) begin tmp = 39。 139。 for i in 3 downto 0 loop tmp = a_bus(i) and tmp。 end loop。 carryout = tmp。 end process。 end a。 architecture a of start is begin process(a_bus) variable tmp:std_logic。 begin tmp := 39。 139。 for i in 3 downto 0 loop tmp := a_bus(i) and tmp。 end loop。 carryout = tmp。 end process。 end a。 VHDL数据类型 标量类型( Scalar) – 枚举( Enumeration) – 整数( Integer) – 浮点数( Float) – 物理( Physical) 复合类型( Composite) VHDL数据类型--枚举 列举数据对象可能存在的值,一般用于定义状态机的状态 – Type states is (idle, start, running, pause, stop) – Signal current_state : states。  IEEE1076标准中预定义了两个枚举类型 – Type boolean is (False, True) – Type bit is („0‟, „1‟) – Signal a : bit。 VHDL数据类型--枚举  IEEE1164标准中预定义了一个枚举类型Type std_logic is(„U‟, „X‟,„0‟, „1‟, „Z‟, „W‟, „L‟, „H‟, „‟)。 – 该类型能比较全面地包括数字电路中信号会出现的几种状态,因此一般情况把这种类型代替 bit – Signal a : std_logic。 – 注意: 这里的大小写是敏感的 VHDL数据类型 整数、浮点数 – 方便用于数值方面的运算:加减乘除 – 整数范围: 231 ~ 231 –1,经常用于计数器 – 实数范围: ~ +,不被 Max+ PLusII支持 Variable a : integer range –255 to +255。 物理类型 – 主要用于调试 VHDL数据类型--复合类型  Array Types – 多个相同类型成员组成的队列,一般用于定义数据总线、地址总线等。 Signal a: std_logic_vector(7 downto 0)。 a = B“00111010”。 a = X “3A”。 – 可自定义复合类型 Type word is array (15 downto 0) of bit。 Signal b : word。 Type table8x4 is array (0 to 7, 0 to 3) of bit。 VHDL数据类型--复合类型  Record Types – 相同或不同类型的元素组成,类似 C中的结构 – 具有模型抽象能力,用于描述一个功能模块 – Type iocell is record Enable :bit。 DataBus :bit_vector(7 downto 0)。 end record。 singal bus : iocell。 = „1‟。 = “00110110”。 VHDL数据类型及子类型 Types And Subtypes  VHDL是强类型语言,必须用类型转换函数才能进行不同类型之间的转换 – type byte_size is integer range 0 to 255。 – signal a : byte_size。 – signal b : integer range 0 to 255。 –。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。