vhdl04 chapter1.ppt [호환 모드]dasan.sejong.ac.kr/~dihan/vhdl/vhdl04_chapter1.pdf ·...

24
VHDL 프로그래밍 VHDL 프로그래밍 4. VHDL 구문 정리 학습 목표 학습 목표 순차 실행문과 병렬 실행문의 차이점 알기 process 문의 완전한 이해 병렬 신호 할당문의 이해 병렬 신호 할당문의 이해 연모델에 차이알기 if 문, case 문에 대한 이해 VHDL code 작성에 대한 자신감 가지기 2/47

Upload: lamthuy

Post on 11-Jun-2018

228 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: VHDL04 chapter1.ppt [호환 모드]dasan.sejong.ac.kr/~dihan/vhdl/VHDL04_chapter1.pdf · 2009-03-23 · El:Example : architecture arck_blk of BLOCKSTMT is ... condition이false

VHDL 프로그래밍VHDL 프로그래밍

4. VHDL 구문 정리

학습 목표학습 목표

순차 실행문과 병렬 실행문의 차이점 알기

process 문의 완전한 이해

병렬 신호 할당문의 이해병렬 신호 할당문의 이해

지연 모델에 대한 차이점 알기지 델에 대 차이 알기

if 문, case 문에 대한 이해

VHDL code 작성에 대한 자신감 가지기

2/47

Page 2: VHDL04 chapter1.ppt [호환 모드]dasan.sejong.ac.kr/~dihan/vhdl/VHDL04_chapter1.pdf · 2009-03-23 · El:Example : architecture arck_blk of BLOCKSTMT is ... condition이false

ContentContent

순차 실행문 (Sequential Statements)

if 문if 문

case 문

loop 문 등

병렬 실행문 (Concurrent Statements)병렬 실행문 (Concurrent Statements)

process 문

conditional signal assignment 문

selected signal assignment 문 등selected signal assignment 문 등

3/47

Concurrent StatementsConcurrent Statements

내의 문장은 기본적architecture body 내의 문장은 기본적으로 concurrent statement으로 concurrent statement

모든 문장은 동시에 실행

문장간의 상대적 순서는 중요하지 않음

architecture test1 of test isbegin

A <= B or C;

architecture test2 of test isbegin

C <= not E;A <= B or C;B <= D and E;C <= not E;

C <= not E;B <= D and E;A <= B or C;

=

end test1; end test2;

concurrent statement의 예

4/47

concurrent statement의 예

Page 3: VHDL04 chapter1.ppt [호환 모드]dasan.sejong.ac.kr/~dihan/vhdl/VHDL04_chapter1.pdf · 2009-03-23 · El:Example : architecture arck_blk of BLOCKSTMT is ... condition이false

Concurrent StatementsConcurrent Statements

병렬 실행문의 종류병렬 실행문의 종류process 문(process statement)process 문(process statement)concurrent signal assignment 문

t ti 문concurrent assertion 문concurrent procedure call 문pcomponent instantiation 문generate 문(생성문)generate 문(생성문)

5/47

Concurrent StatementsConcurrent Statements

process 문 자체는 하나의 concurrent statement로 간주statement로 간주

다만 process 문 내부는 sequential 다만 p 문 내부는 qstatement로 구성됨

d lt 문 내부의 ti ldelta : process 문 내부의 sequential statement 전체가 실행되는 시간

모든 concurrent signal assignment statement들은 하나의 process문으로statement들은 하나의 process문으로재 작성될 수 있음

6/47

Page 4: VHDL04 chapter1.ppt [호환 모드]dasan.sejong.ac.kr/~dihan/vhdl/VHDL04_chapter1.pdf · 2009-03-23 · El:Example : architecture arck_blk of BLOCKSTMT is ... condition이false

Concurrent Statements(b )

Concurrent Statementsprocess (b, c)

beginA B CA <= B or C;

end process;

A <= B or C;B < D and E;

process (b, c) begin

X t bB <= D and E;C <= not E;

