SISTEMI EMBEDDED. Basic Concepts about Computers. Federico Baronti Last version:

Similar documents
M1 Computers and Data

UNIT 7A Data Representation: Numbers and Text. Digital Data

Number System. Introduction. Decimal Numbers

2. ADDRESSING METHODS

Groups of two-state devices are used to represent data in a computer. In general, we say the states are either: high/low, on/off, 1/0,...

Announcements HW1 is due on this Friday (Sept 12th) Appendix A is very helpful to HW1. Check out system calls

Number Systems Prof. Indranil Sen Gupta Dept. of Computer Science & Engg. Indian Institute of Technology Kharagpur Number Representation

Math 230 Assembly Programming (AKA Computer Organization) Spring 2008

Introduction to Computer Science-103. Midterm

Processor design - MIPS

Decimal & Binary Representation Systems. Decimal & Binary Representation Systems

Data Representation. DRAM uses a single capacitor to store and a transistor to select. SRAM typically uses 6 transistors.

DRAM uses a single capacitor to store and a transistor to select. SRAM typically uses 6 transistors.

Digital Fundamentals

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

SE311: Design of Digital Systems

Final Labs and Tutors

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

IT 1204 Section 2.0. Data Representation and Arithmetic. 2009, University of Colombo School of Computing 1

Computer Organisation CS303

Introduction to Computer Science. Homework 1

Advanced Computer Architecture-CS501. Vincent P. Heuring&Harry F. Jordan Chapter 2 Computer Systems Design and Architecture

Chapter 3 Machine Instructions & Programs. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan

9/3/2015. Data Representation II. 2.4 Signed Integer Representation. 2.4 Signed Integer Representation

UNIT - I: COMPUTER ARITHMETIC, REGISTER TRANSFER LANGUAGE & MICROOPERATIONS

MACHINE LEVEL REPRESENTATION OF DATA

Problem Set 1 Solutions

Vtusolution.in COMPUTER ORGANIZATION. Subject Code: 10CS46 PART A

Basic Definition INTEGER DATA. Unsigned Binary and Binary-Coded Decimal. BCD: Binary-Coded Decimal

Computer Organization

Introduction to Computers - Chapter 4

BINARY SYSTEM. Binary system is used in digital systems because it is:

10.1. Unit 10. Signed Representation Systems Binary Arithmetic

The von Neumann Architecture. IT 3123 Hardware and Software Concepts. The Instruction Cycle. Registers. LMC Executes a Store.

COMP2121: Microprocessors and Interfacing. Number Systems

Lecture 2: Number Systems

Numbering systems. Dr Abu Arqoub

1. Draw general diagram of computer showing different logical components (3)

Binary Codes. Dr. Mudathir A. Fagiri

COMP2611: Computer Organization. Data Representation

Information Science 1

17. Instruction Sets: Characteristics and Functions

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Bits and Bytes and Numbers

PESIT Bangalore South Campus

Number representations

Chapter 1. Computer Abstractions and Technology. Lesson 3: Understanding Performance

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

Number Systems and Their Representations

Binary. Hexadecimal BINARY CODED DECIMAL

CS 101: Computer Programming and Utilization

Module 2: Computer Arithmetic

PESIT Bangalore South Campus

Wednesday, February 4, Chapter 4

Number Systems CHAPTER Positional Number Systems

CS/EE 260. Digital Computers Organization and Logical Design

N.B. These pastpapers may rely on the knowledge gained from the previous chapters.

Wednesday, September 13, Chapter 4

Chapter 2 Bits, Data Types, and Operations

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

Question 4: a. We want to store a binary encoding of the 150 original Pokemon. How many bits do we need to use?

Chapter 1. Digital Systems and Binary Numbers

Instruction Sets: Characteristics and Functions

Chapter 2 Data Representations

Appendix. Bit Operators

Thus needs to be a consistent method of representing negative numbers in binary computer arithmetic operations.

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

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

Chapter 3 DATA REPRESENTATION

COS 140: Foundations of Computer Science

LAB A Translating Data to Binary

Hardware Level Organization

Advanced Parallel Architecture Lesson 3. Annalisa Massini /2015

Number Systems Standard positional representation of numbers: An unsigned number with whole and fraction portions is represented as:

Binary Addition. Add the binary numbers and and show the equivalent decimal addition.

l l l l l l l Base 2; each digit is 0 or 1 l Each bit in place i has value 2 i l Binary representation is used in computers

IBM 370 Basic Data Types

Digital Fundamentals

Data Representations & Arithmetic Operations

The type of all data used in a C (or C++) program must be specified

COMPUTER ORGANIZATION AND ARCHITECTURE

Digital Logic. The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer.

Fundamentals of Programming (C)

Numeric Encodings Prof. James L. Frankel Harvard University

Chapter 2 Bits, Data Types, and Operations

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

15110 Principles of Computing, Carnegie Mellon University - CORTINA. Digital Data

ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two 26 February 2014

Signed Binary Numbers

CHW 261: Logic Design

Chapter 4: Computer Codes. In this chapter you will learn about:

Operations, Operands, and Instructions

CPE300: Digital System Architecture and Design

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

Number Systems. Binary Numbers. Appendix. Decimal notation represents numbers as powers of 10, for example

Data Representation 1

