欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

VHDL入门基础——语法规则(3)

程序员文章站 2022-06-24 16:30:57
VHDL基础语法(3)——运算符篇算术运算符对象:signal or variable+:integer+integer但如果事先调用ieee库中std_logic_1164、std_logic_unsigned则可以是std_logic_vector+std_logic_vector、std_logic_vector+integer、integer+integer、integer+std_logic_vector-:同+:只能是std_logic_vectorstd_logic_vector...

VHDL基础语法(3)——运算符篇

算术运算符
对象:signal or variable
+:integer+integer
但如果事先调用ieee库中std_logic_1164、std_logic_unsigned则可以是std_logic_vector+std_logic_vector、std_logic_vector+integer、integer+integer、integer+std_logic_vector
- : 同+
* :只能是std_logic_vector * std_logic_vector 或 integer*integer
/:除
ABS:绝对值
MOD:求模
REM:求余

并置运算符
&:将矢量与矢量并置或矢量与元素并置
例:
signal a:std_logic_vector(3 downto 0);
signal b:std_logic_vector(1 downto 0);
signal c:std_logic_vector(5 downto 0);
signal d:std_logic_vector(4 downto 0);

c<=a & b;
d<=a(1 downto 0) & b(1 downto 0) & 1;

VHDL入门基础——语法规则(3)
关系运算符
1.= /=:对象可以是任何数据类型,结果是Boolean(true false)
2. < <= > >=:对像只能是整数类型,枚举类型,整数类型枚举类型构成的数组。结果是Boolean(true false)

逻辑运算符
AND NOT OR NAND NOR XOR NXOR
对象:boolean, bit, bit_vector, std_logic, std_logic_vector

本文地址:https://blog.csdn.net/vinyjh/article/details/107303955