부트로더(BootLoader)

Download Report

Transcript 부트로더(BootLoader)

VHDL 기초 이론
㈜ 한백전자 기술연구소
목차
VHDL 정의
VHDL 구성과 표현
VHDL 문법
Entity declaration
Architecture body
Package
Object
Attribute & Operator
Behavioral representation
Concurrent Signal Assignment Statement
Structural representation
The others
VHDL 정의
VHDL
VHSIC (Very High Speed Integrated Circuit)
Hardware
Description
Language
전자 회로의 언어적 표현
IEEE 표준 언어
설계 정보의 교환성
VHDL 배경
1980 – U.S. Department of Defense (DOD)의 요구로 VHDL
연구 개발
1987 IEEE 1076 표준 탄생
국방성 및 상업용으로 사용할 수 있도록 확장
1991 IEEE 1076에 추가적으로 합성 기능의 강화
관련 CAD 업체의 본격적인 합성 도구 개발 시작
1993 VHDL 응용 과정에서의 추가 건을 반영한 IEEE 10761993 개발
VHDL 특징
표준화된 언어
범용 라이브러리를 이용한 설계
정보 교환 및 설계 기간 단축 및 오류 해소
이용의 확대
IEEE에서 인증하는 언어로 전세계적으로 확대
대규모의 설계 용이
다양한 설계 및 응용
프로그램 언어의 원리에 하드웨어적 특징 추가
여러 단계의 다양한 회로 표현 용이
언어로서 다양한 기능 제공
Top-Down 방식의 설계 가능
설계 기간 단축
Error 검증 및 수정 용이
제품 개발 기간 단출 및 설계 비용 감소
문제점
복잡한 언어로서의 이해의 어려움
타이밍 검증 및 임계 경로에 대한 예측이 어려움
VHDL 규칙
두가지의 구문이 사용됨:
Synthesis(합성)
Simulation(시뮬레이션)
한정된 수의 예약어로 구문을 구성함.
대소문자의 구분이 없음.
모든 문장은 세미콜론( ; )으로 끝남.
가독성을 위해 모든 형태의 공백은 무시됨.
주석문은 “--” 으로 시작하고 그 행의 끝까지 유지됨.
VHDL 모델의 기술 방법
Behavioral(동작적 기술)
Structural(구조적기술)
Mixed(Dataflow기술)
VHDL 구성과 표현
VHDL 구조
VHDL 설계 요소
Entity
모델의 외부 형상(심볼)을 정의
하드웨어 블록의 이름과 입출력 Port를 선언
Architecture
모델의 기능(Schematic)을 정의
내부회로의 연결, 동작,구조 등을 표현
Configuration
Architecture와 Entity의 연결 관계 정의
다수의 Architecture를 갖는 Entity의 경우 사용
Package
VHDL 모델에 의해 인용될 정보 모음(Library에 저장)
자료형(type), 함수(function), 프로시져(procedure) 등을 선언
VHDL : Entity - Architecture
output1
input1
Entity
Symbol
outputn
inputn
Architecture
Schematic
a
b
c
d
D
clk
ENA
CLRN
sel
2
clr
Q
mux_out
VHDL 설계 구조
Library
package 혹은 package 모음을 포함.
Resource Libraries
Standard Package
IEEE developed packages
FPGA Component packages
Working Library
사용자가 만든 Unit들이 저장될 Library
Library
LIBRARY STD ;
다음과 같은 package들을 포함:
standard ( Types: Bit, Boolean, Integer, Real, and Time)
textio (File 동작)
An implicit library (built-in)
VHDL 설계시 인용될 필요 없음.
LIBRARY IEEE;
다음과 같은 package들이 포함됨:
std_logic_1164 (std_logic types & related functions)
std_logic_arith (arithmetic functions)
std_logic_signed (signed arithmetic functions)
std_logic_unsigned (unsigned arithmetic functions)
Library 선언
LIBRARY 선언
사용할 library 를 선언하는 부분
IEEE standard library 를 선언할 수 있다
(IEEE standard 1076, IEEE standard 1164)
사용자가 만든 library 를 선언할 수도 있음
IEEE standard 1076: 1987 년 제정된 IEEE 표준
IEEE standard 1164: 1993 년 제정된 IEEE 표준
Library 선언
LIBRARY 선언의 예
IEEE standard library 1164 를 사용할 경우
library ieee;
use ieee.std_logic_1164.all;
사용자가 만든 library 를 사용할 경우
library work;
use work.sample_lib.all;
Entity Declaration(선언)
Hardware 외부 입 /출력 interface 를 선언
Hardware block 의 이름과 입 /출력 port 를 선언
Entity선언은 ‘entity’에서 ‘end’로 끝나게 된다.
ENTITY <entity_name> IS
Generic Declarations
Port Declarations
END <entity_name>; (1076-1987 version)
END ENTITY <entity_name> ; ( 1076-1993 version)
Architecture body
Hardware 내부를 표현
회로의 연결 , 동작 또는 구조 등을 표현
형식
Architecture <architecture_name> of <entity_name> is
{ architecture_declarative part}
Begin
{statements}
end <architecture_name>;
VHDL 문법
식별어(Identifier)
설계자의 임의 문자열
entiry, architecture body, port의 이름 정의 등
규칙
VHDL은 대소문자 구별 없음
두개의 대쉬(“--”)로 주석 처리
알파벳, 숫자 및 밑줄(“_”)의 사용
첫 번째 문자는 영문으로 시작
빈 칸은 허용하지 않음
지정어(Reserved word)
VHDL 구문을 위한 미리 지정된 문자열
식별어로 사용할 수 없음
주석(commet)
“--”로 표시
VHDL 수행에 영향을 주지 않는다
“--” 표시가 있는 부분부터 그 줄 끝까지 주석 처리
Entity declaration
Entity Declaration(선언)
ENTITY <entity_name> IS
Generic Declarations
Port Declarations
END <entity_name>; (1076-1987 version)
END ENTITY <entity_name> ; ( 1076-1993 version)
Hardware 외부 입 /출력 interface 를 선언
Hardware block 의 이름과 입 /출력 port 를 선언
Entity선언은 ‘entity’에서 ‘end’로 끝나게 된다.
하나의 entity는 복수의 architecture를 사용 가능
parameter를 선언해 주는 역할
일반적인 package나 architecture에서 선언
허용되는 구문
type, subtype, constant, signal, subprogram & body, attribute &
specification, disconnection, use, file, alias
Entity : 문장
값의 설정이나 소거와 같은 assertion
setup/hold time이나 펄스 폭 검사
허용되는 구문
Concurrent assertion, concurrent procedure call, process
최소 엔티티 선언
Test bench와 같이 출력이 없는 하드웨어 구조 표현
사용 예
entity TEST is
end TEST;
Entity Declaration(선언)
Entity 선언의 예
Entity and2 is
port(a,b:in std_logic;
c:out std_logic);
end and2;
Entity : Generic Declaration
ENTITY <entity_name> IS
Generic ( constant tplh , tphl : time := 5ns
--Note: constant is assumed and is not required
tphz, tplz : time := 3ns;
degault_value : integer := 1;
cnt_dir : staring := “up”
);
Port Declarations
END <entity_name>; (1076-1987 version)
END ENTITY <entity_name> ; ( 1076-1993 version)
New values can be passed during compilation
During simulation/synthesis a Generic is read only
Entity : Generic 표현
library ieee;
use ieee.std_logic_1164.all;
entity ANDG is
Generic( SIZE : integer range 8 );
port(
A : in std_logic_vector(SIZE-1 downto 0);
B : in std_logic_vector(SIZE-1 downto 0);
Y : in std_logic_vector(SIZE-1 downto 0));
end ANDG;
architecture HB of ANDG is
begin
Y <= A and B;
end HB;
Entity : Port Declarations
ENTITY <entity_name> IS
Port ( signal clk : in std_logic;
--Note: signal is assumed and is not required
q : out std_logic
);
END <entity_name>; (1076-1987 version)
END ENTITY <entity_name> ; ( 1076-1993 version)
Structure : <class> object_name : <mode> <type> ;
<class> : what can be done to an object
Object_name : identifier
<mode> : directional
in (input)
inout (bidirectional)
linkage
out (output)
buffer (output w/ internal feedback)
<type> : What can be contained in the object
Entity : port 표현
library ieee;
use ieee.std_logic_1164.all;
entity REGNE is
port(
rEG_I : buffer std_logic_vector(3 downto 0);
cl : in std_logic;
rst : inout std_logic_vector(1 downto 0);
e : out std_logic;
reg_o : out std_logic_vector(n-1 downto 0));
end REGNE;
Entity Declaration – Port 선언
Port
외부신호선의 연결상태를 나타낸다
Port Declaration
Port 선언부는 entity 선언부에 포함된다
입 /출력 방향과 특성을 결정하는 mode 와 data_type 이 선
언되어야 한다
Entity Declaration – Port 선언
Mode
Port 내에는 signal 의 입 /출력 방향을 결정하는 4 가지 mode 가 있
다
in
(입력 )
out
(출력 )
inout (입/출력)
buffer (입/출력) : out의 기능과 같으나 외부신호를 입력 받을 수
없고, 단지 자신의 신호를 되 읽는 경우에 사용
Entity Declaration – Port 선언
Data Type
모든 signal 은 data type 을 가지고 있다
Signal 의 개수가 1 개인 경우 : bit
Signal 의 개수가 여러 개인 경우 (bus): bit_vector
Signal 이 bit_vector 인 경우 선언 예
bit_vector(0 to 2);
오름차순
bit_vector(2 downto 0); 내림차순
IEEE standard 1164 에서는 bit 대신에 std_logic 을 사용
std_logic 을 사용하기 위해서는 반드시 아래의 선언이 포함되어 있어야 함.
library ieee;
use ieee.std_logic_1164.all;
Entity Declaration – Port 선언
Data Type
Data Type
Values
bit
'1','0'
std_logic
'u','x','0','1','z','w','l','h','-'
boolean
True,False
integer
…,-2,-1,0,1,2,…
real
-1.0e38 ~1.0e38
character
'a','b','c'etc
time
ms,us,ns,ps
Architecture body
Architecture body
Hardware 내부를 표현
회로의 연결 , 동작 또는 구조 등을 표현
회로의 실질적인 동작이나 연결 상태 등을 표현
하나의 entity에 여러 개의 architecture를 연동하여 사용
형식
Architecture <architecture_name> of <entity_name> is
{ architecture_declarative part}
Begin
{statements}
end <architecture_name>;
Architecture : 선언문
Architecture 내부에서 사용
신호(signal), 변수(variable), 상수(constant), 자료형(data type)
파일 연동을 위한 component 작업 구간
Architecture와 begin 사이에서 선언
내부 신호
모드 : inout(별도로 지정 안함)
Architecture
Architecture 선언의 예
architecture and2_a of and2 is
begin
c <= a and b;
end and2_a;
병행문과 process문
각 문장이 다른 문장과 병렬로 수행
하드웨어 내부동작 또는 구조를 나타내는데 사용
기술 순서와 상관없이 동시 수행
병행문의 종류
Block
Component instantiation
Concurrent assertion
Concurrent procedure call
Concurrent signal assignment
Generate
Process
Process문
일반적은 병행 처리문
하나 혹은 다수의 process문을 통해 설계
각 process 마다 감지신호 리스트에 의해 병렬로 동작
순차문과 병행문
순차문(Sequential statement)
문장이 하나씩 차례로 수행
프로세스문 내부
동작적 기술
Ex) 조건문 : if (조건) then
Case문 : case (수식) is when (값)
반복 제어문 : for loop
병행문(Concurrent Statement)
문장이 동시에 수행
프로세스문 자체는 병행문
여러 개의 프로세스문이 동시에 실행
자료흐름적 기술을 위해 병행신호 할당문 이용
구조적 기술을 위해 컴포넌트 사례화문을 이용
Ex) process문 : process()
조건적 병행 처리문 : when (조건) else
선택적 병행 처리문 : with (수식) select
Architecture의 모델링 방법
동작적 모델링(Behavioral modeling)
가장 추상적인 표현 방법
수학적 연산자들이 그대로 사용
입력에 따른 출력 결과만을 고려한 기술
회로의 기능적 표현을 알고리즘적으로 기술
자료 흐름적 모델링(Dataflow modeling)
부울 대수식, RTL 혹은 연산자를 사용해서 입출력 관계를 나타냄
병행 처리문에서 주로 사용
문장 순서에 상관없이 동시 수행
구조적 모델링(Structural modeling)
하드웨어 시스템에 가장 가까운 표현
Component의 연결 및 게이트 레벨의 상호 연결을 표현
Architecture - Behavioral Modeling
Concurrent Modeling
VHDL 에서는 다른 프로그래밍 언어와 달리 명령문 실행순서가
병렬적이다
Concurrent Modeling 의 예
architecture con_model_a of con_model is
begin
-- 아래의 두 명령은 동시에 수행된다 .
c <= a and b;
d <= a or b;
end con_model_a;
Architecture - Behavioral Modeling
Sequential Modeling
내부명령문의 실행순서가 순차적이다.
Sequential Modeling 의 예
architecture seq_model_a of seq_model is
begin
--아래의 명령문은 조건을 검사하면서 순차적으로 수행
process(clk,rstb)
begin
if (rstb=‘0’) then
b<=‘0’;
elsif (clk’event and clk=‘1’) then
b <= a;
end if;
end process;
end seq_model_a;
Architecture - Behavioral Modeling
일반적인 Design 에서는 Behavioral Modeling 기법을 사용
Concurrent/Sequential Modeling 기법을 사용한 예
architecture behave_model_a of behave_model
begin
process (clk,rstb)
begin
if (rstb=‘0’) then
c <= ‘0’;
d <= ‘0’;
elsif (clk’event and clk=‘1’) then
c <= a;
d <= b;
end if;
end process;
end behave_model_a;
Architecture
Process Declaration
Architecture 내부에 사용
Process 선언의 기본 형태
process(sensitivity_list)
--process declaration
begin
--description statements
end process;
VHDL Modeling(AND)
(a) 논리기호
entity AND_GATE is
port(
A,B : in std_logic;
Y : out std_logic);
end AND_GATE;
architecture HB of AND_GATE is
begin
Y <= A and B;
end HB;
A
B
Y
0
0
0
0
1
0
1
0
0
1
1
1
(b) 진리표
Y = AB
(c) 논리식
Behavioral modeling(AND)
library ieee;
use ieee.std_logic_1164.all;
entity AND_GATE is
port(
A,B : in std_logic;
Y : out std_logic);
end AND_GATE;
architecture HB of AND_GATE is
begin
process(A,B)
begin
if A = ‘1’ and B = ‘1’ then
Y <= ‘1’;
else
Y <= ‘0’;
end if;
end process;
end HB;
Process문을 통한 독립적인
동작 수행
If문을 통한 AND 게이트 동작
정의
Dataflow modeling(AND)
library ieee;
use ieee.std_logic_1164.all;
entity AND_GATE is
port(
A,B : in std_logic;
Y : out std_logic);
end AND_GATE;
architecture HB of AND_GATE is
begin
Y <= A and B;
end HB;
AND 게이트의 연산자를 이용한
설계
하드웨어적인 설계 기법
VHDL Modeling(OR)
entity OR_GATE is
port(
A,B : in std_logic;
Y : out std_logic);
end OR_GATE;
architecture HB of OR_GATE is
begin
Y <= A or B;
end HB;
(a) 논리기호
A
B
Y
0
0
0
0
1
1
1
0
1
1
1
1
(b) 진리표
Y = A+B
(c) 논리식
Behavioral modeling(OR)
library ieee;
use ieee.std_logic_1164.all;
entity OR_GATE is
port(
A,B : in std_logic;
Y : out std_logic);
end OR_GATE;
architecture HB of OR_GATE is
begin
process(A,B)
begin
if A = ‘0’ and B = ‘0’ then
Y <= ‘0’;
else
Y <= ‘1’;
end if;
end process;
end HB;
Process문을 통한 독립적인
동작 수행
If문을 통한 OR 게이트 동작
정의
Dataflow modeling(OR)
library ieee;
use ieee.std_logic_1164.all;
entity OR_GATE is
port(
A,B : in std_logic;
Y : out std_logic);
end OR_GATE;
architecture HB of OR_GATE is
begin
Y <= A or B;
end HB;
OR 게이트의 연산자를 이
용한 설계
하드웨어적인 설계 기법
VHDL Modeling(AND_OR)
(a) 논리기호
entity AND_OR is
port(
A,B,C : in std_logic;
Y : out std_logic);
end AND_OR;
architecture HB of AND_OR is
begin
Y <= (A and B) or C;
end HB;
A
0
0
0
0
1
1
1
1
B
0
0
1
1
0
0
1
1
C
0
1
0
1
0
1
0
1
(b) 진리표
Y = AB+B
(c) 논리식
Y
0
1
0
1
0
1
1
1
Behavioral modeling(AND_OR)
library ieee;
use ieee.std_logic_1164.all;
entity AND_OR is
port(
A,B,C : in std_logic;
Y : out std_logic);
end AND_OR;
architecture HB of AND_OR is
begin
process(A,B,C)
begin
if C = ‘1’ or (A = ‘1’ and B = ‘1’ then
Y <= ‘1’;
else
Y <= ‘0’;
end if;
end process;
end HB;
Process문을 통한 독립적인
동작 수행
If문을 통한 AND_OR 게이트
동작 정의
Dataflow modeling(AND_OR)
library ieee;
use ieee.std_logic_1164.all;
entity AND_OR is
port(
A,B,C : in std_logic;
Y : out std_logic);
end AND_OR;
architecture HB of AND_OR is
begin
Y <= (A and B) or C;
end HB;
AND 및 OR 게이트의 연산자를
이용한 설계
하드웨어적인 설계 기법
Structural modeling(AND_OR)
library ieee;
use ieee.std_logic_1164.all;
entity AND_OR is
port(A,B,C : in std_logic;
Y : out std_logic);
end AND_OR;
architecture HB of AND_OR is
signal temp : std_logic;
component AND_GATE
port(A,B : in std_logic;
Y : out std_loigc);
end component;
component OR_GATE
port(A,B : in std_logic;
Y : out std_logic);
end component;
begin
ANDG : AND_GATE
port map(A,B,temp);
ORG : OR_GATE
port map(temp, C,Y);
end HB;
사전에 설계한 하위 파일을
이용한 설계 기법
AND_GATE 및 OR_GATE
를 Component문으로 연동
Package
Package1
VHDL을 지원하는 호스트 환경의 저장 장소
패키지 선언
외부에서 필요로 하는 자료형과 서브 프로그램 선언
패키지 몸체
패키지 선언에서 선언한 서브프로그램의 몸체 부분을 정의
패키지 형식
패키지 선언
package 패키지_이름 is
[선언문]
end 패키지_이름;
패키지 몸체
package body 패키지_이름 is
[문장]
end 패키지_이름;
Package2
패키지 선언문
자료형 선언(data type declaration)
부자료형 선언(subtype declaration)
상수 선언(constant declaration)
신호 선언(signal declaration)
서브 프로그램 선언(subprogram declaration)
속성 선언 및 명세(attribute declaration and specification)
컴포넌트 선언(component declaration)
단절 명세(disconnection specification)
사용구(use clause)
파일 선언(file declaration)
별명 선언(alias declaration)
패키지 몸체
자료형 선언(data type declaration)
부자료형 선언(subtype declaration)
상수 선언(constant declaration)
서브 프로그램 선언 및 몸체(subprogram declaration and body)
사용구(use clause)
파일 선언(file declaration)
별명 선언(alias declaration)
Package 사용 예
library ieee;
use ieee.std_logic_1164.all;
package over is
type int_unsi is record
int : integer range 0 to 10;
unsi : unsigned(4 downto 0);
end record;
function “+”(A,B : int_unsi) return int_unsi;
end over;
package body over is
function “+” (A,B : int_unsi) return int_unsi is
variable Y : int_unsi;
begin
Y.int := A.int + B.int;
Y.unsi := A.unsi + B.unsi;
return Y;
end “+”;
end over;
Object
객체(Object)
값을 가지는 모든 것
자료형(data type)를 갖고 있음
종류
신호(signal)
변수(variable)
상수(constant)
객체(Object)-signal
각 심블에 연결되어 사용하는 외적 변수(전역변수)
대입 기호 : 실행중 대입 ‘<=‘, 초기값 정의 ‘:=‘
선언 방법
• signal sig : std_logic
- sig를 bit 형태인 std_logic으로 선언
• signal count1 : std_logic_vector(3 downto 0); -- 내림차순
- count1을 4 bit 내림차순으로 선언
• signal count2 : std_logic_vector(0 to 3); -- 올림차순
- count2를 4 bit 올림차순으로 선언
• signal temp : std_logic_vector(3 downto 0) := “0101”;
- temp를 4 bit로 선언하고 초기값 “0101”을 대입
객체(Object)-variable
Process문 내에서만 사용되는 내적 변수(지역 변수)
대입 기호 : ‘:=‘
변수의 값이 선언된 지점에서 바로 대입
사용 예
• variable temp1, temp2 : std_logic;
- variable 이름을 temp1, temp2로 하고 bit 단위로 선언
• temp1 := ‘1’;
- :=는’1’이라는 값이 temp1에 대입됨을 표시
• temp2 := a or b;
- a,b는 signal이고 temp2는 variable이다
객체(Object)-signal & variable 사용예
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity LATCH_MULT is
port(
EN1, EN2, EN3
: in std_logic;
A1, A2, A3
: in std_logic;
B2, B3
: in std_logic;
C2, C3
: in std_logic;
Y1, Y2, Y3
: out std_logic);
end LATCH_MULT;
architecture HB of LATCH_MULT is
signal M2 : std_logic; -- signal declaration
begin
process(EN1, EN2, EN3, A1, A2, A3, B2, B3, C2, C3)
variable M3 : std_logic; -- variable declaration
begin
-- signal assignment
if EN1 = '1' then
Y1 <= A1;
end if;
-- two latch
if EN2 = '1' then
M2 <= A2 nand B2;
Y2 <= M2 nor C2;
end if;
-- variable assignment
if EN3 = '1' then
M3 := A3 nand B3;
Y3 <= M3 nor C3;
end if;
end process;
end HB;
객체(Object)-constant
초기 선언한 상수의 값 유지(고정 값)
대입 기호 : ‘:=‘
Constant 선언 방식
Constant 상수 이름 : 자료형[:=초기값]; -- 상수 선언과 값을 초기화
Constant의 활용
Constant delay : time := 5ns;
Constant 선언
Constant size : integer
Constant 선언, 초기화
객체 비교
객체형
사용 조건
signal
variable
constant
신호의 선언
변수의 선언
상수의 선언
변경 가능
변경 가능
변경 불가능
변경 시점
signal 파형의 인가
process문 내부에서
는 process문이 끝난
시점에서 값이 변화
process문 내부에서
만 값이 유효, 내부 연
산 후 그 값은 무효
변경 불가능
선언 장소
architecture
package
entity
process
function
procedure
architecture
package
entity
process
function
Procedure
변경
자료형(type)
객체의 선언 형태
자료형의 종류
스칼라 형(scalar type)
정수형(integer type)
실수형(real type)
열거형(enumeration)
물리형(physical type)
복합형(composite type)
참조형(access type)
파일형(file type)
정수형(integer type)
산술 연산 및 합성이 가능함
범위를 지정하지 않을 경우 32 bit
정수형의 사용 예
type byte is range -128 to 127;
type bit_position is range 14 downto 0;
type integer is range -2147483647 to 2147483647; -- integer 값의 범위 정의
실수형(real & floating point type)
합성이 불가능
시스템 모델링 & 아날로그 모델링
범위
-1.0E38 ~ +1.0E38
실수형의 사용 예
type byte is range -1.0E38 to 1.0E38; -- real은 미리 정의된 값임
type norm is range 0.0 to 1.0;
열거형(Enumeration type)
괄호안에 식별어 및 문자 리터럴을 가짐
열거형의 사용 예
-- 열거형의 정의
type BIT1 is (‘0’, ‘1’);
type BIT2 is (‘0’, ‘1’, ‘Z’);
type BIT3 is (‘0’, ‘1’, ‘X’, ‘Z’);
type Day is (sun, mon, tue, wed, thu, fri, sat);
type Color is (red, blue, yellow);
-- 사용 예
signal A : BIT3;
signal B : Day;
signal C : Color;
A <= ‘Z’;
B <= wed;
C <= yellow;
물리형(Physical type)
저항, 시간, 거리 등의 물리적인 양을
나타냄
기준 단위를 가지며 2차 단위는 기준
단위의 정수배로 표현
물리형의 사용 예
-- 저항 단위 선언
type Resistance is range 1 to 1E10
units
ohm; -- 기준 단위
Kohm = 1000 ohm; -- 2차 단위
Mohm = 1000 Kohm;
end units;
type Time is range implementation_defined
units
fs;
-- femto second, 기준 단위
ps = 1000 fs; -- pico second
ns = 1000 ps; -- nano second
us = 1000 ns; -- micro second
ms = 1000 us; -- milli second
sec = 1000 ms; -- second
min = 60 sec; -- minute
ht = 60 min; -- hour
end units;
Type Length is range 0 to 1E10
units
A; -- angstrrom, 기준 단위
nm = 10 A; -- nano meter
um = 1000 nm; -- micro meter
mm = 1000 um; -- milli meter
cm = 10 mm; -- centimeter
m = 100 cm; -- meter
end units;
복합형(Composite type)
자료형으로 배열형(array type)과 레코드형(record type)
배열형(array type)
제한적 배열형
type word is array (15 downto 0) of bit; -- 내림 차순의 배열
type byte is array (7 downto 0) of bit;
type mem is array (0 to 1023) of byte; -- 올림 차순의 배열
Type mem is array (0 to 1023, 7 downto 0) of bit;
무제한적 배열형
type bit_vector is array (natural range <>) of std_logic;
type string is array (positive range <>) of std_logic;
레코드형(record type)
Type inst_r is record
-- 형의 선언
nemonic : string;
-- 필드(field)의 선언
code : std_logic_vector(0 to 3);
End record;
-- 레코드 구문의 끝
Attribute & Operator
속성(record type)
자료형에 대한 동작이나 상태 표현을 위한 특성 정의
• 형식
자료형_이름 속성 이름
• 정의된 속성
값(value) 속성 : 상수값을 ruturn 한다.
함수(function) 속성 : 값을 return하는 function을 호출한다.
신호(signal) 속성 : 새로운 신호를 생성한다.
자료형(type) 속성 : 자료형 이름을 return 한다.
범위(range) 속성 : 범위를 되돌린다.
• 속성의 사용 예
type index is integer range 0 to 30;
type state 1 (one, two, three, four);
subtype short_state is states range two to four;
signal byte : std_logic_vector(7 downto 0);
signal clk : std_logic;
연산자(operator)
논리 연산자
관계 연산자
산술 연산자
순환 연산자
연결 연산자
부호 연산자
논리 연산자
논리 조합을 만드는데 사용
Bit, boolean, bit_vector
논리 연산자
And, or, nor, nane, xor, xnor…
사용 예
architecture HB of LOGIC_OPER is
signal Z, X, Y : bit_vector(3 downto 0);
signal A, B, C, D : std_logic;
signal E, F, G, H : boolean;
begin
Z <= X and Y;
-- W,X,Y는 같은 수의 bit_vector 형
D <= (A and B) and C; -- A,B,C,D는 같은 std_logic 형
E <= (F nand G) xor H; -- E,F,G는 같은 boolean 형
end HB;
관계 연산자1
비교함수를 만들 때 사용
자료형의 대부분을 지원
종류
객체형
=
/=
<
<=
>
>=
의미
같음
같지 않음
왼쪽의 값이 작음
왼쪽의 값이 작거나 같음
왼쪽의 값이 큼
왼쪽의 값이 크거나 같음
관계 연산자2
사용 예
variable NUM1 : real := 100.0;
variable NUM2 : std_logic_vector(7 downto 0) := (‘0’,’0’,’0’,’0’,’0’,’0’);
variable NUM3, NUM4 : std_logic_vector(2 downto 0);
NUM1 /= 350.54; -- NUM1과 350.54는 같지 않음
NUM1 = 100.0; -- NUM1과 100.0은 같음
NUM2 /= (‘1’,’0’,’0’,’0’,’0’,’0’); -- NUM2는 오른쪽과 같지 않음
NUM1 > 45.54; -- NUM1은 45.54보다 큼
NUM2 < (‘1’,’0’,’0’,’0’,’0’,’0’); -- NUM2는 오른쪽보다 작음
산술 연산자1
정수 & 실수 등의 숫자형을 지원
다른 자료형의 경우 ‘numeric_std’ 패키지 이용
종류
연산자
+
*
/
Mod
Rem
Abs
**
의미
덧셈(addition)
뺄셈(subtraction)
곱셈(multiplication)
나눗셈(division)
모듈(module)
나머지(remainder)
절대값(absolute value)
제곱(exponentiation)
산술 연산자2
사용 예
architecture HB of ARITH_OPER is
begin
process(A,B)
begin
Y1 <= A + B; -- A 더하기 B
Y2 <= A – B; -- A 빼기 B
Y3 <= A * B; -- A 곱하기 B
Y4 <= A mod B; -- A를 B로 나눈 모듈
Y5 <= A rem B; -- A를 B로 나눈 나머지
Y6 <= abs A; -- A의 절대값
end process;
end HB;
순환 연산자1
1차원적인 bit의 배열이나 부울형
종류
연산자
의미
Sll(shift left logical)
논리에 대한 왼쪽 방향으로 순환
srl(shift right logical)
논리에 대한 오른쪽 방향으로 순환
sla(shift left arithmetics)
산술에 대한 왼쪽 방향으로 순환
sra(shift right arithmetics)
산술에 대한 오른쪽 방향으로 순환
rol(roate left)
논리에 대한 왼쪽 방향으로 순환이동
ror(rotate right)
논리에 대한 오르쪽 방향으로 순환이동
순환 연산자2
사용 예
Variable SR : std_logic_vector(3 downto 0) := (‘1’,’0’,’1’,’1’);
SR sll 1; -- SR을 1만큼 sll하면 (‘0’,’1’,’1’,‘0’)
SR sll 3; -- SR을 3만큼 sll하면 (‘1’,’0’,’0’,’0’)
SR sll -3; -- SR을 -3만큼 sll하면 srl을 3만큼 한것과 같음
SR srl 1; -- SR을 1만큼 srl하면 (‘0’,’1’,’0’,’1’)
SR srl 3; -- SR을 3만큼 srl하면 (‘0’,’0’,’0’,’1’)
SR sla 1; -- SR을 1만큼 sla하면 (‘0’,’1’,’1’,’1’)
SR sla 3; -- SR을 3만큼 sla하면 (‘1’,’1’,’1’,’1’)
SR sla -3; -- SR을 -3만큼 sla하면 sra을 3만큼 한것과 같음
SR sra 1; -- SR을 1만큼 sra하면 (‘1’,’1’,’0’,’1’)
SR sra 3; -- SR을 3만큼 sra하면 (‘1’,’1’,’1’,’1’)
SR rol 1; -- SR을 1만큼 rol하면 (‘0’,’1’,’1’,’1’)
SR rol 3; -- SR을 3만큼 rol하면 (‘1’,’1’,’0’,’1’)
SR rol -3; -- SR을 -3만큼 rol하면 ror을 3만큼 한것과 같음
SR ror 1;
SR ror 3;
-- SR을 1만큼 ror하면 (‘1’,’1’,’0’,’1’)
-- SR을 3만큼 ror하면 (‘0’,’1’,’1’,’1’)
연결 연산자
‘&’의 기호 사용
새로운 형태의 1차원 배열을 만드는 데 편리
사용 예
library ieee;
use ieee.std_logic_1164.all;
entity CON_OPER is
port(
A, B : in std_logic_vector(2 downto 0);
Y : out std_logic_vector(14 downto 0));
end CON_OPER;
architecture HB of CON_OPER is
constant C : std_logic_vector(2 downto 0) := “111”;
begin
process(A,B)
begin
Y <= A&B&C&C&”110”;
end process;
end HB;
부호 연산자
단일 요소 연산자
오른쪽에만 숫자형의 피연사자를 가짐
종류
객체형
+
-
의미
양수(positive) 또는 동일(identity)
음수(negative) 또는 부정(negation)
사용 예
architecture HB of SIGN_OPER is
begin
process(A,B)
begin
Y <= +A/(-B);
Y <= (-A) + (-B);
Y <= A * (-B);
end process;
end HB;
연산자의 우선순위
연산자
논리연산자
관계 연산자
연결 연산자
종류
and logical AND
or logical OR
nand logical NAND
nor logical NOR
xor logical exclusive OR
= equal
/= Not equal
< Less than or equal
<= Less than or equal
> Greater than or equal
>= Greater than or equal
& Concatenation
산술 연산자
+ Addition
부호 연산자
+ Unary Plus
우선순위
6
5
4
-Subtraction
- Unary minus
3
* Multiplication
산술 연산자
/ Division
Mod Modulation
2
Rem Remember
** Exponentiation
기타 연산자
Abs Absolute value
Not Complement
1
Behavioral representation
동작적 표션
알고리즘 레벨로 시스템 표현
process문
순차문
대기문
신호할당문
단언문
case, exit, if, loop, next, null
procedure call
Process statement1
Process간 병행적, 내부는 순차적 수행
감지신호(Sensitivity list)에 의해 동작
용도
동작적 모델링
사용 예
entity AND_2 is
port( A,B : in bit;
Y : out bit);
end AND_2;
architecture Sample of AND_2 is
begin
process(A, B)
begin
Y <= A and B after 5ns;
end process;
end Sample;
Process statement2
Process문에서 허용되는 선언
서브 프로그램 선언 및 몸체(subprogram declaration and body)
자료형 선언(data type declaration)
부자료형 선언(subtype declaration)
상수 선언(constant declaration)
변수 선언(variable declaration)
파일 선언(file declaration)
별명 선언(alias declaration)
속성 선언 및 명세(attribute declaration specification)
사용구(use clause)
Sequential Statement
문장이 하나씩 차례로 수행
종류
대기문(Wait statement)
신호 할당문(Signal assignment statement)
단언문(Assertion statement)
case, exit, if, loop next, null문 등
프로시져 호출(Procedure call)
대기문(Wait Statement)
동작을 중지시키기 위해 사용
Process문 내부나 procedure몸체 내에 기술
형태
Label : wait (on (signal_name {, signal_name}))
[until boolean_expression]
[for time_expression]
예제
wait on A,B,C;
wait until A=B;
wait for 10ns;
wait on CLK until RESET = ‘0’;
wait on CLK for 50ns;
wait until A > 500 for 10ms;
신호 할당문(Signal Assignment Statement)
시뮬레이션 초기에 현재 값에 할당
형식
신호_이름 <= [전달지연][관성지연]
[값 after 지연시간]
값;
사용 예
Clock <= ‘0’, ‘1’ after 1ns, ‘0’ after 2ns, ‘1’ after 3ns, ‘0’ after 4ns;
세 가지 시간 지연 모델
델타 지연(delta delay) : 시간 지연이 주어지지 않는 지연
예) a <= ‘2’;
관성 지연(inertial delay) : 디폴트 지연(default delay), 주어진 시간 지연 보다
적은 입력 지연 폭은 무시
예) a <= ‘1’ after 5ns; 또는 a <= inertial ‘1’ after ‘5’ ns;
전달 지연(transport delay) : 선 지연(wire delay)과 같이 그대로 전달
예) a <= transport ‘1’ after 5ns;
변수 할당문
형식
변수_이름 := 값;
사용 예
process(En)
variable dex : boolean := false;
variable val1, val2 : bit;
begin
…
val1 := En;
val2 := val1;
…
end process;
IF 문(IF Statement)
If문의 조건에 따라 하위 내용
수행
Process문 내에서만 사용
형식
-- 첫 번째 형식
if 조건 then
순차문;
end if;
-- 두 번째 형식
if 조건 then
순차문1;
else
순차문2;
end if;
-- 세 번째 형식
if 조건1 then
순차문1;
elsif 조건2 then
순차문2;
…
else
순차문n;
end if;
IF문 사용예
if SIGNAL1 = ‘1’ then
-- SIGNAL1의 조건 식
SUM <= “1100101”;
-- 조건이 true일 때 SUM에 “1100101”을 대입
end if;
if SUM <= 60 then
-- SUM이 60 이하일 때 SIGN에 F값 입력
SIGN <= F;
elsif SUM > 60 and SUM <= 70 then -- SUM이 60에서 70사이일 때 SIGN에 D값 입력
SIGN <= D;
elsif SUM > 70 and SUM <= 80 then -- SUM이 70에서 80사이일 때 SIGN에 C값 입력
SIGN <= C;
elsif SUM > 80 and SUM <= 90 then -- SUM이 80에서 90사이일 때 SIGN에 B값 입력
SIGN <= B;
else
-- 나머지 90이상일 때 SIGN에 A값 입력
SIGN <= A;
end if;
if SIGNAL1 = ‘1’ then
-- SIGNAL1의 값이 ‘1’일 때 하위 수행
if SIGNAL2 = ‘0’ then
-- SIGNAL1, SIGNAL2의 값이 동시에 만족할 때 수행
SUM <= 0;
else
SUM <= 1;
end if;
else
-- SIGNAL1의 값이 ‘0’일 때 하위 수행
if SIGNAL2 = ‘1’ then -- SIGNAL1, SIGNAL2의 값이 동시에 만족할 때 수행
SUM <= 2;
else
SUM <= 3;
end if;
end if;
case 문(case statement)
수식값에 따라 문장을 선택하여
수행
수식 값 형태
Integer, 자료형
정의 되지 않은 구간에 대한 정리
Others
형식
case 수식 is
when 값1 =>
순차문1;
when 값21 | 값 22 =>
순차문2;
when 값 23 to 값30 =>
순차문 3;
…
when 값n =>
순차문n;
when others =>
문장;
end case;
case문 사용 예
library ieee;
use ieee.std_logic_1164.all;
entity MUX_4 is
port(
DATA : in std_logic_vector(3 downto 0);
SEL
: in std_logic_vector(1 downto 0);
Y
: out std_logic);
end MUX_4;
architecture HB of MUX_4 is
begin
process(DATA, SEL)
begin
case SEL is
-- 수식으로 SEL 선택
when "00" =>
Y <= DATA(0); -- SEL이 ‘00’일 때 DATA의 첫번째 bit를 Y에 대입
when "01" =>
Y <= DATA(1); -- SEL이 ‘01’일 때 DATA의 두번째 bit를 Y에 대입
when "10" =>
Y <= DATA(2); -- SEL이 ‘10’일 때 DATA의 세번째 bit를 Y에 대입
when others =>
Y <= DATA(3); -- SEL이 ‘11’일 때 DATA의 네번째 bit를 Y에 대입
end case;
end process;
end HB;
반복 제어문(loop, for, while)
조건이 만족할 때까지 반복 수행
loop, for-loop, while-loop
형식
[레이블:] loop
-- 조건이 없으므로 끝까지 수행
[순차문]
end loop [레이블];
[레이블:] for 루프_변수 in 변수범위 loop -- 변수_범위까지 끝까지 수행
[순차문]
end loop [레이블];
[레이블 :] while 조건 loop
-- 조건이 참인 동안에 수행
[순차문]
end loop [레이블];
반복 제어문 사용 예
-- for-loop 문
for I in 0 to 4 loop
S := x_in(I) and S;
Y(I) <= S;
end loop;
-- for-loop문
type WEEK is (MON, TUE, WED, THU, FRI, SAT, SUN);
…
for DAY in WEEK loop
…
end loop;
-- while-loop문
I := ‘0’;
S := ‘1’;
while I < 4 loop
S := x_in(I) and S;
Y(I) <= S;
I := I + 1;
end loop
-- 단순 loop문
I := ‘0’;
S := ‘1’;
loop
S := x_in(I) and S;
Y(I) <= S;
I := I + 1;
exit when > 3;
end loop;
기타 제어문(exit)
무한 반복문에서 빠져나가게 하는 구문
형식
exit 루프_레이블 [when 조건]
사용 예
Loop1 : loop
a := a + 1;
b := b + 1;
if a > 10 then exit loop1;
end loop loop1;
Loop1 : loop
a := a + 1;
b := b + a;
exit loop1 when a > 10;
end loop loop1;
기타 제어문(next)
Next문 뒤는 실행하지 않고 빠져나감
형식
next [루프_레이블] [when 조건]
사용 예
loop1 : for I in 1 to 10 loop
loop2 : for J in 1 to 10 loop
if J = 5 then next loop1;
end if;
A := A + 1;
end loop loop2;
end loop loop1;
or
loop1 : for I in 1 to 10 loop
loop2 : for J in 1 to 10 loop
next loop1 when J = 5;
A := A + 1;
end loop loop2;
end loop loop1;
Null문
수행 없이 다음 문장으로 넘김
case문에서 사용할 조건이 없을 때 사용
사용 예
case SEL is
when “00” =>
Y <= DATA(0);
when “01” =>
Y <= DATA(1);
when “10” =>
Y <= DATA(2);
when “11” =>
Y <= DATA(3);
when others =>
null;
end case;
Return문
함수 및 프로시져에 존재
부 프로그램 수행 후 원래 문장으로 돌아감
형식
Return [리턴값];
Concurrent Signal
Assignment Statement
자료 흐름적 표현(dataflow representation)
자료의 흐름을 나타내듯이 시스템 기능을 표현
표현
부울 대수식, RTL 혹은 연산자 사용
병행 처리문에서 사용
동시 수행
병행문(concurrent signal assignment statement)
프로세서의 지정어가 없는 간결한 구조
Process문 내부를 제외한 모든 영역
종류
조건적 병행 처리문
조건식에 따라 수행여부를 판단하는 when-else문
선택적 병행 처리문
수식값에 따라 수행여부를 판단하는 with-select문
조건적 병행 신호할당문
여러 조건에 따라 하나의 signal에 다름 값을 할당
형식
신호_이름 <= [transport] [guarded]
파형1 when 조건1 else -- 조건1이 성립하면 파형1을 신호에 대입
파형2 when 조건2 else -- 조건1가 성립하면 파형2를 신호에 대입
…
파형n-1 when 조건n-1 else
파형n;
사용 예
library ieee;
use ieee.std_logic_1164.all;
entity COND_SIG is
port(
A,B,C,D : in std_logic;
Y
: out std_logic);
end COND_SIG;
architecture HB of COND_SIG is
begin
Y <= '0' when D = '0' else
'0' when C = '1' else
'0' when A = '1' and B = '1' else
'1';
end HB;
선택적 병행 신호할당문
형식
With 수식 select
신호_이름 <= [guarded][transport]
파형1 when 선택1,
…
파형n when others;
사용 예
architecture Selected_example of Decoder is
begin
with sel_vector select
dout <= "0001" when "00",
"0010" when "01",
"0100 when "10",
"1000 when others;
end Selected_example;
병행 단언문(Concurrent assertion statement)
병행 수행 환경에서 사용되는 단언문
순차적 단언문과 유사
다른 점:레이블이 있고, process문 내에서 사용불가
형식
[레이블:] assert 조건 [report 수식][severity 수식];
사용 예
entiry RS_FF is
port( S, R : in bit;
Q : out bit);
begin
constraint_check;
assert not (S = ‘1’ and R = ‘1’) report “Both S and R are ‘1’” severity error;
end RS_FF;
architecture detaflow or RS_FF is
begin
…
end dataflow;
Component Statement
구조적 표현(Structural representation)
하드웨어의 가장 가까운 표현
설계 회로를 component등을 통해 상호간 연결
종류
컴포넌트문(Component Statement)
구성 명세(Configuration Specification)
구성 선언(Configuration Declaration)
생성문(Generate Statement)
컴포넌트문(Component Statement)
사전에 설계한 엔티티를 통해 구조적으로 표현
컴포넌트 선언
형식
component 식별어
[generic (범용어_이름);]
[port (포트_이름);]
end component;
사용 예
component AND_2
port(A, B : in bit;
Y : out bit);
end component;
컴포넌트 사례화(Component instantiation Statement)
컴포넌트 사례화 문의 형식
레이블 : 컴포넌트_이름 [generic map(결합_리스트)][port map(결합_리스트);]
사용 예
package Component_set is
component AND_2
port(A, B : in bit; Y : out bit);
end component;
component OR_2
port(A, B : in bit; Y : out bit);
end component;
end component_set;
use Work.component_set;
architecture Structural of AND_OR is
signal temp : bit;
-- component instantition statements
begin
ANDG : AND_2 port map(A, B, temp);
ORG : OR_2 port map(temp, C, Y);
end Structural;
구성 명세(Configuration Specification)
컴포넌트 각각이 라이브러리 내의 엔티티와 아키텍쳐 지정
구성 명세의 형식
For 사례화 리스트 : 컴포넌트_이름
[use entity[라이브러리_이름] 엔티티_이름(아키텍쳐_이름)]
[generic(결합_리스트)]
[port map(결합_리스트)];
레이블 종류에 따른 예제
for all : MUX use entiry WORK.CIRC1(CIRC_BEH)
for C1, C2, C3 : INV user entitiy work.inverter(inverter_body)
for others : ALU use configuration COMLIB.MYCONF;
구성 명세 사용 예
미리 구현된 예제
-- enriry and architecture of a 2-input AND gate
enriry AND_2 is
port( A, B : in bit;
Y : out bit);
end entity;
architecture behavioral of AND_2 is
begin
…
end behavioral;
-- entity and architecture of a 2-input OR gate
entity OR_2 is
port(A,B : in bit;
Y : out bit);
end OR_2;
architecture behavioral of OR_2 is
begin
…
end behavioral;
구성 명세를 이용한 예제
-- enriry and architecture of AND_OR circuit
enriry AND_OR is
port( A, B, C : in bit;
Y : out bit);
end entity;
architecture structural of AND_OR is
signal temp : bit;
-- component declarations
component AND_2
port( A, B : in bit; Y : out bit);
end component;
component OR_2
port(A, B : in bit; Y : out bit);
end component;
--configuration specification
for ANDG : AND_2 use entity work.AND_2(behavioral)
port map(A, B, Y);
for others : OR_2 use entity work.OR_2(Behavioral)
port map(A, B, Y);
--component instantiation statements
begin
ANDG : AND_2 port map(A, B, temp);
ORG : OR_2 port map(temp, C, Y);
end structural;
구성 선언(Configuration Declaration)
Entity & Architecture간의 결합을 표현
사용 예
library WORK.STD_COMP;
configuration System_conf of system is use WORK.all;
for Structural_View
-- architecture Structural_View of entity System
for CPU : PROCESSOR use entity STD_COMP.SPARCII(SV_496)
generic map(clock => 30 ns);
end for;
for BUS : BUS_CONTROLLER use configuration WORK.Conf_comp1;
end for;
for all : COMM_PART use configuration WORK.Conf_comm;
end for;
end for;
end System_Conf;
생성문(Generate Statement)
규칙적인 구조를 가지는 하드웨어를 반복 생성
형식
레이블 : 생성_계획 generate
{ 병행문 }
end generate [레이블];
생성문을 이용한 D-플리플롭 레지스터 설계
생성문을 이용한 예
일반적인 코드
entity shifter8 is
port(si, cp : in bit;
so : out bit);
end Shifter8;
architecture Not_gen_exam of Shifter8 is
signal p : Bit_vector(0 to 8);
component dff port (D, CL : in bit; Q : out bit);
end component;
begin
df0 : dff port map(si, cp, p(0));
df1 : dff port map(p(0), cp, p(1));
df2 : dff port map(p(1), cp, p(2));
df3 : dff port map(p(2), cp, p(3));
df4 : dff port map(p(3), cp, p(4));
df5 : dff port map(p(4), cp, p(5));
df6 : dff port map(p(5), cp, p(6));
df7 : dff port map(p(7), cp, so);
end Not_gen_exam;
Generate Statement의 사용
entity shifter8 is
port(si, cp : in bit;
so : out bit);
end Shifter8;
architecture Not_gen_exam of Shifter8 is
signal p : Bit_vector(0 to 8);
component dff port (D, CL : in bit; Q : out bit);
end component;
begin
p(0) <= si;
gl : for i in 0 to 7 generate
dfx : dff port map(p(i), cp, p(i+1));
end generate g1;
so <= p(8);
end Not_gen_exam;
The Others
분해 함수(Resolution Function)
한 신호에 대한 여러 개의
신호를 하나의 값으로 계산
하나 이상의 소스를 가지는
신호
사용 예
architecture Sample_des of resolution_exam is
function wired_and (input : bit_vector) return bit;
signal Resolved_signal : wired_and bit;
signal src1, src2 : bit;
begin
source1 : process
begin
resolved_signal <= src1;
wait on src1;
end process;
source2 : process
begin
resolved_signal <= src2;
wait on src2;
end process;
end Sample_des;
function wired_and (input : bit_vector) return bit is
begin
for i in input'range loop
if input(i) = '0' then return '0';
end if;
end loop;
return '1';
end Wired_and;
중복 기능(Overloading)
한 이름에 대한 중복기능 제공
리터럴, 연산자, 함수, 프로시져
사용 예
-- ‘0’과 ‘1’에 중복 기능 부여
type bit is (‘0’, ‘1’);
type Three_value_logic is (‘0’, ‘1’, ‘X’);
-- 함수 및 연산자에 중복 기능 부여
function max(A, B : bit) return bit;
function max(A, B : three_level_logic) return three_level_logic;
function “and” (A, B : bit) return bit;
function “and” (A, B : bit_vector) return bit_vector;
블록문 & 감시신호
형식
레이블 : block [{감시_조건}]
{블록_선언_항목}
begin
{병행문}
end block 레이블;
사용 예
architecture ex1 of AND is
begin
b1 : block(Enable = '1')
begin
S1 <= guarded
'1' when A = '1' and B = '1' else '0';
end block b1;
end ex1;
entity two_consecutive is
port(clk, R, X : in bit; z : out bit);
end
architecture ex2 of two_consecutive is
begin
b2 : block((clk = '1' and not clk'stable) or r = '0')
begin
y1 <= guarded '0' when r = '0' else x;
y0 <= guarded '0' when r = '0' else '1';
end block b2;
z = y0 and ((not y1 and not x) or (y1 and x));
end ex2;