This packages defines a standard for designers to use in describing the interconnection data types used in vhdl modeling.

1  std_logic_1164

 PACKAGE std_logic_1164 IS

  3     -------------------------------------------------------------------
4 -- logic state system (unresolved)
5 -------------------------------------------------------------------
TYPE std_ulogic IS ( 'U', -- Uninitialized
'X', -- Forcing Unknown
'', -- Forcing
'', -- Forcing
'Z', -- High Impedance
'W', -- Weak Unknown
'L', -- Weak
'H', -- Weak
'-' -- Don't care
);
16 --------------------------------------------------------------------------
17 -- unconstrained array of std_ulogic for use with the resolution function
18 --------------------------------------------------------------------------
TYPE std_ulogic_vector IS ARRAY ( NATURAL RANGE <> ) OF std_ulogic; 21 -------------------------------------------------------------------
22 -- resolution function
23 -------------------------------------------------------------------
FUNCTION resolved ( s : std_ulogic_vector ) RETURN std_ulogic; 26 -------------------------------------------------------------------
27 -- *** industry standard logic type ***
28 -------------------------------------------------------------------
SUBTYPE std_logic IS resolved std_ulogic; 31 -----------------------------------------------------------------------
32 -- unconstrained array of std_logic for use in declaring signal arrays
33 -----------------------------------------------------------------------
TYPE std_logic_vector IS ARRAY ( NATURAL RANGE <>) OF std_logic; 36 -----------------------------------------------------------------------------
37 -- common subtypes
38 -----------------------------------------------------------------------------
SUBTYPE X01 IS resolved std_ulogic RANGE 'X' TO ''; -- ('X','','')
SUBTYPE X01Z IS resolved std_ulogic RANGE 'X' TO 'Z'; -- ('X','','','Z')
SUBTYPE UX01 IS resolved std_ulogic RANGE 'U' TO ''; -- ('U','X','','')
SUBTYPE UX01Z IS resolved std_ulogic RANGE 'U' TO 'Z'; -- ('U','X','','','Z') 44 -------------------------------------------------------------------
45 -- overloaded logical operators
46 ------------------------------------------------------------------- FUNCTION "and" ( l : std_ulogic; r : std_ulogic ) RETURN UX01;
FUNCTION "nand" ( l : std_ulogic; r : std_ulogic ) RETURN UX01;
FUNCTION "or" ( l : std_ulogic; r : std_ulogic ) RETURN UX01;
FUNCTION "nor" ( l : std_ulogic; r : std_ulogic ) RETURN UX01;
FUNCTION "xor" ( l : std_ulogic; r : std_ulogic ) RETURN UX01;
function "xnor" ( l : std_ulogic; r : std_ulogic ) return ux01;
FUNCTION "not" ( l : std_ulogic ) RETURN UX01; 56 -----------------------------------------------------------------------
57 -- vectorized overloaded logical operators
58 -----------------------------------------------------------------------
FUNCTION "and" ( l, r : std_logic_vector ) RETURN std_logic_vector;
FUNCTION "and" ( l, r : std_ulogic_vector ) RETURN std_ulogic_vector; FUNCTION "nand" ( l, r : std_logic_vector ) RETURN std_logic_vector;
FUNCTION "nand" ( l, r : std_ulogic_vector ) RETURN std_ulogic_vector; FUNCTION "or" ( l, r : std_logic_vector ) RETURN std_logic_vector;
FUNCTION "or" ( l, r : std_ulogic_vector ) RETURN std_ulogic_vector; FUNCTION "nor" ( l, r : std_logic_vector ) RETURN std_logic_vector;
FUNCTION "nor" ( l, r : std_ulogic_vector ) RETURN std_ulogic_vector; FUNCTION "xor" ( l, r : std_logic_vector ) RETURN std_logic_vector;
FUNCTION "xor" ( l, r : std_ulogic_vector ) RETURN std_ulogic_vector; 74 -- -----------------------------------------------------------------------
75 -- Note : The declaration and implementation of the "xnor" function is
76 -- specifically commented until at which time the VHDL language has been
77 -- officially adopted as containing such a function. At such a point,
78 -- the following comments may be removed along with this notice without
79 -- further "official" ballotting of this std_logic_1164 package. It is
80 -- the intent of this effort to provide such a function once it becomes
81 -- available in the VHDL standard.
82 -- -----------------------------------------------------------------------
function "xnor" ( l, r : std_logic_vector ) return std_logic_vector;
function "xnor" ( l, r : std_ulogic_vector ) return std_ulogic_vector; FUNCTION "not" ( l : std_logic_vector ) RETURN std_logic_vector;
FUNCTION "not" ( l : std_ulogic_vector ) RETURN std_ulogic_vector; 89 -------------------------------------------------------------------
90 -- conversion functions
91 -------------------------------------------------------------------
FUNCTION To_bit ( s : std_ulogic; xmap : BIT := '')
RETURN BIT;
FUNCTION To_bitvector ( s : std_logic_vector ; xmap : BIT := '')
RETURN BIT_VECTOR;
FUNCTION To_bitvector ( s : std_ulogic_vector; xmap : BIT := '')
RETURN BIT_VECTOR; FUNCTION To_StdULogic (b : BIT ) RETURN std_ulogic;
FUNCTION To_StdLogicVector (b : BIT_VECTOR ) RETURN std_logic_vector;
FUNCTION To_StdLogicVector (s : std_ulogic_vector) RETURN std_logic_vector;
FUNCTION To_StdULogicVector(b : BIT_VECTOR ) RETURN std_ulogic_vector;
FUNCTION To_StdULogicVector(s : std_logic_vector) RETURN std_ulogic_vector; 105 -------------------------------------------------------------------
106 -- strength strippers and type convertors
107 ------------------------------------------------------------------- FUNCTION To_X01 ( s : std_logic_vector ) RETURN std_logic_vector;
FUNCTION To_X01 ( s : std_ulogic_vector ) RETURN std_ulogic_vector;
FUNCTION To_X01 ( s : std_ulogic ) RETURN X01;
FUNCTION To_X01 ( b : BIT_VECTOR ) RETURN std_logic_vector;
FUNCTION To_X01 ( b : BIT_VECTOR ) RETURN std_ulogic_vector;
FUNCTION To_X01 ( b : BIT ) RETURN X01; FUNCTION To_X01Z ( s : std_logic_vector ) RETURN std_logic_vector;
FUNCTION To_X01Z ( s : std_ulogic_vector ) RETURN std_ulogic_vector;
FUNCTION To_X01Z ( s : std_ulogic ) RETURN X01Z;
FUNCTION To_X01Z ( b : BIT_VECTOR ) RETURN std_logic_vector;
FUNCTION To_X01Z ( b : BIT_VECTOR ) RETURN std_ulogic_vector;
FUNCTION To_X01Z ( b : BIT ) RETURN X01Z; FUNCTION To_UX01 ( s : std_logic_vector ) RETURN std_logic_vector;
FUNCTION To_UX01 ( s : std_ulogic_vector ) RETURN std_ulogic_vector;
FUNCTION To_UX01 ( s : std_ulogic ) RETURN UX01;
FUNCTION To_UX01 ( b : BIT_VECTOR ) RETURN std_logic_vector;
FUNCTION To_UX01 ( b : BIT_VECTOR ) RETURN std_ulogic_vector;
FUNCTION To_UX01 ( b : BIT ) RETURN UX01; 130 -------------------------------------------------------------------
131 -- edge detection
132 -------------------------------------------------------------------
FUNCTION rising_edge (SIGNAL s : std_ulogic) RETURN BOOLEAN;
FUNCTION falling_edge (SIGNAL s : std_ulogic) RETURN BOOLEAN; 136 -------------------------------------------------------------------
137 -- object contains an unknown
138 -------------------------------------------------------------------
FUNCTION Is_X ( s : std_ulogic_vector ) RETURN BOOLEAN;
FUNCTION Is_X ( s : std_logic_vector ) RETURN BOOLEAN;
FUNCTION Is_X ( s : std_ulogic ) RETURN BOOLEAN; END std_logic_1164;

