47
Architecture for Next-generation Digital Engines for SoC Andes Game Platform Porting Andes Technology Andes Technology

Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Architecture for Next-generationDigital Engines for SoC

Andes Game Platform Porting

Andes TechnologyAndes Technology

Page 2: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 2

Outline

Porting guideSystem ArchitecturePackage dependencyGame package detailsPerformance issueThe result of playing game on Andes platformThe ways of enhancement performance

Page 3: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 3

Getting Started

Environment Ubuntu 9.10BSP 2.0Andes tool chain v1.3.3A working target

Page 4: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 4

Porting Guide

Demo open source applications porting for Andes platformThere are following steps

Modify config.subconfigure and make

Page 5: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 5

Environment settings for Andes tool chain

Set the location of your tool chainsource bashrc.nds32le-linux-V0export ANDESIGHT_ROOT=/home/path/toolchains/nds32-elf-n1213-43u1hexport PATH=$ANDESIGHT_ROOT/bin:$PATH

Page 6: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 6

Modify config.sub

Find the line below "Some are omitted here ..."

Page 7: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 7

Modify config.sub

Find the line below "Recognize the basic CPU types with company name."

Page 8: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 8

Configure

Using build scripts

Page 9: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 9

Configure

Assign Andes toolchains

Page 10: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 10

Deploy

Copy the folder of your building path to SD cardSet environment variable of library

Page 11: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 11

Make and Install

The compile time error can find in this step

Page 12: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 12

Game platform

Demo how to play games on Andes platformEmulate a hardware architecture of a game systemA game emulator will be composed of the following modules

A CPU emulator or CPU simulator (the two terms are mostly interchangeable in this case)A memory subsystem moduleVarious I/O devices emulators

Page 13: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 13

Game Menu

Page 14: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 14

Software

Linux kernel/driver

System Architecture

ROM codeGame Emulator

Game BoyGameboy AdvanceNintendo Entertainment SystemSuper Nintendo Entertainment System

Simple DirectMedia Layer (SDL)Display on frame bufferAudio

Linux kernel/driversAudio driver Joy Stick/GPIOSD card driver

SDL

Game Emulator

ROM code

Andes Hardware

Page 15: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 15

Joy Stick

AA

UpUpXX

BB

Start SelectStart Select

LeftLeft RightRight

DownDown

Page 16: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 16

Package dependency

InfoNESVisualBoyAdvance 1.7.2

SDL 1.2.14libpng 1.2.40zlib 1.2.3

Snes9xSDL 1.2.14

Gnuboy 1.0.3SDL 1.2.14

Page 17: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 17

Gnuboy Performance Issue

No floating point code whatsoever. Use fixed point or better yet exact analytical integer methods as opposed to any approximation.Assembly code implementation of CPU emulation

Page 18: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 18

Game Emulator

Game BoyNintendo Entertainment SystemSuper Nintendo Entertainment System

Page 19: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 19

Game Boy(1/4)

An 8-bit handheld video game console developed and manufactured by NintendoIt was released in Japan on April 21, 1989 (1989-04-21)It was created by Gunpei Yokoi and Nintendo's Research and Development 1

The same staff who had designed the Game & Watch series as well as several popular games for the NES.

Page 20: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 20

Game Boy(2/4)

Directional padFour operation buttons

"A""B""SELECT""START"

Page 21: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 21

Game Boy(3/4)

CPUCustom 8-bit Sharp LR35902 core at 4.19 MHz The core also contains integrated sound generation

RAM8 kB internal S-RAM

Video RAM8 kB internal

ROMOn-CPU-Die 256-byte bootstrap; 256 kb, 512 kb, 1 Mb, 2 Mb, 4 Mb and 8 Mb cartridges

Page 22: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 22

Gnuboy Performance Issue

No floating point code whatsoever. Use fixed point or better yet exact analytical integer methods as opposed to any approximation.Assembly code implementation of CPU emulation

Page 23: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 23

Game Boy(4/4)

