最新EDA實(shí)驗(yàn)報(bào)告(5篇)

格式:DOC 上傳日期:2023-01-11 17:20:06
最新EDA實(shí)驗(yàn)報(bào)告(5篇)
時(shí)間:2023-01-11 17:20:06     小編:zdfb

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

EDA實(shí)驗(yàn)報(bào)告篇一

eda技術(shù)實(shí)驗(yàn)

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

三、本課程教學(xué)目的、要求:

介紹eda的基本知識(shí)、常用的eda工具的使用方法和目標(biāo)器件的結(jié)構(gòu)原理、vhdl設(shè)計(jì)輸入方法(圖形和文本)、vhdl仿真、vhdl的設(shè)計(jì)優(yōu)化等。

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

1)實(shí)驗(yàn)?zāi)康模?/p>

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

詳細(xì)敘述8位加法器的設(shè)計(jì)流程;給出各層次的原理圖及其對應(yīng)的仿真波形圖;給出加法器的延時(shí)情況。

3)實(shí)驗(yàn)步驟:

(1)設(shè)計(jì)一個(gè)一位半加器。

步驟1:輸入設(shè)計(jì)項(xiàng)目和存盤 步驟2:輸入半加器元件: 步驟3:將項(xiàng)目設(shè)置為工程文件 步驟4:選擇目標(biāo)器件并編譯 步驟5:時(shí)序仿真 步驟6:包裝元件入庫

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

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

實(shí)驗(yàn)二

簡單組合電路和時(shí)序電路設(shè)計(jì)(4課時(shí))

一、實(shí)驗(yàn)?zāi)康模?/p>

熟悉max+plusⅱ的vhdl文本設(shè)計(jì)流程全過程,學(xué)習(xí)簡單組合電路和時(shí)序電路的設(shè)計(jì)和仿真方法。

二、實(shí)驗(yàn)內(nèi)容

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

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

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

4:用一位全加器設(shè)計(jì)8為全加器。要求記錄vhdl文件內(nèi)容和仿真波形結(jié)果。(選作)參考程序 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位二進(jìn)制全加器頂層設(shè)計(jì)描述 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;二選一多路選擇器仿真結(jié)果:

實(shí)驗(yàn)三

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

一、實(shí)驗(yàn)?zāi)康模?/p>

學(xué)習(xí)計(jì)數(shù)器的設(shè)計(jì)、仿真,進(jìn)一步熟悉vhdl設(shè)計(jì)技術(shù)。

二、實(shí)驗(yàn)內(nèi)容:

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

實(shí)驗(yàn)四

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

一、實(shí)驗(yàn)?zāi)康模?/p>

1、學(xué)習(xí)7段數(shù)碼顯示譯碼器設(shè)計(jì);

2、學(xué)習(xí)vhdl的多層次設(shè)計(jì)方法。

二、實(shí)驗(yàn)原理:

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

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

三、實(shí)驗(yàn)內(nèi)容

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

2、對7段數(shù)碼顯示譯碼器設(shè)計(jì)進(jìn)行編輯、仿真,給出其所有信號的時(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;仿真結(jié)果:

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

實(shí)驗(yàn)五

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

一、實(shí)驗(yàn)?zāi)康模?/p>

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

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

二、實(shí)驗(yàn)內(nèi)容

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

三、實(shí)驗(yàn)步驟:

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

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

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

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;仿真結(jié)果:

提高型實(shí)驗(yàn):

實(shí)驗(yàn)六

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

一、實(shí)驗(yàn)?zāi)康募耙螅?/p>

1、掌握vhdl語言的基本結(jié)構(gòu)及編程思想。

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

3、提高學(xué)生綜合應(yīng)用能力。

二、實(shí)驗(yàn)內(nèi)容:

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

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

三、實(shí)驗(yàn)步驟

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

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

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

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

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

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

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

實(shí)驗(yàn)七

a/d采樣控制器設(shè)計(jì)

一、實(shí)驗(yàn)?zāi)康募耙螅?/p>

1、掌握vhdl語言的基本結(jié)構(gòu)及編程思想。

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

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

二、實(shí)驗(yàn)內(nèi)容:

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

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

3、模擬輸入通道為in0。

