基于quartus ii110的modelsim仿真_第1頁
基于quartus ii110的modelsim仿真_第2頁
基于quartus ii110的modelsim仿真_第3頁
基于quartus ii110的modelsim仿真_第4頁
基于quartus ii110的modelsim仿真_第5頁
已閱讀5頁,還剩10頁未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、Quartus自從9.0版本以后就沒有自帶仿真工具。需要進(jìn)行仿真要另外安裝仿真工具。下面就以altera-modelsim6.6d 版本介紹一個(gè)簡單的VHDL語言編寫的程序的仿真步驟。Quartus工具為11.0版本。1).新建一個(gè)工程。以與非門為例。打開quartus11.0工具欄的file->new->New Quartus II Project.點(diǎn)擊OK。點(diǎn)Next創(chuàng)建工程文件夾,如andnotgate。輸入工程名稱。點(diǎn)Next先別管它,點(diǎn)Next選擇芯片型號(hào),因?yàn)槭侵皇欠抡?,可以隨便選?;蛘吣J(rèn)。點(diǎn)Next.選擇仿真工具,這里選擇ModelSim-Altera.點(diǎn)Next.

2、點(diǎn)Finish。新建了一個(gè)工程。2).向新建工程添加VHDL源文件File->new->VHDL File->OK編寫源程序:library ieee;use ieee.std_logic_1164.all;entity andnotgate isport(a,b:in std_logic; c:out std_logic );end entity andnotgate;architecture rt1 of andnotgate isbegin c<=not(a and b);end rt1;保存源程序在新建的工程中File->save as保存。編譯源文件:點(diǎn)

3、擊Start compilation編譯成功。3).利用modelsim進(jìn)行波形仿真要進(jìn)行仿真必須先創(chuàng)建一個(gè)testbench的仿真激勵(lì)文件。testbench文件的編寫可以利用軟件提供的模板進(jìn)行修改。生成testbench模板processing->start->start test bench template writer->OK打開新生成的testbench模板。在新建工程里的simulation->modelsim里的后綴為.vht的文件。修改testbench文件,主要工作是加入要輸入的信號(hào)以及輸出的時(shí)間。生成的模板為LIBRARY ieee; USE ie

4、ee.std_logic_1164.all; ENTITY andnotgate_vhd_tst ISEND andnotgate_vhd_tst;ARCHITECTURE andnotgate_arch OF andnotgate_vhd_tst IS- constants - signals SIGNAL a : STD_LOGIC;SIGNAL b : STD_LOGIC;SIGNAL c : STD_LOGIC;COMPONENT andnotgatePORT (a : IN STD_LOGIC;b : IN STD_LOGIC;c : OUT STD_LOGIC);END COMPO

5、NENT;BEGINi1 : andnotgatePORT MAP (- list connections between master ports and signalsa => a,b => b,c => c);init : PROCESS - variable declarations BEGIN - code that executes only once WAIT; END PROCESS init; always : PROCESS - optional sensitivity list - ( ) - variable declarations BEGIN -

6、code executes for every event on sensitivity list WAIT; END PROCESS always; END andnotgate_arch;修改后LIBRARY ieee; USE ieee.std_logic_1164.all; ENTITY andnotgate_vhd_tst ISEND andnotgate_vhd_tst;ARCHITECTURE andnotgate_arch OF andnotgate_vhd_tst IS- constants constant clk_period: time := 40 ns; -定義一個(gè)時(shí)

7、間常數(shù)。 - signals SIGNAL a : STD_LOGIC;SIGNAL b : STD_LOGIC;SIGNAL c : STD_LOGIC;COMPONENT andnotgatePORT (a : IN STD_LOGIC;b : IN STD_LOGIC;c : OUT STD_LOGIC);END COMPONENT;BEGINi1 : andnotgatePORT MAP (- list connections between master ports and signalsa => a,b => b,c => c);init : PROCESS -

8、variable declarations BEGIN -給變量a、b輸入信號(hào)。 - code that executes only once a<='0'-20ns a輸出為0.b<='0'-20ns b輸出為0.c=1,輸出正確wait for clk_period/2;a<='1'-20ns a輸出為1b<='1'-20ns b輸出為1,c=0,輸出正確wait for clk_period/2;a<='1'b<='0'-c輸出為1,輸出正確wait for

9、 clk_period/2; WAIT; END PROCESS init; always : PROCESS - optional sensitivity list - ( ) - variable declarations BEGIN - code executes for every event on sensitivity list WAIT; END PROCESS always; END andnotgate_arch;編譯testbench.成功編譯。接著,Assignments->settings->simulation->compile test bench->Test Benches按照上述輸入test bench name,這里為andnotgate.在第二項(xiàng)輸入testbench文件里的實(shí)體名,這里為andnotgate_vhd_tst在第三項(xiàng)輸入testbench文件里的實(shí)例名,這里為andnotgate.在File name 一欄,選擇生成的testbench模板。點(diǎn)擊Add。全部OK3).查看仿真波形Tools

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論