![]() |
|
||||||||||||||
| . 网站首页 . 新闻 . 新品 . 方案 . 专访 . 活动 . DSP . EDA . 评测室 . 技术文库 . 会员区 . 商城 . 服务导航 . 邮购 . 资源 . | ||
|
||
|
|||||
| VHDL易忘语句语法摘要 | |||||
作者:Free 文章来源:Free 点击数: 更新时间:2008-1-4 ![]() |
|||||
|
一.Wait语句 1,wait 不常用 2,wait on 信号1,信号2。。。 类似于敏感信号列表功能process(a,b) 3,wait until 条件表达式 举例:process begin wait until clock’event and clock=’1’ ; x<=a; wait until clock’event and clock=’1’ ; y<=b; end process; 4,wait for时间表达式 此语句不可以被逻辑综合! 等待x时间后开始执行其后面的语句。 举例: process begin wait for 30ns; clk<= not clk; wait for 20ns; clk<= not clk end process; 注意:当process中有wait时,那么prcess中就不可以有敏感信号列表。 二.Function 语法格式: function函数名(输入参数1,输入参数2,。。。)return返回值类型is [函数声明部分]; begin [顺序处理语句]; return [返回变量名]; end函数名; 举例: library ieee; use ieee.std_logic_1164.all; package exam1 is function vector_to_int(vect:std_logic_vector) return integer; end exam1; package body exam1 is function vector_to_int(vect:std_logic_vector) return integer is variable reout : integer :=0; begin for …. ….. end loop; return reout; end vect_to_int; end exam1; 函数定义好之后就可以被调用了,为了使调用成功,需要在实体前面加上程序包说明,用户自定义的程序包被自动默认放在work工作库中,所以自定义程序包的说明语句为: library work; use work.exam1.all; 在结构体中调用此函数时可写为: dig+num:=vect_to_int(a); 三.Procedure 语法格式: Procedure过程名(输入参数1;输入参数2;。。。)is [定义语句](变量等的定义); begin [顺序处理语句]; end过程名; 过程调用的语法格式为: 过程名[([名称=>]表达式,[名称=>]表达式,。。。。。。)]; 举例: process(in_serial) procedure swap(data: inout xxx type; low,high: in integer) is variable temp :data_cell; begin xxxxxxxxxxx; end swap; variable my_vector : xxx type; begin my_vector:=in_serial; swap(my_vector,1,2); swap(my_vector,2,3); out_serial<=my_vector; end process; 四.库 1.Std 程序包名 包中定义内容 standard vhdl类型,如bit,bit-vector 2.Ieee 程序包名 包中定义内容 std_logic_1164 定义了std_logic,std_logic_vector等数据类型 numeric_std 定义了一组基于std_logic_1164中定义的类型的算术运算符,如+,-,shl,shr等 std_logic_arith 定义了有符号无符号类型,以及相关算术运算 conv_std_logic_vector(A,位长) conv_integer(A) std_logic_signed 定义了基于std_logic与std_logic._vector类型上的有符号运算 std_logic_unsigned 定义了基于std_logic与std_logic_vector类型上的无符号运算 conv_ineger(A) |
|||||
| 欢迎点击进入:TI德州中文网 (国内唯一针对TI应用的中文技术网站) 文章录入:admin 责任编辑:admin | |||||
| 【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】 | |||||
| 最新热点 | 最新推荐 | 相关文章 | ||
| 国外VHDL& Verilog IP Resou… VHDL快速参考手册 在FPGA中实现SPI与总线接口转… VHDL信号 异步通信起始位正确检测的VH… FPGA驱动VGA接口的VHDL语言实… VHDL实现VGA接口设计 FPGA设计中对输入信号的处理 《同步电路设计中clock skew… “单比特信号同步” 学习笔记 |
| 网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!) |
| | 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 版权申明 | 网站公告 | 管理登录 | | |||
|
|