三、實(shí)驗(yàn)步驟:

1、adc0809特點(diǎn)介紹

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

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

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

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):啟動(dòng)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’

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

else

轉(zhuǎn)換結(jié)束,進(jì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)換結(jié)果送鎖存器鎖存。

ale=‘0’,start=‘0’,oe=‘1’,lock=‘1’; s6狀態(tài):延時(shí)狀態(tài)。為了保證數(shù)據(jù)可靠鎖存,延時(shí)一個(gè)時(shí)鐘狀態(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í)驗(yàn)八

數(shù)字頻率計(jì)設(shè)計(jì)

一、實(shí)驗(yàn)?zāi)康募耙螅?/p>

1、掌握vhdl語言的基本結(jié)構(gòu)及編程思想。

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

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

二、實(shí)驗(yàn)內(nèi)容:

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

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

三、實(shí)驗(yàn)原理: 測頻原理框圖

四、實(shí)驗(yàn)步驟 1、8位十進(jìn)制計(jì)數(shù)器設(shè)計(jì)

(1)用vhdl設(shè)計(jì)十進(jìn)制計(jì)數(shù)器,并進(jìn)行軟件和硬件仿真 參考程序如下: 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');--計(jì)數(shù)器復(fù)位

elsif clk'event and clk='1' then

--檢測時(shí)鐘上升沿

if en = '1' then

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

if cqi < “1001” then

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

else

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

end if;

end if;

end if;

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

else

cout <= '0';

end if;

cq <= cqi;

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

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

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控制器設(shè)計(jì)

(1)控制器時(shí)序圖

(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 span2clk:std_logic;begin

process(clk)

begin

if clk'event and clk='1' then

span2clk<=not span2clk;

end process;

process(clk,span2clk)

begin

if clk='0' and span2clk='0'

then

clr_cnt<='1';

else clr_cnt<='0';

end if;

end process;

load<=not span2clk;

tsten<=span2clk;end behav;

end if;end if;

實(shí)驗(yàn)九

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

一、實(shí)驗(yàn)?zāi)康募耙螅?/p>

1、掌握vhdl語言的基本結(jié)構(gòu)及編程思想。

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

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

二、實(shí)驗(yàn)內(nèi)容:

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

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

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

三、實(shí)驗(yàn)原理

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

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

3、工作方式

方式一:直通工作方式(本實(shí)驗(yàn)采用此種方式)

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

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

=xfer=0 方式

二、雙緩沖器工作方式

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

一般用于多路da輸出。

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

5、實(shí)驗(yàn)儀實(shí)際接口電路圖

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

設(shè)輸入控制器的時(shí)鐘頻率為50mhz。

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

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

3、題目要求正弦波步進(jìn)頻率為100hz,則時(shí)鐘頻率步進(jìn)應(yīng)為6400hz。按“加”鍵,則時(shí)鐘頻率增加6400hz,按“減”減,時(shí)鐘頻率減小6400hz。

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

四、實(shí)驗(yà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;

實(shí)驗(yàn)十

七段顯示器動(dòng)態(tài)掃描電路設(shè)計(jì)(提高型)

實(shí)驗(yàn)?zāi)康募耙螅?/p>

1、掌握vhdl語言的基本結(jié)構(gòu)及編程思想。

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

1、設(shè)計(jì)一個(gè)七段數(shù)碼管動(dòng)態(tài)掃描電路。

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

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

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

(1)自左至右逐個(gè)點(diǎn)亮數(shù)碼管,最后全亮;再重復(fù)以上動(dòng)作,每次變化時(shí)間間隔為1秒。

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

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

二、存儲(chǔ)器設(shè)計(jì)(8位8字節(jié)靜態(tài)隨機(jī)存儲(chǔ)器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ù)電路設(shè)計(jì) 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;

五、掃描控制器設(shè)計(jì) 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;

應(yīng)用實(shí)例一:顯示“01234567”八個(gè)數(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;實(shí)驗(yàn)十一

彩燈控制器設(shè)計(jì)(提高型實(shí)驗(yàn))

實(shí)驗(yàn)?zāi)康募耙螅?/p>

1、掌握vhdl語言的基本結(jié)構(gòu)及編程思想。

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

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

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

