手機閱讀

EDA實驗報告 EDA實驗報告武漢理工大學(五篇)

格式:DOC 上傳日期:2023-02-02 01:19:44 頁碼:10
EDA實驗報告 EDA實驗報告武漢理工大學(五篇)
2023-02-02 01:19:44    小編:ZTFB

“報告”使用范圍很廣,按照上級部署或工作計劃,每完成一項任務,一般都要向上級寫報告,反映工作中的基本情況、工作中取得的經(jīng)驗教訓、存在的問題以及今后工作設想等,以取得上級領導部門的指導。那么什么樣的報告才是有效的呢?下面是小編為大家整理的報告范文,僅供參考,大家一起來看看吧。

EDA實驗報告 EDA實驗報告武漢理工大學篇一

eda技術實驗

二、教材名稱: 《eda技術使用教程》,潘松等編著。

三、本課程教學目的、要求:

介紹eda的基本知識、常用的eda工具的使用方法和目標器件的結構原理、vhdl設計輸入方法(圖形和文本)、vhdl仿真、vhdl的設計優(yōu)化等。

eda技術作為重要的專業(yè)課程,其實踐性強。在教學時要注重理論和實踐的緊密結合,通過大量上機操作,使學生掌握vhdl的基本結構和編程思想。實驗1 原理圖輸入方法及8位全加器設計(4課時)

1)實驗目的:

熟悉利用max+plusⅱ的原理圖輸入方法設計簡單組合電路,掌握層次化設計的方法,并通過一個8位全加器的設計把握利用eda軟件進行電子電路設計的詳細流程。2)實驗報告要求:

詳細敘述8位加法器的設計流程;給出各層次的原理圖及其對應的仿真波形圖;給出加法器的延時情況。

3)實驗步驟:

(1)設計一個一位半加器。

步驟1:輸入設計項目和存盤 步驟2:輸入半加器元件: 步驟3:將項目設置為工程文件 步驟4:選擇目標器件并編譯 步驟5:時序仿真 步驟6:包裝元件入庫

選擇菜單“file”→“open”,在“open”對話框中選擇原理圖編輯文件選項“graphic editor files”,,重新打開半加器設計文件,然后選擇如圖4-5中“file”菜單的“create default symbol”項,將當前文件變成了一個包裝好的單一元件(symbol),并被放置在工程路徑指定的目錄中以備后用。

(2)利用半加器組成一個一位全加器,并記錄仿真結果。(3)利用全加器組成一個八位全加器,并記錄仿真結果。

實驗二

簡單組合電路和時序電路設計(4課時)

一、實驗目的:

熟悉max+plusⅱ的vhdl文本設計流程全過程,學習簡單組合電路和時序電路的設計和仿真方法。

二、實驗內(nèi)容

1:首先利用max+plusⅱ完成2選1多路選擇器和一位全加器的文本編輯輸入和仿真測試等步驟,給出仿真波形,驗證本項設計的功能。

2:設計觸發(fā)器(j-k),給出程序設計、軟件編譯、仿真分析、硬件測試及詳細實驗過程。

3:先設計或門和一位半加器的vhdl描述文件,并進行仿真調(diào)試,再用元件例化的方法實現(xiàn)一位全加器,并仿真調(diào)試。要求記錄vhdl文件內(nèi)容和仿真波形結果。

4:用一位全加器設計8為全加器。要求記錄vhdl文件內(nèi)容和仿真波形結果。(選作)參考程序 entity mux21a is port(a, b : in bit;s : in bit;y : out bit);end entity mux21a;architecture one of mux21a is signal d,e : bit;begin d <= a and(not s);e <= b and s;y <= d or e;end architecture one;

library ieee;use ;entity or2a is port(a, b :in std_logic;c : out std_logic);end entity or2a;

architecture fu1 of or2a is begin c <= a or b;end architecture fu1;

半加器描述(1)library ieee;use ;entity adder is port(a, b : in std_logic;co, so : out std_logic);end entity adder;architecture fh1 of adder is begin so <= not(a xor(not b));co <= a and b;end architecture fh1;

1位二進制全加器頂層設計描述 library ieee;use ;entity f_adder is port(ain,bin,cin : in std_logic;cout,sum : out std_logic);end entity f_adder;architecture fd1 of f_adder is component h_adder port(a,b : in std_logic;co,so : out std_logic);end component ; component or2a port(a,b : in std_logic;c : out std_logic);end component;

signal d,e,f : std_logic;begin u1 : h_adder port map(a=>ain,b=>bin,co=>d,so=>e);u2 : h_adder port map(a=>e,b=>cin,co=>f,so=>sum);u3 : or2a port map(a=>d,b=>f,c=>cout);end architecture fd1;二選一多路選擇器仿真結果:

實驗三

含異步清0和同步時鐘使能的4位加法計數(shù)器(4課時)

一、實驗目的:

學習計數(shù)器的設計、仿真,進一步熟悉vhdl設計技術。

二、實驗內(nèi)容:

設計一含計數(shù)使能、異步復位和能進行計數(shù)值并行預置功能的4位加法計數(shù)器。rst是異步清零信號,高電平有效;clk是時鐘輸入信號;d0、d1、d2、d3是4位數(shù)據(jù)輸入端(數(shù)據(jù)預置輸入端)。q0、q1、q2、q3為計數(shù)器輸出端。cout為進位輸出端。ena為使能端,為?1?時,計數(shù)器實現(xiàn)對clk時鐘脈沖信號的加1計數(shù),為0時停止計數(shù)。

參考程序:library ieee;use ;use ;entity cnt4b is port(clk : in std_logic;rst : in std_logic;ena : in std_logic;outy : out std_logic_vector(3 downto 0);cout : out std_logic);end cnt4b;architecture behav of cnt4b is signal cqi : std_logic_vector(3 downto 0);begin p_reg: process(clk, rst, ena)begin if rst = '1' then cqi <= “0000”;elsif clk'event and clk = '1' then if ena = '1' then cqi <= cqi + 1;else cqi <= “0000”;end if;end if;outy <= cqi;end process p_reg;cout <= cqi(0)and cqi(1)and cqi(2)and cqi(3);--進位輸出 end behav;

實驗四

7段數(shù)碼顯示譯碼器設計(2課時)

一、實驗目的:

1、學習7段數(shù)碼顯示譯碼器設計;

2、學習vhdl的多層次設計方法。

二、實驗原理:

7段數(shù)碼是純組合電路,通常的小規(guī)模專用ic,如74或4000系列的器件只能作十進制bcd碼譯碼,然而數(shù)字系統(tǒng)中的數(shù)據(jù)處理和運算都是2進制的,所以輸出表達都是16進制的,為了滿足16進制數(shù)的譯碼顯示,最方便的方法就是利用譯碼程序在fpga/cpld中來實現(xiàn)。但為了簡化過程,首先完成7段bcd碼譯碼器的設計。例如輸出為“1101101”時,數(shù)碼管的7個段:g、f、e、d、c、b、a分別接1、1、0、1、1、0、1;接有高電平的段發(fā)亮,于是數(shù)碼管顯示“5”。

圖6-21 共陰數(shù)碼管及其電路

三、實驗內(nèi)容

1、編程實現(xiàn)7段數(shù)碼顯示譯碼器設計;

2、對7段數(shù)碼顯示譯碼器設計進行編輯、仿真,給出其所有信號的時序仿真波形; 參考程序: library ieee;use ;entity decl7s is port(a : in std_logic_vector(3 downto 0);led7s : out std_logic_vector(6 downto 0));end;architecture one of decl7s is begin process(a)begin case a is when “0000” => led7s <= “0111111”;when “0001” => led7s <= “0000110”;when “0010” => led7s <= “1011011”;when “0011” => led7s <= “1001111”;when “0100” => led7s <= “1100110”;when “0101” => led7s <= “1101101”;when “0110” => led7s <= “1111101”;when “0111” => led7s <= “0000111”;when “1000” => led7s <= “1111111”;when “1001” => led7s <= “1101111”;when others => null;end case;end process;end;仿真結果:

綜合后的計數(shù)器和譯碼器連接電路的頂層文件原理圖:

實驗五

用狀態(tài)機實現(xiàn)序列檢測器的設計(4課時)

一、實驗目的:

1、掌握狀態(tài)機的編程方法和步驟;

2、掌握用狀態(tài)機設計序列檢測器的方法和步驟;

二、實驗內(nèi)容

用狀態(tài)機編程實現(xiàn)對系列數(shù)“11100101”的檢測,當某一系列串(以左移方式)進入檢測器后,若該串與預置的系列數(shù)相同,則輸出“a”,否則輸出“b”。

三、實驗步驟:

1、編輯系列檢測器的vhdl程序;

2、仿真測試并給出仿真波形,了解控制信號的時序;

3、將上述方案改為系列檢測密碼為可預置(外部輸入)情況,重新編寫程序、編譯和仿真,并記錄仿真結果。參考程序:

library ieee;use ;entity schk is port(din,clk,clr : in std_logic;ab : out std_logic_vector(3 downto 0));end schk;architecture behv of schk is signal q:integer range 0 to 8;signal d:std_logic_vector(7 downto 0);begin d<=“11100101”;process(clk,clr)begin if clr= '1' then q <= 0;elsif clk='1' and clk'event then case q is when 0 => if din = d(7)then q<=1;else q<=0;end if;when 1 => if din = d(6)then q<=2;else q<=0;end if;when 2 => if din = d(5)then q<=3;else q<=0;end if;when 3 => if din = d(4)then q<=4;else q<=0;end if;when 4 => if din = d(3)then q<=5;else q<=0;end if;when 5 => if din = d(2)then q<=6;else q<=0;end if;when 6 => if din = d(1)then q<=7;else q<=0;end if;when 7 => if din = d(0)then q<=8;else q<=0;end if;when others=> q<=0;end case;end if;end process;process(q)begin if q=8 then ab<=“1010”;else ab<=“1011”;end if;end process;end behv;仿真結果:

提高型實驗:

實驗六

用vhdl實現(xiàn)數(shù)字鐘及校園打鈴系統(tǒng)(6課時)

一、實驗目的及要求:

1、掌握vhdl語言的基本結構及編程思想。

2、掌握vhdl語言的進行系統(tǒng)設計的方法和步驟。

3、提高學生綜合應用能力。

二、實驗內(nèi)容:

1、用vhdl實現(xiàn)數(shù)字鐘及校園打鈴系統(tǒng)的軟件編輯。

2、用vhdl實現(xiàn)數(shù)字鐘及校園打鈴系統(tǒng)的軟件仿真。

三、實驗步驟

1、用vhdl編輯60進制計數(shù)器,并進行軟件仿真。

2、用vhdl編輯24進制計數(shù)器,并進行軟件仿真。

3、用vhdl編輯30進制計數(shù)器,并進行軟件仿真。

4、用元件例化的方法實現(xiàn)數(shù)字鐘的軟件編輯及軟件仿真。

5、實現(xiàn)數(shù)字鐘的校時功能。

6、實現(xiàn)數(shù)字鐘的打鈴功能。

7、完成數(shù)字鐘及校園打鈴系統(tǒng)的實驗報告。

實驗七

a/d采樣控制器設計

一、實驗目的及要求:

1、掌握vhdl語言的基本結構及編程思想。

2、掌握a/d采樣控制器的工作原理。

3、掌握a/d采樣控制器的vhdl語言編程方法。

二、實驗內(nèi)容:

1、設計一a/d0809模數(shù)轉(zhuǎn)換器控制器。

2、將轉(zhuǎn)換結果送數(shù)碼管顯示器顯示(2位)。

3、模擬輸入通道為in0。

三、實驗步驟:

1、adc0809特點介紹

(1)、單極性輸入,8位a/d轉(zhuǎn)換精度。(2)、逐次逼近式,每次采樣時間約為100us(3)、8通道模擬輸入

2、a/d轉(zhuǎn)換器外部引腳功能結構圖

3、a/d轉(zhuǎn)換器時序圖

4、ad轉(zhuǎn)換控制器與ad轉(zhuǎn)換器的接口電路框圖

5、狀態(tài)控制

s0狀態(tài):初始狀態(tài)。addc=‘1’,選擇1通道模擬信號輸入。

ale=start=oe=lock=‘0’;

s1狀態(tài):通道鎖存。ale=‘1’, start=oe=lock=‘0’;

s2狀態(tài):啟動a/d轉(zhuǎn)換。ale=‘1’,start=‘1’,oe=lock=‘0’; s3狀態(tài):a/d轉(zhuǎn)換等待狀態(tài)。

ale=start=‘0’,oe=lock=‘0’;

if eoc=‘0’

保持當前狀態(tài)不變,繼續(xù)等待a/d轉(zhuǎn)換。

else

轉(zhuǎn)換結束,進入下一狀態(tài)。

s4狀態(tài):數(shù)據(jù)輸出允許狀態(tài)。a/d轉(zhuǎn)換完畢,開啟數(shù)據(jù)輸出允許信號。

ale=‘0’,start=‘0’,oe=‘1’,lock=‘0’;

s5狀態(tài):數(shù)據(jù)鎖存狀態(tài)。開啟數(shù)據(jù)鎖存信號,將轉(zhuǎn)換結果送鎖存器鎖存。

ale=‘0’,start=‘0’,oe=‘1’,lock=‘1’; s6狀態(tài):延時狀態(tài)。為了保證數(shù)據(jù)可靠鎖存,延時一個時鐘狀態(tài)周期。

ale=‘0’,start=‘0’,oe=‘1’,lock=‘1’; 其它狀態(tài):返回到初始狀態(tài)。ale=start=oe=lock=‘0’;

6、參考程序: library ieee;use ;entity ad0809 is

port(d :in std_logic_vector(7 downto 0);

clk0,eoc : in std_logic;

adda,oe : out std_logic;

ale,start : out std_logic;

q : out std_logic_vector(7 downto 0);

qq : out integer range 15 downto 0);end ad0809;architecture behav of ad0809 is

type st_type is(s0, s1, s2, s3,s4,s5,s6,s7);

signal current_state,next_state : st_type;

signal regl:std_logic_vector(7 downto 0);

signal lock :std_logic;

begin

adda<='1';

pro: process(current_state,eoc)

begin

case current_state is

when s0 => qq<=0;ale<='0';start<='0';oe<='0';lock<='0';next_state <= s1;

when s1 => qq<=1;ale<='0';start<='0';oe<='0';lock<='0';next_state <= s2;

when s2 => qq<=2;ale<='1';start<='1';oe<='0';lock<='0';next_state <= s3;

when s3 => qq<=3;ale<='1';start<='1';oe<='0';lock<='0';

if eoc='0' then next_state <= s4;

else next_state <= s3;

end if;

when s4 => qq<=4;ale<='0';start<='0';oe<='0';lock<='0';

if eoc='1' then next_state <= s5;

else next_state <= s4;

end if;

when s5 => qq<=5;ale<='0';start<='1';oe<='1';lock<='0';next_state <= s6;

when s6 => qq<=6;ale<='0';start<='0';oe<='1';lock<='1';next_state <= s7;

when s7 => qq<=7;ale<='0';start<='0';oe<='1';lock<='1';next_state <= s0;

when others => next_state <= s0;

end case;

end process pro;reg:process(clk0)

begin

if clk0'event and clk0='1' then

current_state<=next_state;

end if;

end process reg;

com:process(lock)

begin

if lock'event and lock='1' then

regl<=d;

end if;

end process com;

q<=regl;end behav;

實驗八

數(shù)字頻率計設計

一、實驗目的及要求:

1、掌握vhdl語言的基本結構及編程思想。

2、掌握數(shù)字頻率計的工作原理。

3、掌握數(shù)字頻率計的vhdl語言編程方法。

二、實驗內(nèi)容:

1、設計8位十進制數(shù)字頻率計。

2、測量頻率范圍為1hz-50mhz

三、實驗原理: 測頻原理框圖

四、實驗步驟 1、8位十進制計數(shù)器設計

(1)用vhdl設計十進制計數(shù)器,并進行軟件和硬件仿真 參考程序如下: library ieee;use ;use ;entity cnt10 is

port(clk,rst,en : in std_logic;

cq : out std_logic_vector(3 downto 0);

cout : out std_logic);

end cnt10;architecture behav of cnt10 is begin

process(clk, rst, en)

variable cqi : std_logic_vector(3 downto 0);

begin

if rst = '1' then

cqi :=(others =>'0');--計數(shù)器復位

elsif clk'event and clk='1' then

--檢測時鐘上升沿

if en = '1' then

--檢測是否允許計數(shù)

if cqi < “1001” then

cqi := cqi + 1;--允許計數(shù)

else

cqi :=(others =>'0');--大于9,計數(shù)值清零

end if;

end if;

end if;

if cqi = “1001” then cout <= '1';--計數(shù)大于9,輸出進位信號

else

cout <= '0';

end if;

cq <= cqi;

--將計數(shù)值向端口輸出

end process;end behav;(2)8位十進制頻率計電路圖 2、32位鎖存器設計 參考程序

library ieee;use ;use ;entity reg32b is

port(load : in std_logic;

din: in std_logic_vector(31 downto 0);

dout : out std_logic_vector(31 downto 0));

end reg32b;architecture behav of reg32b is begin

process(load,din)

begin

if load'event and load='1' then

dout<=din;

end process;end behav;3控制器設計

(1)控制器時序圖

(2)參考程序 library ieee;use ;use ;entity testctl is

port(clk : in std_logic;

tsten:out

std_logic;

clr_cnt: out

std_logic;

load:out

std_logic);

end testctl;architecture behav of testctl is

signal p2clk:std_logic;begin

process(clk)

begin

if clk'event and clk='1' then

p2clk<=not p2clk;

end process;

process(clk,p2clk)

begin

if clk='0' and p2clk='0'

then

clr_cnt<='1';

else clr_cnt<='0';

end if;

end process;

load<=not p2clk;

tsten<=p2clk;end behav;

end if;end if;

實驗九

dac接口電路與波形發(fā)生器設計

一、實驗目的及要求:

1、掌握vhdl語言的基本結構及編程思想。

2、掌握da轉(zhuǎn)換器接口方法。

3、掌握da轉(zhuǎn)換器的vhdl語言編程方法。

二、實驗內(nèi)容:

1、設計一dac0832數(shù)模轉(zhuǎn)換器控制器。

2、要求使用dac轉(zhuǎn)換器輸出一正弦波,最大值為5v。(使用單緩沖方式)

3、要求正弦波頻率能步進可調(diào),步進間隔為100hz。(使用2個按鍵控制,一個步進為加,另一個為步進減)

三、實驗原理

1、dac0832特點(1)、8位電流dac轉(zhuǎn)換,輸出為電流信號,因此要轉(zhuǎn)換為電壓輸出,必須外接集成運算放大器。(2)、轉(zhuǎn)換時間約為50---500ns,轉(zhuǎn)換速度比電壓型dac轉(zhuǎn)換器快,電壓型一般為1---10us(3)、20腳雙列直插式封裝的cmos型器件。(4)、內(nèi)部具有兩極數(shù)據(jù)寄存器,可采用單或雙緩沖方式。

2、d/a轉(zhuǎn)換器外部引腳功能及內(nèi)部結構圖

3、工作方式

方式一:直通工作方式(本實驗采用此種方式)

一般用于只有一路輸出信號的情況。

接線情況:ile=1,cs=wr1=wr2

