VHDL結(jié)構(gòu)體的數(shù)據(jù)流描述法

發(fā)布時(shí)間:2023-09-12
數(shù)據(jù)流描述(dataflow description)是結(jié)構(gòu)體描述方法之一,它描述了數(shù)據(jù)流程的運(yùn)動(dòng)路徑、運(yùn)動(dòng)方向和運(yùn)動(dòng)結(jié)果。例如,同樣是一個(gè)8位比較器采用數(shù)據(jù)流法編程,則如例1所示:
【例1】 用數(shù)據(jù)流描述法設(shè)計(jì)8位比較器
library ieee;
use ieee std_logic_1164.all;
entity comparator is
port (a,b:in std_logic_vector(7 downto 0);
g:out std_logic);
end comparator;
architecture dataflow of  comp  is
begin
g <=1 when (a = b) else0;
end dataflow;
上述程序設(shè)計(jì)的數(shù)據(jù)流程為:當(dāng)a=b時(shí),g=1;其余時(shí)間g=0。注意,數(shù)據(jù)流描述的句法與行為描述的句法是不一樣的。
cale—when:條件信號(hào)賦值語(yǔ)句。
with—select—when:選擇信號(hào)賦值語(yǔ)句。
這兩種語(yǔ)句是數(shù)據(jù)流描述法常用的語(yǔ)法,同樣采用布爾方程,也可用數(shù)據(jù)流描述法,如例2所示。
【例2】 用布爾方程的數(shù)據(jù)流描述法設(shè)計(jì)的8位比較器
library ieee;
use ieee std_logic_1164.all;
entity comparator is
port (a,b:in std_logic_vector(7 downto 0);
g:out std_logic);
end  comparator;
architecture bool of comparator is
begin
g<=not(a(0)xorb(0))and
not(a(1)xorb(1))
and not(a(2)xorb(2))
and not(a(3)xorb(3))
and not(a(4)xorb(4))
and not(a(5)xorb(5))
and not(a(6)xorb(6))
and not(a(7)xorb(7));
end bool;
布爾方程的數(shù)據(jù)流描述法描述了信號(hào)的數(shù)據(jù)流的路徑。這種描述法比例1-6的結(jié)構(gòu)體復(fù)雜,因?yàn)槔?-6的結(jié)構(gòu)體描述與端口結(jié)構(gòu)無關(guān)。只要a=b,g就輸出1,與a、b的大小無關(guān)。而例1-7是一個(gè)8位比較器,布爾方程定義的端口尺寸為8位。
數(shù)據(jù)流描述法采用并發(fā)信號(hào)賦值語(yǔ)句,而不是進(jìn)程順序語(yǔ)句。一個(gè)結(jié)構(gòu)體可以有多重信號(hào)賦值語(yǔ)句,且語(yǔ)句可以并發(fā)執(zhí)行。
上一個(gè):手機(jī)換屏后觸屏總亂點(diǎn)怎么回事(手機(jī)換屏后觸屏總亂點(diǎn))
下一個(gè):惠普光影精靈7配置參數(shù),惠普暗影精靈7配置參數(shù)

安溪鐵觀音茶的品質(zhì)鑒別方法
電腦鍵盤不亮怎么回事-(電腦鍵盤不亮怎么回事兒-)
意大利sirai電磁閥l133系列
CR1206D41913G 麗智電阻1206 191KΩ D
在施工合同糾紛中,因工期延長(zhǎng)引起的索賠與反索賠最為常見
RC-01W1803FTE在線查庫(kù)存,今日?qǐng)?bào)價(jià)
矮生紫薇的栽培
芍藥疫病
串聯(lián)諧振和并聯(lián)諧振的特點(diǎn)和區(qū)別
觀賞竹的盆景制作技術(shù)
十八禁 网站在线观看免费视频_2020av天堂网_一 级 黄 色 片免费网站_绝顶高潮合集Videos