2、將你所了解的情況,畫出你的設(shè)計(jì)思想框圖;

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

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

5、完成課程設(shè)計(jì)報(bào)告(約2000字)

實(shí)驗(yàn)

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

實(shí)驗(yàn)?zāi)康募耙螅?/p>

1、掌握vhdl語言的基本結(jié)構(gòu)及編程思想。

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

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

設(shè)計(jì)一個(gè)簡易十字路口交通燈控制器。要求:

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

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

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

4、完成課程設(shè)計(jì)報(bào)告 實(shí)驗(yàn)步驟:

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

00

綠燈20秒(橫向路口);

01

黃燈5秒(橫向路口)

綠燈20秒(直向路口)

黃燈5秒(直向路口)

recount:重新計(jì)數(shù)信號。=?1?,發(fā)送倒計(jì)時(shí)時(shí)間數(shù)據(jù); =?0?,正常倒計(jì)時(shí); 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、倒計(jì)時(shí)控制電路(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;

----設(shè)定當(dāng)前為橫向紅燈亮,豎向綠燈亮 sign_state<=“01”;------選擇20秒倒計(jì)時(shí)

recount<=‘1’;------裝入計(jì)數(shù)初值并啟動(dòng)倒計(jì)時(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--當(dāng)前計(jì)數(shù)完畢,轉(zhuǎn)入下一種計(jì)時(shí)

recount<='1';state<=r0y1;sign_state <= “01”;else recount<=‘0’;state<=r0g1;----否則,繼續(xù)倒計(jì)時(shí) 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實(shí)驗(yàn)報(bào)告篇二

實(shí)驗(yàn)四 計(jì)數(shù)器與七段譯碼器及顯示的設(shè)計(jì)

一 實(shí)驗(yàn)?zāi)康?/p>

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

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

3、學(xué)會(huì)運(yùn)用波形仿真測試檢驗(yàn)程序的正確性;

4、用quartusii完成基本組合電路的設(shè)計(jì)。

二 實(shí)驗(yàn)儀器

pc機(jī)、quartus ii 6.0軟件、康芯eda實(shí)驗(yàn)箱

三 實(shí)驗(yàn)內(nèi)容

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

四 實(shí)驗(yàn)原理及步驟

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

三、實(shí)驗(yàn)內(nèi)容:

1、說明下列程序中各語句的含義,以及該例的整體功能。在quartus ii 6.0上對以下該例進(jìn)行編輯、編譯、綜合、適配、仿真,給出其所有信號的時(shí)序仿真波形(提示:用輸入總線的方式給出輸入信號仿真數(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、引腳鎖定以及硬件下載測試。建議選實(shí)驗(yàn)電路模式6,用數(shù)碼8顯示譯碼輸出(pio46--pio40),鍵

8、鍵

7、鍵

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

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

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

(提示:

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

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

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

四、實(shí)驗(yàn)報(bào)告要求

1、總結(jié)quartus ii 6.0 vhdl 中case語句應(yīng)用及多層次設(shè)計(jì)方法

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

3、心得體會(huì)――本次實(shí)驗(yàn)中你的感受;你從實(shí)驗(yàn)中獲得了哪些收益;本次實(shí)驗(yàn)?zāi)愕某晒χ?;本次?shí)驗(yàn)中還有待改進(jìn)的地方;下次實(shí)驗(yàn)應(yīng)該從哪些地方進(jìn)行改進(jìn);怎樣提高自的實(shí)驗(yàn)效率和實(shí)驗(yàn)水平等等。

五、問題與思考:

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

EDA實(shí)驗(yàn)報(bào)告篇三

數(shù)字eda實(shí)驗(yàn)報(bào)告--------------薛蕾0941903207

數(shù)字eda實(shí)驗(yàn) 實(shí)驗(yàn)報(bào)告

學(xué)院: 計(jì)算機(jī)科學(xué)與工程學(xué)院 專業(yè): 通信工程 學(xué)號: 0941903207 姓名: 薛蕾 指導(dǎo)老師: 錢強(qiáng)

數(shù)字eda實(shí)驗(yàn)報(bào)告--------------薛蕾0941903207 實(shí)驗(yàn)一 四選一數(shù)據(jù)選擇器的設(shè)計(jì)

一、實(shí)驗(yàn)?zāi)康?/p>

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

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

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

二、實(shí)驗(yàn)原理及內(nèi)容

實(shí)驗(yàn)原理

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

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

d0、d1、d2、d3

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

:地址變量

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

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

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

三.實(shí)驗(yàn)內(nèi)容

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

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

四、實(shí)驗(yàn)程序

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

--當(dāng)s=00時(shí),y=a0 a1 when s = “01” else

--當(dāng)s=01時(shí),y=a1 a2 when s = “10” else

--當(dāng)s=10時(shí),y=a2 a3;

--當(dāng)s取其它值時(shí),y=a2 end archmux;

五、運(yùn)行結(jié)果

六.實(shí)驗(yàn)總結(jié)

真值表分析:

當(dāng)js=0時(shí),a1,a0取00,01,10,11時(shí),分別可取d0,d1,d2,d3.實(shí)驗(yàn)二 血型配對器的設(shè)計(jì)

一、實(shí)驗(yàn)?zāi)康?/p>

