AHDL語法入門(Altera公司提供).ppt_第1頁
AHDL語法入門(Altera公司提供).ppt_第2頁
AHDL語法入門(Altera公司提供).ppt_第3頁
AHDL語法入門(Altera公司提供).ppt_第4頁
AHDL語法入門(Altera公司提供).ppt_第5頁
已閱讀5頁,還剩46頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

1、9/23/2020 P.1,AHDLTraining Class,Danny Mok Altera HK FAE (),9/23/2020 P.2,What is AHDL,Altera Hardware Description Language develop by Altera integrate into the Altera software Max+Plus II description the hardware in language instead of graphic easy to modify easy to maintane very good for complex c

2、ombinational logic BCD to 7 Segment converter address decoding state machine more than you want.,9/23/2020 P.3,continue.,As easy as Graphic Entry As powerful as HDL (Hardware Description Language) VHDL, Verilog HDL etc.,9/23/2020 P.4,How to use the ADHL,use any text editor to create the file Altera

3、Software Max+Plus II provide text editor,Type in your AHDL design file,9/23/2020 P.5,continue.,Create your AHDL file,9/23/2020 P.6,continue.,save your ADHL file as name.TDF,9/23/2020 P.7,continue.,9/23/2020 P.8,Error Location during Compilation,Easy to locate the error,9/23/2020 P.9,AHDL Template,9/

4、23/2020 P.10,General AHDL Format,SUBDESIGN decode1 ( input_pin_name : INPUT; input_bus_name15.0 : INPUT; output_pin_name : OUTPUT; output_bus_name : OUTPUT; ) BEGIN ouptut_pin_name = input_pin_name; output_bus_name = input_bus_name; END;,Key Word,Defien I/O port,Logic,AHDL format,9/23/2020 P.11,Your

5、 First AHDL design - Address Decoder,Chip_enable = a0 chip_enable : output; ) begin chip_enable = (a3.0 = H7); end;,9/23/2020 P.12,Why I use AHDL instead of Graphic,Easy to Modify Document during the coding I want to decode H”A” not H”7”,SUBDESIGN decode1 ( a3.0 : input; chip_enable : output; ) begi

6、n chip_enable = (a3.0 = HA); end;,Self Explain the Function,Only thing to change,Need more effort to modify,Chip_enable = !a0 chip_enable : output; ) begin chip_enable = (a3.0 = B1x0 x); end;,Some bit can be ignore for comparsion,9/23/2020 P.14,Something you need to know,Addition : + Subtraction : -

7、 Numeric Equality : = Not equal to : != Greater than : Greater than or equal to : = Less than : Less than or equal to : = Logical OR : # Logical AND : SUBDESIGN decode1 ( a3.0 : input; chip_enable : output; ) begin chip_enable = (a3.0 = IO_ADDRESS); if (a3.0 = IO_ADDRESS) then . end;,Define CONSTANT

8、 before SUBDESIGN keyword,9/23/2020 P.16,More about Constant,Constant example Constant IO_ADDRESS = H”370”; Constant FOO = 1+2*3 - LOG2(256); Constant FOO_PLUS_one = FOO + 1;,9/23/2020 P.17,Implement Combinational Logic,out1 = a0 out3.0 : output; ) begin out0 = a0 ,9/23/2020 P.20,More on Bus Operati

9、on,Bus Operation a9.0, b9.0 a = b; a7.4 = b9.6; a9.8 = VCC; a9.8 = 1; a9.8 = 2; a9.8 = 3; a3.0 = GND a3.0 = 0; temp = b0 a2.1 = temp,a7=b9, a6=b8, a5=b7, a4=b6,a9.8 connect to VCC,a9.8 = B”01”,a9.8 = B”10”,a9.8 = B”11”,a3.0 connect to GND,a3.0 = B”0000”,a2 = temp, a1 = temp,9/23/2020 P.21,Advance Bu

10、s Operation,Bus b3.0 b3, b2, b1, b0 (having 4 members) MSB is b3, LSB is b0 ARRAY BUS a3.02.0 a3_2, a3_1, a3_0, a2_2, a2_1, a2_0, a1_2, a1_1, a1_0, a0_2, a0_1, a0_0 (having 12 members) MSB is a3_2, LSB is a0_0,9/23/2020 P.22,Truth Table,i3.0 Segment 7 0 0 1 1 2 2 F F,How easy to make any modificatio

11、n,9/23/2020 P.23,IF-THEN-ELSE,SUBDESIGN priority ( low, medium, high : input; highest_level3.0 : output; ) begin if ( high = B”1”) then highest_level = B”1000”; elsif (medium = B”1”) then highest_level = B”0100”; elsif (low = B”1”) then highest_level = B”0010”; else highest_level = B”0001”; end if;

12、end;,9/23/2020 P.24,Need 4 LCELL,9/23/2020 P.25,CASE Statement,SUBDESIGN decoder (low, medium, high : input; highest_level3.0 : output; ) variable code2.0 : node; begin code2=high; code1=medium; code0=low; case code is when 4 = highest_level = B”1000”; when 2 = highest_level = B”0100”; when 1 = high

