CSCE 313: Embedded Systems Performance Counters Instructor: Jason D. Bakos.

Slides:



Advertisements
Similar presentations
Lecture 6 Programming the TMS320C6x Family of DSPs.
Advertisements

CSCE 212 Chapter 3: Arithmetic for Computers Instructor: Jason D. Bakos.
Computer Engineering FloatingPoint page 1 Floating Point Number system corresponding to the decimal notation 1,837 * 10 significand exponent A great number.
2.3) Example of program execution 1. instruction  B25 8 Op-code B means to change the value of the program counter if the contents of the indicated register.
CSCE 313: Embedded Systems Scaling Multiprocessors Instructor: Jason D. Bakos.
Instruction Set Architecture & Design
1 Lecture 3 Bit Operations Floating Point – 32 bits or 64 bits 1.
1  2004 Morgan Kaufmann Publishers Chapter Three.
Floating Point Numbers
CSCE 313: Embedded Systems Multiprocessor Systems
Professor Jennifer Rexford COS 217
1 Lecture 10: FP, Performance Metrics Today’s topics:  IEEE 754 representations  FP arithmetic  Evaluating a system Reminder: assignment 4 due in a.
CPS Computer Architecture Assignment 4: Multiplication, Division, Floating Point.
Computer Organization CS345 David Monismith Based upon notes by Dr. Bill Siever and notes from the Patterson and Hennessy Text.
Data Representation – Chapter 3 Sections 3-2, 3-3, 3-4.
Mehmet Can Vuran, Instructor University of Nebraska-Lincoln Acknowledgement: Overheads adapted from those provided by the authors of the textbook.
Connecting with Computer Science 2 Objectives Learn why numbering systems are important to understand Refresh your knowledge of powers of numbers Learn.
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
Simple Data Type Representation and conversion of numbers
Advanced Instructions Most PLCs now support more advanced functions such as Floating point math, Boolean operations, Shifting, Sequencing, Program control.
Binary Real Numbers. Introduction Computers must be able to represent real numbers (numbers w/ fractions) Two different ways:  Fixed-point  Floating-point.
Computer Arithmetic Nizamettin AYDIN
Computer Architecture Lecture 3: Logical circuits, computer arithmetics Piotr Bilski.
CSCE 313: Embedded Systems Final Project Instructor: Jason D. Bakos.
Machine Instruction Characteristics
NUMBER REPRESENTATION CHAPTER 3 – part 3. ONE’S COMPLEMENT REPRESENTATION CHAPTER 3 – part 3.
Number Systems So far we have studied the following integer number systems in computer Unsigned numbers Sign/magnitude numbers Two’s complement numbers.
Computing Systems Basic arithmetic for computers.
Computer Architecture
Fundamental of Computer Architecture By Panyayot Chaikan November 01, 2003.
Lec 3: Data Representation Computer Organization & Assembly Language Programming.
Introduction to Computer Engineering ECE/CS 252, Fall 2010 Prof. Mikko Lipasti Department of Electrical and Computer Engineering University of Wisconsin.
CH09 Computer Arithmetic  CPU combines of ALU and Control Unit, this chapter discusses ALU The Arithmetic and Logic Unit (ALU) Number Systems Integer.
9.4 FLOATING-POINT REPRESENTATION
8-1 Embedded Systems Fixed-Point Math and Other Optimizations.
Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.
The Teacher CP4 Binary and all that… CP4 Revision.
CSCE 212 Review for Exam 1 Instructor: Jason D. Bakos.
Lecture 12: Integer Arithmetic and Floating Point CS 2011 Fall 2014, Dr. Rozier.
Integer & Floating Point Representations CDA 3101 Discussion Session 05.
Introduction to Number System
Lecture notes Reading: Section 3.4, 3.5, 3.6 Multiplication
Fractions in Binary.
Lab 2 Parallel processing using NIOS II processors
CSC 370 (Blum)1 Binary Numbers Material on Data Representation can be found in Chapter 2 of Computer Architecture (Nicholas Carter)
Computer Engineering FloatingPoint page 1 Floating Point Number system corresponding to the decimal notation 1,837 * 10 significand exponent A great number.
Bits, Data types, and Operations: Chapter 2 COMP 2610 Dr. James Money COMP
순천향대학교 정보기술공학부 이 상 정 1 3. Arithmetic for Computers.
Numbers in Computers.
©Brooks/Cole, 2003 Chapter 3 Number Representation.
Representation of Data (Part II) Computer Studies Notes: chapter 19 Ma King Man.
Speedup Speedup is defined as Speedup = Time taken for a given computation by a non-pipelined functional unit Time taken for the same computation by a.
Integer Operations Computer Organization and Assembly Language: Module 5.
Learning Objectives 3.3.1f - Describe the nature and uses of floating point form 3.3.1h - Convert a real number to floating point form Learn how to normalise.
Floating Point Numbers
Floating Point Representations
Topic: Binary Encoding – Part 2
David Kauchak CS 52 – Spring 2017
CSCE 313: Embedded Systems Final Project Notes
Integer Division.
Floating Point Number system corresponding to the decimal notation
Lesson objectives Understand how computers represent and manipulate numbers [unsigned integers, signed integers (sign and magnitude, Two’s complement)
EE 445S Real-Time Digital Signal Processing Lab Spring 2014
October 24 Programming problems? Read Section 6.1 for November 5
CSCE 313: Embedded Systems Final Project
Ladder programming Counter Instruction S7 300
CSCE 313: Embedded Systems Performance Analysis and Tuning
Presentation transcript:

CSCE 313: Embedded Systems Performance Counters Instructor: Jason D. Bakos

Performance Counters Performance counters are hardware counters that increment under certain conditions Significant because they allow cycle-level precision Allows for high resolution hardware instrumentation: –Events, i.e. cache misses, instruction commits, exceptions –Timing, use counter to count cycles to execute a segment of code In lab 3, we will use them to time sections of code –Begin counter immediately prior to executing a section of code –Execute section of code –Stop counter immediately after executing a section of code CSCE 313 2

Performance Counters in NIOS SOPC To use, add in SOPC Builder: –Performance Counter Unit –Name: “performance_counter_0” –Must specify number of counters This number must be one greater than the number of counters you want to measure –Make sure you put it on sys_clk and (automatically) assign base addresses CSCE 313 3

Performance Counters in NIOS SOPC To use: –FIRST, delete timer_0 from your system design, then include file: #include –To reset counters: PERF_RESET(PERFORMANCE_COUNTER_0_BASE); –To start/stop measuring (you must stop before you can read the counters): PERF_START_MEASURING(PERFORMANCE_COUNTER_0_BASE); PERF_STOP_MEASURING(PERFORMANCE_COUNTER_0_BASE); (place at begin and end of main()) –To measure a section of code (accumulating count): PERF_BEGIN (PERFORMANCE_COUNTER_0_BASE, ); PERF_END (PERFORMANCE_COUNTER_0_BASE, ); –The global counter, 0, measures from the START to STOP CSCE 313 4

Performance Counters in NIOS SOPC –To read global count: time=perf_get_total_time ((void*)PERFORMANCE_COUNTER_0_BASE); –To read section count: time=perf_get_section_time ((void*)PERFORMANCE_COUNTER_0_BASE, ); –To read number of occurrences between start and stop: occurences=perf_get_num_starts ((void*)PERFORMANCE_COUNTER_0_BASE, ); –To convert clock cycles to time: (double)time/(double)ALT_CPU_FREQ CSCE 313 5

CSCE Fixed-Point Need a way to represent fractional numbers in binary (N,M) Fixed-point representation –Assume a decimal point at some location in a value: –Example (6,4)-fixed format: 6-bit (unsigned) value = 1x x x x x x2 -4 For signed, use two’s compliment –Range = [-2 N-1 /2 M, 2 N-1 /2 M – 1/2 M ] –For example above, [-2 5 /2 4, 2 5 /2 4 -1/2 4 ]  [-2,2-(1/16)]

Lab 3 Fixed-Point C doesn’t offer a dedicated fixed-point type We don’t have fixed-point sin and cos, so use floating-point for this, but convert to (32,4) fixed point by: –Multiply result by 16.0 –Typecast to int Multiply: –cos/sin, which is (32,4) fixed-point value with –row/col, which is a (32,0) fixed-point number, –gives a (32,4) value, so keep this in mind! Adding two (32,4) values gives a (32,4) value CSCE 313 7

Lab 3 Fixed-Point Round when converting (32,4) fixed-point back to integer: –Check bit 3 to see if you should round up, i.e. val & 8 –Shift fixed-point value 4 bits to right –If original bit 3==1, then add one to converted integer CSCE 313 8

Lab 3 Split into two parts: –Change CPU to NIOS II/f –Enable hardware multiply CSCE 313 9

Lab 3 Enable hardware floating point CSCE

Lab 3 Use performance counters to find average time, in cycles, to transform each individual pixel when using different cache sizes: –4K instruction cache, no data cache –4K instruction cache, 4K data cache –4K instruction cache, 16K data cache CSCE

Lab 3 After testing floating point with various cache sizes, repeat the same tests with fixed-point Determine the performance impact of each Write a short report detailing your results and conclusions CSCE