2  resolution function  

     function resolved ( s : std_ulogic_vector ) return std_ulogic;
variable result : std_ulogic := 'Z'; -- weakest state default
begin
4 -- the test for a single driver is essential otherwise the
5 -- loop would return 'X' for a single driver of '-' and that
6 -- would conflict with the value of a single driver unresolved signal.
if s'length = 1 then
return s(s'low);
else
for i in s'range loop
result := resolution_table(result, s(i));
end loop;
end if;
return result;
end resolved; constant resolution_table : stdlogic_table := (
20 -- ---------------------------------------------------------
21 -- | U X 0 1 Z W L H - | |
22 -- ---------------------------------------------------------
( 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U' ), -- | U |
( 'U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X' ), -- | X |
( 'U', 'X', '', 'X', '', '', '', '', 'X' ), -- | 0 |
( 'U', 'X', 'X', '', '', '', '', '', 'X' ), -- | 1 |
( 'U', 'X', '', '', 'Z', 'W', 'L', 'H', 'X' ), -- | Z |
( 'U', 'X', '', '', 'W', 'W', 'W', 'W', 'X' ), -- | W |
( 'U', 'X', '', '', 'L', 'W', 'L', 'W', 'X' ), -- | L |
( 'U', 'X', '', '', 'H', 'W', 'W', 'H', 'X' ), -- | H |
( 'U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X' ) -- | - |
);

VHDL之std_logic_1164的更多相关文章

  1. VHDL 学习

    近期在接触 VHDL,首先要本好书,个人觉得 1)<VHDL for engineer>  VHDL 大学实用教程 (这个名字翻译的无语...) 2)估计verilog的作者的 bhask ...

  2. 实验五 含有控制信号的计数器VHDL设计

    一.实验目的 学习计数器的设计.仿真和硬件测试,进一步熟悉VHDL设计技术. 二.实验仪器与器材 计算机1台,GW48-PK2S实验箱1台,QuartusⅡ6.0 1套. 三.实验 1. 基本命题 在 ...

  3. 实验三 组合逻辑电路的VHDL设计

    一.实验目的 熟悉QuartusⅡ的VHDL文本设计过程,学习简单组合逻辑电路的设计.仿真和测试方法. 二.实验内容 1. 基本命题 完成2选1多路选择器的文本编辑输入(mux21a.vhd)和仿真测 ...

  4. VHDL学习札记:library and Package

     参考:http://www.cnblogs.com/garylee/archive/2012/11/16/2773596.htmlhttp:// http://forums.xilinx.com ...

  5. 3. 戏说VHDL之入门游戏一:流水灯

    一.   流水灯 1.1流水灯原理 流水灯是每个学电子的入门“游戏” ,示意图如图1,其原理极其简单,但是可玩性却极强,可以就8个LED写出不同花样的程序.在1.2中我们列出两个不同思路的代码作为VH ...

  6. 让WPS支持VHDL的关键词加粗

    WPS的VBA在这里下载:http://bbs.wps.cn/forum.php?mod=viewthread&tid=22347925 语法高亮是参考Word的,这篇文章:http://bl ...

  7. VHDL程序的库

    VHDL库存储和放置了可被其他VHDL程序调用的数据定义.器件说明.程序包等资源.VHDL库的种类有很多,但最常见的库有IEEE标准库.WORK库.IEEE标准库主要包括STD_LOGIC_1164. ...

  8. VHDL学习之TEXTIO在仿真中的应用

    TEXTIO 在VHDL 仿真与磁盘文件之间架起了桥梁,使用文本文件扩展VHDL 的仿真功能.本文介绍TEXTIO 程序包,以一个加法器实例说明TEXTIO 的使用方法,最后使用ModelSim 对设 ...

  9. kururu的VHDL学习笔记

    最近开始做课程设计,VHDL设计一个中央空调的控制程序.所以开始学习VHDL,在这篇文章里面记录一些自己的笔记,期望对于同样的初学者有些借鉴意义~ 编写VHDL所需的工具: 那自然很是quartus啦 ...