X <= not b;end process;

=

process (b, c) begin

bb <= c xor y;end process;

7/47

concurrent statement의 예

Concurrent StatementsConcurrent Statements

process statementi i i li 를 갖거나 내부에 i 문을sensitivity list를 갖거나 내부에 wait문을

가져야 한다.

process 사이의 실행은 concurrent 하고, process 내의 실행은 sequential 함p q

process declaration part에 signal declaration은 올 수 없으나 variabledeclaration은 올 수 없으나, variable declaration은 올 수 있음

8/47

Page 5: VHDL04 chapter1.ppt [호환 모드]dasan.sejong.ac.kr/~dihan/vhdl/VHDL04_chapter1.pdf · 2009-03-23 · El:Example : architecture arck_blk of BLOCKSTMT is ... condition이false

Concurrent StatementsConcurrent Statements

Syntax :[label:] process [ (sensitivity_list) ][variable_decl][constant_decl][type_decl][subprogram_body][ ][use_clause][alias_decl][fil d l][file_decl]begin < ti l t t t ><sequential statements>

end process [label] ;

9/47

Concurrent StatementsConcurrent Statements

concurrent signal assignment statement (병렬 신호 할당문)statement (병렬 신호 할당문)

signal assignment 문이 process 바깥에존재하면 병렬 신호 할당문, process 내부에 존재하면 순차 신호 할당문에 존재하면 순차 신호 할당문

simple signal assignment 문

conditional signal assignment 문

selected signal assignment 문selected signal assignment 문

10/47

Page 6: VHDL04 chapter1.ppt [호환 모드]dasan.sejong.ac.kr/~dihan/vhdl/VHDL04_chapter1.pdf · 2009-03-23 · El:Example : architecture arck_blk of BLOCKSTMT is ... condition이false

Concurrent StatementsConcurrent Statements

simple signal assignment statement

SyntaxSyntax [lable:] signal_name <= expression [after time expr];time_expr];

예) qa <= r or t after 1 ns;

( ( ))qb <= (qa and not(g xor h)) after 2 ns;

11/47

Concurrent StatementsConcurrent Statements

selected signal assignment statement

식의 값에 따라 다른 값을 할당식의 값에 따라 다른 값을 할당

회로 합성 시 multiplexer로 합성됨

Syntax : case 문과 유사[label:] with expression selectsignal_name <= expression when value

{ , expression when value}{ , expression when others}

예) with MYSEL select

Z <= A when 15, B when 22,

C when 28 D when others;

12/47

C when 28, D when others;

Page 7: VHDL04 chapter1.ppt [호환 모드]dasan.sejong.ac.kr/~dihan/vhdl/VHDL04_chapter1.pdf · 2009-03-23 · El:Example : architecture arck_blk of BLOCKSTMT is ... condition이false

Concurrent StatementsConcurrent Statements

conditional signal assignment statement조건에 따라 signal에 다른 값이 할당조건에 따라 signal에 다른 값이 할당

회로 합성 시에 priority encoder 회로

S t : if l 문과 유사Syntax : if-else 문과 유사[label:] signal_name <= expression when condition else

{expression when condition else}

expression;

예) :

Z <= A when (X > 3) else

B when (X < 3) else

C; -- X = 3

13/47

Concurrent StatementsConcurrent Statements

논리 합성 예

14/47

Page 8: VHDL04 chapter1.ppt [호환 모드]dasan.sejong.ac.kr/~dihan/vhdl/VHDL04_chapter1.pdf · 2009-03-23 · El:Example : architecture arck_blk of BLOCKSTMT is ... condition이false

Delay Model(지연 모델)Delay Model(지연 모델)

병렬 신호 할당문이나 순차 신호 할당문에서모두 사용두 사용

하드웨어의 신호 지연 상태의 모델링 방법

종류delta delay model(델타 지연 모델)delta delay model(델타 지연 모델)

inertial delay model(관성 지연 모델)

t t d l d l(전달 지연 모델)transport delay model(전달 지연 모델)

