Microsoft PowerPoint - VHDL01_chapter1.ppt [호환 모드]

Similar documents
歯Chap1-Chap2.PDF

MAX+plus II Getting Started - 무작정따라하기

Microsoft PowerPoint - VHDL06.ppt [호환 모드]

C# Programming Guide - Types

디지털공학 5판 7-8장

1

Microsoft Word - 제6장 Beyond Simple Logic Gate.doc

제5장 PLD의 이해와 실습

Microsoft PowerPoint - VHDL12_full.ppt [호환 모드]

Microsoft Word - logic2005.doc

Microsoft PowerPoint - VHDL08.ppt [호환 모드]

비트와바이트 비트와바이트 비트 (Bit) : 2진수값하나 (0 또는 1) 를저장할수있는최소메모리공간 1비트 2비트 3비트... n비트 2^1 = 2개 2^2 = 4개 2^3 = 8개... 2^n 개 1 바이트는 8 비트 2 2

ºÎ·ÏB

Microsoft PowerPoint - [2009] 02.pptx

Microsoft PowerPoint - VHDL02_full.ppt [호환 모드]

public key private key Encryption Algorithm Decryption Algorithm 1

PowerPoint 프레젠테이션

Microsoft PowerPoint - ch07 - 포인터 pm0415

歯02-BooleanFunction.PDF

Microsoft PowerPoint - Chapter_04.pptx

Microsoft PowerPoint - hw8.ppt [호환 모드]

OCW_C언어 기초

Microsoft PowerPoint - 27.pptx

HW5 Exercise 1 (60pts) M interpreter with a simple type system M. M. M.., M (simple type system). M, M. M., M.

<4D F736F F F696E74202D C31345FB0EDB1DE20BFB5BBF320C8B8B7CE20BCB3B0E82E BC8A3C8AF20B8F0B5E55D>

슬라이드 1

Microsoft PowerPoint - 3ÀÏ°_º¯¼ö¿Í »ó¼ö.ppt

< E20C6DFBFFEBEEE20C0DBBCBAC0BB20C0A7C7D12043BEF0BEEE20492E707074>

Microsoft PowerPoint - VHDL03.ppt [호환 모드]

. 고성능마이크로프로세서 LU 와레지스터 파일의구조 (2.). 직접디지털주파수합성기 (FS) 의구조 3. 고성능마이크로프로세서부동소수점연산기 (Floating-Point Unit) 구조 (2) (2.) (2.) 2. 암호화를위한 VLSI 구조와설계의개요 (2.) 다음참

SIGPLwinterschool2012

Microsoft PowerPoint - CH6.ppt [호환 모드]

DIY 챗봇 - LangCon

컴파일러

Microsoft PowerPoint - chap04-연산자.pptx

10주차.key

T100MD+

Microsoft PowerPoint - hw4.ppt [호환 모드]

thesis

4. #include <stdio.h> #include <stdlib.h> int main() { functiona(); } void functiona() { printf("hihi\n"); } warning: conflicting types for functiona

Libero Overview and Design Flow

<4D F736F F F696E74202D C61645FB3EDB8AEC7D5BCBA20B9D720C5F8BBE7BFEBB9FD2E BC8A3C8AF20B8F0B5E55D>

歯15-ROMPLD.PDF

슬라이드 1

<C6F7C6AEB6F5B1B3C0E72E687770>

Microsoft PowerPoint - lec2.ppt

UML

Microsoft PowerPoint - PL_03-04.pptx

PowerPoint 프레젠테이션

Microsoft Word - Experiment 5.docx

Slide 1

PRO1_14E [읽기 전용]

Microsoft PowerPoint - chap03-변수와데이터형.pptx

Microsoft Word - FunctionCall

C++-¿Ïº®Çؼ³10Àå

Microsoft PowerPoint - chap02-C프로그램시작하기.pptx

Observational Determinism for Concurrent Program Security

디지털 ASIC 설계 (1주차) MAXPLUS II 소개 및 사용법

Microsoft PowerPoint - CHAP-03 [호환 모드]

강의10

PowerPoint Presentation

hwp

