You are on page 1of 168

A GAJSKI-KUHN DIAGRAM

Alapelv:
Rendezzk a digitlisrendszerek lersait clok s szintek szerint
2013.01.04. Keresztes Pter 1

A VHDL lexiklis elemei, azonostk, kulcsszavak I.


szepartorok : "space" "end of line specilis szimblumok : egyszerek : & ' ( ) * + - . , / : ; < = > | sszetettek : => <= ** /= <> Plda : Y <= not(x1 or x2); lexiklis elemek : Y, <=, not, (, ), x1, or, x2, ; ezek kzl specilis szimblumok : <= , (, ), ; Azonostk : betvel kell kezddnik, ezutn tetszleges szm bet vagy szm kvetkezhet. Egy szimpla "underscore" ( _ ) brhov, tbbszr is beilleszthet, de ezzel az azonost nem vgzdhet.
2013.01.04. Keresztes Pter 2

A VHDL lexiklis elemei, azonostk, kulcsszavak II. Literlok (szmok)


Formjuk szerint: absztrakt karakteres Alapjuk szerint: decimlis ms-alap Pldk : absztrakt decimlis : 123 , 123.456 , 1.23E-2 absztrakt ms alap : 2#1111# (15 binrisan) karakter literl : 'D, '1' , '0' fzr (string) literl : "ERROR" , bit-fzr: b"1111_1111" (255, binrisan), X"F_F" (255, hexadecimlisan)
2013.01.04. Keresztes Pter 3

fzres

bit-fzres

Tpusok s csomagok

- szabvnyos (standard) s - felhasznl ltal definilt tpusok. A tpus-definils legjobb helye : a VHDL csomag (package) A szabvnyos tpusok a STANDARD nev csomagban vannak deklarlva. A STANDARD csomag szabvnyos tpusai : boole-tpus (boolean) bit karakter (character) egsz (integer) vals (real) id (time) !!!!!!!
2013.01.04. Keresztes Pter 4

Egy VHDL csomag felptse


package MY_PACKAGE is -- deklarcik end MY_PACKAGE; package body MY_PACKAGE is -- defincik end MY_PACKAGE;

2013.01.04.

Keresztes Pter

Objektumok (rtkhordozk)
- konstansok (constant)

- vltozk (variable) - jelek (signal) Az rtkhordozkat deklarljuk. Pldk : constant c : integer := -2345; variable v1 : boolean ; signal READY : bit := '1'; A jel (signal) sajtossgai : A VHDL szimultor minden egyes jelhez hozzrendel egy "hatrid-naplt". Minden egyes jelnek van regisztrlt mltja, jelene s jvje. A jelnek nemcsak aktulis rtke, hanem a mltbl szrmaz jvbeli jslatok is tartoznak hozz.
2013.01.04. Keresztes Pter 6

Plda a jel kezelsre


.

y <= x1 and x2 after 3 ns;

Vgrehajts: 1. A szimultor kirtkeli a a jobboldali kifejezs (x1 and x2) aktulis rtkt. 2. A szimultor elveszi az y jelhez rendelt naplt, s regisztrlja, hogy mostantl 3 ns mlva az y jel rtkt a kiszmtott rtkre kell megvltoztatni. 3. Ezutn a szimultor ttr a kvetkez utasts vgrehajtsra. Ezutn kt alapeset lehet : - 3 ns elteltig nincs az y rtkre vonatkoz jabb jslat. Az y jel teht felveszi a megjsolt rtket. - Mieltt a 3 ns eltelne, y-ra egy jabb utasts- vgrehajts jabb rtket jsol. Ilyenkor = trldik a rgi jslat (inercia-modell) = marad a rgi jslat is (transzport-modell)
2013.01.04. Keresztes Pter 7

Entits s architektrk

EGY SZIMULLHAT VHDL LERSNAK LEGALBB EGY ENTITST, S LEGALBB EGY HOZZ TARTOZ ARCHITEKTRT TARTALMAZNIA KELL.

2013.01.04.

Keresztes Pter