Inf2C - Computer Systems Lecture 2 Data Representation

CPE300: Digital System Architecture and Design

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

18. Machine Language. Computer Systems. COMP1917: Computing 1. Machine Language Programming. History of Computer Technology

Harry H. Porter, 2006

Transcription:

SISTEMI EMBEDDED Basic Concepts about Computers Federico Baronti Last version: 20170307

Embedded System Block Diagram Embedded Computer Embedded System Input Memory Output Sensor Sensor Sensor SENSOR CONDITIONING Processor Peripherals DRIVER Actuator Actuator Indicator Device/Equipment to be controlled

Functional Units of a Computer

Instructions and Programs An instruction specifies an operation and the locations of its data operands A 32-bit word typically holds one encoded instruction A sequence of instructions, executed one after another, constitutes a program Both a program and its data are stored in the main memory

Instruction types Four basic instruction types: Load: Read a data operand from memory or an input device into the processor Store: Write a data operand from a processor register to memory or an output device Operate: Perform an arithmetic or logic operation on data operands in processor registers Branch: Alter, if a condition is verified, the sequential execution of the instructions

Program Example A, B, and C, are labels representing memory word addresses; Ri are processor registers A program for the calculation C = A + B is: Load Load Add Store R2, A R3, B R4, R2, R3 R4, C

Main Processor Elements (1) The program counter (PC) register holds the memory address of the current instruction The instruction register (IR) holds the current instruction General-purpose registers hold data and addresses Control circuits and the arithmetic and logic unit (ALU) fetch and execute instructions

Main Processor Elements (2)

Fetching and executing instructions Example: Load R2, LOC The processor control circuits do the following: Send address in PC to memory; issue Read Load instruction from memory into IR Increment PC to point to next instruction Send address LOC to memory; issue Read Load word from memory into register R2

Representation of Information Whatever is the source of information, data are represented by a string of bits (usually in a number multiple of 8, i.e., 1 BYTE) An array of bits directly represents a Natural number in base 2 (positional binary notation) B = b n-1 b 1 b 0 represents the number V(B) = b n-1 x 2 n-1 +... b 1 x 2 1 + b 0 x 2 0 Any other information can be encoded by a Natural using a specific representation E.g. signed numbers, floating point numbers, chars, Representations typically use 1, 2, 4, 8 BYTES

Signed Numbers (1) For signed integers, the leftmost bit (MSB) contains the sign information: 0 for positive 1 for negative There are three ways to represent signed integers: Sign and magnitude 1 s complement 2 s complement (the MSB has weight -2 n-1 )

Signed Numbers (2)

Signed Numbers (3) 2 s-complement representation is used in current computers Consider a four-bit signed integer example, where the value +5 is represented as: 0 1 0 1 To form the value -5, complement all bits of 0 1 0 1 to obtain 1 0 1 0 and then add 1 to obtain 1 0 1 1

Signed Numbers (4) Replicate the sign bit to extend 4-bit signed integers to 8-bit signed integers 0 1 0 1 0 0 0 0 0 1 0 1 1 1 1 0 1 1 1 1 1 1 1 0

Character Encoding American Standard Code for Information Interchange (ASCII) Uses 7-bit codes (extended version 1 BYTE) Some examples: character binary code (decimal, 0x hexadecimal) A 1 0 0 0 0 0 1 (65, 0x41) a 1 1 0 0 0 0 1 (97, 0x61) 0 0 1 1 0 0 0 0 (48, 0x30) 1 0 1 1 0 0 0 1 (49, 0x31) 9 0 1 1 1 0 0 1 (57, 0x39)

Memory Organization Memory consists of many millions of cells Each cell holds a bit of information, 0 or 1 Information is usually handled in larger units: bytes or words A word is a group of n bytes Word length can be 16, 32 or 64 bits Memory can be seen as either a collection of consecutive bytes or words (of the size specified by the word length)

Word and Byte Encoding A common word length is 32 bits Such a word can store a 32-bit signed integer or four 8-bit bytes (e.g., ASCII characters) Words in memory may store data or machine instructions for a program Each machine instruction may require one (or more consecutive words for encoding)

Addresses for Memory Location To store or retrieve items of information, each memory location has a distinct address Numbers 0 to 2 k - 1 are used as addresses for successive locations in the memory The 2 k locations constitute the address space Memory size set by k (number of address bits) Examples: k = 20 2 20 or 1M locations, k = 32 2 32 or 4G locations

Byte Addressability Byte size is always 8 bits But word length may range from 16 to 64 bits A byte-addressable memory assigns an address to each byte Byte locations have addresses 0, 1, 2, Assuming that the word length is 32 bits, word locations have addresses 0, 4, 8,

Big- Little-Endianess Two ways to assign byte address across words Big-endian addressing assigns lower addresses to more significant (leftmost) bytes of word Little-endian addressing uses opposite order Commercial computers use either approach, and some can support both approaches Addresses for 32-bit words are still 0, 4, 8, Bits in each byte labeled b 7 b 0, left to right

Word Alignment # of bytes per word is normally a power of 2 Word locations have aligned addresses if they begin at byte addresses that are multiples of the number of bytes in a word Examples of aligned addresses: 2 bytes per word 0, 2, 4, 8 bytes per word 0, 8, 16, Some computers permit unaligned addresses