=xfer=0 方式

二、雙緩沖器工作方式

采用兩步操作完成,可使da轉(zhuǎn)換輸出前一數(shù)據(jù)的同時,將采集下一個數(shù)據(jù)送到8位輸入寄存器,以提高轉(zhuǎn)換速度。

一般用于多路da輸出。

4、da轉(zhuǎn)換器與控制器接口電路設計

5、實驗儀實際接口電路圖

6、da轉(zhuǎn)換器輸出波形步進可調(diào)控制電路設計 設計思想:

設輸入控制器的時鐘頻率為50mhz。

1、da轉(zhuǎn)換一次,需要一個時鐘周期。若采用64點輸出,則需要64個時鐘周期。如果控制器時鐘頻率為64hz,則輸出的正弦波頻率為1hz。

2、因此,只需要控制da轉(zhuǎn)換控制器的時鐘頻率,則就可以控制正弦波頻率,正弦波頻率與時鐘頻率的 關系為1:64。

3、題目要求正弦波步進頻率為100hz,則時鐘頻率步進應為6400hz。按“加”鍵,則時鐘頻率增加6400hz,按“減”減,時鐘頻率減小6400hz。

7、帶按鍵控制da轉(zhuǎn)換器與控制器接口電路設計

四、實驗程序 參考程序:

library ieee;use ;entity dac0832 is

port(clk :in std_logic;

dd : out integer range 255 downto 0);end dac0832;architecture behav of dac0832 is signal q:integer range 63 downto 0;signal d : integer range 255 downto 0;begin

process(clk)

begin

if clk'event and clk='1' then q<=q+1;

end if;

end process;process(q)

begin

case q

is

when 00=>d<=254;when 01=>d<=252;when 02=>d<=249;when 03=> d<=245;

when 04=>d<=239;when 05=>d<=233;when

06=> d<=225;when

07=> d<=217;

when 08=>d<=207;when 09=>d<=197;when

10=> d<=186;when

11=> d<=174;

when 12=>d<=162;when 13=>d<=150;when 14=> d<=137;when

15=> d<=124;

when 16=>d<=112;when 17=>d<=99;when 18=> d<=87;

when

19=> d<=75;

when 20=>d<=64;when

21=>d<=53;when 22=>d<=43;

when 23=> d<=34;

when 24=>d<=26;when 25=>d<=19;when

26=> d<=13;

when

27=> d<=8;

when 28=>d<=4;

when

29=>d<=1;

when 30=>d<=0;

when

31=> d<=0;

when 32=>d<=1;when 33=>d<=4;

when 34=> d<=8;

when 35=> d<=13;when 36=>d<=19;when 37=>d<=26;

when 38=> d<=34;

when

39=> d<=43;

when 40=>d<=53;when

41=>d<=64;when 42=> d<=75;

when

43=> d<=87;

when 44=>d<=99;when 45=>d<=112;when 46=>d<=124;when

47=> d<=137;

when 48=>d<=150;when 49=>d<=162;when 50=> d<=255;when 51=> d<=174;

when 52=>d<=186;when 53=>d<=197;when 54=>d<=207;when 55=> d<=217;

when 56=>d<=225;when 57=>d<=233;when 58=> d<=239;when

59=> d<=245;

when 60=>d<=249;when 61=> d<=252;when 62=> d<=254;when 63=>d<=255;when others=>null;end case;end process;

dd<=d;

end;

實驗十

七段顯示器動態(tài)掃描電路設計(提高型)

實驗目的及要求:

1、掌握vhdl語言的基本結構及編程思想。

2、掌握七段顯示器動態(tài)掃描電路設計方法。設計要求:

1、設計一個七段數(shù)碼管動態(tài)掃描電路。

2、數(shù)碼管個數(shù)為8個,共陰極接法。

3、設計bcd碼--七段字符碼的轉(zhuǎn)換電路;

4、設計一電路,控制上述電路實現(xiàn)“12345678”八個數(shù)字的顯示,要求顯示方式為:

(1)自左至右逐個點亮數(shù)碼管,最后全亮;再重復以上動作,每次變化時間間隔為1秒。

(2)自左至右點亮數(shù)碼管,每次只點亮一個,最后全息滅,再重復以上動作,每次變化時間間隔為1秒。

(3)先中間兩個點亮,再依次向外點亮;全亮后,再依次向中間熄滅;重復上述步驟,每次變化時間間隔為1秒。一、七段顯示器動態(tài)掃描電路設計框圖

二、存儲器設計(8位8字節(jié)靜態(tài)隨機存儲器sram)library ieee;

use ;entity memo_rd_wr is port(wr,rd: in std_logic;

a : in std_logic_vector(2 downto 0);

b : in std_logic_vector(2 downto 0);

d : in std_logic_vector(7 downto 0);

q : out std_logic_vector(7 downto 0));end memo_rd_wr;architecture a of memo_rd_wr is

signal q0,q1,q2,q3: std_logic_vector(7 downto 0);

signal q4,q5,q6,q7: std_logic_vector(7 downto 0);begin process(wr,a)

begin

if wr='1' then

case

a

is

when “000”=>q0<=d;

when “001”=> q1<=d;

when “010”=>q2<=d;

when “011”=> q3<=d;

when “100”=>q4<=d;

when “101”=> q5<=d;

when “110”=>q6<=d;

when “111”=> q7<=d;

when others=>null;

end case;

end if;

end process;process(rd,b)

begin

if rd='1' then

case

b

is

when “000”=>q<=q0;

when “001”=> q<=q1;

when “010”=>q<=q2;

when “011”=> q<=q3;

when “100”=>q<=q4;

when “101”=> q<=q5;

when “110”=>q<=q6;

when “111”=> q<=q7;

when others=>null;

end case;

end if;

end process;end a;

四、循環(huán)取數(shù)電路設計 library ieee;

use ;entity get_code is port(clk1: in std_logic;

d : in std_logic_vector(7 downto 0);

rd:out std_logic;

a : out std_logic_vector(2 downto 0);

dout:out std_logic_vector(7 downto 0));end get_code;architecture a of get_code

is

signal load: std_logic;

signal qq : std_logic_vector(7 downto 0);

signal num: integer range 7 downto 0;begin

rd<=?1?;

load<=clk1;process(clk1)

begin

if clk1'event and clk1='1' then

if num<=7

then

num<=num+1;

else num<=0;

end if;

end if;end process;process(num)

begin

case num is

when 0 =>a<=“000”;

when 1 =>a<=“001”;

when 2 =>a<=“010”;

when 3 =>a<=“011”;

when 4 =>a<=“100”;

when 5 =>a<=“101”;

when 6 =>a<=“110”;

when 7 =>a<=“111”;

when others =>null;

end case;

end process;process(load)

begin

if load?event and load=?1?

then-------上升沿鎖存

qq<=d;

end if;end process;dout(7 downto 0)<=qq(7 downto 0);end a;

五、掃描控制器設計 library ieee;

use ;entity scan_8 is port(clk2: in std_logic;

c : out std_logic_vector(7 downto 0));

end scan_8;architecture a of scan_8

is

signal num: integer range 7 downto 0;begin process(clk2)

begin

if clk2'event and clk2=‘1' then

if num<=7

then

num<=num+1;

else num<=0;

end if;

end if;end process;process(num)

begin

case

num

is

when 1=>c<=“11111110”;when 2=> c<=“11111101”;

when 3=>c<=“11111011”;when 4=> c<=“11110111”;

when 5=>c<=“11101111”;when 6=> c<=“11011111”;

when 7=>c<=“10111111”;when 0=> c<=“01111111”;

when

others=>null;

end case;end process;end a;

應用實例一:顯示“01234567”八個數(shù)字

library ieee;

use ;entity disp_data is port(clk: in std_logic;

wr:out std_logic;

a:out std_logic_vector(2 downto 0);

q:out std_logic_vector(7 downto 0));end disp_data;architecture a of disp_data

is

--signal qq : std_logic_vector(7 downto 0);

signal num: integer range 7 downto 0;begin

wr<=?1?;process(clk)

begin

if clk'event and clk='1' then

if num<=7

then

num<=num+1;

else num<=0;

end if;

end if;end process;process(num)

begin

case num is

when 0 =>q<=“00111111”;a<=“000”;

when 1 =>q<=“00000110”;a<=“001”;

when 2 =>q<=“01011011”;a<=“010”;

when 3 =>q<=“01001111”;a<=“011”;

when 4 =>q<=“01100110”;a<=“100”;

when 5 =>q<=“01101101”;a<=“101”;

when 6 =>q<=“01111101”;a<=“110”;

when 7 =>q<=“01111111”;a<=“111”;

when others =>null;

end case;end process;end a;實驗十一

彩燈控制器設計(提高型實驗)

實驗目的及要求:

1、掌握vhdl語言的基本結構及編程思想。

2、掌握vhdl語言的進行系統(tǒng)設計的方法和步驟。

3、培養(yǎng)學生綜合應用能力。實驗內(nèi)容:

1、了解各類節(jié)日彩燈的顯示方式(主要是動態(tài)方式)(上街觀察);

2、將你所了解的情況,畫出你的設計思想框圖;

3、根據(jù)框圖畫出電路框圖(用eda技術);

4、用vhdl語言編程實現(xiàn);

5、完成課程設計報告(約2000字)

實驗

十二、紅綠交通燈控制系統(tǒng)

實驗目的及要求:

1、掌握vhdl語言的基本結構及編程思想。

2、掌握vhdl語言的進行系統(tǒng)設計的方法和步驟。

3、培養(yǎng)學生綜合應用能力。實驗內(nèi)容:

設計一個簡易十字路口交通燈控制器。要求:

1、每個路口有紅、綠、黃三個指示燈指示交通運行情況。紅燈亮,禁止車輛通行;綠燈亮,車輛正常通行。