ENTITS
A krnyezetbl kiragadott hardware egysg, fekete doboznak tekintve. entity PROCESSOR is port( DATA_BUS :inout byte; ADDR_BUS : out double_byte; C_BUSI : in bit_vector (1 to 19); C_BUSO: out bit_vector(1 to 13); end PROCESSOR;
2013.01.04. Keresztes Pter 9

AZ ARCHITEKTRA FOGALMA

Az elbbi entitssal kapcsolatban felmerl krdsek: Hogyan mkdik a PROCESSOR? Mi van a PROCESSOR belsejben? Ezekre a krdsekre az ARCHITEKTRA vagy ARCHITEKTRK vlaszol(nak) (architecture) Ha az architektra csak az "A" krdsre vlaszol, akkor viselkedsi, ha csak a "B" krdsre, akkor strukturlis. Egy entitsnak tbb architektrja lehet.
2013.01.04. Keresztes Pter 10

ARCHITEKTRK
architecture BEHAVIOR of PROCESSOR is begin ........ . end BEHAVIOR; architecture STRUCTURE of PROCESSOR is. begin ........ end SRUCTURE;
2013.01.04. Keresztes Pter 11

Utastsok

-- SZEKVENCILIS

-- KONKURRENS

2013.01.04.

Keresztes Pter

12

Egyszer szekvencilis utastsok ( a legfontosabbak)


vltoz rtkads ( variable_assignment_statement ) jel rtkads ( signal_assignment_statement ) "if" utasts ( if_statement ) "loop" utastsok ( loop_statement ) eljrs hvs ( procedure_call_statement ) vrakoz utastsok ( wait_statement )
2013.01.04. Keresztes Pter 13

Vltoz rtkad utasts


Csak szekvencilis lehet, konkurrens utastsnak vltoz nem lehet a targetje (VHDL-1076) v1 := s1 + v2; v3 := FUNC1(v4, v5, v6);

Idksleltets nem rhat el!!!!!!


2013.01.04. Keresztes Pter 14

Az "if" utasts (if_statement)

if c = '1' then y := a + b; else y := a - b; end if;

2013.01.04.

Keresztes Pter

15

Hurok utastsok (loop_statements)


for i in 123 downto l loop a(i) := b(i) * c(i-1); end loop;
while d > 0.0001 loop ny := 0.5 * (cy + x/cy) ; d := ny - cy; if d <= 0.0 then d := -1.0*d; end if; cy := ny; end loop;
2013.01.04. Keresztes Pter 16

A vrakoz utastsok (wait_statements)


wait for 123 ns;
A SZIMULCI a foly szekvencilis utastssorozatot 123 ns idtartamra felfggeszti.

wait on s1, s2, s3;


A SZIMULCI a foly szekvencilis utastssorozatot felfggeszti addig, amg a felsorolt jelek valamelyike megvltozik

wait until s1 = 123;


A SZIMULCI a foly szekvencilis utastssorozatot felfggeszti addig, amg az s1 rtke megvltozik, s a megvltozott rtk a kifejezs szerinti. Plda "felfut lre val vrakozsra:

wait until START = '1' ;


2013.01.04. Keresztes Pter 17

Szekvencilis jelrtkad utasts (sequential signal_assignment_statement)

s1 <= a * b after 10 ns;

Vgrehajts : 1. az a*b rtk kiszmtsa 2. s1 h.i. napljba annak bejegyzse, hogy 10 ns mlva s1 felveszi ezt az rtket. 3. Ha 10 ns eltelte eltt ezt az utastst ismt vgrehajtja a SZIMULCI, s a jobboldal rtke addigra megvltozott, vagy egy msik utasts ezalatt ms rtket r el s1-re, ez a jslat trldik.
2013.01.04. Keresztes Pter 18

Transport ksleltets

s2 <= transport c + d after 20 ns; Vgrehajts: 1. az a*b rtk kiszmtsa 2. s2 h.i. napljba annak bejegyzse, hogy 10 ns mlva felveszi ezt az rtket. 3. Ha 10 ns eltelte eltt ezt az utastst ismt vgrehajtja a SZIMULCI, s a jobboldal rtke addigra megvltozott, vagy egy msik utasts ezalatt s2-re s egy ksbbi idpontra ms rtket jsol, ez a jslat is rvnyben marad.
2013.01.04. Keresztes Pter 19

Plda sszetett hullmformra


count_up <= 0, 1 after 1 ns, 2 after 2 ns, 3 after 3 ns, ........... ........... 15 after 15 ns;
2013.01.04. Keresztes Pter 20

Egyszer konkurrens utastsok


konkurrens jelrtkad utasts (concurrent_signal_assignment_statement) a komponens beltets utastsa (component_instantiation_statement) konkurrens eljrshv utasts (concurrent_procedure_call) generl utasts (generate_statement)
2013.01.04. Keresztes Pter 21

A konkurrens jelrtkad utasts (concurrent_signal_assignment_statement)

y <=

x1 when SELECT1 = '1' after 1 ns else x2 when SELECT2 = '1' after 1 ns else y;

2013.01.04.

Keresztes Pter

22

Komponens beltetsi utasts (component_instantiation_statement)


architecture STRUCT of PROCESSZOR is .... component ALU port ( A : in byte; B : in byte; RESULT : out byte; CARRY_in in bit; CARRY_out out bit); end component; begin . . UNIT_12 : ALU port map( BUS1, BUS2, ACC_in, CY, FLAG3_in); . . end structure;
Keresztes Pter 23

2013.01.04.

Egy msfajta beltets

UNIT_12 : ALU port map( A => BUS1, B => BUS2, CARRY_in => CY, CARRY_out => FLAG3_in, RESULT =>ACC_in ); .
2013.01.04. Keresztes Pter 24

sszetett konkurrens utastsok A processzus (process_statement) rzkenysgi lista nlkl

CLOCKGEN : process begin clock <= '1' ; wait for 10 ns; clock <= '0'; wait for 10 ns; end process;
2013.01.04. Keresztes Pter 25

rzkenysgi lists
MLTPR : process (X1, X2) begin Y <= X1 * X2 after 100 ns; end process;

MLTPR : process begin Y <= X1 * X2 after 100 ns; wait on x1, x2; end process;
2013.01.04. Keresztes Pter 26

A blokk utasts, vdetlen (block statement) I.


entity UNIT1 is port ( in1, in2 : integer := 0; out1, out2 : out integer := 0 ); end; architecture BEH of UNIT1 is signal a, b, c, d, e : integer := 0; begin a <= in1; b <= in2;

2013.01.04.

Keresztes Pter

27

Vdett blokk (guarded block)


entity reg is port (data_in : in real := 0.0; data_out : out real := 0.0 STROBE : in bit); end; architecture BEH of reg is begin B : block(STROBE = '1') begin data_out <= guarded data_in after 11 ns; end block
2013.01.04. Keresztes Pter 28

Vdetlen blokkok II.


B1 : block signal y : integer := 0; begin c <= a * b after 10 ns; d <= a + c after 1 ns; y <= a - d after 2 ns; out1 <= y; end block; B2 : block signal z : integer; begin e <= c * b after 10 ns; z <= d + e after 1 ns; out2 <= z; end block; end BEH;
Keresztes Pter 29

2013.01.04.

Alprogramok s csomagok

Ld. VHDL plda, binris aritmetikai csomag

2013.01.04.

Keresztes Pter

30

Egy specilis fggvny, a rezolci (resolution_function)


-

Hibt jelezzen a szimultor, ha egyszerre kt processzus kvnja meghajtani ugyanazt a jelet. A fggvny gy oldja fel a konfliktust, hogy rtket definil a tbbszrs meghajts esetre is. Pldk : Ld. VHDL feladatok
Keresztes Pter 31

2013.01.04.

DIGITLIS RENDSZEREK KAPCSOLSZINT MODELLZSE

A logikai kapuk MOSFET tranzisztorokbl val felptsvel s modellezsvel foglalkozunk. Legkorszerb: A C-MOS kapcsolstechnika

2013.01.04.

Keresztes Pter

32

Vdetlen blokkok II.


B1 : block signal y : integer := 0; begin c <= a * b after 10 ns; d <= a + c after 1 ns; y <= a - d after 2 ns; out1 <= y; end block; B2 : block signal z : integer; begin e <= c * b after 10 ns; z <= d + e after 1 ns; out2 <= z; end block; end BEH;
Keresztes Pter 33

2013.01.04.

Tiszta (intrinsic) szilcium

2013.01.04.

Keresztes Pter

34

Tltshordoz prok generlsa s rekombincija

2013.01.04.

Keresztes Pter

35

ramvezets tiszta szilciumban

2013.01.04.

Keresztes Pter

36

Donor-atomokkal adalkolt szilcium

2013.01.04.

Keresztes Pter

37

Szabad elektronok donorokkal adalkolt szilciumban

2013.01.04.

Keresztes Pter

38

ram donorokkal adalkolt n-tpus szilciumban

2013.01.04.

Keresztes Pter

39

Akceptor-atomokkal adalkolt szilcium

2013.01.04.

Keresztes Pter

40

Lyukak akceptorokkal adalkolt szilciumban

2013.01.04.

Keresztes Pter

41

ram akceptorokkal adalkolt p-tpus szilciumban

2013.01.04.

Keresztes Pter

42

Egy n+ - p tmenet kialakulsnak els pillanata

2013.01.04.

Keresztes Pter

43

Egy n+ -p tmenet egyenslyban

2013.01.04.

Keresztes Pter

44

C-MOS technolgia 1.

2013.01.04.

Keresztes Pter

45

C-MOS technolgia 2.

2013.01.04.

Keresztes Pter

46

C-MOS technolgia 3.

2013.01.04.

Keresztes Pter

47

C-MOS technolgia 4.

2013.01.04.

Keresztes Pter

48

C-MOS technolgia 5.

2013.01.04.

Keresztes Pter

49

C-MOS technolgia 6.

2013.01.04.

Keresztes Pter

50

C-MOS technolgia 7.

2013.01.04.

Keresztes Pter

51

C-MOS technolgia 8.

2013.01.04.

Keresztes Pter

52

C-MOS technolgia 9.

2013.01.04.

Keresztes Pter

53

N-CSATORNS MOSFET (n-MOS, n-FET)

2013.01.04.

Keresztes Pter

54

Az n-MOSFET karakterisztiki

2013.01.04.

Keresztes Pter

55

A p-MOSFET struktrja s szimblumai

2013.01.04.

Keresztes Pter

56

A p-MOSFET karakterisztiki

2013.01.04.

Keresztes Pter

57

Az n-MOSFET modellje
Ha UGS < VTn , akkor az n-MOSFET lezrt llapotban van, IDn = 0; Ha UGS > VTn s UDS < UGS VTn, akkor az n-MOSFET trida llapotban van: IDn = n(( UGS VTn )UDS U2DS )

Ha UGS > VTn s UDS UGS VTn , akkor az n-MOSFET teltsi llapotban van, s IDn = n /2( UGS VTn )2
2013.01.04. Keresztes Pter 58

P-MOSFET modellje
Ha USG < |VTp| IDp = 0; Ha USG > |VTp| s USD < USG |VTp|
- IDp = p(( USG |VTp| )USD U2SD )

Ha USG > |VTp| s USD USG |VTp| - IDp = p /2( USG |VTp| )2
2013.01.04. Keresztes Pter 59

Az n-MOSFET magas szint tvitelnek mrse

2013.01.04.

Keresztes Pter

60

Az n-MOSFET alacsony szint tvitelnek mrse

2013.01.04.

Keresztes Pter

61

A p-MOSFET magas szint tvitelnek mrse

2013.01.04.

Keresztes Pter

62

A p-MOSFET alacsony szint tvitelnek mrse

2013.01.04.

Keresztes Pter

63

Az tvivkapu, vagy transmission gate

2013.01.04.

Keresztes Pter

64

A C-MOS INVERTER

2013.01.04.

Keresztes Pter

65

Dulis g CMOS kapuk

2013.01.04.

Keresztes Pter

66

A dulis g CMOS kapuk elvi felptse

2013.01.04.

Keresztes Pter

67

Az Y = not( A.B + C) fggvny megvalstsa dulis g CMOS kapuval

2013.01.04.

Keresztes Pter

68

TROLK : Kt stabil llapot logikai ramkr (bistabil)

2013.01.04.

Keresztes Pter

69

A bistabil egy msik alakban

2013.01.04.

Keresztes Pter

70

Berhat S-R s nS-nR bistabilok

2013.01.04.

Keresztes Pter

71

Klasszikus D-latch

2013.01.04.

Keresztes Pter

72

Egy msik bersi lehetsg, tviv kapukkal

2013.01.04.

Keresztes Pter

73

Kvzistatikus D-latch

2013.01.04.

Keresztes Pter

74

Dinamikus D-latch

2013.01.04.

Keresztes Pter

75

Nemtlapolt ktfzis rajel

2013.01.04.

Keresztes Pter

76

Ktfzis MASTER-SLAVE flip-flop

2013.01.04.

Keresztes Pter

77

Kvzistatikus ktfzis MS flip-flop

2013.01.04.

Keresztes Pter

78

Dinamikus, ktfzis M-S flip-flop

2013.01.04.

Keresztes Pter

79

A REZOLCIS FGGVNY
Egynl tbb konkurens egysg csak akkor hajthatja meg ugyanazt a jelet, ha egy fggvny, a rezolcis fggvny igaztja el a szimultort arrl, hogy melyiket rszestse elnyben, vagy mit tegyen ebben az esetben!!! A rezolcis fggvny, ha van, akkor a jelhez tartozik, s minden alkalommal kirtkeldik, ha a jelet hajtjuk. Egy jel rezolcis fggvnynek a neve a jel deklarcijval egytt, vagy a jel tpusnak defincijban adhat meg.
Keresztes Pter

2013.01.04.

80

MODELLEZSE 8 LOGIKAI RTKKEL

2013.01.04.

Keresztes Pter

81

A newbit tpus

A nnewbit deklarcija :
type nnewbit is ( Z, w0, w1, s0, s1, '0', '1', U);

A newbit ennek a rezolcis fggvnnyel rtelmezett vltozata:


subtype newbit is resolved nnewbit;

Fontos, hogy a newbit szktett altipusa a klasszikus ktllapot bit, az oldbit.


subtype oldbit is nnewbit range '0' to '1';

2013.01.04.

Keresztes Pter

82

MODELLEZS A KAPUK SZINTJN

2013.01.04.

Keresztes Pter

83

A kombincis hlzat fekete-doboz modellje


X1. . . .Xn : bemenetek,
logikai vltozk

Y1. . . .Ym : kimenetek,

logikai vltozk

84

Egy K-hlzat specifikci

2013.01.04.

Keresztes Pter

85

LUT VHDL SPECIFIKCIJA KONKURENS JELRTKADSOKKAL


entity KH is port(A, B, C : in bit; F : out bit); end; architecture SPEC1 of KH is begin F <= 1 when A = 0 and B = 1 and C = 0 else 1 when A = 0 and B = 1 and C = 1 else 1 when A = 1 and B = 0 and C = 0 else 1 when A = 1 and B = 1 and C = 0 else 0; end SPEC1;
2013.01.04. Keresztes Pter 86

LUT VHDL SPECIFIKCIJA PROCESSZUSSAL


architecture SPEC2 of KH is begin process(A, B, C) begin if A = 0 and B = 1 and C = 0 then F <= 1; elsif A = 0 and B = 1 and C = 0 then F <= 1; . . else F <= 0; end process;
2013.01.04. Keresztes Pter 87

Szinkron hlzat tervezsi feladat (MEALY)

Egy hlzatra egy rajel temben az X bemenet rtkei rkeznek. Adjon a hlzat egyetlen Z kimenete 1-et, ha ktszer egyms utn X-re 1 rkezik!

2013.01.04.

Keresztes Pter

88

llapot-tmeneti grf

2013.01.04.

Keresztes Pter

89

CLARCHITEKTRA S VHDL PROCESSZUSOK

2013.01.04.

Keresztes Pter

90

SZINKRON HLZAT-SPECIFIKCI 1.
entity A_SYNC1 is port ( X : in bit; Z : out bit; CLK : inout bit); end; architecture BEH of A_SYNC1 is type state_type is (a, b, c); signal nq, q : state_type; begin psample: process begin wait until CLK = '1'; if q = a and X = '0' then nq <= a after 1 ns; elsif q = a and X = '1' then nq <= b after 1 ns; elsif q = b and X = '0' then nq <= a after 1 ns; elsif q = b and X = '1' then nq <= c after 1 ns; elsif q = c and X = '0' then nq <= a after 1 ns; elsif q = c and X = '1' then nq <= c after 1 ns; end if; wait
2013.01.04.

until <= nq

CLK

'0';
Keresztes Pter 1 ns; 91

after

end

process;

SZINKRON HLZAT SPECIFIKCI 2.


pout: process( X, q) begin if X = '1' and (q = b or q = c) Z <= '1' after 1 ns; else Z <= '0'after 1 ns; end if; end process; CLOCK: process begin wait for 5 ns; loop CLK <= '1'; wait for 10 ns; CLK <= '0'; wait for 10 ns; end loop; end process; then

2013.01.04.

end BEH;

Keresztes Pter

92

Sorrendi hlzatok tervezse

Aszinkron hlzat tervezsi feladat

Tervezznk kt-bemenet (X1, X2) sorrendi S ramkrt. A Z kimenet akkor s csakis akkor 1, ha az X1 bemenet elbb ll 1-re, mint az X2. A tervezst vgezzk el a kvetkez llapotot elllt hlzat kzvetlen visszacsatolsval, s S-R trolkkal trtn visszacsatolssal is !

2013.01.04.

Keresztes Pter

93

Clarchitektra

2013.01.04.

Keresztes Pter

94

Sorrendi hlzatok tervezse


Elzetes szimbolikus llapottbla

2013.01.04.

Keresztes Pter

95

A sorrendi AND specifikcija 1.


entity ASEQ_AND1 is port ( x1, x2 : in bit; z : out bit); end; Architecture DF1 of ASEQ_AND1 is type state_type is (a,b,c,d,e,f,x); signal y : state_type;

2013.01.04.

Keresztes Pter

96

SZEKVENCILIS AND SPECIFIKCI, KONKURRENS UTASTSOKKAL


begin y <= a after 1 ns when (y = a and x2 = '0') b after 1 ns when (y = a and x2 = '1') c after 1 ns when (y = a and x2 = '0') x after 1 ns when (y = a and x2 = '1') . . x after 1 ns; x1 = else x1 = else x1 = else x1 = else '0' and '0' and '1' and '1' and

z <= '1' after 1 ns when y = c and x1 = '1' and x2 = '1' else '1' after 1 ns when y = e and x1 = '1' and x2 = '1' else '0'; end DF1;
2013.01.04. Keresztes Pter 97

SPECIFIKCI PROCESSZUSOKKAL
pr1: process(X1, X2, y) begin if (y = a and X1 = '0' and X2 = y <= a after 1 ns; elsif(y = a and X1 = '0' and X2 y <= b after 1 ns; elsif(y = a and X1 = '1' and X2 y <= c after 1 ns; elsif(y = a and X1 = '1' and X2 y <= x;
. .

'0')

then

= '1')then = '0) then = '1) then

else y <= x after 1 ns; end if; end process; pr2: process(X1, X2, y) begin if y = c and X1 = '1' and X2 = '1'then Z <= '1' after 1 ns; elsif y = c and X1 = '1' and X2 = '1'then Z <= '1' after 1 ns; elsif y = e and X1 = '1' and X2 = '1'then Z <= '0' after 1 ns; end if; end process; 2013.01.04. Keresztes Pter

98

MODELLEZZK VHDL NYELVEN!

2013.01.04.

Keresztes Pter

99

TERVEZS S MODELLEZS REGISZTER TVITELI SZINTEN

2013.01.04.

Keresztes Pter

100

DATAFLOW GRFOK S VHDL MODELLJEIK

Csompontok : aktorok, illetve funkcik Irnytott lek : adatok

2013.01.04.

Keresztes Pter

101

DATA-FLOW GRFOK S VHDL MODELLJEIK

2013.01.04.

Keresztes Pter

102

DATA-FLOW GRFOK TPUSAI


1. Esemny-hajtott (Event Driven, ED) 2. Zseton-hajtott (Token Driven, TD)

2013.01.04.

Keresztes Pter

103

SZINKRON REGISZTER SZINT ELEMEK S AZ AZOKAT REPREZENTL ESEMNY-HAJTOTT GRFBELI CSOMPONTOK

2013.01.04.

Keresztes Pter

104

KSLELTETS-RZKETLEN, ASZINKRON REGISZTER SZINT ELEMEK S AZ AZOKAT REPREZENTL ZSETON-HAJTOTT GRFBELI CSOMPONTOK

2013.01.04.

Keresztes Pter

105

AKTOROK (FUNKCIK)

2013.01.04.

Keresztes Pter

106

AKTOROK OSZTLYOZSA
SZEMANTIKA SZERINT: - esemny-hajtott (event-driven) - zseton hajtott (token-driven) BEMENETEK SZMA SZERINT: - unris - binris - sokbemenet FUNKCI SZERINT - LUT - REGISZTER

KSLELTETS SZERINT - idelis - fizikai

2013.01.04.

Keresztes Pter

107

ESEMNY-HAJTOTT LUT AKTOROK


1. Tzel, ha a bemenetein lnyeges esemny lp fel.

2. A tzels : a lnyeges esemny kvetkeztben elll j rtk eljegyzse a kimenetre.

2013.01.04.

Keresztes Pter

108

ZSETON-HAJTOTT LUT AKTOROK


1. Tzel, ha minden bemenetn zsetonos adat jelenik meg, s a kimenetn nics zsetonos adat. 2. A tzels : a zsetonokra kimondott felttel teljeslsekor kiszmtott rtk eljegyzse a kimenetre.

2013.01.04.

Keresztes Pter

109

ED-REGISZTER AKTOROK
Tzel, ha strb = 1.
A tzels a d bemenet rtknek y-ra val kihelyezst jelenti. Ez az rtk a kvetkez tzelsig vltozatlanul az y-kimeneten marad

2013.01.04.

Keresztes Pter

110

TD-REGISZTER AKTOROK
Tzel, ha d zsetonos, y res, s ack_in 0. A tzels y-ra d kihelyezst jelenti zsetonnal, s ack_out 1-re emelst. Ha d-rl lekerl a zseton, s ack_in 1, akkor y-rl is leveszi a zsetont, s ack_out t 0-ra teszi. Ha d-rl lekerl a zseton, de ack_in mg 0, akkor y-rl csak akkor kerl le a zseton, s ack_out 0 lesz, ha ha ack_in felemelkedik 1-re.

2013.01.04.

Keresztes Pter

111

ED-LUT AKTOROK VHDL MODELLJE

v1 <= MLTPLY(a1, b1) after Td;

2013.01.04.

Keresztes Pter

112

ED-REGISZTER AKTOROK VHDL MODELLJE

a1 <= pa after Td when nstate = 1 and ph1 = '1 else a1;

2013.01.04.

Keresztes Pter

113

ED-MPX AKTOROK VHDL MODELLJE


Y <= d1 after Td when S1 = 1 else d2 after Td when S2 = 1 else ................. dn after Td when Sn = 1 else anyvalue;

2013.01.04.

Keresztes Pter

114

TD-LUT AKTOROK VHDL MODELLJE


process(X1, X2) begin if Y = INTNULL and X1 /= INTNULL and X2 /= INTNULL then Y <= MLTPLY(X1, X2) after 5 ns; elsif Y /= INTNULL and X1 = INTNULL and X2 = INTNULL then Y <= INTNULL after 5 ns; end if; end process;
2013.01.04. Keresztes Pter 115

TD-REGISZTER AKTOROK VHDL MODELLJE


process(D, ack_in, Y) begin if Y = INTNULL and ack_in = '0' and D /= INTNULL then Y <= D after 10 ns; ack_out <= '1' after 10 ns; elsif Y /= INTNULL and ack_in = '1' and D = INTNULL then Y <= INTNULL after 10 ns; ack_out <= '0' after 10 ns; end if; end process;
2013.01.04. Keresztes Pter 116

TD-MPX AKTOROK VHDL MODELLJE


process(d1, d2 . . . dn, S1, S2. . .Sn) begin if Y = INTNULL and d1 /= INTNULL and d2 /= INTNULL and dn /= INTNULL and S1 = 1 and S2 = 0 and . . . Sn =0 then Y <= d1 after 5 ns; ................................................. elsif Y /= INTNULL and d1 = INTNULL and d2 = INTNULL and dn = INTNULL S1 = N and S2 = N and . . . Sn = N then Y <= INTNULL after 5 ns; end if; end process;

2013.01.04.

Keresztes Pter

117

RTKKVET (VALUE-TRACE) DF GRF


Ha egy szekvencilis utastssorozatban az xi := E(x1, x2, . . xi. . .xn); vltoz-rtkadshoz jutunk, abbl aktort csinlunk, s azt egy DF grfba helyezzk ci : az i. index vltoz aktulis rtkhez tartoz sorszm-index.

Xi(ci+1) <= E(x1c1, x2c2, . . Xici, . . xncn); Xi(ci+1) <=o E(x1c1, x2c2, . . Xici, . . . xncn);
2013.01.04. Keresztes Pter 118

FELADAT 1.
Rajzoljuk fel fel az rtkkvet DF grfot begin for i in 1 to 4 loop a := a + 1; end loop;

2013.01.04.

Keresztes Pter

119

FELADAT 2.
Rajzoljuk fel fel az rtkkvet DF grfot! begin if c < 0 then d := a + b; else d := a b; end if; end;
2013.01.04. Keresztes Pter 120

FELADAT 3.
Rajzoljuk fel az rtkkvet DF grfot! begin if c < 0 then d := a + b; else e := a b; end if; end;
2013.01.04. Keresztes Pter 121

ZSETON-HAJTOTT VT-DF GRF VHDL MODELLJE


Xi(ci+1) <=o E(x1c1, x2c2, . . Xici, . . . xncn);

process(x1c1, x2c2, . . xici, . . . xncn) begin if x1c1 /= NULL and x2c2 /= NULL and . .
xici /= NULL and . . . .xncn /= NULL and Xi(ci+1) = NULL then Xi(ci+1) <= E(x1c1, x2c2, . . Xici, . . . xncn) after Td; elsif
2013.01.04. Keresztes Pter 122

FOLYTATS . . .
x1c1 = NULL and x2c2 = NULL and . . xici = NULL and . . . .xncn = NULL and xi(ci+1) /= NULL then Xi(ci+1) <= NULL after Td; end if; end process; NULL : a zseton nlkli adat
2013.01.04. Keresztes Pter 123

EGY ALGORITMUS : COMPUTING


library work; use work.specpack.all; entity COMPUTING is port ( START : in bit; pa, pb, pc, pd : in integer:= 0; py : inout integer := 0); end COMPUTING; architecture ALG of COMPUTING is begin process variable a, b, c, d, y, v, u : integer := 0; begin wait until START = '1'; a := pa; c := pc; b := pb; d := pd; v := MLTPR(a, b); u := MLTPR(c, d); y := ADD(v, u); py <= y; end process; end ALG;
2013.01.04. Keresztes Pter 124

RTKKVET GRF

2013.01.04.

Keresztes Pter

125

ESEMNY-HAJTOTT SZORZ
Y <= MLTPLY (x1, x2) after Td; function MLTPLY(a : real; b : real) return real is variable v : real; begin v := a * b; return v; end MLTPR;
2013.01.04. Keresztes Pter 126

ZSETON HAJTOTT SZORZ


architecture BEH of TD_MLTPR is begin process(X1, X2, Y) begin if Y = INTNULL and X1 /= INTNULL and X2 /= INTNULL the Y <= MLTPLY(X1, X2) after 20 ns; elsif Y /= INTNULL and X1 = INTNULL and X2 = INTNULL then Y <= INTNULL after 20 ns; end if; end process; end BEH;
2013.01.04. Keresztes Pter 127

SZINKRON PIPE-LINE VT DF, FSM VEZRLSSEL

2013.01.04.

Keresztes Pter

128

ASZINKRON (DR) REGISZTER


entity TD_REG is port ( D : in integer := INTNULL; Y : inout integer := INTNULL; ack_in : in bit; ack_out : inout bit); end; architecture BEH of DR_REG is begin process(D, ack_in, Y) begin if Y = INTNULL and ack_in = '0' and D /= INTNULL then Y <= D after 10 ns; ack_out <= '1' after 10 ns; elsif Y /= INTNULL and ack_in = '1' and D = INTNULL then Y <= INTNULL after 10 ns; ack_out <= '0' after 10 ns; end if; end process; end BEH;
2013.01.04. Keresztes Pter 129

ASZINKRON PIPE-LINE TDREGISZTEREKKEL

2013.01.04.

Keresztes Pter

130

2013.01.04.

Keresztes Pter

131

EGY ALGORITMUS
procedure FUZZY_AND_LUK ( a, b, : in real; y : out real) is variable v : real := 0.0; variable u : bit; begin v := ADD(a, b); v := DECR(v); u := CM0(v); if u = '0' then v := 0.0; end if; y <= v; end FUZZY_AND_LUK;

2013.01.04.

Keresztes Pter

132

Az algoritmus VT-DF grfja

2013.01.04.

Keresztes Pter

133

A FUZZY-AND ED-VT-DF MODELLJE


architecture VT_ED_DF of FUZZY_AND is constant Td : time := 10 ps; signal a1, b1, v1, v2, v3 : real := 0.0; signal u1 : bit; begin a1 <= pa after Td ; b1 <= pb after Td; v1 <= ADD(a1, b1)after Td; v2 <= DECR(v1)after Td; u1 <= CM0(v2) after Td; v3 <= 0.0 after Td when u1 = '0' else v2; y1 <= v3 after Td; end VT_ED_DF;
2013.01.04. Keresztes Pter 134

CSOMAG A TD-VT-DFB MODELLHEZ


package compmodels_m is subtype s_real is real range -2.0 to 2.0; constant REALNULL : s_real := -2.0; constant td : time := 10 ps; type token_port is (empty, token); type s_bit is (N, '0', '1'); function CM0(a: real) return s_bit; function ADD(a : real; b : real)return real; function DECR(a : real)return real;

end compmodels_m;
2013.01.04. Keresztes Pter 135

A CM0 FGGVNY
package body compmodels_m is

function Cm0(a: real) return s_bit is variable v : s_bit; begin if a > 0.0 then v := '1' ; else v := '0'; end if; return v; end Cm0;
2013.01.04. Keresztes Pter 136

AZ ADD FGGVNY
function ADD(a : real; b : real)return real is variable v : real; begin v := a + b; return v; end ADD;
2013.01.04. Keresztes Pter 137

A DECR FGGVNY
function DECR(a : real) return real is variable v : real; begin v := a 1.0; return v; end DECR;

end compmodels_m;
2013.01.04. Keresztes Pter 138

pa-a1 processzus
TD_A1 : process(pa) begin if pa = REALNULL and a1 /= REALNULL then a1 <= REALNULL after td; elsif pa /= REALNULL and a1 = REALNULL then a1 <= pa after td; end if; end process;

2013.01.04.

Keresztes Pter

139

A TD-ADDER PROCESSZUS
TD_ADDER : process(a1, b1) begin if a1 = REALNULL and b1 = REALNULL and v1 /= REALNULL then v1 <= REALNULL after td; elsif a1 /= REALNULL and b1 /= REALNULL and v1 = REALNULL then v1 <= ADD(a1, b1)after td; end if; end process;
2013.01.04. Keresztes Pter 140

A TD-DECR PROCESS
TD_DECR : process(v1) begin if v1 = REALNULL and v2 /= REALNULL then v2 <= REALNULL after td; elsif v1 /= REALNULL and v2 = REALNULL the v2 <= SUBT(v1, 1.0)after td; end if; end process;
2013.01.04. Keresztes Pter 141

A TD-CM0 PROCESSZUS
TD_CM0 : process(v2) begin if v2 = REALNULL and u1 /= N then u1 <= N after td; elsif v2 /= REALNULL and u1 = N then u1 <= CM0(v2)after td; end if; end process;
2013.01.04. Keresztes Pter 142

A TD-MPX PROCESSZUS
TD_MPX : process(u1, v2) begin if v2 = REALNULL and u1 = N and v3 /= REALNULL then v3 <= REALNULL after td; elsif v2 /= REALNULL and u1 = '0' and v3 = REALNULL then v3 <= 0.0 after td; elsif v2 /= REALNULL and u1 = '1' and v3 = REALNULL then v3 <= v2 after td; end if; end process;
2013.01.04. Keresztes Pter 143

NGYZETGYKVONS
package sqrt_package is type md_cont_type is (mult, div); type as_cont_type is (add, sub); function SQRT_INIT ( x : real) return real; function SQRT_CORE ( x : real; cy : real) return real; function SQRT1( x : real) return real; function SQRT2( x : real; e : real) return real; function Cm(a: real; b: real) return bit; function MD(md_contr: md_cont_type; a : real; b : real) return real; function AS(as_contr: as_cont_type; a : real; b : real)return real; end sqrt_package;

2013.01.04.

Keresztes Pter

144

A KEZDETI GYK SZMTSA


function SQRT_INIT ( x : real) return real is variable init : real := 0.0; begin if x < 0.00001 then init := 0.0; elsif x >= 0.00001 and x < 0.0001 then init := 0.007; elsif x >= 0.0001 and x < 0.001 then init := 0.022; elsif x >= 0.001 and x < 0.01 then init := 0.07; elsif x >= 0.01 and x < 0.1 then init := 0.22; elsif x >= 0.1 and x < 1.0 then init := 0.7; elsif x >= 1.0 and x < 10.0 then init := 2.2; elsif x >= 10.0 and x < 100.0 then init := 7.0; elsif x >= 100.0 and x < 1000.0 then init := 22.0; elsif x >= 1000.0 and x < 10000.0 then init := 70.0; elsif x >= 10000.0 and x < 100000.0 then init := 220.0; elsif x > 100000.0 then init := 220.0 ; end if; return init; end SQRT_INIT;
2013.01.04. Keresztes Pter 145

A GYKVONS CIKLUSNAK MAGJA


function SQRT_CORE (x : real; cy real) return real is variable v : real := 0.0; begin v := x/cy; v := cy + v; v := 0.5 * v ; return v; end SQRT_CORE;
2013.01.04. Keresztes Pter 146

Gykvons for ciklussal


function SQRT1(x : real) return real is variable v : real := 0.0; begin v := SQRT_INIT(x);

for i in 1 to 5 loop v := SQRT_CORE(x, v); end loop; return v; end SQRT1;


2013.01.04. Keresztes Pter 147

Gykvons while ciklussal

function SQRT2( x : real; e : real) return real is variable cy, ny : real := 0.0; variable d : real := 1.0; begin cy := SQRT_INIT(x); while d > e loop ny := SQRT_CORE(x, cy); d := ny - cy; if d < 0.0 then d := -d; end if; cy := ny; end loop; return cy; end SQRT2;
Keresztes Pter 148

2013.01.04.

ENTITS
entity SQRT_UNIT is port ( START : in bit; READY : inout bit := '1'; RESET : in bit; pe : in real := 0.0; px : in real:= 0.0; py : inout real := 0.0; ph1, ph2 : in bit); end SQRT_UNIT;
2013.01.04. Keresztes Pter 149

KILAPTOTT ALGORITMUS, HW-BE GYAZVA


architecture ALG of SQRT_ALG is begin process variable e, x, y, cy, ny, v : real := 0.0; variable d : real := 1.0; variable f : bit;; variable g : bit; begin wait until START = '1'; f := '1'; READY <= '0'; wait for 1 ns; e := pe; x := px; cy := SQRT_INIT(x); wait for 1 ns; while f = '1' loop v := MD(div, x, cy); v := AS(add, cy, v); ny := MD(mult, 0.5, v) ; d := AS(sub,ny,cy); g := Cm(d, 0.0); if g = '0' then d := AS(sub, 0.0, d); end if; cy := ny; f := Cm(d, e); end loop; wait for 1 ns; py <= cy; READY <= '1'; end process; end ALG;

2013.01.04.

Keresztes Pter

150

A kilaptott gykvons CDFG-je. A kezdeti temezs

<<= : regiszter tpus akci !!!!

2013.01.04.

Keresztes Pter

Fi = SQR_INIT !!!!!

151

KORLTOZS : csak egy szorz-oszt hasznlhat fel! ttemezs

2013.01.04.

Keresztes Pter

152

A regiszterek elklntse. A regiszter allokci elksztse

2013.01.04.

Keresztes Pter

153

Funkcis egysg allokci

2013.01.04.

Keresztes Pter

154

llapotfggetlen akcik kiemelse

2013.01.04.

Keresztes Pter

155

Regiszter-allokci, 1. varins (v2_py)

2013.01.04.

Keresztes Pter

156

REGISZTER ALLOKCI, 2. varins (py_cy2)

2013.01.04.

Keresztes Pter

157

A vgeredmny

2013.01.04.

Keresztes Pter

158

ENTITS

library work; use work.euklid_pack.all; entity EUKLID is port ( START : in bit; READY : inout bit; RESET : in bit; pM, pN : in integer; py : inout integer; ph1, ph2 : inout bit); end EUKLID;
Keresztes Pter 159

2013.01.04.

ALGORITMUS 1

architecture BEH of EUKLID is begin process variable M, N, A, B, Q : integer; variable R : natural; begin READY <= '1'; wait until START = '1'; R := 1; READY <= '0'; wait for 1 ns;

2013.01.04.

Keresztes Pter

160

ALGORITMUS 2

M := pM; N := pN; if M > N then A := M; B := N; else A := N; B := M; end if; while R /= 0 loop Q := A/B; R := A - Q*B; A := B; B := R; end loop; py <= A; READY <= '1'; end process; end BEH;
Keresztes Pter 161

2013.01.04.

FSM vezrelt VT-EDDF-blokkok

2013.01.04.

Keresztes Pter

162

EDDF1- TTEMEZETT, FSM VEZRELT


M1 <= pM when state = 1 else anyinteger; N1 <= pN when state = 1 else anyinteger; G1 <= Cm(M1, N1) when state = 1 else anybit; A1 <= M1 when state = 1 and ph2 = '1' and G1 = '1' else N1 when state = 1 and ph2 = '1' and G1 = '0' else A2 when state = 4 and ph2 = '1' else A1; .......................................
2013.01.04. Keresztes Pter 163

FSM

TAC : block begin state <= nextstate when ph1 = '1' else state; slave <= state when ph2 = '1' else slave; nextstate <= 0 when RESET = '1' else 0 when slave = 0 and RESET = '0' and START = '0' else 1 when slave = 0 and RESET = '0' and START = '1' else 2 when slave = 1 and RESET = '0' else 3 when slave = 2 and RESET = '0' else 4 when slave = 3 and RESET = '0' and F1 = '1' else 5 when slave = 3 and RESET = '0' and F1 = '0' else 2 when slave = 4 and RESET = '0' else 0 when slave = 5 and RESET = '0' else 0;
READY <= '0' when state = 1 and ph2 = '1' else '1' when state = 5 and ph2 = '1' else READY; end block; end EDDF_1;
Keresztes Pter 164

2013.01.04.

EDDF2 REGISZTEREK KIEMELSE


........ A1 <= A1_i when (state = 1 or state = 4) and ph2 = '1' else A1; A1_i <= M1 when state = 1 and G1 = '1' else N1 when state = 1 and G1 = '0' else A2 when state = 4 else anyinteger; .........
2013.01.04. Keresztes Pter 165

EDDF3 FU ALLOKCI

-- a szorz-oszt --Q1_i <= MD(div, A1, B1) when state = 2 else anyinteger; --R1 <= MD(mult, Q1, B1) when state = 3 else anyinteger; n8 <= MD(n9, n10, n11) ; Q1_i <= n8 when state = 2 else anyinteger; R1 <= n8 when state = 3 else anyinteger; n9 <= div when state = 2 else mult when state = 3 else any_md_cont; n10 <= A1 when state = 2 else Q1 when state = 3 else anyinteger; n11 <=B1 when (state = 2 or state = 3) else anyinteger;

2013.01.04.

Keresztes Pter

166

EDDF4 5 LLAPOTFGGETLEN TRANZAKCIK JELLSE


nn1 <= Cm(n2, n3); n4 <= AS(n5, n6, n7); n8 <= MD(n9, n10, n11); M1 <= pM; N1 <= pN; G1 <= nn1; F1_i <= nn1; n2 <= M1 when state = 1 else R2; n3 <= N1 when state = 1 else 0;
Keresztes Pter 167

2013.01.04.

RT-szint struktra

2013.01.04.

Keresztes Pter

168

You might also like