1、進(jìn)一步熟悉quartus ii軟件的使用。

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

3、進(jìn)一步學(xué)習(xí)quartus ii中基于原理圖設(shè)計(jì)的流程。

二、實(shí)驗(yàn)原理及內(nèi)容

實(shí)驗(yàn)原理

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

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

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

輸血者

受血者

o a

o a b ab

b ab

三.實(shí)驗(yàn)內(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、對所編寫的電路進(jìn)行編譯及正確的仿真。

實(shí)驗(yàn)分析 真值表

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

p,q表示輸血者的血型;r,s,表示受血者的血型。當(dāng)兩者符合血型配合原則時(shí),f=1,否則為0.四、運(yùn)行結(jié)果

五、實(shí)驗(yàn)總結(jié)

本實(shí)驗(yàn)給出了四種不同的血型編碼,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í)驗(yàn)的原理圖,畫出電路圖并進(jìn)行連接。

實(shí)驗(yàn)三 簡單數(shù)字鐘的設(shè)計(jì)

一、實(shí)驗(yàn)?zāi)康?/p>

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

2、進(jìn)一步學(xué)習(xí)quartus ii中基于vhdl設(shè)計(jì)的流程。

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

4、掌握簡單時(shí)序邏輯電路的設(shè)計(jì)方法與功能仿真技巧。

二、實(shí)驗(yàn)原理及內(nèi)容

實(shí)驗(yàn)原理

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

三.實(shí)驗(yàn)內(nèi)容

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

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

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

2、對所編寫的電路進(jìn)行編譯及正確的仿真。

二十四進(jìn)制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;

六十進(jìn)制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;

原理圖

四、運(yùn)行結(jié)果

24進(jìn)制

60進(jìn)制

時(shí)鐘仿真結(jié)果

五、實(shí)驗(yàn)總結(jié)

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

實(shí)驗(yàn)四 簡單交通燈的設(shè)計(jì)

一、實(shí)驗(yàn)?zāi)康?/p>

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

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

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

二、實(shí)驗(yàn)原理及內(nèi)容

實(shí)驗(yàn)原理

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

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

三.實(shí)驗(yàn)內(nèi)容

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

2、對所編寫的電路進(jìn)行編譯及正確的仿真。

程序: 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;

四、運(yùn)行結(jié)果

分析:

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

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

五、實(shí)驗(yàn)總結(jié)

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

但是,這遠(yuǎn)遠(yuǎn)不能滿足實(shí)際生活的需要,還應(yīng)設(shè)置倒計(jì)時(shí)秒數(shù),因此可在此電路基礎(chǔ)上外加一個(gè)定時(shí)模塊。

實(shí)驗(yàn)五 流水燈的設(shè)計(jì)

一、實(shí)驗(yàn)?zāi)康?/p>

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

二、實(shí)驗(yàn)原理及內(nèi)容

實(shí)驗(yàn)原理

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

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

2、應(yīng)具有兩種以上不同風(fēng)格的流動(dòng)閃亮效果。比如依次點(diǎn)亮或者依次熄滅。(選作)

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

4、有流動(dòng)閃亮效果選擇設(shè)置鍵。(選作)

