Introduction to C. Why C? Difference between Python and C C compiler stages Basic syntax in C

Similar documents
Topics Power tends to corrupt; absolute power corrupts absolutely. Computer Organization CS Data Representation

CS 61C: Great Ideas in Computer Architecture. (Brief) Review Lecture

Floating Point Numbers

Data Storage. August 9, Indiana University. Geoffrey Brown, Bryce Himebaugh 2015 August 9, / 19

Lecture 4: Instruction Set Architecture

17. Instruction Sets: Characteristics and Functions

CS61c Midterm Review (fa06) Number representation and Floating points From your friendly reader

CS367 Test 1 Review Guide

Final Exam. 11 May 2018, 120 minutes, 26 questions, 100 points

Midterm 1 topics (in one slide) Bits and bitwise operations. Outline. Unsigned and signed integers. Floating point numbers. Number representation

CS , Fall 2004 Exam 1

Computer Organization CS 206 T Lec# 2: Instruction Sets

CS , Spring 2004 Exam 1

Instruction Sets: Characteristics and Functions Addressing Modes

The CPU and Memory. How does a computer work? How does a computer interact with data? How are instructions performed? Recall schematic diagram:

COMP2611: Computer Organization. Data Representation

SOME ASSEMBLY REQUIRED

M1 Computers and Data

Assembly Language Design

Instruction Sets: Characteristics and Functions

Computer Organisation CS303

Floating Point Numbers

Floating Point Numbers

Bits and Bytes. Why bits? Representing information as bits Binary/Hexadecimal Byte representations» numbers» characters and strings» Instructions

COMPUTER ORGANIZATION & ARCHITECTURE

ECE2049: Embedded Computing in Engineering Design C Term Spring Lecture #3: Of Integers and Endians (pt. 2)

Page 1. Where Have We Been? Chapter 2 Representing and Manipulating Information. Why Don t Computers Use Base 10?

Computer Systems A Programmer s Perspective 1 (Beta Draft)

231 Spring Final Exam Name:

CSE 351 Midterm - Winter 2015 Solutions

ICS Instructor: Aleksandar Kuzmanovic TA: Ionut Trestian Recitation 2

Time: 8:30-10:00 pm (Arrive at 8:15 pm) Location What to bring:

CSE 351 Midterm - Winter 2015

Floating-Point Data Representation and Manipulation 198:231 Introduction to Computer Organization Lecture 3

Malloc Lab & Midterm Solutions. Recitation 11: Tuesday: 11/08/2016

COMP3221: Microprocessors and. and Embedded Systems. Instruction Set Architecture (ISA) What makes an ISA? #1: Memory Models. What makes an ISA?

Why Don t Computers Use Base 10? Lecture 2 Bits and Bytes. Binary Representations. Byte-Oriented Memory Organization. Base 10 Number Representation

Chapter 4. Operations on Data

Computer (Literacy) Skills. Number representations and memory. Lubomír Bulej KDSS MFF UK

CS107 Handout 13 Spring 2008 April 18, 2008 Computer Architecture: Take II

15-213/18-243, Spring 2011 Exam 1

Written Homework 3. Floating-Point Example (1/2)

Team 1. Common Questions to all Teams. Team 2. Team 3. CO200-Computer Organization and Architecture - Assignment One

Computer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2

Real instruction set architectures. Part 2: a representative sample

CPE300: Digital System Architecture and Design

55:132/22C:160, HPCA Spring 2011

Systems Programming and Computer Architecture ( )

Arithmetic and Bitwise Operations on Binary Data

Name: CMSC 313 Fall 2001 Computer Organization & Assembly Language Programming Exam 1. Question Points I. /34 II. /30 III.

SIGNED AND UNSIGNED SYSTEMS

CSIS1120A. 10. Instruction Set & Addressing Mode. CSIS1120A 10. Instruction Set & Addressing Mode 1

Instruction Sets Ch 9-10

Instruction Sets Ch 9-10

Operations On Data CHAPTER 4. (Solutions to Odd-Numbered Problems) Review Questions

Why Don t Computers Use Base 10? Lecture 2 Bits and Bytes. Binary Representations. Byte-Oriented Memory Organization. Base 10 Number Representation

Question Points Score Total: 100

Course Schedule. CS 221 Computer Architecture. Week 3: Plan. I. Hexadecimals and Character Representations. Hexadecimal Representation

CSE 351 Midterm - Winter 2017

Understand the factors involved in instruction set

CSE 12 Week Eight, Lecture One

Instruction Set Architecture

Numeric Encodings Prof. James L. Frankel Harvard University

COMP2121: Microprocessors and Interfacing. Instruction Set Architecture (ISA)

2. Define Instruction Set Architecture. What are its two main characteristics? Be precise!

Computer Architecture and IC Design Lab. Chapter 3 Part 2 Arithmetic for Computers Floating Point

CS Programming In C

MACHINE LEVEL REPRESENTATION OF DATA

Fixed-Point Math and Other Optimizations

Foundations of Computer Systems

C Programming. Course Outline. C Programming. Code: MBD101. Duration: 10 Hours. Prerequisites:

Chapter 2 Float Point Arithmetic. Real Numbers in Decimal Notation. Real Numbers in Decimal Notation

Chapter 03: Computer Arithmetic. Lesson 09: Arithmetic using floating point numbers

Hardware: Logical View

