Data representation How do we represent data in a digital system?

Slides:



Advertisements
Similar presentations
CS/COE0447 Computer Organization & Assembly Language
Advertisements

IT253: Computer Organization Lecture 6: Assembly Language and MIPS: Programming Tonga Institute of Higher Education.
CS2100 Computer Organisation MIPS Part III: Instruction Formats (AY2014/2015) Semester 2.
Instruction Representation II (1) Fall 2007 Lecture 10: Instruction Representation II.
The Control Unit. The Instruction Register The Instruction Formats The Register Type (R type) Fields AND RD, RS, RT -- #and(RS,RT) -> RD.
Lecture 5 Sept 14 Goals: Chapter 2 continued MIPS assembly language instruction formats translating c into MIPS - examples.
Instruction Representation II (1) Fall 2005 Lecture 10: Instruction Representation II.
What is an instruction set?
ECE 4436ECE 5367 ISA I. ECE 4436ECE 5367 CPU = Seconds= Instructions x Cycles x Seconds Time Program Program Instruction Cycle CPU = Seconds= Instructions.
CS 300 – Lecture 6 Intro to Computer Architecture / Assembly Language Instructions.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
Instruction Set Architecture
Lecture Objectives: 1)Define the terms least significant bit and most significant bit. 2)Explain how unsigned integer numbers are represented in memory.
1 Computer Architecture COSC 3430 Lecture 3: Instructions.
Chapter 2-2 Assembly Instructions Number Systems Number Systems Assembly Instructions Assembly Instructions Branch Branch Next Lecture Next Lecture  Addressing.
Computer Organization and Architecture Instructions: Language of the Machine Hennessy Patterson 2/E chapter 3. Notes are available with photocopier 24.
Computer Architecture CSE 3322 Lecture 2 NO CLASS MON Sept 1 Course WEB SITE crystal.uta.edu/~jpatters.
Computer Architecture CSE 3322 Lecture 3 Assignment: 2.4.1, 2.4.4, 2.6.1, , Due 2/3/09 Read 2.8.
EET 4250 Instruction Representation & Formats Acknowledgements: Some slides and lecture notes for this course adapted from Prof. Mary Jane Penn.
Chapter 2 — Instructions: Language of the Computer — 1 Memory Operands Main memory used for composite data – Arrays, structures, dynamic data To apply.
Data Representation. How is data stored on a computer? Registers, main memory, etc. consists of grids of transistors Transistors are in one of two states,
Address alignment When a word (4-bytes) is loaded or stored the memory address must be a multiple of four. This is called an alignment restriction. Addresses.
CS 125 Lecture 3 Martin van Bommel. Overflow In 16-bit two’s complement, what happens if we add =
Assembly Variables: Registers Unlike HLL like C or Java, assembly cannot use variables – Why not? Keep Hardware Simple Assembly Operands are registers.
COMPUTER ARCHITECTURE & OPERATIONS I Instructor: Yaohang Li.
Memory, Bits, & Bytes. Memory Part of the computer where programs and data are stored. Read and written (changed). Bit – Binary digit – Basic unit of.
Memory Access Instructions Load and Store Addressing Modes Memory Addressing. Base addressing mode. Load byte and store byte: lb, lbu, sb Address alignment.
23/07/2016CSE1303 Part B lecture notes 1 Introduction to computer systems Lecture B01 Lecture notes section B01.
Number Systems Decimal Can you write 12,045 in expanded form? Base? Allowable digits for each place?
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
MIPS Arithmetic is 32 bits
Computer Architecture & Operations I
Computer Architecture & Operations I
Data representation How do we represent data in a digital system?
Memory Access Instructions
Example Addiu $t1 $r0 3 Addiu $t1 $t1 5 Addiu $t1 $t1 7.
A Closer Look at Instruction Set Architectures
COMPUTER ARCHITECTURE & OPERATIONS I
Morgan Kaufmann Publishers
MIPS Coding Continued.
Lecture 4: MIPS Instruction Set
A Closer Look at Instruction Set Architectures
The University of Adelaide, School of Computer Science
Lecturer PSOE Dan Garcia
Computer Architecture & Operations I
CSCI206 - Computer Organization & Programming
MIPS coding.
Single-Cycle CPU DataPath.
Computer Organization and ASSEMBLY LANGUAGE
Systems Architecture I (CS ) Lecture 5: MIPS Instruction Set*
CSCI206 - Computer Organization & Programming
The University of Adelaide, School of Computer Science
Computer Architecture & Operations I
MIPS Instruction Encoding
MIPS Instruction Encoding
ECEG-3202 Computer Architecture and Organization
Chapter 9 Instruction Sets: Characteristics and Functions
Computer Instructions
Computer Architecture
ECEG-3202 Computer Architecture and Organization
The University of Adelaide, School of Computer Science
COMS 361 Computer Organization
Introduction to Microprocessor Programming
The branch instruction
MIPS Instruction Set Architecture
MIPS Coding Continued.
MIPS coding.
Data representation How do we represent data in a digital system?
Systems Architecture I (CS ) Lecture 5: MIPS Instruction Set*
Chapter 10 Instruction Sets: Characteristics and Functions
Presentation transcript:

Data representation How do we represent data in a digital system? Digital data is stored as bits: a bit is a binary number {0, 1} in a hardware design this is usually interpreted as 0 Volt, GND {5, 3.3, 1.8, … } Volt, VCC

String of bits! Everything we work with is represented as a string of bits. Example: We don't work with integers! We represent (encode) integers as strings of bits and manipulate those. 1 0 1 0 (binary) represents 1*23 + 0*22 + 1*21 + 0*20 (decimal) 8 + 0 + 2 + 0 = 10 (decimal)

Ask yourself: How many bits are required to represent this thing? How can we do it? We need to structure the information.

Word, halfword and byte “The word: 32 bits”. “The halfword: 16 bits”. “The byte: 8 bits”. 31 High order bit Low order bit 15 7

“The Space” We can group a large number of bit strings into an array called a space. We use at least three spaces: the register space. the instruction space. the data space. Do not confuse them!

The Register Space (or Register “file”) An array of words. Smallest addressable unit is the word. 32 choices, how do we select? 2x = 32, x? x=5 i.e., we need 5 bits! 1 2 3 29 30 31

Address To work with a space we must be able to address the elements of the space. Each space may have a different address method.

The Instruction space (or instruction memory) An array of bytes. Smallest addressable unit is a byte, but the smallest accessible unit is a word. 232 bytes gives 230 accessible words.

What's that mean? An instruction address is 32 bits long. Same as a word. An instruction address fits into a word!

But: Only every fourth address is legal. The ones whose last two bits are “00”. We can access 230 instructions.

Instruction memory 1 Address “4”: 0000........00100 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Address “4”: 0000........00100 Hardware accesses an entire 32-bit word.

Instruction memory 2 Address "3": 0000........00011 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Address "3": 0000........00011 The hardware will complain! This is called an “alignment error”. The address was not “word aligned”.

Byte order Big endian Little endian Byte 0 Byte 1 Byte 2 Byte 3 Addr 0

Instruction memory 3 An instruction is represented by 32 bits. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 An instruction is represented by 32 bits. There are two “instruction formats”. (Not the whole truth, but don't worry about it)

Instruction formats Remember: 6 bits 5 5 5 Format 1 (reg) Opcode rs rt rd 6 bits 5 5 16 Format 2 (imm) Opcode rs rt Immediate Remember: Never immediate field together with rd-field. Immediate field is only 16 bits!

“Data space” 232 bytes, byte addressable, byte accessible. A data address fits into 32 bits. Halfword accesses must be halfword aligned; (low order bit = 0). Word accesses must be word aligned; (low order 2 bits = 0).

Review - How many bits?? Instruction address ? Instruction ? Immediate field ? Register address ? Register ? Data address ? Data ?

Review - How many bits?? Instruction address 32, word aligned Immediate field 16 Register address 5 Register 32 Data address 32, byte aligned Data 8 (byte) 16 (halfword) 32 (word)

Feedback from the lectures: Questions? Feedback from the lectures: Per.Lindgren@ltu.se