5、對所編寫的電路進(jìn)行編譯及正確的仿真。

三、實(shí)驗(yàn)程序

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;

四、運(yùn)行結(jié)果

結(jié)果分析:

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

五、實(shí)驗(yàn)總結(jié)

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

通過這次實(shí)驗(yàn),加深了vhdl語言的運(yùn)用能力,更進(jìn)一步了解了8位移位寄存器的功能。

實(shí)驗(yàn)六 乘法器的設(shè)計(jì)

一、實(shí)驗(yàn)?zāi)康?/p>

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

2、了解復(fù)雜時(shí)序電路的設(shè)計(jì)流程。

二、實(shí)驗(yàn)原理及內(nèi)容

實(shí)驗(yàn)原理

具體設(shè)計(jì)原理參見教材188頁。實(shí)驗(yàn)內(nèi)容

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

2、對所編寫的電路進(jìn)行編譯及正確的仿真。

三、實(shí)驗(yàn)程序

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;

四、運(yùn)行結(jié)果

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

五、實(shí)驗(yàn)總結(jié)

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

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

EDA實(shí)驗(yàn)報(bào)告篇四

實(shí)驗(yàn)二

數(shù)字秒表設(shè)計(jì)

一、實(shí)驗(yàn)?zāi)康?/p>

1、理解計(jì)時(shí)器的原理與verilog/vhdl 的編程方法;

2、掌握多模塊設(shè)計(jì)及層次設(shè)計(jì)的方法。

二、實(shí)驗(yàn)原理

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

三、實(shí)驗(yàn)框圖

四、實(shí)驗(yàn)任務(wù)

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

2、秒計(jì)時(shí)器應(yīng)當(dāng)具有系統(tǒng)復(fù)位功能;

3、每十秒發(fā)出提示信號及計(jì)滿60 秒時(shí)發(fā)出報(bào)警信號。(選做)

五、實(shí)驗(yàn)步驟與要求

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

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

3、編譯完成后進(jìn)行波形仿真;

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

六、分模塊設(shè)計(jì) 1.十進(jìn)制計(jì)數(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.六進(jìn)制計(jì)數(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)模塊符號

七.頂層原理圖:

八.仿真波形

九.結(jié)果分析

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

EDA實(shí)驗(yàn)報(bào)告篇五

《電子設(shè)計(jì)自動(dòng)化實(shí)驗(yàn)》課程設(shè)計(jì)

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

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

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

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

二:正文

(一)系統(tǒng)設(shè)計(jì)

1.設(shè)計(jì)要求

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

2.系統(tǒng)設(shè)計(jì)方案

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

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

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

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

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

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

(二)單元電路設(shè)計(jì)

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

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

--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:將鎖存器鎖存的上一階段的值與進(jìn)行完乘法計(jì)算得到的值dataa*datab加起來,并輸出結(jié)果。程序:

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.計(jì)數(shù)器cnt16:區(qū)分每兩組乘加所得數(shù)。clk接到start,每當(dāng)有一個(gè)上升沿脈沖送入cnt16時(shí),若計(jì)數(shù)不到5,則進(jìn)行計(jì)數(shù)+1,若計(jì)數(shù)達(dá)到5,cout輸出進(jìn)位信號到鎖存器en_dff的reset端口,將鎖存器復(fù)位清零,重新進(jìn)行計(jì)數(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:鎖存上一階段計(jì)算得到的值,從而使加法器實(shí)現(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;

(三)仿真結(jié)果

(1)乘法器

給clock一個(gè)時(shí)鐘信號,驗(yàn)證得當(dāng)clock處于上升沿時(shí)result=dataa*datab

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

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

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

(四)軟件設(shè)計(jì)

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

3.程序的流程方框圖:

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

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

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

(3)8位加法器adder8b

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

2.功能仿真

3.引腳綁定

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

(六)結(jié)論

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

三:參考文獻(xiàn)

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

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

1.實(shí)驗(yàn)電路結(jié)構(gòu)圖

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

五.心得體會(huì)

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

【本文地址:http://mlvmservice.com/zuowen/1086898.html】

全文閱讀已結(jié)束,如果需要下載本文請點(diǎn)擊

下載此文檔