Top Banner
디디디 디디디 디디 (2)
33

디지털 시스템 설계 (2)

Jan 05, 2016

Download

Documents

nairi

디지털 시스템 설계 (2). VHDL 의 Data Type. 숫자형 (Scaler Type) 열거형 (Enumeration Type) 정수형 (Integer Type) 실수형 (Floating Point Type) 물리형 (Physical type) 혼합형 (Composite Type) 배열형 (Array Type) 제한형 (Constraint Type) 무제한형 (Unconstraint Type) 뭉침형 (Record Type) 연결형 (Access Type) -- 사용 않함 - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 디지털 시스템 설계 (2)

디지털 시스템 설계 (2)

Page 2: 디지털 시스템 설계 (2)

VHDL 의 Data Type

숫자형 (Scaler Type) 열거형 (Enumeration Type) 정수형 (Integer Type) 실수형 (Floating Point Type) 물리형 (Physical type)

혼합형 (Composite Type) 배열형 (Array Type)

제한형 (Constraint Type) 무제한형 (Unconstraint Type)

뭉침형 (Record Type) 연결형 (Access Type) -- 사용 않함 File Type -- 사용않함

Page 3: 디지털 시스템 설계 (2)

VHDL 의 Data Type(Scalar Type)

정수형 (Integer Type) - 231 -1 ~ 231 -1 까지의 모든 정수 정의 가능

실수형 (Floating Point Type) -1E38 ~ 1E38

Page 4: 디지털 시스템 설계 (2)

VHDL 의 Data Type(Scalar Type)

물리형 (Physical Type) 시간 , 거리 , 전류 등의 물리적인 단위 기본적인 단위를 가지고 그것을 중심으로 다른 단위를

나타냄

Page 5: 디지털 시스템 설계 (2)

VHDL 의 Data Type(Scalar Type)

Floating Point Type

열거형 (Enumeration Type) 문자열을 하나의 데이터로 묶어 선언한 것으로 , BOOLE

AN, BIT 등이 여기에 속함

Page 6: 디지털 시스템 설계 (2)

VHDL 의 Data Type(Composite Type)

Array Type bit_vector, std_ulogic_vector 가 이 종류라 할 수

있으며 같은 종류의 데이터를 하나로 엮은 형 다차원 배열도 가능 무제한형 (Unconstraint Type)

이미 선언된 Type 을 또 하나의 변형된 새로운 Type으로 다시 만든 것

제한형 (Constraint Type) 이미 선언된 Type 을 정해진 범위에서 열거 일종의 Bus Type 으로 만든 것

Page 7: 디지털 시스템 설계 (2)

VHDL 의 Data Type(Composite Type)

type array_name is array(range_name range <> ) of type_name; range_name

Integer, Natural, Positive

type array_name is array(integer range <> ) of type_name;

type std_ulogic_vector is array(NATURAL ranve <>) of std_ulogic; -- 무제한형type byte is array(7 downto 0) of bit; -- 제한형

Page 8: 디지털 시스템 설계 (2)

VHDL 의 Data Type(Composite Type)

다차원 배열 Multi Dimensional Array

type memory1 is array(0 to 4, 3 downto 0) of bit constant ROM1 : memory1 := ((‘0’,’0’,’0’,’0’), (‘0’,’0’,’0’,’1’),

(‘0’,’0’,’1’,’0’), (‘0’,’0’,’1’,’1’), (‘0’,’1’,’0’,’0’));

Array of Array type word is array (3 downto 0) of BIT; type memory2 is array(0 to 4) of wordtype memory1 is array(0 to 4, 3 downto 0) of bit constant ROM2 : memory2 := ((“0000”),

(“0001”), (“0010”),

(“0011”), (“0100”));

Page 9: 디지털 시스템 설계 (2)

VHDL 의 Data Type(Composite Type)

뭉침형 (Record Type) 배열이 같은 종류의 숫자형을 묶어서 사용과 반면 다른

