新聞中心

EEPW首頁 > EDA/PCB > 設(shè)計應(yīng)用 > 基于FPGA的高速數(shù)字相關(guān)器設(shè)計

基于FPGA的高速數(shù)字相關(guān)器設(shè)計

作者: 時間:2009-12-08 來源:網(wǎng)絡(luò) 收藏

  在使用 VHDL進行相關(guān)器設(shè)計時,主要實現(xiàn) 4位相關(guān)器和多位加法器模塊的設(shè)計。其元件生成圖分別是 4位相關(guān)器模塊 XIANGGUAN4、3位加法器模塊 ADD3和 4位加法器模塊 ADD4,其電路原理圖如圖 2所示。其中 4位相關(guān)器模塊 XIANGGUAN4的主要源代碼為:

  entity xiangguan4 is

  port(a,b:in std_logic_vector(3 downto 0);

  sum:out std_logic_vector(2 downto 0);

  clk:in std_logic);

  end ;

  architecture one of xiangguan4 is

  signal ab :std_logic_vector(3 downto 0);

  begin

  ab=a xor b; --判斷 a,b是否相同

  process(clk)

  begin

  if clk'event and clk='1' then

  if ab=1111 then sum=000; --列出各種組合,輸出相應(yīng)相關(guān)值

  elsif ab=0111 or ab=1011 or ab=1101 or ab=1110 then sum=001;

  elsif ab=0001 or ab=0010 or ab=0100 or ab=1000 then sum=011;

  elsif ab=0000 then sum=100;

  else sum=010;

  end if;

  end if;

  end process;

  end one;



關(guān)鍵詞: FPGA 高速數(shù)字

評論


相關(guān)推薦

技術(shù)專區(qū)

關(guān)閉