随机推荐

  1. linux - redis基础

    目录 linux - redis基础 redis 源码编译安装 redis 数据结构 1. strings类型 2. list 类型 3. sets集合类型 有序集合 5. 哈希数据结构 centos ...

  2. 《零压力学Python》 之 第三章知识点归纳

    第三章(第一个程序)知识点归纳 编程犹如写剧本.Python函数与剧本差别不大,你可以反复调用函数,而它每次都执行预定的“脚本”(脚本也可以指整个程序). 在Python IDLE中,真正的编程是从编 ...

  3. padding填充与box-sizing: border-box配合使用

    不管伸缩盒还是浮动盒子,只要使用到padding,就必须使用 box-sizing: border-box;     有图片的时候,需摇与其他文字对齐的时候,在图片的外层加个:vertical-ali ...

  4. AIM Tech Round (Div. 2)——ABCD

    http://codeforces.com/contest/624 A.python是用来写div2的AB题的... a, b, x, y = map(float, raw_input().split ...

  5. Jzzhu and Numbers

    Jzzhu and Numbers time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...

  6. assertion: 18 { code: 18, ok: 0.0, errmsg: "auth fails" }

    MongoDB Version: 2.4.7 Mongodump: $ bin/mongodump -u admin -p admin -d test -o ./tmp/ connected to: ...

  7. sql中对数值四舍五入取小数点后两位数字

    用:cast(value as decimal(10,2)) 来实现.

  8. PHP中Session和Cookie 快速了解与使用

    SessionPHP的$_SESSION可以存储当前用户数据信息,用户访问WEB网站的时候,PHP会给每个访问的用户创建一个session ID,该ID是唯一ID,保存在客户机上,而用户的会话数据是保 ...

  9. 优化实例- not in 和 not exists

    客户运行一个SQL,非常慢.于是进行了一下改写.速度飞快,首先看一下原来的SQL. original sql SQL> explain plan for 2 select count(*) fr ...

  10. HDU 5393

    [background] 保研的事终于告一段落了,之后去北京折腾了一段时间,本以为会在那里实习一个月,谁知道刚去ICT,心中就各种反感,可能是因为LP的态度吧,否则我可能会留在那里读研也说不定.花了两 ...