종류의 숫자형이나 배열형 (field) 을 묶어 사용 단 , 각 field 에 배열형을 사용 할 때는 제한형 만이 가능

Type command is (add, sub, mul, …)Type instruction is record OPCODE : COMMAND; SRC : BIT_VECTOR(7 downto 0); PC : INTEGER; end record;

Case OP_CND is when ADD INST.opcode := OP_CMD;

INST.src := X”F1”; INST.pc := 2;

when SUB INST.opcode := OP_CMD; INST.src := B”1111_0011”; INST.pc := 2;

Page 10: 디지털 시스템 설계 (2)

VHDL 의 Data Type(Composite Type)

File type 외부와의 입출력이나 특정 File 의 변수를 선언 VHDL Package 의 TEXTIO 부분에 선언 회로에 대한 검증단계에서 많이 사용됨 type TEXT is file of STRING

Page 11: 디지털 시스템 설계 (2)

VHDL 의 Operator

Operator Priority

Logical and, or, nand, nor, xor, xnor Low

High

Relational =, /=, <=, <, >, >=

Shift sll, srl, sla, sra, rol, ror

ADD +, -, &

Sign +, -

Multiplier *, /, mod, rem

Etc **, abs, not

Page 12: 디지털 시스템 설계 (2)

VHDL 의 Operator

Logical Operator 피연산자의 type 은 BIT 또는 boolean

Page 13: 디지털 시스템 설계 (2)

VHDL 의 Operator

Relational Operator “=“, “/=“ 는 file type 을 제외한 모든 type 의

피연산자에 적용가능 숫자형 또는 1 차원 배열형 (Bus) 만이 가능 길이가 다른 두 수를 비교시 왼쪽부터 순차적으로 비교

“101011” 과 “ 1011” 비교시 ??? “110” 과 “ 11000” 비교시 ???

Page 14: 디지털 시스템 설계 (2)

VHDL 의 Operator

Shift 1 차원 배열형에서만 사용가능

SLL --- shift left logical SRL --- shift right logical SLA --- shift left arithmetic SRA --- shift right Arithmetic SOL --- rotate left logical SOR --- rotate right logical

A_Sig := “11110101” sll 2; B_Sig := “01011111” sll 2;C_Sig := “11110001” sll 2;

Page 15: 디지털 시스템 설계 (2)

VHDL 의 Operator

Add +, -

같은 numeric type(integer, floating point, physical type)이어야함

&(Concatenation) 피연산자는 1 차원 array 또는 array element 이어야

Page 16: 디지털 시스템 설계 (2)

VHDL 의 Operator

Sign numeric type 에서 사용 ‘-’ 는 단순 음수가 아닌 , MSB 를 sign 비트로 사용 A1 -B 는 B 의 2 의 보수를 입력

Page 17: 디지털 시스템 설계 (2)

VHDL 의 Operator

Multiplying poerator *, / 는 integer type, floating point type 의 피연산자에

대하여 정의 되며 두 피연산자의 type 은 같아야 함 다음과 같은 physical type 에서도 연산가능

rem, mod 의 피연산자는 integer type

Page 18: 디지털 시스템 설계 (2)

VHDL 의 Operator

Etc operator abs 피연산자는 nemeric type 이어야 함 ** 는 모든 integer type 과 floating poing type 에

대하여 정의 됨 ** 의 오른쪽 연산자는 Integer 만 가능

2.4 ** 3

Page 19: 디지털 시스템 설계 (2)

Data Flow Description

Concurrent Signal Assignment Statement 주어진 값 , 입력 signal, 또는 이에 대한연산의 결과

등을 delay 에 대한 정보와 함께 출력 signal 에 전달 각 concurrent signal assignment statement 는 하나의

독립된 concurrent process 로서 동작하며 sensitive signal 에 변화가 있을 때마다 반복 수행됨

Conditional signal assignment, selected signal assignment

Page 20: 디지털 시스템 설계 (2)

Data Flow Description

