VHDL的库
STD_LOGIC_ARITH
扩展了UNSIGNED、SIGNED、SMALL_INT(短整型)三个数据类型,并定义了相关的算术运算和转换函数。
--================================================
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
entity mux1 is
port(
sclk : in std_logic;
rst_n: in std_logic;
count: buffer std_logic_vector(4 downto 0)
);
end mux1;
architecture ok of mux1 is
signal cnt : std_logic_vector(4 downto 0);
begin
process
begin
wait until sclk'event and sclk= '1';
if rst_n = '0' then
cnt <=(others =>'0');
elsif unsigned(cnt ) >= 10 then
cnt <= (others =>'0');
else
cnt <= unsigned(cnt) + 2;
end if;
end process;
count <= cnt;
end ok;
--========================================================
use IEEE.NUMERIC_STD.
支持整数的MOD,REM,ABS 等运算
dd <= 5 mod 3;
dd <= 5 rem 3;
dd <= abs(-3);
最新文章
- 基于Three.js的360X180度全景图预览插件
- Html空格字符代码:
- spring security 图解过滤器的使用
- mysql数据库---同时插入两个表以上的数据
- jQuery.validator 详解
- devexpress 控制面板汉化方式 参考信息
- web.xml 中的listener、 filter、servlet 加载顺序
- java03变量和基本数据类型
- C# sql操作
- Linux中的网络
- javascript 闭包基础分享
- Java Web(三) 会话机制,Cookie和Session详解
- esri-leaflet入门教程(5)- 动态要素加载
- 开启第一个Node.js的Express项目
- Docker Swarm Mode 学习笔记(创建 Swarm 集群)
- js设计模式(三)---代理模式
- 单因素方差分析的SAS实现
- Echarts简单案例
- [PHP]Nginx与PHP的文件上传大小限制
- Android Activity、Service、BroadcastReceiver 的生命周期