8-비트 마이크로프로세서 설계 김영철 교수 전남대학교 전자공학과 yckim@chonnam.chonnam.ac.kr.

Slides:



Advertisements
Similar presentations
Quad 2-to-1 and Quad 4-to-1 Multiplexers Discussion D2.4 Example 7.
Advertisements

Arbitrary Waveform Discussion 5.5 Example 34.
1 VLSI DESIGN USING VHDL Part II A workshop by Dr. Junaid Ahmed Zubairi.
Ring Counter Discussion D5.3 Example 32. Ring Counter if rising_edge(CLK) then for i in 0 to 2 loop s(i)
Generic Multiplexers: Parameters Discussion D2.5 Example 8.
A Simple Microcontroller VHDL Tutorial R. E. Haskell and D. M. Hanna T6: VHDL State Machines.
Single-Cycle Instructions VHDL Tutorial R. E. Haskell and D. M. Hanna T5: VHDL ROM.
FPGAs and VHDL Lecture L12.1. FPGAs and VHDL Field Programmable Gate Arrays (FPGAs) VHDL –2 x 1 MUX –4 x 1 MUX –An Adder –Binary-to-BCD Converter –A Register.
Structural VHDL VHDL Tutorial R. E. Haskell and D. M. Hanna T3: ALU Design.
Counters Discussion D5.3 Example 33. Counters 3-Bit, Divide-by-8 Counter 3-Bit Behavioral Counter in Verilog Modulo-5 Counter An N-Bit Counter.
Kazi Fall 2006 EEGN 4941 EEGN-494 HDL Design Principles for VLSI/FPGAs Khurram Kazi Some of the slides were taken from K Gaj’s lecture slides from GMU’s.
Sequencing and Control Mano and Kime Sections 8-1 – 8-7.
7-Segment Displays VHDL Tutorial R. E. Haskell and D. M. Hanna T4: Xilinx LogiBLOX.
Registers Lab 5 Mano and Kime Sections 5-2, 5-3, 5-7.
4-bit Shift Register. 2-bit Register Serial-in-serial-out Shift Register.
ECE 545 Lecture 7 Behavioral Modeling of Sequential-Circuit Building Blocks Mixing Design Styles Modeling of Circuits with a Regular Structure.
1 Part V: VHDL CODING. 2 Design StructureData TypesOperators and AttributesConcurrent DesignSequential DesignSignals and VariablesState Machines A VHDL.
Data Flow Modeling of Combinational Logic Simple Testbenches
1 Combinational Logic Lecture #6. 모바일컴퓨터특강 2 강의순서 Decoder 3x8 Mux 4x1 Mux 8x1 Mux 8x1 4bits Half Adder Full Adder Ripple carry Adder 4-bit Adder.
LECTURE 8: VHDL PROCESSES
1 Part I: SYSTEM DESIGN. 2 Packages and Components Functions and Procedures Problem (Design & Implementation) Additional System Designs.
VHDL Introduction. V- VHSIC Very High Speed Integrated Circuit H- Hardware D- Description L- Language.
ELEC / Computer Architecture and Design Fall 2009 ELEC / Computer Architecture and Design Fall 2009 Modeling for Synthesis.
VHDL in 1h Martin Schöberl. AK: JVMHWVHDL2 VHDL /= C, Java,… Think in hardware All constructs run concurrent Different from software programming Forget.
A full die photograph of the MIPS R2000 RISC Microprocessor is shown above. The 1986 MIPS R2000 with five pipeline stages and 450,000 transistors was the.
1 ECE 545 – Introduction to VHDL ECE 545 Lecture 4 Behavioral & Structural Design Styles.
Main Project : Simple Processor Mini-Project : 3-bit binary counter (using 7400 series) Memory By Oluwayomi B. Adamo.
George Mason University ECE 545 – Introduction to VHDL Variables, Functions, Memory, File I/O ECE 545 Lecture 7.
Copyright(c) 1996 W. B. Ligon III1 Getting Started with VHDL VHDL code is composed of a number of entities Entities describe the interface of the component.
CPE 626 Advanced VLSI Design Lecture 6: VHDL Synthesis Aleksandar Milenkovic
Mixed Style RTL Modeling
2’s Complement 4-Bit Saturator Discussion D2.8 Lab 2.
8-bit Microprocessor Design
15-Dec-15EE5141 Chapter 4 Sequential Statements ä Variable assignment statement ä Signal assignment statement ä If statement ä Case statement ä Loop statement.
Copyright (c) 2003 by Valery Sklyarov and Iouliia Skliarova: DETUA, IEETA, Aveiro University, Portugal.
CS/EE 3700 : Fundamentals of Digital System Design
04/26/20031 ECE 551: Digital System Design & Synthesis Lecture Set : Introduction to VHDL 12.2: VHDL versus Verilog (Separate File)
기초 회로의 VHDL 설계 XOR SungKyunKwan Univ..
ACANEL VHDL 의 이해와 실습 2000 년 1 학기 Computer Architecture (classes links)
CEC 220 Digital Circuit Design VHDL in Sequential Logic Wednesday, March 25 CEC 220 Digital Circuit Design Slide 1 of 13.
George Mason University Behavioral Modeling of Sequential-Circuit Building Blocks ECE 545 Lecture 8.
Lecture 11 Xilinx FPGA Memories Part 2
Registers and Counters Discussion D8.1. Logic Design Fundamentals - 3 Registers Counters Shift Registers.
Sequential statements (1) process
Combinational logic circuit
Main Project : Simple Processor Mini-Project : Vending Machine Memory
Part III: SYSTEM DESIGN
Hardware Description Languages
CHAPTER 17 VHDL FOR SEQUENTIAL LOGIC
Part IV: VHDL CODING.
ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448 – FPGA and ASIC Design with VHDL.
Algorithmic State Machine (ASM) Charts: VHDL Code & Timing Diagrams
ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448 – FPGA and ASIC Design with VHDL.
CHAPTER 17 VHDL FOR SEQUENTIAL LOGIC
مدار های ترکیبی دیکدر لامپ های هفت قسمتی یکی از دیکدر هایی که اغلب به کار برده می شود،دیکدر 4 به 7 برای تبدیل کد bcd به کد هفت بیتی برای لامپ های seven.
VHDL (VHSIC Hardware Description Language)
ECE 545 Lecture 6 Behavioral Modeling of Sequential-Circuit Building Blocks Mixing Design Styles Modeling of Circuits with a Regular Structure.
A Greatest Common Divisor (GCD) Processor
CPE 528: Lecture #5 Department of Electrical and Computer Engineering University of Alabama in Huntsville.
Behavioral Modeling of Sequential-Circuit Building Blocks
Sequntial-Circuit Building Blocks
ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448 – FPGA and ASIC Design with VHDL.
Data Flow Description of Combinational-Circuit Building Blocks
Modeling of Circuits with a Regular Structure
Data Flow Description of Combinational-Circuit Building Blocks
Modeling of Circuits with Regular Structure
Sequntial-Circuit Building Blocks
디 지 털 시 스 템 설 계 UP2 Kit를 이용한 카운터 설계
Digital Logic with VHDL
(Sequential-Circuit Building Blocks)
Presentation transcript:

8-비트 마이크로프로세서 설계 김영철 교수 전남대학교 전자공학과 yckim@chonnam.chonnam.ac.kr

명령어 형식과 종류에 따른 의미 정의 명령어 형식 (Instruction Format) 명령어에 대한 Op-code, Mnemonic-code 및 의미

명령어 수행 Timing 정의와 각 Stage에 대한 의미 정의 명령어 수행에 대한 Timing Diagram 명령어 수행에 따른 Timing Stage의 종류와 의미

Instruction Fetch 수행을 위한 하드웨어 정의

Instruction Decoding 수행을 위한 하드웨어 정의

Instruction Execution 수행을 위한 하드웨어 정의

Instruction Execution 수행을 위한 ALU 기능 정의

Store into Memory 수행을 위한 하드웨어 정의

Write Back into Accumulator 수행을 위한 하드웨어 정의

RTL Component에 대한 분석 하드웨어 구성에 대한 분석

조합논리회로에 대한 VHDL 설계(1) 5-비트 2*1 MUX에 대한 VHDL 표현 library IEEE; use IEEE.std_logic_1164.all; entity MUX5 is port ( A,B : in std_logic_vector(4 downto 0); SEL : in std_logic; Y : out std_logic_vector(4 downto 0)); end MUX5; architecture RTL of MUX5 is begin process(A,B,SEL) if SEL=’1’ then Y <= A; elsif SEL=’0’ then Y <= B; else Y <= “-----“; end if; end process; end RTL; 8-비트 2*1 MUX에 대한 VHDL 표현 library IEEE; use IEEE.std_logic_1164.all; entity MUX8 is port ( A,B : in std_logic_vector(7 downto 0); SEL : in std_logic; Y : out std_logic_vector(7 downto 0)); end MUX8; architecture RTL of MUX8 is begin process(A,B,SEL) if SEL=’1’ then Y <= A; elsif SEL=’0’ then Y <= B; else Y <= “--------“; end if; end process; end RTL;

조합논리회로에 대한 VHDL 설계(2) 1증가 회로에 대한 VHDL 표현 ALU에 대한 VHDL 표현 library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_unsigned.all; entity INC is port ( PC_ADDR : in std_logic_vector(4 downto 0); INC_ADDR : out std_logic_vector(4 downto 0)); end INC; architecture RTL of INC is begin INC_ADDR <= PC_ADDR + 1; end RTL; ALU에 대한 VHDL 표현 entity ALU is port (OPCODE: in std_logic_vector(2 downto 0); OP1,OP2 : in std_logic_vector(7 downto 0); ZERO_FLAG : out std_logic; ALU_OUT : out std_logic_vector(7 downto 0)); end ALU; architecture RTL of ALU is begin process(OPCODE,OP1,OP2) variable TMP: std_logic_vector(7 downto 0); case OPCODE is when “010” => TMP := OP1 + OP2; when “011” => TMP := OP1 and OP2; when “100” => TMP := OP1 xor OP2; when “101” => TMP := OP2; when others => TMP := OP1; end case; if TMP = 0 then ZERO_FLAG <= ‘1’; else ZERO_FLAG <= ‘0’; end if; ALU_OUT <= TMP; end process; end RTL;

Memory에 대한 VHDL 설계(1) 검증용 Program Data

Memory에 대한 VHDL 설계(2) ROM에 대한 VHDL 표현 RAM에 대한 VHDL 표현 library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_unsigned.all; entity ROM is port ( ROM_ADDR : in std_logic_vector(4 downto 0); ROM_DATA : out std_logic_vector(7 downto 0)); end ROM; architecture RTL of ROM is subtype ROMWORD is std_logic_vector(7 downto 0); type ROMTABLE is array(0 to 31) of ROMWORD; constant ROM_TBL : ROMTABLE := ( “11100011”,”00000000”,중간 생략 ............................................); begin ROM_DATA <= ROM_TBL(conv_integer(ROM_ADDR)); end RTL; RAM에 대한 VHDL 표현 library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_unsigned.all; entity RAM is port (RAM_ADDR : in std_logic_vector(4 downto 0); RAM_IN : in std_logic_vector(7 downto 0); RAM_OUT : out std_logic_vector(7 downto 0); MEM_RD, MEM_WR : in std_logic); end RAM; architecture RAM_A of RAM is subtype WORD is std_logic_vector(7 downto 0); type RAM is array(0 to 31) of WORD; signal TMP: RAM := (….., "00000000","00000001", "00000001", "00000000", "10010000", "00000000", ”00000000", "00000000"); begin process (MEM_RD, RAM_ADDR, RAM_IN) begin if MEM_RD = '1' then RAM_OUT <= TMP(conv_integer(RAM_ADDR)); elsif MEM_WR = '1' then TMP(conv_integer(RAM_ADDR)) <= RAM_IN; end if; end process; end RAM_A;

순서 논리 회로에 대한 VHDL 설계(1) Flip-Flop과 Register의 Symbol 정의 1-Bit Flip-Flop에 대한 VHDL 표현 library IEEE; use IEEE.std_logic_1164.all; entity REG1 is port ( CLK,RST,D,EN : in std_logic; Q : out std_logic); end REG1; architecture RTL of REG1 is begin process(CLK,RST) if RST = '0' then Q <= '0'; elsif EN = '1' then if CLK = '0' and CLK'event then Q <= D; end if; end process; end RTL;

순서 논리 회로에 대한 VHDL 설계(2) 5-Bit Register에 대한 VHDL 표현 library IEEE; use IEEE.std_logic_1164.all; entity REG5 is port ( CLK,RST,EN : in std_logic; D : in std_logic_vector(4 downto 0); Q : out std_logic_vector(4 downto 0)); end REG1; architecture RTL of REG5 is begin process(CLK,RST) if RST = '0' then Q <= (others=>’0’); elsif EN = '1' then if CLK = '0' and CLK'event then Q <= D; end if; end process; end RTL; 8-Bit Register에 대한 VHDL 표현 library IEEE; use IEEE.std_logic_1164.all; entity REG8 is port ( CLK,RST,EN : in std_logic; D : in std_logic_vector(7 downto 0); Q : out std_logic_vector(7 downto 0)); end REG8; architecture RTL of REG8 is begin process(CLK,RST) if RST = '0' then Q <= (others=>’0’); elsif EN = '1' then if CLK = '0' and CLK'event then Q <= D; end if; end process; end RTL;

순서 논리 회로에 대한 VHDL 설계(3) 명령어 수행 Timing Stage를 구분하기 위한 One-Hot Code 신호 생성

One-Hot Code 생성을 위한 FSM 형태의 VHDL 설계 library IEEE; use IEEE.std_logic_1164.all; entity CLK_GEN is port( CLK,RST : in std_logic; CLK_HOT : out std_logic_vector(4 downto 0)); end CLK_GEN; architecture CLK_GEN_A of CLK_GEN is signal CURRENT_STATE,NEXT_STATE : std_logic_vector(4 downto 0); begin process(CLK,RST) if RST = '0' then CURRENT_STATE <= "00000"; elsif CLK = '0' and CLK'event then CURRENT_STATE <= NEXT_STATE; end if; end process; process(CURRENT_STATE) begin if CURRENT_STATE = "00000" then NEXT_STATE <= "00001"; elsif CURRENT_STATE = "00001" then NEXT_STATE <= "00010"; elsif CURRENT_STATE = "00010" then NEXT_STATE <= "00100"; elsif CURRENT_STATE = "00100" then NEXT_STATE <= "01000"; elsif CURRENT_STATE = "01000" then NEXT_STATE <= "10000"; elsif CURRENT_STATE = "10000" then else end if; end process; CLK_HOT <= CURRENT_STATE; end CLK_GEN_A;

명령어 수행 Stage에 따른 제어 신호에 대한 정의

명령어에 따른 제어 신호 생성 Timing의 정의 명령어와 제어 신호 발생 위치 정의

제어 신호 생성에 대한 VHDL 표현(1) architecture CONTROL_A of CONTROL is library IEEE; use IEEE.std_logic_1164.all; package CONTROL_P is constant S4 : std_logic_vector(4 downto 0) := "10000"; constant S3 : std_logic_vector(4 downto 0) := "01000"; constant S2 : std_logic_vector(4 downto 0) := "00100"; constant S1 : std_logic_vector(4 downto 0) := "00010"; constant S0 : std_logic_vector(4 downto 0) := "00001"; end CONTROL_P; -- use work.CONTROL_P.all; entity CONTROL is PORT( OP_D : in std_logic_vector(2 downto 0); CLK_HOT : in std_logic_vector(4 downto 0); ZERO_D : in std_logic; CLK_D : in std_logic; ACC_EN_D : out std_logic; ALU_REG_EN_D : out std_logic; MEM_RD_D : out std_logic; MEM_WR_D : out std_logic; PC_EN_D : out std_logic; IR_EN_D : out std_logic; MEM_REG_EN_D : out std_logic; ZERO_EN : out std_logic; MUX5_SEL : out std_logic; MUX8_SEL : out std_logic); end CONTROL; architecture CONTROL_A of CONTROL is signal ACC_EN_S,PC_EN_S : std_logic; signal IR_EN_S,ALU_REG_EN_S : std_logic; signal MEM_WR_S,MEM_REG_EN_S : std_logic; signal ZERO_EN_S : std_logic; signal MUX5_SEL_S,MUX8_SEL_S : std_logic; begin process(CLK_D) if CLK_D = '1' and CLK_D'event then ACC_EN_D <= ACC_EN_S; PC_EN_D <= PC_EN_S; IR_EN_D <= IR_EN_S; ALU_REG_EN_D <= ALU_REG_EN_S; MEM_WR_D <= MEM_WR_S; MEM_REG_EN_D <= MEM_REG_EN_S; ZERO_EN <= ZERO_EN_S; MUX5_SEL <= MUX5_SEL_S; MUX8_SEL <= MUX8_SEL_S; end if; end process;

제어 신호 생성에 대한 VHDL 표현(2) process(CLK_HOT,OP_D,ZERO_D) variable OP_D_COND : std_logic; begin if OP_D="010" or OP_D="011" OR OP_D="100" then OP_D_COND := '1'; else OP_D_COND := '0'; end if; case CLK_HOT is when S0 => ACC_EN_S <= '0'; PC_EN_S <= '0'; MEM_WR_S <= '0'; MEM_RD_D <= '0'; IR_EN_S <= '1'; MUX5_SEL_S <= '1'; MUX8_SEL_S <= '1'; MEM_REG_EN_S <= '0'; ALU_REG_EN_S <= '0'; ZERO_EN_S <= '0'; when S1 => ACC_EN_S <= '0'; PC_EN_S <= '0'; MEM_WR_S <= '0'; IR_EN_S <= '0'; MUX5_SEL_S <= '1'; if OP_D_COND = '1' or OP_D = "101" then MEM_REG_EN_S <= '1'; MEM_RD_D <= '1'; else MEM_REG_EN_S <= '0'; MEM_RD_D <= '0'; end if; MUX8_SEL_S <= '0'; MUX8_SEL_S <= '1'; ALU_REG_EN_S <= '0'; ZERO_EN_S <= '0';

제어 신호 생성에 대한 VHDL 표현(3) when S2 => if OP_D = "000" then PC_EN_S <= '0'; else PC_EN_S <= '1'; end if; ACC_EN_S <= '0'; MEM_WR_S <= '0'; IR_EN_S <= '0'; MUX5_SEL_S <= '1'; if OP_D_COND = '1' or OP_D = "101" then MEM_RD_D <= '1'; MEM_RD_D <= '0'; if OP_D_COND = '1' then ZERO_EN_S <= '1'; ZERO_EN_S <= '0'; MUX8_SEL_S <= '1'; MEM_REG_EN_S <= '0'; if (OP_D_COND = '1') or (OP_D = "101") or (OP_D = "110") then ALU_REG_EN_S <= '1'; ALU_REG_EN_S <= '0'; when S3 => if (OP_D = "001" and ZERO_D = '1') or OP_D = "111" then PC_EN_S <= '1'; else PC_EN_S <= '0'; end if; ACC_EN_S <= '0'; IR_EN_S <= '0'; if OP_D = "110" then MEM_WR_S <= '1'; MEM_WR_S <= '0'; end if; if OP_D = "111" then MUX5_SEL_S <= '0'; MUX5_SEL_S <= '1'; MUX8_SEL_S <= '1'; ALU_REG_EN_S <= '0'; if OP_D_COND = '1' or OP_D = "101" then MEM_REG_EN_S <= '1'; MEM_REG_EN_S <= '0'; ZERO_EN_S <= '0'; MEM_RD_D <= '0';

제어 신호 생성에 대한 VHDL 표현(4) when S4 => if OP_D_COND = '1' or OP_D = "101" then ACC_EN_S <= '1'; else ACC_EN_S <= '0'; end if; MEM_WR_S <= '0'; IR_EN_S <= '0'; MUX5_SEL_S <= '1'; MUX8_SEL_S <= '1'; ALU_REG_EN_S <= '0'; MEM_RD_D <= '0'; MEM_REG_EN_S <= '0'; PC_EN_S <= '0'; ZERO_EN_S <= '0'; when others => ACC_EN_S <= '0'; PC_EN_S <= '0'; MEM_WR_S <= '0'; MEM_RD_D <= '0'; IR_EN_S <= '1'; MUX5_SEL_S <= '1'; MUX8_SEL_S <= '1'; MEM_REG_EN_S <= '0'; ALU_REG_EN_S <= '0'; ZERO_EN_S <= '0'; end case; end process; end CONTROL_A;

마이크로프로세서에 대한 최상위 레벨에 대한 VHDL 표현 Entity에 대한 VHDL 표현 entity U_P is port ( RESET,CLOCK : in std_logic); end U_P; Architecture에 대한 VHDL 표현 architecture U_P_A of U_P is --component에 대한 선언 ........ --중간 기억 장소인 signal에 대한 선언 ......… --사용 Component의 Configuration 정의 begin U0: MUX5 port map (PC_ADDR, IR_ADDR, MUX5_SEL, MUX5_OUT); U1: MUX8 port map (ALU_OUT, RAM_OUT, MUX8_SEL, MEM_REG_IN); U2: INC port map (PC_REG_OUT, PC_ADDR); U3: REG1 port map (CLOCK, RESET, ZERO_IN, ZERO_EN, ZERO_OUT); U4: REG5 port map (CLOCK, RESET, PC_EN, MUX5_OUT, PC_REG_OUT); U5: REG8 port map (CLOCK, RESET, IR_EN, ROM_OUT, IR_OUT); U6: REG8 port map CLOCK,RESET,ACC_EN ,ACC_IN,ACC_OUT); U7: REG8 port map (CLOCK, RESET, ALU_REG_EN, ALU_IN, ALU_OUT); U8: REG8 port map (CLOCK, RESET, MEM_REG_EN, MEM_REG_IN, ACC_IN); U9: ALU port map (OPCODE, ACC_OUT, ACC_IN, ZERO_IN, ALU_IN); U10: CONTROL port map (OPCODE, CLK_HOT, ZERO_OUT, CLOCK, ACC_EN, ALU_REG_IN, MEM_RD, MEM_WR, PC_EN, IR_EN, EM_REG_IN ZERO_EN, MUX5_SEL, MUX8_SEL); U11: CLK_GEN port map (CLOCK, RESET, CLK_HOT); U12: ROM port map (PC_REG_OUT, ROM_OUT); U13: RAM port map (IR_ADDR, ALU_OUT, RAM_OUT, MEM_RD, MEM_WR); end U_P_A;

검증 기준 값 정의와 Test Bench VHDL 표현 Program 수행에 대한 검증 기준 값 Test Bench에 대한 VHDL 표현 library IEEE; use IEEE.std_logic_1164.all; entity TEST_BENCH is end TEST_BENCH; architecture TEST_BENCH_A of TEST_BENCH is component U_P port (RESET,CLOCK : in std_logic); end component; signal RESET : std_logic :='0'; signal CLOCK : std_logic :='1'; for U0: U_P use entity work.U_P(U_P_A); begin U0 : U_P port map (RESET,CLOCK); RESET <= '1' after 10 ns; CLOCK <= not CLOCK after 5 ns; end TEST_BENCH_A; configuration TEST_BENCH_C of TEST_BENCH is for TEST_BENCH_A end for; end TEST_BENCH_C;

시뮬레이션 결과에 대한 Waveform