




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、AHDLTraining ClassDanny MokAltera HK FAE(dmo)1What is AHDLAltera Hardware Description Languagedevelop by Alteraintegrate into the Altera software Max+Plus IIdescription the hardware in language instead of graphiceasy to modifyeasy to maintanevery good forcomplex combinational logic BCD to 7 Segment
2、converteraddress decodingstate machinemore than you want.2continue.As easy as Graphic EntryAs powerful as HDL (Hardware Description Language) VHDL, Verilog HDL etc.3How to use the ADHLuse any text editor to create the fileAltera Software Max+Plus II provide text editorClick the buttonType in your AH
3、DL design file 4continue.Create your AHDL file5continue.save your ADHL name.TDFMust bethe same6continue.Clickon thisicon7Error Location during CompilationEasy to locate the errorClick theerror message Click the Locate buttonError location8AHDL TemplateI forgot .If-then-elsecase-end caseloop-end loop
4、?Modify the code9General AHDL FormatSUBDESIGN decode1( input_pin_name : INPUT; input_bus_name15.0 : INPUT; output_pin_name : OUTPUT; output_bus_name : OUTPUT;)BEGINouptut_pin_name = input_pin_name;output_bus_name = input_bus_name;END;Key WordDefien I/O portLogic AHDL format10Your First AHDL design -
5、 Address DecoderChip_enable = a0 & a1 & a2 & !a3SUBDESIGN decode1( a3.0 : input; chip_enable : output;)beginchip_enable = (a3.0 = H7);end;11Why I use AHDL instead of GraphicEasy to Modify Document during the codingI want to decode H”A” not H”7”SUBDESIGN decode1( a3.0 : input; chip_enable : output;)b
6、eginchip_enable = (a3.0 = HA);end;Self Explain the FunctionOnly thing to changeNeed more effort to modifyChip_enable = !a0 & a1 & !a2 & a312MoreSUBDESIGN decode1( a3.0 : input; chip_enable : output;)beginchip_enable = (a3.0 = B1x0 x);end;Some bit can be ignore for comparsion13Something you need to k
7、nowAddition : +Subtraction : -Numeric Equality : =Not equal to : !=Greater than : Greater than or equal to : =Less than : Less than or equal to : highest_level = B”1000”;when 2 = highest_level = B”0100”;when 1 = highest_level = B”0010”;when others = highest_level = B”0001”;end case;end;What is the u
8、sage of this statement2526For LoopCONSTANT num_of_bit = 8;SUBDESIGN numbit( anum_of_bit.0 : input; bnum_of_bit.0 : output;)beginb8 = a0;b7 = a1;b6 = a2;b5 = a3;b4 = a4;b3 = a5;b2 = a6;b1 = a7;b0 = a8;end;CONSTANT num_of_bit = 8;SUBDESIGN numbit( anum_of_bit.0 : input; bnum_of_bit.0 : output;)beginfo
9、r i in 0 to num_of_bit generatebnum_of_bit - i = ai;end generate;end;easier with same functionCONSTANT num_of_bit = 8;SUBDESIGN numbit(anum_of_bit.0 : input; bnum_of_bit.0 : otuput;)beginbnum_of_bit.0 = a0.num_of_bit;end;27AHDL with GraphicUse the to create Symbol for the AHDL designThe symbol can b
10、e used for graphic entry28Register LogicMethod 1Method 2SUBDESIGN flip_flop( d, clk : input; q : output;)beginq = dff(d,clk, ,);end;SUBDESIGN flip_flop( d, clk : input; q : output;)variable temp : dff;begintemp.d = d;temp.clk = clk;q = temp.q;end;I want a D-Flipflop29More Detail30More on RegisterHow
11、 to do the Bus with RegisterHow to do the other type of RegisterDFFE (D-FF with enable)TFF/TFFEJKFF/JKFFESRFF/SRFFE31Register BusesSUBDESIGN bus_reg( clk, d7.0 : input; q7.0 : output;)variable ff7.0 : dff;beginff.clk = clk;ff.d = d;q = ff.q;end;ff0.clk = clk;ff1.clk = clk;ff2.clk = clk;ff3.clk = clk
12、;ff4.clk = clk;ff5.clk = clk;ff6.clk = clk;ff7.clk = clk;ff0.d = d0;ff1.d = d1;ff2.d = d2;ff3.d = d3;ff4.d = d4;ff5.d = d5;ff6.d = d6;ff7.d = d7;q0 = ff0.q;q1 = ff1.q;q2 = ff2.q;q3 = ff3.q;q4 = ff4.q;q5 = ff5.q;q6 = ff6.q;q7 = ff7.q;32D-Flip-Flop with Enable/Preset/ClearSUBDESIGN flip_flop_enable( c
13、lock, data, enable, preset, clear : input; qout : output;)variable temp : dffe;begintemp.d = data;temp.clk = clock;temp.clrn = clear;temp.prn = preset;temp.ena = enable;qout = temp.q;end;DCLKCLRNPRNENAQSUBDESIGN flip_flop_enable( clock, data, enable, preset, clear : input; qout : output;)variable te
14、mp : dffe;begintemp.d = data;temp.clk = clock;temp.clrn = clear;temp.prn = preset;temp.ena = enable;qout = temp.q;end;DCLKCLRNPRNENAQSUBDESIGN flip_flop_enable( clock, data, enable, preset, clear : input; qout : output;)variable temp : dffe;begintemp.d = data;temp.clk = clock;temp.clrn = clear;temp.
15、prn = preset;temp.ena = enable;qout = temp.q;end;DCLKCLRNPRNENAQSUBDESIGN flip_flop_enable( clock, data, enable, preset, clear : input; qout : output;)variable temp : dffe;begintemp.d = data;temp.clk = clock;temp.clrn = clear;temp.prn = preset;temp.ena = enable;qout = temp.q;end;DCLKCLRNPRNENAQSUBDE
16、SIGN flip_flop_enable( clock, data, enable, preset, clear : input; qout : output;)variable temp : dffe;begintemp.d = data;temp.clk = clock;temp.clrn = clear;temp.prn = preset;temp.ena = enable;qout = temp.q;end;DCLKCLRNPRNENAQSUBDESIGN flip_flop_enable( clock, data, enable, preset, clear : input; qo
17、ut : output;)variable temp : dffe;begintemp.d = data;temp.clk = clock;temp.clrn = clear;temp.prn = preset;temp.ena = enable;qout = temp.q;end;DCLKCLRNPRNENAQSUBDESIGN flip_flop_enable( clock, data, enable, preset, clear : input; qout : output;)variable temp : dffe;begintemp.d = data;temp.clk = clock
18、;temp.clrn = clear;temp.prn = preset;temp.ena = enable;qout = temp.q;end;DCLKCLRNPRNENAQ33Other Type of Flip-Flop34How to use Help MenuQ : I dont know how to use Altera DFF/JKFFE, what can I do ?A : Altera Help Menu is a good place to find informationQ : How do I use the Help Menu ?A : It is easy an
19、d FunDFFE35How to use Help Menu36Tri-state BufferMethod 1Method 2SUBDESIGN tri_state(a, enable : input; b : output;)beginb = tri(a, enable);end;SUBDESIGN tri_state( a, enable : input; b : output;)variable temp : tri;begintemp.in = a;temp.oe = enable;b = temp.out;end;37More Detail38OPNDRN - Open Drai
20、n BufferMethod 1Method 2SUBDESIGN opn_drn(enable : input; b : output;)beginb = opndrn(enable);end;SUBDESIGN tri_state( enable : input; b : output;)variable temp : opndrn;begintemp.in= enable;b = temp.out;end;39More Detail40Using AHDL as EASY as SchematicbutUsing AHDL is more POWERFUL 41ExerciseAHDLS
21、UBDESIGN tri_io( clk, enable : input; io : bidir;)variabletemp1 : dff;temp2 : tri;begintemp1.d = io;temp1.clk = clk;temp2.in = temp1.q;temp2.oe = enable;io = temp2.out;end;inputbidirclk, enable : input;io : bidir;42Design 8 bits Counter is EasySUBDESIGN 8bits(clk : input; q7.0 : output;)variable tem
22、p7.0 : dff;begintemp.clk = clk;temp.d = temp.q +1 ;q = temp.q;end; 43State MachineSUBDESIGN simple( clk, reset, jump : input; q : output;)variable ss : MACHINE WITH STATES (S0,S1);beginss.clk = clk;ss.reset = reset;case ss is when s0 = q = gnd; if (jump) then ss = s1; end if; when s1 = q = vcc; if (
23、jump) then ss = s0; end if;end case;end;State Machine DiagramNote : All State Machine Variable mustbe associated with a CLOCKS0S1jump=1jump=1q = 0q = 1jump=0jump=044if (jump) thenss = s1;end if;if (jump) thenss = s0;end if;45More about State MachineSUBDESIGN stepper( reset, ccw, cw, clk : input; pha
24、se3.0 : output;)variable ss : MACHINE OF BITS (temp3.0) WITH STATES ( s0 = B”0001”, s1 = B”0010”, s2 = B”0100”, s3 = B”1000”);beginss.clk = clk;if (reset) thenss = s2;end if;phase = temp; TABLE ss, ccw, cw = ss; s0, 1, x = s3; s0, x, 1 = s1; s1, 1, x = s0; s1, x, 1 = s2; s2, 1, x = s1; s2, x, 1 = s3
25、; s3, 1, x = s2; s3, x, 1 = s0;END TABLE;end;Note : No need to declare what is TEMPIt is automatic declare as DFF46User can control the State Bit47ExerciseSUBDESIGN stepper( reset, ccw, cw, clk : input; phase3.0 : output;)variable ss : MACHINE OF BITS (temp3.0) WITH STATES ( s0 = B”0001”, s1 = B”001
26、0”, s2 = B”0100”, s3 = B”1000”);beginss.clk = clk;if (reset) thenss = s2;end if;phase = temp; TABLE ss, ccw, cw = ss; s0, 1, x = s3; s0, x, 1 = s1; s1, 1, x = s0; s1, x, 1 = s2; s2, 1, x = s1; s2, x, 1 = s3; s3, 1, x = s2; s3, x, 1 = s0;END TABLE;end;Can you Modify this Truth Table to CASE statement
27、48State Machine without Recover StateSUBDESIGN recover( clk, go : input; ok : output;)variable sequence : MACHINE OF BITS (q2.0) with STATES ( idle, one, two, three, four, illegal1, illegal2, illegal3);beginsequence.clk = clk;case sequence iswhen idle = if (go) then sequence = one; end if;when one = sequence = t
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(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)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 設(shè)定明確的工作優(yōu)先級(jí)計(jì)劃
- 財(cái)務(wù)分析在企業(yè)評(píng)估中的應(yīng)用計(jì)劃
- 教學(xué)創(chuàng)新與成果分享機(jī)制計(jì)劃
- 防止職業(yè)倦怠的小技巧計(jì)劃
- 醫(yī)學(xué)影像科醫(yī)生工作計(jì)劃
- 建立員工反饋與建議機(jī)制計(jì)劃
- 2025年電動(dòng)晾衣機(jī)項(xiàng)目合作計(jì)劃書
- 景區(qū)承包合同
- 珠寶定制服務(wù)特殊條款協(xié)議
- 農(nóng)產(chǎn)品電商項(xiàng)目開發(fā)合作框架協(xié)議
- (完整版)中心醫(yī)院心血管學(xué)科的??平ㄔO(shè)與發(fā)展規(guī)劃
- 勞動(dòng)合同法草案的立法背景與創(chuàng)新黎建飛中國人民大學(xué)法學(xué)院教授
- 第三章 檢測(cè)儀表與傳感器
- 服裝QC尾期查貨報(bào)告(中英雙語)
- 冷庫噴涂施工工藝(詳細(xì))
- 電機(jī)學(xué)辜承林(第三版)第1章
- 醫(yī)療機(jī)構(gòu)停業(yè)(歇業(yè))申請(qǐng)書
- Counting Stars 歌詞
- 肩鎖關(guān)節(jié)脫位的分型及其endobutton手術(shù)治療
- 管理系統(tǒng)中計(jì)算機(jī)應(yīng)用PPT課件
- 企業(yè)辦公自動(dòng)化系統(tǒng)設(shè)計(jì)與實(shí)現(xiàn)
評(píng)論
0/150
提交評(píng)論