?? 0.txt
字號:
測試向量(Test Bench)和波形產(chǎn)生:VHDL實例---加法器源程序新手入門
PLD概述/原理
發(fā)展歷程
FPGA原理
HDL 概述
學習資料
VHDL實例
Verilog實例
參考設計
開發(fā)軟件
參考書籍
設計進階
PLD廠商
ALTERA專欄
XILINX專欄
Lattice專欄
ALTERA培訓中心
ALTERA常見問題
FPGA開發(fā)
硬件描述語言
接口與外設
工業(yè)控制
綜合應用
| 網(wǎng)站首頁 | 新聞 | DSP | FPGA | 嵌入式系統(tǒng) | 電路圖 | VIP下載 | 普通下載 | 筆記 | 商城 | 郵購須知 |
留言 | 社區(qū) |
|
FPGA/PLD首頁
|
新手入門
|
HDL語言
|
參考設計
|
應用文章
|
您現(xiàn)在的位置: 61IC中國電子在線 >> FPGA >> HDL語言 >> VHDL實例 >> 文章正文 用戶登錄 新用戶注冊
測試向量(Test Bench)和波形產(chǎn)生:VHDL實例---加法器源程序 【字體:小 大】
測試向量(Test Bench)和波形產(chǎn)生:VHDL實例---加法器源程序
作者:admin 文章來源:本站原創(chuàng) 點擊數(shù):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
上一篇文章: 狀態(tài)機舉例:VHDL實例---帶莫爾/米勒輸出的狀態(tài)機
下一篇文章: 測試向量(Test Bench)和波形產(chǎn)生:VHDL實例---波形發(fā)生器(含test beach)
【發(fā)表評論】【加入收藏】【告訴好友】【打印此文】【關閉窗口】
最新熱點 最新推薦 相關文章
Verilog-HDL與CPLD/FPGA設
[圖文]ACEX 1K系列CPLD配置
[組圖]多種EDA工具的FPGA協(xié)
[組圖]對PLD進行邊界掃描(
[組圖]在系統(tǒng)可編程通用數(shù)
[組圖]基于MicroBlaze軟核
[組圖]基于C語言的設計方式
[組圖]用Rocket I/O模塊的
參考設計:更多參考設計
[組圖]Free Intellectual
[組圖]基于FPGA的IPV6數(shù)據(jù)
[組圖]數(shù)字頻率合成器的FP
[組圖]FIR數(shù)字濾波器分布式
[組圖]基于FPGA流水線分布
[組圖]基于分布式算法和FP
[組圖]CPLD 基于FPGA實現(xiàn)F
[組圖]數(shù)字簽名算法SHA-1的
[組圖]基于FPGA的四階IIR數(shù)
[組圖]基于FPGA的快速傅立
[組圖]基于FPGA的直接數(shù)字
其他設計舉例:VHDL實例---4
其他設計舉例:VHDL實例---布
其他設計舉例:VHDL實例---一
其他設計舉例:VHDL實例---一
其他設計舉例:VHDL實例---4
其他設計舉例:VHDL實例---偽
其他設計舉例:VHDL實例---直
其他設計舉例:VHDL實例---步
其他設計舉例:VHDL實例---偽
測試向量(Test Bench)和波
網(wǎng)友評論:(只顯示最新10條。評論內(nèi)容只代表網(wǎng)友觀點,與本站立場無關!)
沒有任何評論
| 設為首頁 | 加入收藏 | 聯(lián)系站長 | 友情鏈接 | 版權申明 | 管理登錄 |
站長:61IC中國電子在線
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -