加载中…
个人资料
eric
eric
  • 博客等级:
  • 博客积分:0
  • 博客访问:113,917
  • 关注人气:75
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
相关博文
推荐博文
谁看过这篇博文
加载中…
正文 字体大小:

vhdl中的类型转换

(2010-04-13 14:37:28)
标签:

杂谈

分类: FPGA

 Packages

IEEE VHDL'87/VHDL'93 SYNOPSYS proprietary draft math
std_logic_1164.vhd (ieee) standard.vhd (std) std_logic_arith.vhd    (ieee) mathpack.vhd
numeric_std.vhd    (ieee) textio.vhd   (std) std_logic_misc.vhd     (ieee)  
numeric_bit.vhd    (ieee)   std_logic_signed.vhd   (ieee)  
    std_logic_unsigned.vhd (ieee)  
    std_logic_textio.vhd   (ieee)  
    attributes.vhd     (synopsys)  

 Numeric Packages

  • Numeric packages have been defined to support arithmetic operations on binary vectors. The IEEE packages numeric_std and numeric_bit provide the two types unsigned and signed, the latter in 2's complement number representation. The difference is that numeric_std uses vectors the components of which are of type std_logic while numeric_bit uses vectors of bit-type components.
  • Package std_logic_arith is a proprietary stopgap developed by SYNOPSYS before the IEEE packages became available. It should not be used for new designs any longer now that there is an official IEEE standard.
Types in Binary Arithmetic Operations
  numeric_std std_logic_arith
Argument 1 Argument 2 Result
unsigned unsigned unsigned unsigned/std_logic_vector
unsigned integer unsigned unsigned/std_logic_vector
integer unsigned unsigned unsigned/std_logic_vector
signed signed signed signed/std_logic_vector
signed integer signed signed/std_logic_vector
integer signed signed signed/std_logic_vector
  numeric_std std_logic_arith
Type Conversion
std_logic_vector    -> unsigned unsigned(arg) unsigned(arg)
std_logic_vector    -> signed signed(arg) signed(arg)
unsigned            -> std_logic_vector std_logic_vector(arg) std_logic_vector(arg)
signed              -> std_logic_vector std_logic_vector(arg) std_logic_vector(arg)
integer             -> unsigned to_unsigned(arg,size) conv_unsigned(arg,size)
integer             -> signed to_signed(arg,size) conv_signed(arg,size)
unsigned            -> integer to_integer(arg) conv_integer(arg)
signed              -> integer to_integer(arg) conv_integer(arg)
integer             -> std_logic_vector integer -> unsigned/signed ->std_logic_vector
std_logic_vector    -> integer std_logic_vector -> unsigned/signed ->integer
unsigned + unsigned -> std_logic_vector std_logic_vector(arg1 + arg2) arg1 + arg2
signed + signed     -> std_logic_vector std_logic_vector(arg1 + arg2) arg1 + arg2
Resizing
unsigned resize(arg,size) conv_unsigned(arg,size)
signed resize(arg,size) conv_signed(arg,size)

0

阅读 评论 收藏 转载 喜欢 打印举报/Report
  • 评论加载中,请稍候...
发评论

    发评论

    以上网友发言只代表其个人观点,不代表新浪网的观点或立场。

      

    新浪BLOG意见反馈留言板 电话:4000520066 提示音后按1键(按当地市话标准计费) 欢迎批评指正

    新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 会员注册 | 产品答疑

    新浪公司 版权所有