[ 마이크로프로세서 1] 2 주차 3 차시. 포인터와구조체 2 주차 3 차시포인터와구조체 학습목표 1. C 언어에서가장어려운포인터와구조체를설명할수있다. 2. Call By Value 와 Call By Reference 를구분할수있다. 학습내용 1 : 함수 (Functi

No Slide Title

USER GUIDE

Microsoft PowerPoint - C프로그래밍-chap03.ppt [호환 모드]

Microsoft PowerPoint - chap-03.pptx

03-JAVA Syntax(2).PDF

Microsoft PowerPoint 자바-기본문법(Ch2).pptx

4 CD Construct Special Model VI 2 nd Order Model VI 2 Note: Hands-on 1, 2 RC 1 RLC mass-spring-damper 2 2 ζ ω n (rad/sec) 2 ( ζ < 1), 1 (ζ = 1), ( ) 1

12-file.key

Microsoft PowerPoint - Chapter_02.pptx

11장 포인터

쉽게

untitled

예제 1.1 ( 관계연산자 ) >> A=1:9, B=9-A A = B = >> tf = A>4 % 4 보다큰 A 의원소들을찾을경우 tf = >> tf = (A==B) % A

step 1-1

chap 5: Trees

<C0CCBCBCBFB52DC1A4B4EBBFF82DBCAEBBE7B3EDB9AE2D D382E687770>

PowerPoint Template

2007_2_project4

PCServerMgmt7

SRC PLUS 제어기 MANUAL

슬라이드 1

Microsoft PowerPoint - 2주차-1차시 (강의자료) ch01 - C Programming 기초 (part 2)

歯처리.PDF

Microsoft PowerPoint - ICCAD_Analog_lec01.ppt [호환 모드]

chap10.PDF

Microsoft PowerPoint - chap12-고급기능.pptx

Secure Programming Lecture1 : Introduction

3 Gas Champion : MBB : IBM BCS PO : 2 BBc : : /45

PowerPoint 프레젠테이션

Week5

Orcad Capture 9.x

Modern Javascript

chap x: G입력

,,,,,, (41) ( e f f e c t ), ( c u r r e n t ) ( p o t e n t i a l difference),, ( r e s i s t a n c e ) 2,,,,,,,, (41), (42) (42) ( 41) (Ohm s law),

PowerPoint Presentation

Transcription:

VHDL 프로그래밍 1. 문법기초 - 간단한조합회로및문법 학습목표 VHDL 기술과소프트웨어와차이파악 Signal assignment 의의미파악 Architecture body 의개념파악 Entity declaration 의개념파악 Process 문의사용법 Variable 과 signal 의차이파악 Library, Use, Package 의사용법 2/53

간단한논리회로예제 A B t1 X B C C A t2 t3 Y Boolean 수식 X = AB + BC, Y = BC + CA t2=bc, X = AB + t2, Y = t2 + CA 3/53 Boolean VHDL t2=bc, X = AB + t2, Y = t2 + CA t2 <= B and C; Boolean/logic op X <= (A and B) or t2; 문장끝 ; Y <= t2 or (C and A); Assignment op. variable? ibl? signal (time, value) 4/53

Wire?InVHDL Signal ( 시간에따라다른값을가짐 ) Y <= t2 or (C and A); X <= (A and B) or t2; t2 <= B and C; To use signals? Define Before Use!! Where? Within Architecture body!! 5/5353 Architecture Body architecture netlist of first is signal t2 : std_logic; begin Y <= t2 or (C and A); X <= (A and B) or t2; t2 <= B and C; end netlist; 6/53

소프트웨어와다른점? 각문장이병렬로수행됨 따라서, 문장순서가중요하지않음. Concurrent Signal Assignment 문 아래두개의 H/W 기술은같은동작 t2 <= B and C; X <= (A and B) or t2; X <= (A and B) or t2; t2 <= B and C; Y <= t2 or (C and A); Y <= t2 or (C and A); 7/53 신호할당문은언제수행되나? RHS 의한신호에값의변화가있을때 (Event 가생겼을때 ) X<= (A and B) or t2; A B t2 X 8/53

Entity 선언? A B B C C A t1 t2 t3 X Y Entity first is Port (A, B, C : in std_logic; inout X, Y : out std_logic); buffer End first; std_logic?? 9/53 std_logic 전선 /node/wire를모델링하는 type 가질수있는값? 0 -- Forcing 0 1 -- Forcing 1 Z -- High Impedance - -- Don t care U -- Uninitialized X -- Forcing Unknown W -- Weak Unknown L -- Weak 0 H -- Weak 1 IEEE 의 std_logic_1164 package 에정의된 type (std_logic, std_logic_vector ) 10/53

std_logic 을사용하려면? library IEEE ; use IEEE.std_logic_1164.all; Library : 여러가지패키지포함 Use : library 의특정패키지사용 11/53 Libraries i and Packages Standard Library: IEEE, STD IEEE library std_logic_1164 std_logic, std_logic_vector std_logic_arith, std_logic_unsigned, std_logic_signed, std_logic_textio STD library : 기본적으로포함됨. library WORK, STD; use STD.STANDARD.all; STANDARD 12/53

Arch. Body, Entity decl. 외에? Design unit Primary unit Package declaration package body Secondary unit Entity declaration Architecture body Configuration declaration 13/53 Another way to describe Y <= t2 or (C and A); X <= (A and B) or t2; t2 <= B and C; process (A,B,C) variable ibl t2 : std_logic; dl begin Sequential exec. t2 := BandC; X <= (A and B) or t2; Sensitivity i i list Y <= t2 or (C and A); RHS signals end process; In Sig. Assignment. 14/53

Architecture t body (updated) d) architecture netlist of first is begin process (A,B,C), variable t2 : std_logic; begin t2 := B and C; X <= (A and B) or t2; Y <= t2 or (C and A); end process; end netlist; 15/5353 Y<= outside of process architecture netlist of first is begin process (A,B,C) variable t2 : std_logic; begin t2 := B and C; X <= (A and B) or t2; end process; Y <= (B and C) or (C and A); end netlist; No Problem? 16/53

To share AND gate? architecture netlist of first is Signal t2 : std_logic; begin t2 <= B and C; process (A, B, t2) begin X <= (A and B) or t2; end process; Y <= t2 or (C and A); end netlist; 17/53 The order of statements t t architecture netlist of first is begin process (A,B,C) variable t2 : std_logic; begin t2 := B and C; Y <= t2 or (C and A); X <= (A and B) or t2; end process; end netlist; 18/53

ALU (1/2) library IEEE; use IEEE.std_logic_1164.all; _ use IEEE.std_logic_arith.all; use IEEE.std_logic_unsigned.all; entity alu is port ( A, B, M : IN std_logic_vector(2 downto 0); Y : out std_logic_vector(2 downto 0); CO : out std_logic ); end alu; 19/53 ALU (2/2) architecture t behav of alu is signal temp : std_logic_vector(3 downto 0); begin y <= temp(2 downto 0); CO <= temp(3); process (A, B, M) begin temp <= (others => '0'); case M is when "000" => temp(2 downto 0) <= not A; when "001" => temp(2 downto 0) <= A xor B; when "010" => temp(2 downto 0) <= A or B; when "011" => temp(2 downto 0) <= A and B; when "100" => temp <= ('0' & A) + B; when "101" => temp <= ( A(2) & A) + (not (B(2) & B)) + 1; when "110" => temp <= ('0' & A) + 1; when others => temp(2 downto 0) <= A; end case; end process; end behav; 20/53

문법기초 주석, 식별자, Literal 상수 Object class( 객체의종류 ) variable, signal, constant, file Object Data type Scalar, composite, file, access Operators (arithmetic ti & logical) l) Design units & Libraries 21/53 Comments in VHDL -- 로시작, 행의끝까지 -- this is a comment Entity test is... End test; -- the beginning of architecture... 22/53

Identifiers in VHDL Identifier ( 식별자 ) 변수, 신호, 상수, name 등. Letter 로시작 << VHDL 은대소문자구별이없음!! >> 다음에 letter, digit, _ 가옴. _ (underscore) 는연속해올수없음! 23/53 Literals in VHDL 정수형 literal 21, 0, 1E2, 123_000 실수형 literal 11.0, 0.436, 3.141_592_6, 2.0E+4 문자형 literal 1, A, % 24/53

Literals in VHDL ( 계속 ) Base 를포함한숫자형 literal 2#1111_1100#, 1100# 16#FC#, 016#0FC#, 7#510# ( 모두 252 의미 ) 스트링 literal ad# sd 비트스트링 literal Prefix: B, O, X (Binary, Octal, Hexa) X F_FF, FF O 7777, B 1111_1111_1111 25/5353 Objects in VHDL Object: 사용자가정의해서사용하는객체들 Object class( 객체의종류 ): 사용방식 variables, signals, constants, files Object type( 객체의 type): 데이터유형 Scalar, composite, file, access 26/53

Object data types VHDL object types scalar type access type File type composite type enumeration Integer real Physical array record 27/53 Object class (constant) 변경불가 Entity, architecture, process, package 내에서선언가능 예 : Constant vcc: real := 4.5; Constant t five : bit_vector t := 1010 ; 28/53

Object class (variable) 변경가능 ( 즉시변경됨 signal 과차이 ) Process, subprogram(proc., func.) 내에서만선언가능 예 : variable index : integer range 1 to 60; variable R : std_ logic _ vector(7 downto 0); 할당연산자 (variable assignment operator) R := 10101111 ; index := 27; 29/53 Object class (signal) Entity, architecture내에서선언, process 내에서는선언불가. Entity decl. 의 port 들은모두 signal 임. 선언예 : Signal count : integer range 1 to 31; Signal ground : bit := 0 ; 할당연산자 : 신호 (time, value) pair 로표현 Ground <= 0 ; 0; count <= 23 after 20 ns; 30/53

Object class (file) VHDL-87 에서 (IEEE std 1076-1987) File <id> : <name> is [in out] <logical_name>; File infile : TEXT is in sample.dat ; VHDL-93 (IEEE std 1076-1993) 1993) File <id> : <file_type_name> [open file_open_mode] is <logical_name> File infile : text open read_mode is sample.dat File infile :text; file_open(infile, sample.dat, read_mode); file_close(infile) l 31/53 Object data type (scalar type) Enumeration type : ordered list Std_ulogic, std_logic, bit 등 Type bit is ( 0, 1 ); type state is (s0, s1, s2); Integer type Real type Physical type : 시간등단위가있는수 Type time is range -. To +.; Units fs; -- femto second ps = 1000 fs; ns = 1000 ps;... End units 32/53

Object data type (composite) Array type : 주의!!: 첨자표시 (, ) Type string is array (positive range <> ) of character; Type mem is array(0 to 1023, 7 downto 0) of bit; Record type Type instruction is record Op_field : OPR; OPD1 : integer range 0 to 127; OPD2 : integer range 0 to 127; End record; Variable cmd : instruction;... cmd.opd1 := 2; cmd.opr := ADD; 33/53 선언 Object data type (file type) type <file_type_name> >is file of f<t <type_name>; type vec_file is file of std_logic_vector(15 downto 0); 사용 file filea : vec_file is in test.dat ; 34/53

Object data type (access) C 에서 pointer type 과같음. 정의는되어있으나거의사용되지않음 35/5353 Subtype 이미정의된 type(base type) 에어떤조건을추가해새이름의 type 정의. 예 : Subtype eightval is integer range 0 to 7; Signal b : subtype; Subtype 사용하지않고도 range 제한가능. Signal b : integer range 0 to 7; 36/53

산술및논리연산자 Logical operator Relational operator Adding operator Sign Multiplying operator 기타 operator 37/53 연산자우선순위 구분 종류 우선순위 논리연산자 and, or, nand, nor, xor 6 관계연산자 =, /=, <, >, >=, <= 5 덧셈연산자 +, -, & 4 부호 +, - 3 곱셈연산자 *,/,mod,rem 2 기타연산자 **, abs, not 1 38/53

논리연산자사용예 잘못된논리연산자사용예 올바른논리연산자사용예 A <= x and y or z A <= x nor y nor z; A <= (x and y) or z ; B <= (x nor y) nor z; C <= x and y and z; 39/53 Concatenation 연산자사용예 signal sig6 : std_logic_vector(5 downto 0); signal sig4 : std_logic_vector(3 downto 0) ; signal sig3 : std_logic_vector(2 downto 0); signal sig2 : std_logic_vector(1 t downto 0); signal S1 : std_logic_vector(3 downto 0); signal S2 : std_logic_vector(4 t downto 0); sig3 <= sig2 & 1 ; sig6 <= 00 &sig4; sig8 <= sig2 & sig6; S1 <= 00 & 10 ; S2 <= 0 & S1; 40/53

Remainder Operator Integer division and remainder are defined by the following relation: A = (A/B)*B + (A rem B) where (A rem B) has the sign of A and an absolute value less than the absolute value aueof B. 41/53 Modulus Operator The result of the modulus operation is such that (A mod B) has the sign of B and absolute value less than the absolute value of B; in addition, for some integer value N, this result must satisfy the relation: A = B*N + (A mod B) 42/53

/, rem, mod 연산자의사용예 A B A/B A rem B A mod B 11 4 2 3 3 11-4 -2 3-1 -11 4-2 -3 1-11 -4 2-3 -3 43/53 Work Library WORK library? 현재읽히는 VHDL 코드의분석결과가 default로저장되는위치. 라이브러리 : 논리적이름, 물리적이름 물리적이름 :HDD 의디렉토리 (folder) 이름 논리적이름 : VHDL 소스내에서의 lib. 이름 둘간대응시키는일 simulator의환경설정에서할일 44/53

VHDL analysis VHDL analyzer WORK LIB2 VHDL sources simulation results (waveform or text) VHDL simulator IEEE STD library Simulation commands 45/5353 표준자료형과표준패키지 중요표준패키지 std.textio, std.standard ieee.std_logic_1164, std_logic_unsigned, std_logic_arith 46/53

Std.standard 패키지 Boolean, character, integer, real, time, string, bit, bit_vector : type Natural, positive : subtype 47/53 Std.textiotextio 패키지 Plain text file 입출력위한데이터타입, 함수선언 Type: TEXT(file of character), LINE(access string) ti Input( STD_INPUT file), output( STD_OUTPUT file) : file object READ, WRITE, READ_LINE, WRITE_LINE 등입출력 function 48/53

IEEE.std_logic_1164 package Std_logic, std_ulogic Std_logic_vector, std_ulogic_vector and, nand, or, nor, xor, xnor, not (logical operator ) Type conversion functions To_bit(std_(u)logic td ( i bit) To_bitvector, to_stdulogic(bit std_ulogic) To_stdLogicVector(bitvector std_logic_ve ctor Falling_edge, rising_edge : 함수 49/53 Std_logic_1164, std_logic_arith std_logic_1164 std_logic std_logic_vector unsigned signed std_logic_arith type UNSIGNED is array (NATURAL range <>) of STD_LOGIC; type SIGNED is array (NATURAL range <>) of STD_LOGIC; 50/5353

Std_logic_unsigned/signed 산술 / 관계연산자 ( 내부적으로 unsigned/signed type으로해석해서계산하는 ) overloaded 둘중하나만사용해야혼돈이없음. 예 : function "+"(L: std_logic_vector; R: std_logic_vector) return STD_LOGIC_VECTOR; function "+"(L: STD_LOGIC_VECTOR; R: INTEGER) return STD_LOGIC_VECTOR; function "+"(L: INTEGER; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR; function "+"(L: STD_LOGIC_VECTOR; R: STD_LOGIC) return STD_LOGIC_VECTOR; function "+"(L:"(L STD_LOGIC; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR; 51/5353 Std_logic_unsigned/signed 필요성? 내부계산을 signed 로하고싶을때 Library ieee; Use ieee.std_logic_1164.all; Use ieee.std_logic_arith.all; Use ieee.std_logic_signed.all; signed 52/5353

Std_logic_arith Integer, unsigned, signed, std_logic_vector간 conversion 함수제공 예 :(size: 결과의비트수 ) function CONV_INTEGER(ARG: INTEGER) return INTEGER; function CONV_INTEGER(ARG: SIGNED) return INTEGER; function CONV_UNSIGNED(ARG: INTEGER; SIZE: INTEGER) return UNSIGNED; function CONV_UNSIGNED(ARG: SIGNED; SIZE: INTEGER) return UNSIGNED; function CONV_SIGNED(ARG: INTEGER; SIZE: INTEGER) return SIGNED; 53/53