15/47

Delay Model(지연 모델)Delay Model(지연 모델)

델타 지연 모델신호 할당문에서 지연이 정의되지 않은 경우신호 할당문에서 지연이 정의되지 않은 경우

신호 지연이 0 ns 인 경우

델타 지연만 추가될 뿐 실제 시간 지연이 발생하델타 지연만 추가될 뿐 실제 시간 지연이 발생하지 않음

시뮬레이션 시 신호에 발생되는 이벤트의 순서를 정하는 방법서를 정하는 방법

시뮬레이션 시간의 각 단계는 무한한 수의 델타 지연으로 구성됨타 지연으로 구성됨

16/47

Page 9: VHDL04 chapter1.ppt [호환 모드]dasan.sejong.ac.kr/~dihan/vhdl/VHDL04_chapter1.pdf · 2009-03-23 · El:Example : architecture arck_blk of BLOCKSTMT is ... condition이false

Delay Model(지연 모델)Delay Model(지연 모델)

델타 지연 모델

A B C Y

B <= not A; C <= not B; Y <= not C;

A B C Y

AA

B

C

YY

10 ns 10+1Δ 10+2Δ 10+3Δ=10 ns

17/47

Delay Model(지연 모델)Delay Model(지연 모델)

관성 지연 모델스위칭 회로의 신호 지연 현상을 모델링스위칭 회로의 신호 지연 현상을 모델링

입력은 정의된 관성 지연 후에 출력됨

입력값은 정의된 펄스 제한 시간 내에 안정되어입력값은 정의된 펄스 제한 시간 내에 안정되어야 함

입력이 펄스 제한 시간 내에 안정되지 않으면 출력은 변하지 않음

지연이 있을 경우 default delay model

18/47

Page 10: VHDL04 chapter1.ppt [호환 모드]dasan.sejong.ac.kr/~dihan/vhdl/VHDL04_chapter1.pdf · 2009-03-23 · El:Example : architecture arck_blk of BLOCKSTMT is ... condition이false

Delay Model(지연 모델)Delay Model(지연 모델)

관성 지연 모델SyntaxSyntax

signal_name <= [[reject pulse_rejection_limit] inertial ]

expression after inertial delay value;expression after inertial_delay_value;

예) : Y <= reject 4 ns A after 10 ns;

delay = 10 ns

reject limit = 4 nsA Y

5 8 10 25 28 30 45 48

reject limit = 4 ns

A5 8 10 25 28 30 45 48

Y

19/47

20 40

Delay Model(지연 모델)Delay Model(지연 모델)

관성 지연 모델Y <= inertial A after 10 ns;Y < inertial A after 10 ns;

-- same as Y <= A after 10 ns

-- same as Y <= reject 10 ns inertial A after 10 ns;same as Y <= reject 10 ns inertial A after 10 ns;

X < reject 4 ns inertial A after 10 ns;X <= reject 4 ns inertial A after 10 ns;-- same as X <= reject 4 ns A after 10 ns

delay가 있는 지연문은 default로 관성 지연문

20/47

Page 11: VHDL04 chapter1.ppt [호환 모드]dasan.sejong.ac.kr/~dihan/vhdl/VHDL04_chapter1.pdf · 2009-03-23 · El:Example : architecture arck_blk of BLOCKSTMT is ... condition이false

Delay Model(지연 모델)Delay Model(지연 모델)

전달 지연 모델순수한 전달 지연을 의미순수한 전달 지연을 의미

입력의 변화가 아주 적더라도 정의된 지연 이후에 출력에 출력

전달 지연 모델을 이용 시 반드시 transport 라는예약어를 사용해야 함예약어를 사용해야 함

21/47

Delay Model(지연 모델)Delay Model(지연 모델)

전달 지연 모델SyntaxSyntax

signal_name <= transport expression after

transport delay value;transport_delay_value;

예) : Y <= transport A after 10 ns;

delay = 10 nsA Y

5 8 10 25 28 30 45 48

A5 8 10 25 28 30 45 48

Y

22/47

15 18 20 35 38 40 55 58

Page 12: VHDL04 chapter1.ppt [호환 모드]dasan.sejong.ac.kr/~dihan/vhdl/VHDL04_chapter1.pdf · 2009-03-23 · El:Example : architecture arck_blk of BLOCKSTMT is ... condition이false

Concurrent StatementsConcurrent Statements

concurrent procedure call

d ll t t t 하나만 가진procedure call statement 하나만 가진process문과 동일

procedure의 인자 : in, inout, out

SyntaxSyntax

<procedure_name> ( )(<actual_parameter_list>);

23/47

Concurrent StatementsConcurrent Statements

Example :architecture … is

procedure VEC2INT(signal s : in bit_vector;signal ZFLAG : out boolean;signal ZFLAG : out boolean;signal Q : inout integer;) is…

end VEC2INT;…

beginbeginVEC2INT (BITVEC, FLAG, NUMBER);…

end arch;

24/47

Page 13: VHDL04 chapter1.ppt [호환 모드]dasan.sejong.ac.kr/~dihan/vhdl/VHDL04_chapter1.pdf · 2009-03-23 · El:Example : architecture arck_blk of BLOCKSTMT is ... condition이false

Concurrent StatementsConcurrent Statements

block statement

t t t t들의 그룹을 만든다concurrent statement들의 그룹을 만든다.

block문 내의 block문 가능

block의 declaration part에서 선언된 type, constant signal subprogram들은 해당constant, signal, subprogram들은 해당block내로 scope가 제한

25/47

Concurrent StatementsConcurrent StatementsSyntaxSyntaxlabel : block [(guard_expression)]

[port clause; port map clause][port_clause; port_map_clause][use_clause][subprogram decl subprogram body][subprogram_decl subprogram_body][type_decl][subtype decl][subtype_decl][constant_decl][signal decl][signal_decl][conponent_decl]

beging[concurrent_statements]

end block [label];

26/47

Page 14: VHDL04 chapter1.ppt [호환 모드]dasan.sejong.ac.kr/~dihan/vhdl/VHDL04_chapter1.pdf · 2009-03-23 · El:Example : architecture arck_blk of BLOCKSTMT is ... condition이false

Concurrent StatementsConcurrent StatementsE l :Example :

architecture arck_blk of BLOCKSTMT is…

beginbeginstage2 : SHIFT port map (rst=>rst, clk=>clk, si=>t1, so=>t1);

block0 : blockbeginbegin

state1 : SHIFT port map(rst=>rst, clk=>clk, si=>t1, so=>t2);

state0 : SHIFT port mapstate0 : SHIFT port map(rst=>rst, clk=>clk, si=>t2, so=>so);

end block;end arch_blk;_

stage2

block0clkrst so

g

si

27/47

Concurrent StatementsConcurrent Statements

bl k 첫머리의 bl k h d부분에 t 을 함으block 첫머리의 block_head부분에 port map을 함으로써 bloc내부의 신호와 외부의 신호를 연결 가능block header 사용 예 :block_header 사용 예 :

entity BKHEAD isport (DA,DB : in std_logic; DZ : out std_logic);

end BKHEAD;architecture BEH of BKHEWAD isbeginbeginblock0 : block

port (A,B : in std_logic; z : out std_logic);port map (A=>DA, B=>DB, Z=>DZ);begin

Z <= A nand B;Z <= A nand B;end block;

end BEH;

28/47

Page 15: VHDL04 chapter1.ppt [호환 모드]dasan.sejong.ac.kr/~dihan/vhdl/VHDL04_chapter1.pdf · 2009-03-23 · El:Example : architecture arck_blk of BLOCKSTMT is ... condition이false

Concurrent StatementsConcurrent Statements

concurrent assertion statement시뮬레이션 시 조건이 맞는지 검사하는 문장시뮬레이션 시 조건이 맞는지 검사하는 문장

sequential assertion statement와 문법 면에서 동일일

assert문 하나만을 갖는 process문과 동일

condition 값이 false이면 화면에 문자열 출력condition 값이 false이면 화면에 문자열 출력

Syntax :

[label:] assert <condition>[label:] assert <condition>

[report <string_type expression>]

[severity NOTE|WARNING|ERROR|FATAL] ;[severity NOTE|WARNING|ERROR|FATAL] ;

29/47

Concurrent StatementsConcurrent Statements

Example :entity ASSRT is ... end ASSRT ;entity ASSRT is ... end ASSRT ;architecture BEH of ASSRT is

signal S, Y ; std_logic;g , _ gbegin

...asrt0: assert Y = S report “not equal”

severity NOTE;asrt1: assert FALSE report “start to compare”

severity NOTE;end BEH ;

30/47

Page 16: VHDL04 chapter1.ppt [호환 모드]dasan.sejong.ac.kr/~dihan/vhdl/VHDL04_chapter1.pdf · 2009-03-23 · El:Example : architecture arck_blk of BLOCKSTMT is ... condition이false

Concurrent StatementsConcurrent Statements

Severity 값에 따른 차이note : 단순히 문자열을 화면에 출력note 단순히 문자열을 화면에 출력

warning : 화면에 warning 메시지와 시간, 위치를출력

error: 화면에 error메시지와 시간, 위치를 출력, warning과 유사하나 error 정도를 구분하여 표시 가능

fatal : fatal 메시지와 시간, 위치를 출력하고 시뮬레이션이 중지됨

31/47

Concurrent StatementsConcurrent Statements

component instantiation statementSyntex :y

label : component_name[generic map( <generic_mapping> )][port map ( <signal mapping> )] ;[port map ( <signal_mapping> )] ;

Example:Example:H0 : HA port map (A=>X, B=>Y, Sum=>t_s, Carry=>t_c1);u_or : OR2 generic map (delay => 1 ns)

port map (i1=>t_c1, i2=>t_c2, z=>Cout);

32/47

Page 17: VHDL04 chapter1.ppt [호환 모드]dasan.sejong.ac.kr/~dihan/vhdl/VHDL04_chapter1.pdf · 2009-03-23 · El:Example : architecture arck_blk of BLOCKSTMT is ... condition이false

Concurrent StatementsConcurrent Statements

generate statement(생성문)generate statement(생성문)규칙적인 설계 구조를 간결하게 표현할 수 있는 도구 제공구 제공

메모리, 레지스터, 카운터 등

Simulation과는 무관한 개념Simulation과는 무관한 개념복잡하고 긴 코딩을 단순하게 표현할 수 있는 도구제공논리 합성 이전에 복제되거나 해체된 후 사용됨

For-Generate 문: elaboration 단계에서 미리 정해진 횟수 만큼 복제됨수 만큼 복제됨If-Generate 문: 조건적으로 선택됨

33/47

Concurrent StatementsConcurrent Statements

generate statement(생성문)Syntex : For-Generate 문

t l b l f i bl i tgenerate_label : for variable in range generate[<block_declarative_item>

begin ]begin ]<concurrent_statement>

end generate [generate_label];

Syntex : If-Generate 문generate label : if condition generategenerate_label if condition generate

[<block_declarative_item>begin ]

< t t t t><concurrent_statement>end generate [generate_label];

34/47

Page 18: VHDL04 chapter1.ppt [호환 모드]dasan.sejong.ac.kr/~dihan/vhdl/VHDL04_chapter1.pdf · 2009-03-23 · El:Example : architecture arck_blk of BLOCKSTMT is ... condition이false

Concurrent StatementsConcurrent Statements

Example :

beginU0: FullAdder1 port map (X=>DA(0),

Y=>DB(0), Cin=>Ci, Cout=>t(0), ( ))

begin

gen0 : for i in 0 to 3 generateSout=>S(0));

U1: FullAdder1 port map (X=>DA(1), Y=>DB(1), Cin=>t(1), Cout=>t(1), Sout=>S(1));

U0: FullAdder1 port map (X=>DA(i), Y=>DB(i), Cin=>t(i), Cout=>t(i+1), Sout=>S(i));Sout >S(1));

U2: FullAdder1 port map (X=>DA(2), Y=>DB(2), Cin=>t(2), Cout=>t(2),Sout=>S(2));

U3 F llAdd 1 (X DA(3)

Sout >S(i));

end generate ;

t(0) <= Ci;

=

U3: FullAdder1 port map (X=>DA(3), Y=>DB(3), Cin=>t(2), Cout=>Co, Sout=>S(3));

end struct top;

Co <= t(4);

end struct_gen ;end struct_top;

35/47

Sequential StatementsSequential Statements

process 내부와 subprogram 내부에서사용되는 문장사용되는 문장알고리즘을 기술하는데 유리기술된 순서대로 순차적 실행

Process 자체는 병렬 실행문이나 Process는 순차Process 자체는 병렬 실행문이나 Process는 순차실행문으로 구성됨임의의 시간에 단 하나의 순차 실행문 만이 각 프임의의 시간에 단 하나의 순차 실행문 만이 각 프

로세스 안에서 실행됨

36/47

Page 19: VHDL04 chapter1.ppt [호환 모드]dasan.sejong.ac.kr/~dihan/vhdl/VHDL04_chapter1.pdf · 2009-03-23 · El:Example : architecture arck_blk of BLOCKSTMT is ... condition이false

Sequential StatementsSequential Statements

순차 실행문의 종류순차 실행문의 종류signal assignment 문g gvariable assignment 문if 문 case 문if 문, case 문wait 문assert 문assert 문loop 문

i ll 문exit, next, null 문return 문procedure call or function call

37/47

Sequential StatementsSequential Statements

waitProcess를 일정 조건이 만족될 때까지 suspendSyntex :

wait [on <signal_list> [until] <condition>] [for <time>];

i bl i tvariable assignmentSyntax :

<variable name> := <expression>

signal assignmentSyntax :

<signal name> <= [transport|inertia] <expression> after<time delay>];<time delay>];

신호 대입문이 process 내부에 존재하면 순차 신호 대입문

38/47

신호 대입문이 process 내부에 존재하면 순차 신호 대입문

Page 20: VHDL04 chapter1.ppt [호환 모드]dasan.sejong.ac.kr/~dihan/vhdl/VHDL04_chapter1.pdf · 2009-03-23 · El:Example : architecture arck_blk of BLOCKSTMT is ... condition이false

Sequential Statements

t

Sequential Statements

assert시뮬레이션 시 조건이 맞는지 검사하는 문장

문 내부에 있으면 순차 문 외부에 있으면process문 내부에 있으면 순차 assert문 외부에 있으면병렬 assert 문Syntax :Syntax :

[label:] assert <condition> [report <string_type expression>]

[severity NOTE|WARNING|ERROR|FATAL];[severity NOTE|WARNING|ERROR|FATAL];예)

process (R, S)b ibegin

assert not (S=‘1’ and R = ‘1’)report “Both R and S sre 1”report Both R and S sre 1severity ERROR;

…d

39/47

end process;

Sequential Statements

if 문

Sequential Statements

if 문조건 값에 따라서 실행할 문장을 선택처음으로 True인 조건이 나타날 때까지 각 조건을순차적으로 검사True인 조건과 관련된 순차문을 수행True인 조건과 관련된 순차문을 수행elsif 문이 없거나 하나 이상 존재 가능다른 if문을 포함 가능다른 if문을 포함 가능else 문은 없거나 단 1개만 존재 가능

40/47

Page 21: VHDL04 chapter1.ppt [호환 모드]dasan.sejong.ac.kr/~dihan/vhdl/VHDL04_chapter1.pdf · 2009-03-23 · El:Example : architecture arck_blk of BLOCKSTMT is ... condition이false

Sequential Statements

S t

Sequential Statements