Conditional Signal Assignment

Page 21: 디지털 시스템 설계 (2)

Data Flow Description

Selected Signal Assignment

Page 22: 디지털 시스템 설계 (2)

Concurrent(Block)

Block 회로상의 내부 회로를 표현 회로설계시에 계층구조를 갖는데 , Top 회로는

Design Block 들을 서로 연결하는 성격을 띄게 되고 , 각 Design Block 은 그 안에 또 다른 Design Block 이나 회로를 갖는다 VHDL 에서 Top VHDL 파일에서 Design Block 으로 표시 할 수 있는 가장 쉬운방법

Netlist 형식이 아닌 일반 Compiler 언어와 같은 표현으로 전체회로의 동작을 표현 할 수 있다

Page 23: 디지털 시스템 설계 (2)

Concurrent(Block) Syntex

block_name : block ( 동작 제한식 )[generic (generic_list);][port (port_list);]

beginConcurrent 문

end block[Block_name]

Ex)B1: block(EMB = ‘0’)

signal S : bit;begin

S <= A and B;B2: block

signal S:bit;begin

S <= C or D;out1 <= S;

end block B2;

out2 <= S;end block B1;

Page 24: 디지털 시스템 설계 (2)

Behavioral Description

Sequential statement Behavioral description 은 실질적으로 사용되는 문장이 Sequential 문 Process 문 또는 Subprogram 문 에서만 사용가능 sequential

statement 로 구성 내부의 sequential statement 들을 순서대로 wait statement 를 만날

때까지 반복 수행함 Sensitivity list 가 있는 경우에는 그 list 에 포함되어 있는 signal 의 값이

변해야만 sequential statement 들이 반복 수행됨 Sensitivity list 도 없고 wait statement 도 없는 process statement

는 무한히 반복 수행되어 시뮬레이션이 끝날 수 없게 되므로 주의해야 함 명령어

wait, assertion, signal assignment, variable assignment, procedure call, if, case, loop, next, exit, return, null

Page 25: 디지털 시스템 설계 (2)

Behavioral Description

Page 26: 디지털 시스템 설계 (2)

Behavioral Description

Wait Process 문이나 , procedure 의 수행을 일시 정지시킴

Page 27: 디지털 시스템 설계 (2)

Behavioral Description

Signal entity 선언에서 port 로 선언된 것들 또는 그

밖에서 Signal 로 선언된 것에 신호를 전달 할 때 사용

out <= in;

Variable process 또는 subprogram 내에서 variable

로 선언된 임시변수에 값을 전달 temp := in;

Page 28: 디지털 시스템 설계 (2)

Behavioral Description

Signal & veriable

entity Test isport(in_data:in bit; out_sig:out bit);

end;

architecture Behave of Test isbeginprocess(in_data)

variable out_var :bit;begin

out_var := in_data;out_sig <= in_data;

end process;end

Page 29: 디지털 시스템 설계 (2)

Behavioral Description

IF

Page 30: 디지털 시스템 설계 (2)

Behavioral Description

Case

Page 31: 디지털 시스템 설계 (2)

Behavioral Description

Loop Loop, for, while loop 문을 사용할 때 exit, wait 등을 사용하여

loop 의 진행을 종료 하지 않도록 사용할 것

Logic Synthesis 가 되지 않음

Page 32: 디지털 시스템 설계 (2)

Behavioral Description

Next, Exit Loop 문 안에서 조건문을 이용하여 조건에 만족했을 때

loop 를 빠저나오는것이 exit, next 다음을 실행하지 않고 , loop 의 처음으로 돌아가는것을 의미

loop label 이 있는 exit, next 는 해당 loop 에 적용 loop label 이 없는 exit, next 는 각문장이 포함되어있는

loop 중 가장 내부의 loop

Page 33: 디지털 시스템 설계 (2)

Behavioral Description

Null 다음 실행문으로 수행순서를 넘겨주는것 외에는 아무

일도 하지 않음