Sound2 square waves, 1 programmable 32-sample 4-bit PCM wave, 1 white noise, and one audio input from the cartridge

DisplayReflective LCD 160 × 144 pixels

Screen size66 mm (2.6 in) diagonal

Power6 V, 0.7 W (4 AA batteries provide ~14~35 hours)

Dimensions: 90 mm (W) x 148 mm (H) x 32 mm (D) / 3.5" x 5.8" 1.3" (in)

Page 24: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 24

Nintendo Entertainment System

CPURicoh 2A03 8-bit processor (MOS Technology 6502 core)

Controller input2 controller port

Best-selling gameSuper Mario Bros.

PredecessorColor TV Game

SuccessorSuper Nintendo Entertainment System

Page 25: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 25

Nintendo Entertainment System

GameSuper Mario Bros.The Legend of Kage

Page 26: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 26

Super Nintendo Entertainment System

Built on 16-bit architectures and offered improved graphics and sound over the 8-bit NES

Page 27: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 27

Super Nintendo Entertainment System

CPU referenceClock Rates (NTSC)

• Input: 21.47727 MHzBus

• 3.58 MHz, 2.68 MHz, or 1.79 MHzClock Rates (PAL)

• Input: 21.28137 MHzBus

• 3.55 MHz, 2.66 MHz, or 1.77 MHz• 24-bit and 8-bit address buses, 8-bit data bus

Page 28: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 28

Super Nintendo Entertainment System

Additional Features DMA and HDMATimed IRQParallel I/O processingHardware multiplication and division

Page 29: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 29

Super Nintendo Entertainment System

CPU16-bit 65c816 Ricoh 5A22 3.58 MHz

Best-selling gameSuper Mario World Donkey Kong Country

PredecessorNintendo Entertainment System

SuccessorNintendo 64

Page 30: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 30

Super Nintendo Entertainment System

GameSuper Mario WorldMega Man XSuper Bomber Man 5

Page 31: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 31

Five Inch Version

Page 32: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 32

Resource usage and profiling

VisualBoyAdvance on Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz192/100 => 1.92 Core

Page 33: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 33

The result of playing game on Andes platform

Emulator name

CPU consumption rate DRAM

consumption ratesmoothness0~100

Game boy 30~5% 4% 90

Game boy Advance

98% 32% 20

NES 98% 3% 55

SNES 98% 16% 90

Page 34: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 34

The ways of enhancement performance

Game emulator study and optimizationEliminate floating point calculationClose hardware emulation

Page 35: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Architecture for Next-generationDigital Engines for SoC

Andes Platform Porting Experiment

Andes TechnologyAndes Technology

Page 36: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 36

Outline

Porting Diff packageCreating working platformGetting packageAdding Andes architectureConfigureMakeDeploy

Page 37: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 37

About Diff

Diff is a file comparison utilityOutputs the differences between two files. Show the changes between a file and a former version of the same file.The output is called a diff or a patchLike the use of the word "grep" for describing the act of searching, the word diff is used in jargon as a verb for calculating any difference.

Page 38: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 38

Getting started

Make sure you haveLinux platformTool-chainsA folder name nds32 under your home folder

Page 39: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 39

Getting package

apt-get source diff

Page 40: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 40

Adding Andes Architecture

nds32 | nds32le

Page 41: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 41

Adding Andes Architecture

File under config/config.subconfig/config.subnds32 | nds32le

Page 42: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 42

Using Scripts

./build_nds.sh

Page 43: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 43

If You Forget to Add Andes Arch.

Page 44: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 44

Configure

Page 45: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 45

Compile

Page 46: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Page 46

Deploy

Copy all the files and folder under $HOME/nds32 folderDiff usage

diff [diff opts] file1 file2

Page 47: Andes Game Platform Porting - National Chiao Tung Universitytwins.ee.nctu.edu.tw/courses/embedlab_09/lecture/final_project_porti… · Demo how to play games on Andes platform Emulate

Architecture for Next-generationDigital Engines for SoC

Thank You!!!