Syntaxif <condition> then sequential statements end if;if <condition> thenif <condition> then

sequential statements1else

sequential statements2end if;if <condition1> thenif <condition1> then

sequential statements1elsif <condition2> then

sequential statements2…elseelse

sequential statementsNend if;

41/47

Sequential StatementsSequential Statements

case 문expression 값에 따라 실행할 분기 선택p

Syntax

case <expression> iscase <expression> is

when value1 => <sequential statement1>

when value2 => <sequential statement2>when value2 > <sequential statement2>

when others => <sequential statementN>when others => <sequential statementN>

end case;

expression의 값은 서로 overlap되어서는 안됨expression의 값은 서로 overlap되어서는 안됨.

others는 <expression>에 해당되는 값이 없을 때선택

42/47

선택

Page 22: VHDL04 chapter1.ppt [호환 모드]dasan.sejong.ac.kr/~dihan/vhdl/VHDL04_chapter1.pdf · 2009-03-23 · El:Example : architecture arck_blk of BLOCKSTMT is ... condition이false

Sequential Statements

loop 문

Sequential Statements

loop 문Syntax

[l b l ] f l i i bl l[label:] for loop_var in variable_range loopsequential statements

end loop [label]; 지정 횟수만큼 반복end loop [label]; -- 지정 횟수만큼 반복-- loop_var는 외부에서 따로 선언할 필요 없음[label:] while <condition> loop[label:] while <condition> loop

sequential statementsend loop [label]; -- condition 이 true이면 반복end loop [label]; condition 이 true이면 반복[label:] loopsequential statementssequential statementsend loop [label]; -- 무한 반복 필요시 내부에 exit 문 삽입

43/47

무한 반복, 필요시 내부에 exit 문 삽입

Sequential StatementsSequential Statements

exitSyntaxy

exit [loop label] [when <condition>];

loop 내에서만 사용 가능

loop문을 빠져 나가는 용도loop문을 빠져 나가는 용도

label이 정의되어 있지 않을 경우 가장 안쪽 loop가 종료가 종료

label이 있을 경우 label이 있는 전체 loop를 빠져나감나감

condition이 false이면 다음 문장이 실행됨

44/47

Page 23: VHDL04 chapter1.ppt [호환 모드]dasan.sejong.ac.kr/~dihan/vhdl/VHDL04_chapter1.pdf · 2009-03-23 · El:Example : architecture arck_blk of BLOCKSTMT is ... condition이false

Sequential StatementsSequential Statements

nextSyntaxy

next [loop_label] [when <condition>];나머지 부분을 실행하지 않고 loop의 처음 부분으

이 없 면 가장 안쪽로 jump, label이 없으면 가장 안쪽 loop로 jump예)

i lbl i t 0varialble a : integer := 0;loop1 : for i in 1 to 10 loop

l 2 : f j i 1 t 10 lloop2 : for j in 1 to 10 loopnext loop2 when j = 5;a := a + 1;a := a + 1;

end loop2;end loop1;

45/47

end loop1;

Sequential StatementsSequential Statements

null

아무 일도 하지 않는다아무 일도 하지 않는다.

when others 등에서 쓸 문장이 없는 경우

Syntaxnull;null;

예)case sel is

when “00” => Z <= i0;when “01” => Z <= i1;

h “10” > Z < i2;when 10 => Z <= i2;when others => null;

46/47

Page 24: VHDL04 chapter1.ppt [호환 모드]dasan.sejong.ac.kr/~dihan/vhdl/VHDL04_chapter1.pdf · 2009-03-23 · El:Example : architecture arck_blk of BLOCKSTMT is ... condition이false

Sequential StatementsSequential Statements

return

subprogram body에서 호출한 원래 문장으로 되돌아 감.

Syntax :

return [value];

procedure call or function call

Syntex :

<procedure name> (<actual parameter list>);procedure_name ( actual_parameter_list )

<signal> <=

<function name> (<actual parameter list>);<function_name> (<actual_parameter_list>);

47/47