📄 0.txt
字号:
测试向量(Test Bench)和波形产生:VHDL实例---加法器源程序新手入门
PLD概述/原理
发展历程
FPGA原理
HDL 概述
学习资料
VHDL实例
Verilog实例
参考设计
开发软件
参考书籍
设计进阶
PLD厂商
ALTERA专栏
XILINX专栏
Lattice专栏
ALTERA培训中心
ALTERA常见问题
FPGA开发
硬件描述语言
接口与外设
工业控制
综合应用
| 网站首页 | 新闻 | DSP | FPGA | 嵌入式系统 | 电路图 | VIP下载 | 普通下载 | 笔记 | 商城 | 邮购须知 |
留言 | 社区 |
|
FPGA/PLD首页
|
新手入门
|
HDL语言
|
参考设计
|
应用文章
|
您现在的位置: 61IC中国电子在线 >> FPGA >> HDL语言 >> VHDL实例 >> 文章正文 用户登录 新用户注册
测试向量(Test Bench)和波形产生:VHDL实例---加法器源程序 【字体:小 大】
测试向量(Test Bench)和波形产生:VHDL实例---加法器源程序
作者:admin 文章来源:本站原创 点击数:361 更新时间:2004-11-16
-------------------------------------------------------------------------- Single-bit adder------------------------------------------------------------------------library IEEE;use IEEE.std_logic_1164.all;entity adder is port (a : in std_logic; b : in std_logic; cin : in std_logic; sum : out std_logic; cout : out std_logic);end adder; -- description of adder using concurrent signal assignmentsarchitecture rtl of adder isbegin sum <= (a xor b) xor cin; cout <= (a and b) or (cin and a) or (cin and b);end rtl; -- description of adder using component instantiation statementsuse work.gates.all;architecture structural of adder is signal xor1_out, and1_out, and2_out, or1_out : std_logic;begin xor1: xorg port map( in1 => a, in2 => b, out1 => xor1_out); xor2: xorg port map( in1 => xor1_out, in2 => cin, out1 => sum); and1: andg port map( in1 => a, in2 => b, out1 => and1_out); or1: org port map( in1 => a, in2 => b, out1 => or1_out); and2: andg port map( in1 => cin, in2 => or1_out, out1 => and2_out); or2: org port map( in1 => and1_out, in2 => and2_out, out1 => cout);end structural; -------------------------------------------------------------------------- N-bit adder-- The width of the adder is determined by generic N------------------------------------------------------------------------library IEEE;use IEEE.std_logic_1164.all;entity adderN is generic(N : integer := 16); port (a : in std_logic_vector(N downto 1); b : in std_logic_vector(N downto 1); cin : in std_logic; sum : out std_logic_vector(N downto 1); cout : out std_logic);end adderN; -- structural implementation of the N-bit adderarchitecture structural of adderN is component adder port (a : in std_logic; b : in std_logic; cin : in std_logic; sum : out std_logic; cout : out std_logic); end component; signal carry : std_logic_vector(0 to N);begin carry(0) <= cin; cout <= carry(N); -- instantiate a single-bit adder N times gen: for I in 1 to N generate add: adder port map( a => a(I), b => b(I), cin => carry(I - 1), sum => sum(I), cout => carry(I)); end generate;end structural; -- behavioral implementation of the N-bit adderarchitecture behavioral of adderN isbegin p1: process(a, b, cin) variable vsum : std_logic_vector(N downto 1); variable carry : std_logic; begin carry := cin; for i in 1 to N loop vsum(i) := (a(i) xor b(i)) xor carry; carry := (a(i) and b(i)) or (carry and (a(i) or b(i))); end loop; sum <= vsum; cout <= carry; end process p1;end behavioral;
文章录入:admin 责任编辑:admin
上一篇文章: 状态机举例:VHDL实例---带莫尔/米勒输出的状态机
下一篇文章: 测试向量(Test Bench)和波形产生:VHDL实例---波形发生器(含test beach)
【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】
最新热点 最新推荐 相关文章
Verilog-HDL与CPLD/FPGA设
[图文]ACEX 1K系列CPLD配置
[组图]多种EDA工具的FPGA协
[组图]对PLD进行边界扫描(
[组图]在系统可编程通用数
[组图]基于MicroBlaze软核
[组图]基于C语言的设计方式
[组图]用Rocket I/O模块的
参考设计:更多参考设计
[组图]Free Intellectual
[组图]基于FPGA的IPV6数据
[组图]数字频率合成器的FP
[组图]FIR数字滤波器分布式
[组图]基于FPGA流水线分布
[组图]基于分布式算法和FP
[组图]CPLD 基于FPGA实现F
[组图]数字签名算法SHA-1的
[组图]基于FPGA的四阶IIR数
[组图]基于FPGA的快速傅立
[组图]基于FPGA的直接数字
其他设计举例:VHDL实例---4
其他设计举例:VHDL实例---布
其他设计举例:VHDL实例---一
其他设计举例:VHDL实例---一
其他设计举例:VHDL实例---4
其他设计举例:VHDL实例---伪
其他设计举例:VHDL实例---直
其他设计举例:VHDL实例---步
其他设计举例:VHDL实例---伪
测试向量(Test Bench)和波
网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
没有任何评论
| 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 版权申明 | 管理登录 |
站长:61IC中国电子在线
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -