Building A RISC Microcontroller in an FPGA



Similar documents
Instruction Set. Instruction Set Nomenclature: Status Register (SREG) Registers and Operands

Atmel AVR 8-bit Instruction Set

Instruction Set. Instruction Set Nomenclature. Status Register (SREG) Registers and Operands

Instruction Set. Instruction Set Nomenclature. Status Register (SREG) Registers and Operands

Atmel AVR 8-bit Instruction Set

Programming of Microcontrollers in Assembly Language

The AVR Microcontroller and C Compiler Co-Design Dr. Gaute Myklebust ATMEL Corporation ATMEL Development Center, Trondheim, Norway

Voltage boost and buck circuits using Atmel AVR Tiny13V for driving a white LED.

Chapter 13. PIC Family Microcontroller

How to use AVR Studio for Assembler Programming

8-bit Microcontroller. Application Note. AVR410: RC5 IR Remote Control Receiver

MICROPROCESSOR AND MICROCOMPUTER BASICS

Poor Man s A/D Converter By Dave Wissel at Wave Technology

AVR1321: Using the Atmel AVR XMEGA 32-bit Real Time Counter and Battery Backup System. 8-bit Microcontrollers. Application Note.

ATtiny4 / ATtiny5 / ATtiny9 / ATtiny10. Introduction. Feature. Atmel 8-bit AVR Microcontroller with 512/1024 Bytes In-System Programmable Flash

8-bit Microcontroller with 1K Bytes In-System Programmable Flash. ATtiny13V ATtiny13

Technical Note. Micron NAND Flash Controller via Xilinx Spartan -3 FPGA. Overview. TN-29-06: NAND Flash Controller on Spartan-3 Overview

Digitale Signalverarbeitung mit FPGA (DSF) Soft Core Prozessor NIOS II Stand Mai Jens Onno Krah

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Question Bank Subject Name: EC Microprocessor & Microcontroller Year/Sem : II/IV

8051 hardware summary

Central Processing Unit (CPU)

8-bit Microcontroller with 2/4/8K Bytes In-System Programmable Flash. ATtiny24 ATtiny44 ATtiny84

AVR151: Setup and Use of the SPI. Introduction. Features. Atmel AVR 8-bit Microcontroller APPLICATION NOTE

8-Bit Flash Microcontroller for Smart Cards. AT89SCXXXXA Summary. Features. Description. Complete datasheet available under NDA

Building Blocks for PRU Development

Microcontrollers in Practice

8051 MICROCONTROLLER COURSE

Atmel Norway XMEGA Introduction

Atmel 8-bit AVR Microcontroller with 2/4/8K Bytes In-System Programmable Flash. ATtiny25/V / ATtiny45/V / ATtiny85/V. Features

EC313 - VHDL State Machine Example

8-bit Microcontroller with 2K Bytes In-System Programmable Flash. ATtiny2313/V. Preliminary

8-bit Microcontroller with 16K Bytes In-System Programmable Flash. ATmega162 ATmega162V. Features

Microprocessor and Microcontroller Architecture

ET-BASE AVR ATmega64/128

AUTOMATIC NIGHT LAMP WITH MORNING ALARM USING MICROPROCESSOR

8-bit Microcontroller with 8K Bytes In-System Programmable Flash AT90S8515

A 5 Degree Feedback Control Robotic Arm (Haptic Arm)

2.0 Command and Data Handling Subsystem

Am186ER/Am188ER AMD Continues 16-bit Innovation

MACHINE ARCHITECTURE & LANGUAGE

7a. System-on-chip design and prototyping platforms

AVR034: Mixing C and Assembly Code with IAR Embedded Workbench for AVR. 8-bit Microcontroller. Application Note. Features.

Introduction to Microcontrollers

Serial port interface for microcontroller embedded into integrated power meter

AVR Butterfly Training. Atmel Norway, AVR Applications Group

UNIVERSITY OF CALIFORNIA, DAVIS Department of Electrical and Computer Engineering. EEC180B Lab 7: MISP Processor Design Spring 1995

Advanced Computer Architecture-CS501. Computer Systems Design and Architecture 2.1, 2.2, 3.2

Develop a Dallas 1-Wire Master Using the Z8F1680 Series of MCUs

Z80 Microprocessors Z80 CPU. User Manual UM Copyright 2014 Zilog, Inc. All rights reserved.

Using The PIC I/O Ports

8-bit Microcontroller with 1K Bytes In-System Programmable Flash. ATtiny13A

Mixing C and assembly language programs Copyright 2007 William Barnekow <barnekow@msoe.edu> All Rights Reserved

PART B QUESTIONS AND ANSWERS UNIT I

The ARM Architecture. With a focus on v7a and Cortex-A8

Microtronics technologies Mobile:

Microprocessor & Assembly Language

8-bit Microcontroller with 32K/64K/128K Bytes of ISP Flash and CAN Controller AT90CAN32 AT90CAN64 AT90CAN128

Palaparthi.Jagadeesh Chand. Associate Professor in ECE Department, Nimra Institute of Science & Technology, Vijayawada, A.P.

ATmega16U4/ATmega32U4

Freescale Semiconductor, I

ADS9850 Signal Generator Module

Microcontroller Based Low Cost Portable PC Mouse and Keyboard Tester

Timer A (0 and 1) and PWM EE3376

ATmega8A. Introduction. Features. 8-bit AVR Microcontroller DATASHEET COMPLETE

AN LPC1700 timer triggered memory to GPIO data transfer. Document information. LPC1700, GPIO, DMA, Timer0, Sleep Mode

8-bit Microcontroller with 8K/16K Bytes In-System Programmable Flash

8-bit Microcontroller with 8K Bytes In-System Programmable Flash. ATmega8515 ATmega8515L

8-bit Microcontroller. Application Note. AVR201: Using the AVR Hardware Multiplier

Step Motor Controller. Application Note. AVR360: Step Motor Controller. Theory of Operation. Features. Introduction

Arduino Due Back. Warning: Unlike other Arduino boards, the Arduino Due board runs at 3.3V. The maximum. Overview

Implementing SPI Master and Slave Functionality Using the Z8 Encore! F083A

COMPUTERS ORGANIZATION 2ND YEAR COMPUTE SCIENCE MANAGEMENT ENGINEERING JOSÉ GARCÍA RODRÍGUEZ JOSÉ ANTONIO SERRA PÉREZ

RAPID PROTOTYPING OF DIGITAL SYSTEMS Second Edition

CAN bus board. EB018

Solution: start more than one instruction in the same clock cycle CPI < 1 (or IPC > 1, Instructions per Cycle) Two approaches:

ASYNCHRONOUS COUNTERS

Software based Finite State Machine (FSM) with general purpose processors

Systems I: Computer Organization and Architecture

ETEC 2301 Programmable Logic Devices. Chapter 10 Counters. Shawnee State University Department of Industrial and Engineering Technologies

8-bit Microcontroller. Application Note. AVR400: Low Cost A/D Converter

8-bit Atmel Microcontroller with 128KBytes In-System Programmable Flash. ATmega128 ATmega128L

Introduction to the Altera Qsys System Integration Tool. 1 Introduction. For Quartus II 12.0

M68EVB908QL4 Development Board for Motorola MC68HC908QL4

AVR305: Half Duplex Compact Software UART. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

AVR Timer/Counter. Prof Prabhat Ranjan DA-IICT, Gandhinagar

System Considerations

8-bit Microcontroller with 1K Bytes In-System Programmable Flash. ATtiny13A. Summary

Memory Basics. SRAM/DRAM Basics

LAB #4 Sequential Logic, Latches, Flip-Flops, Shift Registers, and Counters

8-bit Microcontroller with 16K Bytes In-System Programmable Flash. ATmega16 ATmega16L

The WIMP51: A Simple Processor and Visualization Tool to Introduce Undergraduates to Computer Organization

Lab 1 Course Guideline and Review

Best Practises for LabVIEW FPGA Design Flow. uk.ni.com ireland.ni.com

The Programming Interface

How To Write A Microsoft Microsoft 8D (Droid) (Program) (Powerbook) (I386) (Microsoft) (Donga) (Opera) And (Dungeo) (Dugeo

APPLICATION NOTE. Atmel AVR443: Sensor-based Control of Three Phase Brushless DC Motor. Atmel AVR 8-bit Microcontrollers. Features.

8-bit Atmel with 8KBytes In- System Programmable Flash. ATmega8 ATmega8L

Chapter 2 Logic Gates and Introduction to Computer Architecture

Secure My-d TM and Mifare TM RFID reader system by using a security access module Erich Englbrecht (info@eonline.de) V0.1draft

Transcription:

Building A RISC Microcontroller in an FPGA Name : Yap Zi He Course : 4 SEL Supervisor : PM Muhammad Mun im Ahmad Zabidi

Introduction Reduce Instruction Set Computer (RISC) is a new trend on computer design. The opposite and rather established trend is Complex Instruction Set Computer (CISC), which consist lots of instruction sets, addressing modes, instruction formats and a number of possible instructions length. The complexity of the instruction makes the design more complicated. While RISC tend to reduce the complexity of the instructions set and thus make the design process easier.

Objectives The objectives of my project is to design a RISC Microcontroller using VHDL and implement it in an FPGA The instructions set and features are based on ATMEL AVR AT90S1200 RISC Microcontroller. AT90S1200 At First Glance 89 Instructions 32 General Purpose Registers 2 IO Ports (15 pins) 1 x 8-bit Timer 1 x External Interrupt 1 x Analog Comparator

Scopes Implement the Complete AT90S1200 Microcontroller in an FPGA FPGA unimplementable features (analog comparator and internal pull-up resistors) and unnecessary feature (WatchDog Reset) will be ignored What is the Challenges? 1. AREA the design must be able to fit into the targeted FPGA device, which is Altera EPF10K20RC240-4. 2. SPEED the microcontroller must be able to run at a minimum clock speed of 10MHz.

Project Background FPGA Implementation of a RISC microcontroller Wan Mohd Khalid Problems : 1. Project is poorly documented 2. Design using both VHDL and schematics 3. Only 50% instructions designed (behavioral approach) 4. No peripheral features (port, timer, ext int) 5. Project size is too large, require 3 pieces of EPF10K20! 6. FPGA implementation is not done

Approach Software (VHDL) Architecture & Instructions Set VHDL Coding (Text Editor) Synthesis (FPGA Express) Compilation & Simulation (MaxPlus II) Program Coding & Assembling (AVR Assembler) ASM to MIF Converter (Self Written) Program + Designed Microcontroller Simulation (AVR Studio) Compilation & Device Programming (MaxPlus 2) Results Checking Hardware Implementation

Architecture Overview Reset Clock Microcontroller (FPGA) PortB PortC PortD * All IO Ports are 8-bits width (3 ports = 24 pins) * External Interrupt and Timer external clock source share the same pin with pin D7

Fetch Unit Execution Unit I/O Program Counter Program ROM Instruction Reg Control Unit Register Addressing Indirect Addressing General Purpose Registers ALU Status Reg 8-Bit Data Bus Port B Port C Port D Timer Control Signals RAM Ext Int

Instructions Cycle / Pipelines Clock Cycle 1 2 3 4 1 st Instruction Fetch Execute 2 nd instruction Fetch Execute 3 rd instruction Fetch Execute The 2 stage pipelines allowed 1 instruction to be executed on every clock cycle.

Project Highlight : Control Unit Designing the control unit is usually the most tedious task in digital system design In my design, the control unit is implemented with Synchronous Mealy Model. The advantages are :- 1. The control signals are asserted according to clock transition rather than generated by the state as in Moore Model. Thus the control signals appear faster and will speed up the microcontroller. 2. The control unit for the microcontroller has only 8 states! This is because control signals are lock to transition rather than the states. So all single cycle instructions can share the same state.

What is Synchronous Mealy Model? INPUT (Instruction Code, IRQ, Branch Taken? ) Combinational Combinational Logic for Logic NEXT STATE Next State Flip Flops Combinational Logic for OUTPUT Flip Flops OUTPUT (Control Signals) Clock Current State Clock

8 States Control Unit Wait for Interrupt Reset EXE State No IRQ SLEEP Branch1 Single Cycle Instrutions IRQ Sleep Unconditional branch LD Load Inst EXE Conditional branch taken Branch2 ST Store Inst CBI/SBI SBIC/SBIS SBICS Branch Instructions (3 cycles) 2 Cycles Instructions CBISBI

Instructions The designed microcontroller is capable of executing 92 instructions. Arithmetic and Logic Instructions (20) :- ADD, ADC, SUB, SUBI, SBC, SBCI, AND, ANDI, OR, ORI, EOR, COM, NEG, SBR, CBR, INC, DEC, TST, CLR, SER Branch and Skip Instructions (32) :- RJMP, RCALL, RET, RETI, CPSE, CP, CPC, CPI, SBRC, SBRS, SBIC, SBIS, BRBS, BRBC, BREQ, BRNE, BRCS, BRCC, BRSH, BRLO, BRMI, BRPL, BRGE, BRLT, BRHS, BRHC, BRTS, BRTC, BRVS, BRVC, BRIE, BRID Data Transfer Instructions (10) :- LD Z, LD Z+, LD Z, ST Z, ST Z+, ST Z, MOV, LDI, IN, OUT Bit and Bit Test Instructions (28) :- SBI, CBI, LSL, LSR, ROL, ROR, ASR, SWAP, BSET, BCLR, BST, BLD, SEC, CLC, SEN, CLN, SEZ, CLZ, SEI, CLI, SES, CLS, SEV, CLV, SET, CLT, SHE, CLH Misc Instructions (2) :- NOP, SLEEP > 20 + 32 + 10 + 28 + 2 = 92 instructions

Results Achieved 1. VHDL coding and simulation for all the modules in the block diagram has been done successfully. 2. The design has been programmed into FPGA successfully. 3. The FPGA is now a microcontroller and is able to control some real applications (will be demo). How about the challenges stated? AREA The design fit into the targeted device successfully (using 92% of EPF10K20RC240-4) SPEED The final design clock speed is 12 MHz (target is 10MHz)

AT90S1200 VS My Design AT90S1200 RISCMCU Instructions 89 92 G.P Registers 32 16 Program ROM 512 words 512 words IO Ports 2 (15 pins) 3 (24 pins) Addressing Modes Speed 5 4 MHz / 12 MHz 8 12 MHz* 8-bit Timer 1 1 External Interrupt 1 1 Analog Comparator 1 None Implementation CMOS FPGA SRAM None 128 bytes * 18 MHz can be achieved when implemented in the fastest device from the same family

Recommendations on Future Works My design is based on AVR AT90S1200. There are many more members in the AVR family which contribute to more instructions and features. The next step will be adding these instructions and features into my design. Example: Instructions MUL, DIV, IJMP Features UART, SPI, 16-bit Timer (with input capture, output compare & PWM)

Conclusion The project has achieve all the objectives and fulfilled all the scope specified My main contribution is the VHDL source code, which is an AT90S1200 compatible RISC microcontroller