CSCI 402: Computer Architectures. Arithmetic for Computers (4) Fengguang Song Department of Computer & Information Science IUPUI.

Instruction Set. Instruction Sets Ch Instruction Representation. Machine Instruction. Instruction Set Design (5) Operation types

Bits, Bytes, and Integers Part 2

Copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Review Topics. parameter passing, memory model)

Lecture 5-6: Bits, Bytes, and Integers

System Programming CISC 360. Floating Point September 16, 2008

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.

Bits and Bytes January 13, 2005

Computers Programming Course 5. Iulian Năstac

Floating Point Puzzles. Lecture 3B Floating Point. IEEE Floating Point. Fractional Binary Numbers. Topics. IEEE Standard 754

15-213/18-243, Fall 2010 Exam 1 - Version A

CS , Fall 2001 Exam 1

Bryant and O Hallaron, Computer Systems: A Programmer s Perspective, Third Edition. Carnegie Mellon

Rui Wang, Assistant professor Dept. of Information and Communication Tongji University.

Floating Point. CSE 238/2038/2138: Systems Programming. Instructor: Fatma CORUT ERGİN. Slides adapted from Bryant & O Hallaron s slides

Page 1. Structure of von Nuemann machine. Instruction Set - the type of Instructions

Number Systems. Decimal numbers. Binary numbers. Chapter 1 <1> 8's column. 1000's column. 2's column. 4's column

ECE331: Hardware Organization and Design

CS , Fall 2002 Exam 1

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.

Midterm Exam Answers Instructor: Randy Shepherd CSCI-UA.0201 Spring 2017

Floating Point Arithmetic

Floating Point (with contributions from Dr. Bin Ren, William & Mary Computer Science)

Data Representation and Storage. Some definitions (in C)

Reserved Words and Identifiers

Course overview. Computer Organization and Assembly Languages Yung-Yu Chuang 2006/09/18. with slides by Kip Irvine

Transcription:

Final Review CS304

Introduction to C Why C? Difference between Python and C C compiler stages Basic syntax in C

Pointers What is a pointer? declaration, &, dereference... Pointer & dynamic memory allocation Virtual memory Pointer & arrays Relationship between pointer and array name sizeof, strlen... Pointer arithmetic *(array_ptr++) and (*array_ptr)++ [] and * pointers to arrays and array of pointers

Pointers Pointer & functions passing by value & passing by reference function pointers Pointer & structures Struct declaration and definition #define and typedef access struct with pointers offsetof

Introduction to Computer Organization Three layers in computer system software/os/hardware Hardware organization Von Neumann Architecture virtual memory and cache hierarchy What will happen if we type a linux command in command line?

Information Representation Number systems Decimal, Binary, Hexadecimal, Octal, base-10 Two important limitations Overflow, accuracy Information storage and byte order interpretation is important word size byte big endian and little endian

Integers Why low level representation? B2U, B2T, B2O, B2S range & min, max Signed vs. unsigned Integer operations sign extend, truncation, addition, negation, multiplication, division overflow, multiplication by constant, division by power of 2, rounding shift and bit operations

Floating Point Numbers Binary floating point IEEE-754 format single precision: 1[31]-sign, 8[30-23]-exponent, 23[22-0]-fraction, 127-bias Normalized & special values 0, subnormal (de-normalized), +/-infinity, NaN bias, hidden bit Range and precision Rounding, casting, special operations

Bit Operations Masks Shift operation valid range, logic shift and arithmetic shift Bit operation and logic operation Boolean algebra basic property of & ~ ^ two typical use cases of ^ (swap and array check)

Assembly Programming: Y86 Introduction to assembly programming Why assembly code? Operations and visible states in assembly programming Concept of ISA and CPU cycle Introduction to Y86 Visible states in Y86, registers, memory, cc, PC, program status

Assembly Programming: Y86 Y86 instructions assembler directives status conditions and exceptions instructions (operations, branches, and moves) stack operations subroutine call/return Y86 encoding Y86 instruction execution

Assembly Programming: IA32 Introduction to IA32 RISC and CISC (Y86 R or C, IA32 R or C?) IA32 visible states IA32 operations Data movement addressing modes: absolute, indirect, base+displacement, and indexed Stack and function operations basic stack push and pop; function call and return how to maintain the stack frame for procedure calls register usage conventions recursive procedures

Assembly Programming: IA32 IA32 operations (continue) Arithmetic and logic operations LEA! Compare and jump control flow and data flow cc and how to set cc: cmp and test how to use cc: set, jmp and cmov control structures: select, loop, switch (jump table)

Assembly Programming: IA32 Array and structures allocation and access relationship/conversion between c and IA32 Data alignment issue

Exam format True or false (10 pts) Ex. IA32 belongs to CISC Multiple choice (10 pts) basic concepts Short answer (20 pts) instruction encoding and instruction execution code reading/writing Code evaluation and open questions (60 pts) code reading, explain and fill in blanks conversion between C and Y86 (or IA32) Extra bonus (20 pts) code optimizations with computer organization knowledge some open questions about cache

Suggestions Notes!!!! Labs & HWs!!!! slides!!! Practice problems on our website!!! textbook! Don t forget to prepare for a letter-size double-side cheat sheet (must contain: Y86 encoding) Please take our course evaluation whenever you have time before December 7 th.

Thanks for taking this class, and good luck with all your finals!