2、利用兩位數(shù)碼管顯示通行到計時時間。

3、用vhdl語言編程實現(xiàn);

4、完成課程設計報告 實驗步驟:

1、紅綠黃燈秒計數(shù)選擇控制電路(traffic_mux)sing_state:

00

綠燈20秒(橫向路口);

01

黃燈5秒(橫向路口)

綠燈20秒(直向路口)

黃燈5秒(直向路口)

recount:重新計數(shù)信號。=?1?,發(fā)送倒計時時間數(shù)據(jù); =?0?,正常倒計時; library ieee;

use ;use ;

use ;entity traffic_mux is

port(reset,clk_1hz,recount: in std_logic;

sign_state: in std_logic_vector(1 downto 0);

load: out integer range 255 downto 0);end;

begin

process(reset,clk_1s)

begin

if reset='1' then

load<=“00000000”;

elsif(clk_1hz'event and clk_1hz='1')

then

if

recount = '1‘

then

case sign_state is

when “00” => load <= 20;

when “01” => load <= 5;

when “10” => load <= 20;

when “01” => load <= 5;

when others =>null;

end case;

end if;

end if;end process;end behavior;

2、倒計時控制電路(count_down)library ieee;use ;use ;use ;entity count_down is port(reset,clk_1hz: in std_logic;recount:in std_logic;load: in integer range 255 downto 0;seg7:out std_logic_vector(15 downto 0);next_state: out std_logic);end;architecture behavior of count_down is signal cnt_ff: integer range 255 downto 0;begin process(clk_1hz,reset)begin if(reset='1')then cnt_ff<=“00000000”;seg7<=“***0”;elsif(clk_1hz'event and clk_1hz='1')then if recount='1‘ then cnt_ff<=load-1;else cnt_ff<=cnt_ff-1;end if;end if;end process;process(cnt_ff)begin case cnt_ff is when 0=>seg7<=“***1”;when 1=>seg7<=“***0”;when 2=> seg7<=“***1”;when 3=> seg7<=“***1”;when 4=> seg7<=“***0”;when 5=> seg7<=“***1”;when 6=> seg7<=“***1”;when 7=> seg7<=“***1”;when 8=> seg7<=“***1”;when 9=> seg7<=“***1”;when 10=> seg7<=“***1”;when 11=> seg7<=“***0”;when 12=> seg7<=“***1”;when 13=> seg7<=“***1”;when 14=> seg7<=“***0”;when 15=> seg7<=“***1”;when 16=> seg7<=“***1”;when 17=> seg7<=“***1”;when 18=> seg7<=“***1”;when 19=> seg7<=“***1”;when 20=> seg7<=“***1”;when 21=> seg7<=“***0”;when 22=> seg7<=“***1”;when 23=> seg7<=“***1”;when 24=> seg7<=“***0”;when 25=> seg7<=“***1”;when 26=> seg7<=“***1”;when 27=> seg7<=“***1”;when 28=> seg7<=“***1”;when 29=> seg7<=“***1”;when others=> seg7<=“***1”;end case;end process;next_state <= '1' when cnt_ff=1 else '0';end behavior;

3、紅綠燈信號控制電路(traffic_fsm)library ieee;use ;use ;use ;entity traffic_fsm is port(reset,clk,clk_1hz,flash_1hz: in std_logic;a_m:in std_logic;next_state: in std_logic;recount: out std_logic;sign_state: out std_logic_vector(1 downto 0);red: out std_logic_vector(1 downto 0);green: out std_logic_vector(1 downto 0);yellow: out std_logic_vector(1 downto 0));end;architecture behavior of traffic_fsm is type sreg0_type is(r0g1, r0y1, g0r1, y0r1, y0y1, y0g1, g0y1, r0r1);signal state : sreg0_type;signal light: std_logic_vector(5 downto 0);begin if(reset='1')then state<=r0g1;

----設定當前為橫向紅燈亮,豎向綠燈亮 sign_state<=“01”;------選擇20秒倒計時

recount<=‘1’;------裝入計數(shù)初值并啟動倒計時 else if(clk'event and clk='1')then case state is when r0g1 => if(a_m='1' and clk_1hz='1')then if(next_state = ‘1’)then--當前計數(shù)完畢,轉(zhuǎn)入下一種計時

recount<='1';state<=r0y1;sign_state <= “01”;else recount<=‘0’;state<=r0g1;----否則,繼續(xù)倒計時 end if;when r0y1 =>--now state: red0 on yellow1 flash if(a_m='1' and clk_1hz='1')then if(next_state = '1')then recount<='1';state<=g0r1;sign_state <= “10”;else recount<='0';state<=r0y1;end if;when g0r1 =>--now state: green0 on red1 on if(a_m='1' and ena_1hz='1')then if(next_state = '1')then recount<='1';state<=y0r1;sign_state <= “11”;else recount<='0';state<=g0r1;end if;when y0r1 =>--now state: green0 on red1 on if(a_m='1' and ena_1hz='1')then if(next_state = '1')then recount<='1';state<=r0g1;sign_state <= “00”;else recount<='0';state<=y0r1;--red=2'b10;green=2'b00;yellow=2'b01;end if;when others => state<=r0g1;recount<='0';sign_state <= “00”;end case;end if;end if;end process;--light: r(10)y(10)g(10)light <= “010010” when(state=r0g1)else “011000” when(state=r0y1)else “100001” when(state=g0r1)else “100100” when(state=y0r1)else “110000”;red <= light(5 downto 4);yellow <= light(3 downto 2)and(flash_1hz & flash_1hz);green <= light(1 downto 0);end behavior;

EDA實驗報告 EDA實驗報告武漢理工大學篇二

實驗四 計數(shù)器與七段譯碼器及顯示的設計

一 實驗目的

1、掌握七段譯碼器的工作原理;

2、學會用vhdl硬件描述語言進行數(shù)字系統(tǒng)設計;

3、學會運用波形仿真測試檢驗程序的正確性;

4、用quartusii完成基本組合電路的設計。

二 實驗儀器

pc機、quartus ii 6.0軟件、康芯eda實驗箱

三 實驗內(nèi)容

選gw48系統(tǒng)的實驗電路模式6,用數(shù)碼8顯示譯碼輸出(pio46-pio40),鍵3到鍵8作為控制輸入端。完成計數(shù)器的數(shù)碼管顯示設計。

四 實驗原理及步驟

7段數(shù)碼是純組合電路,通常的小規(guī)模專用ic,如74或4000系列的器件只能作十進制bcd碼譯碼,然而數(shù)字系統(tǒng)中的數(shù)據(jù)處理和運算都是2進制的,所以輸出表達都是16進制的,為了滿足16進制數(shù)的譯碼顯示,最方便的方法就是利用譯碼程序在fpga/cpld中來實現(xiàn)。例6-18作為7段譯碼器,輸出信號led7s的7位分別接如圖6-2數(shù)碼管的7個段,高位在左,低位在右。例如當led7s輸出為“1101101”時,數(shù)碼管的7個段:g、f、e、d、c、b、a分別接1、1、0、1、1、0、1;接有高電平的段發(fā)亮,于是數(shù)碼管顯示“5”。注意,這里沒有考慮表示小數(shù)點的發(fā)光管,如果要考慮,需要增加段h,例6-18中的led7s:out std_logic_vector(6 downto 0)應改為...(7 downto 0)。

1、根據(jù)譯碼器真值表寫出原程序。

譯碼器真值表:

數(shù)

輸入

輸出

值 a

b c d a b c d e f g 0 0 0 0 0 1 1 1 1 1 1 0 1 0 0 0 1 0 1 1 0 0 0 0 2 0 0 1 0 1 1 0 1 1 0 1 3 0 0 1 1 1 1 1 1 0 0 1 4 0 1 0 0 0 1 1 0 0 1 1 5 0 1 0 1 1 0 1 1 0 1 1 6 0 1 1 0 1 0 1 1 1 1 1 0 1 1 1 1 1 1 0 0 0 0 8 1 0 0 0 1 1 1 1 1 1 1 9 1 0 0 1 1 1 1 1 0 1 1 a 0 1 0 1 1 1 0 1 1 1 b 1 0 1 1 0 0 1 1 1 1 1 c 1 1 0 0 1 0 0 1 1 1 0 d 1 1 0 1 0 1 1 1 1 0 1 e 1 1 1 0 1 0 0 1 1 1 1 f 1 1 1 1 1 0 0 0 1 1 1

三、實驗內(nèi)容:

1、說明下列程序中各語句的含義,以及該例的整體功能。在quartus ii 6.0上對以下該例進行編輯、編譯、綜合、適配、仿真,給出其所有信號的時序仿真波形(提示:用輸入總線的方式給出輸入信號仿真數(shù)據(jù))。

library ieee;use ;entity decl7s is port(a : in std_logic_vector(3 downto 0);led7s : out std_logic_vector(6 downto 0));end;architecture one of decl7s is begin process(a)begin case a(3 downto 0)is when “0000” => led7s <= “0111111”;--x“3f”?0 when “0001” => led7s <= “0000110”;--x“06”?1 when “0010” => led7s <= “1011011”;--x“5b”?2 when “0011” => led7s <= “1001111”;--x“4f”?3 when “0100” => led7s <= “1100110”;--x“66”?4 when “0101” => led7s <= “1101101”;--x“6d”?5 when “0110” => led7s <= “1111101”;--x“7d”?6 when “0111” => led7s <= “0000111”;--x“07”?7 when “1000” => led7s <= “1111111”;--x“7f”?8 when “1001” => led7s <= “1101111”;--x“6f”?9 when “1010” => led7s <= “1110111”;--x“77”?10 when “1011” => led7s <= “1111100”;--x“7c”?11 when “1100” => led7s <= “0111001”;--x“39”?12 when “1101” => led7s <= “1011110”;--x“5e”?13 when “1110” => led7s <= “1111001”;--x“79”?14 when “1111” => led7s <= “1110001”;--x“71”?15 when others => null;end case;end process;end;

圖3-1 共陰數(shù)碼管及其電路

2、引腳鎖定以及硬件下載測試。建議選實驗電路模式6,用數(shù)碼8顯示譯碼輸出(pio46--pio40),鍵

8、鍵

7、鍵

6、鍵5四位控制輸入,硬件驗證譯碼器的工作性能。

3、用vhdl完成四位二進制加法計數(shù)器設計,命名為cnt4b.4、用vhdl例化語句(參考實驗1中的1位全加vhdl文本輸入設計)按圖3-2 的方式,完成頂層文件設計,并重復以上實驗過程。注意圖3-2中的tmp是4位總線,led是7位總線。對于引腳鎖定和實驗,建議仍選實驗電路模式6,用數(shù)碼8顯示譯碼輸出,用鍵3作為時鐘輸入(每按2次鍵為1個時鐘脈沖),或直接時鐘信號clock0。

圖3-2 計數(shù)器和譯碼器連接電路的頂層文件原理圖

(提示:

1、將教材p89頁程序和p154頁程序讀懂,分別建立工程、生成各自原理圖。

2、將上述兩個原理圖按教材p155頁圖6-19連接起來建立新的原理圖設計文件。

3、將上述原理圖文件編譯、仿真、引腳綁定,下載到實驗箱驗證。)

四、實驗報告要求

1、總結quartus ii 6.0 vhdl 中case語句應用及多層次設計方法

2、根據(jù)以上的實驗內(nèi)容寫出實驗報告,包括程序設計、軟件編譯、仿真分析、硬件測試和實驗過程;設計程序、程序分析報告、仿真波形圖及其分析報告;

3、心得體會――本次實驗中你的感受;你從實驗中獲得了哪些收益;本次實驗你的成功之處;本次實驗中還有待改進的地方;下次實驗應該從哪些地方進行改進;怎樣提高自的實驗效率和實驗水平等等。

五、問題與思考:

只要求譯出數(shù)字0~9和“-”,怎樣修改程序?

EDA實驗報告 EDA實驗報告武漢理工大學篇三

數(shù)字eda實驗報告--------------薛蕾0941903207

數(shù)字eda實驗 實驗報告

學院: 計算機科學與工程學院 專業(yè): 通信工程 學號: 0941903207 姓名: 薛蕾 指導老師: 錢強

數(shù)字eda實驗報告--------------薛蕾0941903207 實驗一 四選一數(shù)據(jù)選擇器的設計

一、實驗目的

1、熟悉quartus ii軟件的使用。

2、了解數(shù)據(jù)選擇器的工作原理。

3、熟悉eda開發(fā)的基本流程。

二、實驗原理及內(nèi)容

實驗原理

數(shù)據(jù)選擇器在實際中得到了廣泛的應用,尤其是在通信中為了利用多路信號中的一路,可以采用數(shù)據(jù)選擇器進行選擇再對該路信號加以利用。從多路輸入信號中選擇其中一路進行輸出的電路稱為數(shù)據(jù)選擇器?;颍涸诘刂沸盘柨刂葡拢瑥亩嗦份斎胄畔⒅羞x擇其中的某一路信息作為輸出的電路稱為數(shù)據(jù)選擇器。數(shù)據(jù)選擇器又叫多路選擇器,簡稱mux。4選1數(shù)據(jù)選擇器:

(1)原理框圖:如右圖。

d0、d1、d2、d3

:輸入數(shù)據(jù) a1、a0

:地址變量

由地址碼決定從4路輸入中選擇哪1路輸出。

(2)真值表如下圖:(3)邏輯圖

數(shù)據(jù)選擇器的原理比較簡單,首先必須設置一個選擇標志信號,目的就是為了從多路信號中選擇所需要的一路信號,選擇標志信號的一種狀態(tài)對應著一路信號。在應用中,設置一定的選擇標志信號狀態(tài)即可得到相應的某一路信號。這就是數(shù)據(jù)選擇器的實現(xiàn)原理。

三.實驗內(nèi)容

1、分別采用原理圖和vhdl語言的形式設計4選1數(shù)據(jù)選擇器

2、對所涉及的電路進行編譯及正確的仿真。電路圖:

四、實驗程序

library ieee;use ;

entity mux4 is

port(a0, a1, a2, a3 :in std_logic;

s :in std_logic_vector(1 downto 0);

y :out std_logic);end mux4;architecture archmux of mux4 is

begin y <= a0 when s = “00” else

--當s=00時,y=a0 a1 when s = “01” else

--當s=01時,y=a1 a2 when s = “10” else

--當s=10時,y=a2 a3;

--當s取其它值時,y=a2 end archmux;

五、運行結果

六.實驗總結

真值表分析:

當js=0時,a1,a0取00,01,10,11時,分別可取d0,d1,d2,d3.實驗二 血型配對器的設計

一、實驗目的

1、進一步熟悉quartus ii軟件的使用。

2、掌握簡單組合邏輯電路的設計方法與功能仿真技巧。

3、進一步學習quartus ii中基于原理圖設計的流程。

二、實驗原理及內(nèi)容

實驗原理

人類有o、a、b、ab 4種基本血型,輸血者與受血者的血型必須符合圖示原則。設計一血型配對電路,用以檢測輸血者與受血者之間的血型關系是否符合,如果符合,輸出為1,否則為0。

已知: ab血型是萬能受血者,o血型是萬能獻血者!如果要輸血給o型血,那么可以的血型是o型!如果要輸血給a型血,那么可以的血型是a,o型!如果要輸血給b型血,那么可以的血型是b,o型!

如果要輸血給ab型血,那么可以的血型是a,b,ab,o型!

輸血者

受血者

o a

o a b ab

b ab

三.實驗內(nèi)容

1、用vhdl語言編寫程序?qū)崿F(xiàn)血型配對器的功能 library ieee;use ;use ;use ;entity vxuexing is port(p,q,r,s:in std_logic;f:out std_logic);end vxuexing;architecture a of vxuexing is begin

f<=((not p)and(not q))or(r and s)or((not p)and s)or((not q)and r);end a;

2、對所編寫的電路進行編譯及正確的仿真。

實驗分析 真值表

pqrsf***************11111

p,q表示輸血者的血型;r,s,表示受血者的血型。當兩者符合血型配合原則時,f=1,否則為0.四、運行結果

五、實驗總結

本實驗給出了四種不同的血型編碼,pq(1,1),rs(1,1)表示ab型血,p,q(1,0),rs(1,0)表示b型血,pq(0,1),rs(0,1)表示a型血,pq(0,0),rs(0,0)表示o型血。根據(jù)真值表,并根據(jù)實驗的原理圖,畫出電路圖并進行連接。

實驗三 簡單數(shù)字鐘的設計

一、實驗目的

1、了解數(shù)字鐘的工作原理。

2、進一步學習quartus ii中基于vhdl設計的流程。

3、掌握vhdl編寫中的一些小技巧。

4、掌握簡單時序邏輯電路的設計方法與功能仿真技巧。

二、實驗原理及內(nèi)容

實驗原理

簡單數(shù)字鐘應該具有顯示時-分-秒的功能。首先要知道鐘表的工作機理,整個鐘表的工作應該是在1hz信號的作用下進行,這樣每來一個時鐘信號,秒增加1秒,當秒從59秒跳轉(zhuǎn)到00秒時,分鐘增加1分,同時當分鐘從59分跳轉(zhuǎn)

三.實驗內(nèi)容

1、用原理圖的方式編寫一個12/24進制的計數(shù)器,并創(chuàng)建為symbol文件。

2、用vhdl的方式編寫一個60進制的計數(shù)器,并創(chuàng)建為symbol文件。

3、創(chuàng)建頂層文件。調(diào)用已編寫的symbol文件,設計簡單的數(shù)字鐘電路。

2、對所編寫的電路進行編譯及正確的仿真。

二十四進制vhdl library ieee;use ;use ;use ;entity cnt24 is port(cp, en, rd, ld :in std_logic;

d

:in std_logic_vector(5 downto 0);

co

:out std_logic;q

:out std_logic_vector(5 downto 0));end cnt24;architecture str of cnt24 is

signal qn : std_logic_vector(5 downto 0);

begin co<= '1'when(qn = “010111”and en='1')

else '0';process(cp, rd)

begin if(rd ='0')then

qn<= “000000”;elsif(cp'event and cp='1')then if(ld='0')then qn <= d;

elsif(en='1')then qn <= qn+1;end if;end if;end process;q <= qn;end str;

六十進制vhdl library ieee;use ;use ;use ;entity jsq60 is port(en,rd,cp :in std_logic;

qh:buffer std_logic_vector(3 downto 0);

ql :buffer std_logic_vector(3 downto 0);

co :out std_logic);end jsq60;architecture b of jsq60 is begin co<='1'when(qh=“0101”and ql=“1001” and en='1')else'0';process(cp,rd)

begin if(rd='0')then qh<=“0000”;ql<=“0000”;elsif(cp'event and cp='1')then

if(en='1')then

if(ql=9)then

ql<=“0000”;

if(qh=5)then

qh<=“0000”;

else qh<=qh+1;

end if;

else

ql<=ql+1;

end if;

end if;

end if;end process;end b;

原理圖

四、運行結果

24進制

60進制

時鐘仿真結果

五、實驗總結

此設計問題可分為主控電路,計數(shù)器模塊和掃描顯示三大部分,計數(shù)器在之前的學習中已經(jīng)非常熟悉,只要掌握60,12進制的技術規(guī)律,用同步或異步計數(shù)器都可以實現(xiàn)。二掃描電路我們學過兩種驅(qū)動方式:bcd碼驅(qū)動方式和直接驅(qū)動方式。

實驗四 簡單交通燈的設計

一、實驗目的

1、了解交通燈的亮滅規(guī)律。

2、了解交通燈控制器的工作原理。

3、進一步熟悉vhdl語言編程,了解實際設計中的優(yōu)化方案。

二、實驗原理及內(nèi)容

實驗原理

交通燈的顯示有很多方式,如十字路口、丁字路口等,而對于同一個路口又有很多不同的顯示要求,比如十字路口,車子如果只要東西和南北方向通行就很簡單,而如果車子可以左右轉(zhuǎn)彎的通行就比較復雜,本實驗僅針對最簡單的南北和東西直行的情況。

要完成本實驗,首先必須了解交通路燈的亮滅規(guī)律。依人們的交通常規(guī),“紅燈停,綠燈行,黃燈提醒”。其交通燈的亮滅規(guī)律為:初始態(tài)是兩個路口的紅燈全亮,之后東西路口的綠燈亮,南北路口的紅燈亮,東西方向通車,延時一段時間后,東西路口綠燈滅,黃燈開始閃爍。閃爍若干次后,東西路口紅燈亮,而同時南北路口的綠燈亮,南北方向開始通車,延時一段時間后,南北路口的綠燈滅,黃燈開始閃爍。閃爍若干次后,再切換到東西路口方向,重復上述過程。

三.實驗內(nèi)容

1、用vhdl的方式編寫一個簡單的交通控制燈電路

2、對所編寫的電路進行編譯及正確的仿真。

程序: library ieee;use ;use ;

entity traffic is port(clk,enb : in std_logic;

ared,agreen,ayellow,bred,bgreen,byellow : buffer std_logic;

acounth,acountl,bcounth,bcountl : buffer std_logic_vector(3 downto 0));end traffic;

architecture one of traffic is begin process(clk,enb)variable lightstatus : std_logic_vector(5 downto 0);begin

if(clk'event and clk='1')then lightstatus := ared&agreen&ayellow&bred&bgreen&byellowif((acounth=“0000” and acountl=“0000”)or(bcounth=“0000” and bcountl=“0000”))then case lightstatus is when “010100”=> lightstatus:=“001100”;acountl<=“0101”;acounth<=“0000”;bcountl<=“0101”;bcounth<=“0000”;when “001100”=> if(enb='1')then lightstatus:=“100010”;acountl<=“0000”;acounth<=“0011”;bcountl<=“0101”;bcounth<=“0010”;

else lightstatus:=“010100”;acountl<=“0101”;acounth<=“0100”;bcountl<=“0000”;bcounth<=“0101”;end if;

when “100010”=>

lightstatus:=“100001”;acountl<=“0101”;acounth<=“0000”;bcountl<=“0101”;bcounth<=“0000”;

when “100001”=>

lightstatus:=“010100”;acountl<=“0101”;acounth<=“0100”;bcountl<=“0000”;bcounth<=“0101”;

when others=> lightstatus:=“010100”;acountl<=“0101”;acounth<=“0100”;bcountl<=“0000”;bcounth<=“0101”;

end case;else if(acountl=“0000”)then acounth<=acounth-1;acountl<=“1001”;

else acountl<=acountl-1;

end if;

if(bcountl=“0000”)then bcounth<=bcounth-1;bcountl<=“1001”;

else bcountl<=bcountl-1;end if;end if;end if;

ared<=lightstatus(5);agreen<=lightstatus(4);ayellow<=lightstatus(3);

bred<=lightstatus(2);bgreen<=lightstatus(1);byellow<=lightstatus(0);end process;end one;

四、運行結果

分析:

這里a代表東西方向,b代表南北方向,acounth是表示東西方向五進制計數(shù)acountl是東西方向六進制計數(shù),bcounth則表示南北方向五進制,bounthl則是南北方向六進制計數(shù) 東西方向為0時,東西方向紅燈亮(ared=1)

東西方向在1~4之間,東西方向綠燈亮(即agreen=1)南北方向 的紅燈亮起(即bred=1)

五、實驗總結

此設計問題可分為主控電路,譯碼驅(qū)動電路和掃描顯示部分。

但是,這遠遠不能滿足實際生活的需要,還應設置倒計時秒數(shù),因此可在此電路基礎上外加一個定時模塊。

實驗五 流水燈的設計

一、實驗目的

1、了解流水燈的工作原理。

二、實驗原理及內(nèi)容

實驗原理

要完成本實驗,首先必須了解流水燈的原理。所謂的流水燈實際上就是由多個led發(fā)光二極管構成的電路,當發(fā)光二極管可以依次點亮時,即能呈現(xiàn)流水的效果。實驗內(nèi)容

1、設計能帶8個led發(fā)光管發(fā)光,并按照要求輪流發(fā)光,產(chǎn)生流水燈的流動效果。

2、應具有兩種以上不同風格的流動閃亮效果。比如依次點亮或者依次熄滅。(選作)

3、有起動、停止控制鍵。(選作)

4、有流動閃亮效果選擇設置鍵。(選作)

5、對所編寫的電路進行編譯及正確的仿真。

三、實驗程序

library ieee;use ;use ;use ;entity yiweijicun1 is port(cp,r,dsr,dsl:in std_logic;

s:std_logic_vector(2 downto 0);

d:std_logic_vector(7 downto 0);

q:out std_logic_vector(7 downto 0));end yiweijicun1;architecture yiweijicun_arch of yiweijicun1 is

signal iq: std_logic_vector(7 downto 0);begin process(cp,r,iq)begin if(r='1')then iq <=(others =>'0');elsif(cp'event and cp ='1')then case conv_integer(s)is when 0=>null;when 1=> iq <= d;when 2=> iq <= dsr & iq(7 downto 1);when 3=> iq <=iq(6 downto 0)& dsl;when 4=> iq <= iq(0)& iq(7 downto 1);when 5=> iq <=iq(6 downto 0)& iq(7);when 6=> iq <= iq(7)& iq(7 downto 1);when 7=> iq <= iq(6 downto 0)& iq(0);when others => null;end case;end if;q <= iq;end process;end yiweijicun_arch;

四、運行結果

結果分析:

d[0]~d[7]為八個輸入端,s[0]和s[1]控制流水燈得輸出,s=1保持,s=2實現(xiàn)左移功能,s=3實現(xiàn)右移功能,因為延遲的原因,在s=2時,需要經(jīng)過一段時間才能實現(xiàn)循環(huán)右移的功能,流水燈的實現(xiàn)其實是運用了8位移位寄存器,它只是運用了其中的保持左移與右移的功能,8lo位移位寄存器還有循環(huán)右移,循環(huán)左移,算數(shù)右移,算數(shù)左移等功能。

五、實驗總結

了解了移位寄存器的功能和原理

通過這次實驗,加深了vhdl語言的運用能力,更進一步了解了8位移位寄存器的功能。

實驗六 乘法器的設計

一、實驗目的

1、了解乘法器的工作原理。

2、了解復雜時序電路的設計流程。

二、實驗原理及內(nèi)容

實驗原理

具體設計原理參見教材188頁。實驗內(nèi)容

1、設計一個能進行兩個十進制數(shù)相乘的乘法器,乘數(shù)和被乘數(shù)均小于100。(可以參考教材231頁的vhdl代碼來設計)

2、對所編寫的電路進行編譯及正確的仿真。

三、實驗程序

library ieee;use ;

entity one_bit_adder is port(a: in std_logic;b: in std_logic;c_in: in std_logic;s: out std_logic;c_out: out std_logic);end one_bit_adder;

architecture one_bit_adder of one_bit_adder is begin

s <= a xor b xor c_in;c_out <=(a and b)or(c_in and(a xor b));

end one_bit_adder;library ieee;use ;

entity sichen is port(a: in std_logic_vector(3 downto 0);b: in std_logic_vector(3 downto 0);data_out: out std_logic_vector(6 downto 0));end sichen;

architecture multi_arch of sichen is signal a_mult_b0: std_logic_vector(2 downto 0);signal a_mult_b1: std_logic_vector(2 downto 0);signal a_mult_b2: std_logic_vector(2 downto 0);

signal s_temp1: std_logic_vector(1 downto 0);signal s_temp2: std_logic_vector(1 downto 0);

signal c_temp : std_logic_vector(6 downto 0);

signal c0_out_b0, c1_out_b0, c2_out_b0 : std_logic;signal c0_out_b1, c1_out_b1, c2_out_b1 : std_logic;

signal zero: std_logic;

component one_bit_adder port(a: in std_logic;b: in std_logic;c_in: in std_logic;s: out std_logic;c_out: out std_logic);end component;begin u_0_0 : one_bit_adder port map(a => a_mult_b0(1), b => a_mult_b1(0), c_in => zero, s => c_temp(1), c_out => c0_out_b0);u_0_1 : one_bit_adder port map(a => a_mult_b0(2), b => a_mult_b1(1), c_in => c0_out_b0, s => s_temp1(0), c_out => c1_out_b0);u_0_2 : one_bit_adder port map(a => zero, b => a_mult_b1(2), c_in => c1_out_b0, s => s_temp1(1), c_out => c2_out_b0);

u_1_0 : one_bit_adder port map(a => a_mult_b2(0), b => s_temp1(0), c_in => zero, s => c_temp(2), c_out => c0_out_b1);u_1_1 : one_bit_adder port map(a => a_mult_b2(1), b => s_temp1(1), c_in => c0_out_b1, s => s_temp2(0), c_out => c1_out_b1);u_1_2 : one_bit_adder port map(a => a_mult_b2(2), b => c2_out_b0, c_in => c1_out_b1, s => s_temp2(1), c_out => c2_out_b1);

a_mult_b0(0)<= a(0)and b(0);a_mult_b0(1)<= a(1)and b(0);a_mult_b0(2)<= a(2)and b(0);

a_mult_b1(0)<= a(0)and b(1);a_mult_b1(1)<= a(1)and b(1);a_mult_b1(2)<= a(2)and b(1);

a_mult_b2(0)<= a(0)and b(2);a_mult_b2(1)<= a(1)and b(2);a_mult_b2(2)<= a(2)and b(2);

zero <= '0';c_temp(0)<= a_mult_b0(0);c_temp(4 downto 3)<= s_temp2(1 downto 0);c_temp(5)<= c2_out_b1;

c_temp(6)<= a(3)xor b(3);

data_out <= c_temp;

end multi_arch;

四、運行結果

乘法器實現(xiàn)a,b兩數(shù)的相乘。a[0]~a[3]以及b[0]~b[3]是實現(xiàn)輸入端的控制。由圖看出,輸出上產(chǎn)生了延遲是因為當a[3]輸入1,對應了十進制的8,b[0]輸入1,對應了十進制的1,兩者相乘得8,即在data_out端應輸出8,此處因仍存在競爭冒險。

五、實驗總結

乘法器的設計的問題可以分為乘數(shù)和被乘數(shù)控制模塊,寄存模塊,乘法模塊和掃描顯示模塊幾個部分。

兩數(shù)相乘的方法很多,可以用移位相加的方法,也可以將乘法器看成計數(shù)器,乘積的初始值為零,每一個時鐘周期將被乘數(shù)的值加到積上,同時乘數(shù)減一,這樣反復執(zhí)行,直到乘數(shù)為零。

EDA實驗報告 EDA實驗報告武漢理工大學篇四

實驗二

數(shù)字秒表設計

一、實驗目的

1、理解計時器的原理與verilog/vhdl 的編程方法;

2、掌握多模塊設計及層次設計的方法。

二、實驗原理

秒計時器是由計數(shù)器和譯碼器、顯示器組成,其核心是計數(shù)器與譯碼器。60 秒計時器可由二個計數(shù)器分別完成:個位為十進制計數(shù)器,十位為 6 進 制計數(shù)。個位計數(shù)器的計數(shù)信號由實驗開發(fā)板上主頻20mhz分頻產(chǎn)生的1hz 時鐘信號提供, 十位計數(shù)器的計數(shù)信號由個位的進位信號提供。然后由譯碼器 對計數(shù)結果進行譯碼,送led 數(shù)碼管進行顯示。clr為清零,se t為開始。

三、實驗框圖

四、實驗任務

1、采用層次設計的方法,設計一個包括頂層及底層模塊的60 秒計時器,底 層模塊用verilog/vhdl 設計,頂層用原理圖設計。

2、秒計時器應當具有系統(tǒng)復位功能;

3、每十秒發(fā)出提示信號及計滿60 秒時發(fā)出報警信號。(選做)

五、實驗步驟與要求

1、分模塊設計:首先分別設計10 進制、6 進制計數(shù)器、譯碼器模塊;

2、頂層原理圖如圖7-1 所示;

3、編譯完成后進行波形仿真;

4、進行引腳鎖定,并下載至開發(fā)系統(tǒng)驗證。

六、分模塊設計 1.十進制計數(shù)器(1)程序代碼:

module cnt10(clk,rst,en,cout,dout);

input clk,en,rst;

output [3:0]dout;

output cout;

reg[3:0]q1;

reg cout;

assign dout=q1;

always@(posedge clk or negedge rst)

begin

if(!rst)q1<=0;

else if(en)begin

if(q1<9)q1<=q1+1;

else q1<=4'b0000;end

end

always@(q1)

if(q1==4'h9)cout=1'b1;

else cout=1'b0;endmodule

(2)仿真波形

(3)模塊符號

2.六進制計數(shù)器(1)程序代碼:

module cnt6(clk,rst,en,cout,dout);

input clk,en,rst;

output [3:0]dout;

output cout;

reg[3:0]q2;

reg cout;

assign dout=q2;

always@(posedge clk or negedge rst)

begin

if(!rst)q2<=0;

else if(en)begin

if(q2<5)q2<=q2+1;

else q2<=3'b000;end

end

always@(q2)

if(q2==3'h5)cout=1'b1;

else cout=1'b0;endmodule

(2)仿真波形

(3)模塊符號

3.分頻器

(1)程序代碼:

module fpq(clk0,clk1);

input clk0;

output clk1;

reg[26:0] q1;

reg clk1;always@(posedge clk0)

if(q1<10)q1<=q1+1;

else

begin q1<=0;

clk1<=~clk1;

end endmodule(2)模塊符號

七.頂層原理圖:

八.仿真波形

九.結果分析

當輸入端clk,en,rst都不為0時,首先是十進制計數(shù)器開始進行計時,直到dout1輸出端大于9時產(chǎn)生進位,并且自身變?yōu)?,同時使六進制計數(shù)器也開始計時,六進制輸出端dout2大于5時產(chǎn)生進位,使cout輸出為1.

EDA實驗報告 EDA實驗報告武漢理工大學篇五

《電子設計自動化實驗》課程設計

題 目: 十六位硬件乘加器電路 姓 名: 江 璐 學院班級: 13級電子信息工程2班 學 號: 1315212017 指導老師: 邱應強老師 時 間: 20151122 目 錄 一:摘要……………………………………………………3 二: 正文……………………………………………………3(一)系統(tǒng)設計………………………………………………3(二)單元電路設計…………………………………………4(三)仿真結果………………………………………………9(四)軟件設計………………………………………………11(五)系統(tǒng)測試………………………………………………11(六)結論……………………………………………………14 三:參考文獻………………………………………………14 四:附錄……………………………………………………15 六:心得體會………………………………………………16 一:摘要

1.實驗要求:采用并行、串行或流水線方式來實現(xiàn)對8個16位數(shù)據(jù)進行乘法和加法運算(yout=a0?b0+a1?b1+a2?b2+a3?b3),位寬16位。

2.實驗方法:使用乘法器lpm_mult2、16位加法器adder16b、計數(shù)器cnt16以及鎖存器en_dff四個模塊。當clock出現(xiàn)上升沿時,對輸入端輸入的兩個數(shù)dataa、datab進行乘法運算。將結果輸入鎖存器中,鎖存上一階段計算得到的值,16位加法器adder16b將鎖存器鎖存的上一階段的值與進行完乘法計算得到的值dataa*datab加起來,并輸出結果。計數(shù)器cnt16用于區(qū)分四組乘加所得數(shù),當有一個上升沿脈沖送入cnt16時,若計數(shù)不到5,則進行計數(shù)+1,若計數(shù)達到5,cout輸出進位信號到鎖存器en_dff的reset端口,將鎖存器復位清零,重新進行計數(shù)。

3.實驗結論:經(jīng)過仿真與硬件測試檢驗后證實可行,但是是對8個8位數(shù)據(jù)進行乘法和加法運算。

二:正文

(一)系統(tǒng)設計

1.設計要求

采用并行、串行或流水線方式來實現(xiàn)對8個16位數(shù)據(jù)進行乘法和加法運算(yout=a0*b0+a1*b1+a2*b2+a3*b3),位寬16位。

2.系統(tǒng)設計方案

(1)系統(tǒng)設計思路:由十六位加法器構成以時序邏輯方式設計的十六位乘加器,流水線方式,以移位加法為核心器件。(2)總體方案的論證與比較

方案一:采用四個乘法器,以串行方式輸入各數(shù)據(jù)。

方案二:采用一個乘法器,先輸入兩數(shù)據(jù)進行運算,將得到結果保存,并與下一組乘法運算得到的結果相加。

方案的選擇:第一種方案浪費大量的資源,考慮到實驗箱條件限制,采用第二種方案。盡管速度較慢,但可省下相當多的資源,并且實驗室可以實現(xiàn)。(3)各功能塊的劃分與組成

共有4個設計模塊,分別是乘法器lpm_mult0、16位加法器adder16b、計數(shù)器cnt16以及鎖存器en_dff。(4)系統(tǒng)的工作原理

以上是電路原理圖。乘數(shù)dataa與被乘數(shù)datab輸入乘法器lpm_mult0中,當start有上升沿出現(xiàn)時,乘法器計算出dataa*datab的結果并有result[15..0]輸出。result[15..0]輸出的結果送入8位加法器adder8b的a[15..0]輸入端,加法器的b[15..0]輸入端連接到鎖存器en_dff的輸出端q[15..0],這樣鎖存器鎖存的值就可以與加法器所得到的值相加,得到兩對乘法計算后值得和,以此類推,可以得到不斷累加的值。而cin端口接地,這樣可以確保cin端口不影響加法器的計算。加法器計算a[15..0](dataa*datab)和鎖存器鎖存的值b[15..0]的和從輸出端s[15..0]輸出,輸入鎖存器en_dff的輸入端d[15..0],將數(shù)值鎖存起來,同時輸出端s[15..0]接到輸出端yout[15..0],從而從仿真中可以看到每一階段累加的結果。而計數(shù)器cnt16的作用是區(qū)分四組乘加所得數(shù)與四組乘加所得數(shù)。en接高電平,rst接低電平,保證計數(shù)器可用,clk接到start,每當有一個上升沿脈沖送入cnt16時,若計數(shù)不到5,則進行計數(shù)+1,若計數(shù)達到5,cout輸出進位信號到鎖存器en_dff的reset端口,將鎖存器復位清零,重新進行計數(shù)。

(二)單元電路設計

總共有四大模塊,分別為乘法器lpm_mult0、16位加法器adder16b、計數(shù)器cnt16以及鎖存器en_dff。

1.乘法器lpm_mult0:當clock出現(xiàn)上升沿時,對輸入端輸入的兩個數(shù)dataa、datab進行乘法運算。程序:

--megafunction wizard: %lpm_mult% 4--generation: standard--version: wm1.0--module: lpm_mult--==============--file name: --megafunction name(s):------simulation library files(s):--lpm--==============--************************************************************--this is a wizard-generated not edit this file!----7.2 build 151 09/26/2007 sj full version--************************************************************--copyright(c)1991-2007 altera corporation--your use of altera corporation's design tools, logic functions--and other software and tools, and its ampp partner logic--functions, and any output files from any of the foregoing--(including device programming or simulation files), and any--associated documentation or information are expressly subject--to the terms and conditions of the altera program license--subscription agreement, altera megacore function license--agreement, or other applicable license agreement, including,--without limitation, that your use is for the sole purpose of--programming logic devices manufactured by altera and sold by--altera or its authorized refer to the--applicable agreement for further y ieee;use ;library lpm;use ;entity lpm_mult0 is port();end lpm_mult0;architecture syn of lpm_mult0 is signal sub_wire0 : std_logic_vector(15 downto 0);clock dataa datab result

: in std_logic;

: in std_logic_vector(7 downto 0);: in std_logic_vector(7 downto 0);: out std_logic_vector(15 downto 0)lpm_mult 5 component lpm_mult generic();port();end component;begin result <= sub_wire0(15 downto 0);lpm_mult_component : lpm_mult generic map()port map();end syn;--==============--cnx file retrieval info--==============--retrieval info: private: autosizeresult numeric “1”--retrieval info: private: b_isconstant numeric “0”--retrieval info: private: constantb numeric “0”--retrieval info: private: intended_device_family string “cyclone ii”--retrieval info: private: lpm_pipeline numeric “1” dataa => dataa, datab => datab, clock => clock, result => sub_wire0 lpm_hint => “dedicated_multiplier_circuitry=yes,maximize_speed=5”, lpm_pipeline => 1, lpm_representation => “unsigned”, lpm_type => “l(fā)pm_mult”, lpm_widtha => 8, lpm_widthb => 8, lpm_widthp => 16

dataa datab clock result

: in std_logic_vector(7 downto 0);: in std_logic_vector(7 downto 0);: in std_logic;

: out std_logic_vector(15 downto 0)lpm_hint

: string;

: natural;

: string;lpm_pipeline lpm_type lpm_widtha lpm_widthb lpm_widthp lpm_representation

: string;

: natural;: natural;: natural 6--retrieval info: private: latency numeric “1”--retrieval info: private: optionalsum numeric “0”--retrieval info: private: synth_wrapper_gen_postfix string “1”--retrieval info: private: signedmult numeric “0”--retrieval info: private: use_mult numeric “1”--retrieval info: private: validconstant numeric “0”--retrieval info: private: widtha numeric “8”--retrieval info: private: widthb numeric “8”--retrieval info: private: widthp numeric “16”--retrieval info: private: widths numeric “1”--retrieval info: private: aclr numeric “0”--retrieval info: private: clken numeric “0”--retrieval info: private: optimize numeric “0”--retrieval

info:

constant:

lpm_hint

string “dedicated_multiplier_circuitry=yes,maximize_speed=5”--retrieval info: constant: lpm_pipeline numeric “1”--retrieval info: constant: lpm_representation string “unsigned”--retrieval info: constant: lpm_type string “l(fā)pm_mult”--retrieval info: constant: lpm_widtha numeric “8”--retrieval info: constant: lpm_widthb numeric “8”--retrieval info: constant: lpm_widthp numeric “16”--retrieval info: used_port: clock 0 0 0 0 input nodefval clock--retrieval info: used_port: dataa 0 0 8 0 input nodefval dataa[7..0]--retrieval info: used_port: datab 0 0 8 0 input nodefval datab[7..0]--retrieval info: used_port: result 0 0 16 0 output nodefval result[15..0]--retrieval info: connect: @dataa 0 0 8 0 dataa 0 0 8 0--retrieval info: connect: result 0 0 16 0 @result 0 0 16 0--retrieval info: connect: @datab 0 0 8 0 datab 0 0 8 0--retrieval info: connect: @clock 0 0 0 0 clock 0 0 0 0--retrieval info: library: lpm --retrieval info: gen_file: type_normal true--retrieval info: gen_file: type_normal false--retrieval info: gen_file: type_normal true--retrieval info: gen_file: type_normal true false--retrieval info: gen_file: type_normal false--retrieval info: gen_file: type_normal true--retrieval info: gen_file: type_normal lpm_mult0_wave*.jpg false--retrieval info: gen_file: type_normal lpm_mult0_syn.v true--retrieval info: lib_file: lpm

2.16位加法器adder16b:將鎖存器鎖存的上一階段的值與進行完乘法計算得到的值dataa*datab加起來,并輸出結果。程序:

library ieee;use ;use ;entity adder16b is port(cin:in std_logic;a,b :in std_logic_vector(15 downto 0);s :out std_logic_vector(15 downto 0);cout:out std_logic);end adder16b;architecture behav of adder16b is signal sint,aa,bb:std_logic_vector(16 downto 0);begin aa <= '0' & a;bb <= '0' & b;sint <= aa+bb+cin;s <= sint(15 downto 0);cout <= sint(4);end behav;

3.計數(shù)器cnt16:區(qū)分每兩組乘加所得數(shù)。clk接到start,每當有一個上升沿脈沖送入cnt16時,若計數(shù)不到5,則進行計數(shù)+1,若計數(shù)達到5,cout輸出進位信號到鎖存器en_dff的reset端口,將鎖存器復位清零,重新進行計數(shù)。程序:

library ieee;use ;use ;entity cnt16 is port(clk,rst,en:in std_logic;cq:out std_logic_vector(3 downto 0);cout:out std_logic);end cnt16;architecture behav of cnt16 is begin process(clk,rst,en)variable cqi:std_logic_vector(3 downto 0);begin if rst='1' then cqi:=(others=>'0');elsif clk'event and clk='1'then if en='1' then if cqi < 5 then cqi:=cqi+1;else cqi:=(others=>'0');end if;end if;end if;if cqi=5 then cout<='1';else cout<='0';end if;cq<=cqi;8 end process;end behav;4.鎖存器en_dff:鎖存上一階段計算得到的值,從而使加法器實現(xiàn)累加功能。程序:

library ieee;use ;entity en_dff is port(d: in std_logic_vector(15 downto 0);reset,en,clk:in std_logic;q: buffer std_logic_vector(15 downto 0));end en_dff;architecture behavior of en_dff is begin process(reset,clk)begin if reset='1' then q<=“***0”;elsif clk'event and clk='1'then if en='1'then q<=d;else q<=q;end if;end if;end process;end behavior;

(三)仿真結果

(1)乘法器

給clock一個時鐘信號,驗證得當clock處于上升沿時result=dataa*datab

(2)16位加法器adder16b 將cin接低電平,隨意設置a、b的值,s為a、b的和。

(3)計數(shù)器cnt16 給clk一個時鐘信號。首先將rst置低電平,en置高電平,驗證計數(shù)器的計數(shù)功能。再分別將rst置高電平、en置低電平,驗證計數(shù)器的復位清零以及使能端控制功能。

(4)鎖存器en_dff 給clk一個時鐘信號。當reset=1時,鎖存器清零,當reset=0時有上升沿且使能端en=1時,d鎖存進鎖存器中;當有上升沿但是使能端en=0時,d值不鎖存進鎖存器中,鎖存器的值不改變。

(四)軟件設計

1.軟件設計平臺:quartusii 7.2 2.實現(xiàn)方法:通過quartusii 7.2進行vhdl語言編程、方陣、引腳配置,然后燒入 gw48實驗平臺,選擇模式no.1,進行硬件驗證。

3.程序的流程方框圖:

4.實現(xiàn)的功能:位寬16位;能對8個16位數(shù)據(jù)進行乘法和加法運算(yout=a0*b0+a1*b1+a2*b2+a3*b3),并行、串行或流水線方式。

(五)系統(tǒng)測試

1.系統(tǒng)的性能指標(1)總圖(2)乘法器lpm_mult0

(3)8位加法器adder8b

(4)計數(shù)器cnt16(5)鎖存器en_dff

2.功能仿真

3.引腳綁定

確定波形仿真成功后,再配置管腳,將程序燒錄進ep2c5t144c8中,進行測試。選擇模式1,管腳配置圖如下(start設置為鍵8,使得人為可控,更方便調(diào)試)

(六)結論

根據(jù)硬件驗證:鍵1和鍵2輸入一個十六位數(shù),鍵3和鍵4輸入另一個十六位數(shù),數(shù)碼管1、2顯示第一個數(shù),3、4顯示第二個數(shù),鍵8是運算鍵,每點擊一次運算一次,為一組運算,運算結果顯示在數(shù)碼管5、6、7、8,將顯示這兩個數(shù)的積,再次輸入兩個十六位數(shù),數(shù)碼管5、6、7、8將顯示這兩個數(shù)的積與前一組數(shù)積的和,依次輸入四組十六位數(shù),完成一次十六位乘加的運算,且結果顯示在數(shù)碼管5、6、7、8。能夠?qū)崿F(xiàn)對8個16位數(shù)據(jù)進行乘法和加法運算(yout=a0*b0+a1*b1+a2*b2+a3*b3)

三:參考文獻

潘松,技術與vhdl(第3版)——清華大學出版社

潘松,技術實用教程—vhdl版(第4班)——科學出版社 四:附錄

1.實驗電路結構圖

48系統(tǒng)引腳對照表

五.心得體會

本次的課程設計選題時間較短,由于不怎么會寫程序,所以乘法器使用quartus ii生成,而其他模塊是在網(wǎng)上找的資料,自己輸入編譯反復修改而成??傮w來說過程比較順利,但不足之處是不能完全實現(xiàn)設計要求。

您可能關注的文檔