13、est_level = B”0010”; when others = highest_level = B”0001”; end case; end;,What is the usage of this statement,9/23/2020 P.26,9/23/2020 P.27,For Loop,CONSTANT num_of_bit = 8; SUBDESIGN numbit ( anum_of_bit.0 : input; bnum_of_bit.0 : output; ) begin b8 = a0; b7 = a1; b6 = a2; b5 = a3; b4 = a4; b3 = a

14、5; b2 = a6; b1 = a7; b0 = a8; end;,9/23/2020 P.28,AHDL with Graphic,Use the File menu to create Symbol for the AHDL design The symbol can be used for graphic entry,9/23/2020 P.29,Register Logic,SUBDESIGN flip_flop ( d, clk : input; q : output;) begin q = dff(d,clk, ,); end;,9/23/2020 P.30,More Detai

15、l,9/23/2020 P.31,More on Register,How to do the Bus with Register How to do the other type of Register DFFE (D-FF with enable) TFF/TFFE JKFF/JKFFE SRFF/SRFFE,9/23/2020 P.32,Register Buses,SUBDESIGN bus_reg ( clk, d7.0 : input; q7.0 : output; ) variable ff7.0 : dff; begin ff.clk = clk; ff.d = d; q =

16、ff.q; end;,9/23/2020 P.33,D-Flip-Flop with Enable/Preset/Clear,SUBDESIGN flip_flop_enable ( clock, data, enable, preset, clear : input; qout : output; ) variable temp : dffe; begin temp.d = data; temp.clk = clock; temp.clrn = clear; temp.prn = preset; temp.ena = enable; qout = temp.q; end;,D,CLK,CLR

17、N,PRN,ENA,Q,9/23/2020 P.34,Other Type of Flip-Flop,9/23/2020 P.35,How to use Help Menu,Q : I dont know how to use Altera DFF/JKFFE, what can I do ? A : Altera Help Menu is a good place to find information Q : How do I use the Help Menu ? A : It is easy and Fun,DFFE,9/23/2020 P.36,How to use Help Men

18、u,9/23/2020 P.37,Tri-state Buffer,SUBDESIGN tri_state (a, enable : input; b : output;) begin b = tri(a, enable); end;,SUBDESIGN tri_state ( a, enable : input; b : output;) variable temp : tri; begin temp.in = a; temp.oe = enable; b = temp.out; end;,9/23/2020 P.38,More Detail,9/23/2020 P.39,OPNDRN -

19、Open Drain Buffer,SUBDESIGN opn_drn (enable : input; b : output;) begin b = opndrn(enable); end;,SUBDESIGN tri_state ( enable : input; b : output;) variable temp : opndrn; begin temp.in= enable; b = temp.out; end;,9/23/2020 P.40,More Detail,9/23/2020 P.41,Using AHDL as EASY as SchematicbutUsing AHDL

20、 is more POWERFUL,9/23/2020 P.42,Exercise,AHDL,input,bidir,clk, enable : input; io : bidir;,9/23/2020 P.43,Design 8 bits Counter is Easy,SUBDESIGN 8bits (clk : input; q7.0 : output; ) variable temp7.0 : dff; begin temp.clk = clk; temp.d = temp.q +1 ; q = temp.q; end;,9/23/2020 P.44,State Machine,SUB

21、DESIGN simple ( clk, reset, jump : input; q : output; ) variable ss : MACHINE WITH STATES (S0,S1); begin ss.clk = clk; ss.reset = reset; case ss is when s0 = q = gnd; if (jump) then ss = s1; end if; when s1 = q = vcc; if (jump) then ss = s0; end if; end case; end;,State Machine Diagram,Note : All St

22、ate Machine Variable must be associated with a CLOCK,jump=1,jump=1,q = 0,q = 1,jump=0,jump=0,9/23/2020 P.45,9/23/2020 P.46,More about State Machine,SUBDESIGN stepper ( reset, ccw, cw, clk : input; phase3.0 : output;) variable ss : MACHINE OF BITS (temp3.0) WITH STATES ( s0 = B”0001”, s1 = B”0010”, s

23、2 = B”0100”, s3 = B”1000”); begin ss.clk = clk; if (reset) then ss = 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;,Note : No need to declare what is TEMP It is

24、automatic declare as DFF,9/23/2020 P.47,User can control the State Bit,9/23/2020 P.48,Exercise,SUBDESIGN stepper ( reset, ccw, cw, clk : input; phase3.0 : output;) variable ss : MACHINE OF BITS (temp3.0) WITH STATES ( s0 = B”0001”, s1 = B”0010”, s2 = B”0100”, s3 = B”1000”); begin ss.clk = clk; if (r

25、eset) then ss = 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,9/23/2020 P.49,State Machine without Recover Sta

26、te,SUBDESIGN recover ( clk, go : input; ok : output;) variable sequence : MACHINE OF BITS (q2.0) with STATES ( idle, one, two, three, four, illegal1, illegal2, illegal3); begin sequence.clk = clk; case sequence is when idle = if (go) then sequence = one; end if; when one = sequence = two; when two = sequence = three; when three = sequence = four; end case; ok

溫馨提示

  • 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ì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論