Exercise 1: Binary number and hex number

Slides:



Advertisements
Similar presentations
Cache Memory Exercises. Questions I Given: –memory is little-endian and byte addressable; memory size; –number of cache blocks, size of cache block –An.
Advertisements

Number Systems and Codes
Week 3. Assembly Language Programming  Difficult when starting assembly programming  Have to work at low level  Use processor instructions >Requires.
Microprocessors General Features To be Examined For Each Chip Jan 24 th, 2002.
Chapter 2: Memory CEG2400 – Embedded System Design CEG2400 Ch2. Memory V4c1.
Chapter 0 Introduction to Computing
CISCO NETWORKING ACADEMY Chabot College ELEC 74A Hexadecimal Introduction.
CEG 320/520: Computer Organization and Assembly Language Programming1 CEG 320/520 Computer Organization and Assembly Language Programming.
Number Systems and Codes In PLC
Revision Introductory Lesson
Binary and Hexadecimal Numbers
Data Representation Prepared by Dr P Marais (Modified by D Burford)
Lecture 17 Today’s Lecture –Instruction formats Little versus big endian Internal storage in the CPU: stacks vs. registers Number of operands and instruction.
ZONG Wen Department of Computer Science and Engineering The Chinese University of Hong Kong
1 Programming in Machine Language SCSC 311 Spring 2011.
Eng.Samra Essalaimeh Philadelphia University 2013/ nd Semester PIC Microcontrollers.
Lecture Objectives: 1)Define the terms least significant bit and most significant bit. 2)Explain how unsigned integer numbers are represented in memory.
Lecture 8. MIPS Instructions #2 – Memory Access (Load/Store) Instructions Prof. Taeweon Suh Computer Science Education Korea University 2010 R&E Computer.
CS 111 – Sept. 15 Chapter 2 – Manipulating data by performing instructions “What is going on in the CPU?” Commitment: –Please read through section 2.3.
CSNB374: Microprocessor Systems Chapter 1: Introduction to Microprocessor.
Computer Organization – Memory Access David Monismith Jan. 30, 2015 Based upon notes by Dr. Bill Siever and the Patterson and Hennessy Text.
Chapter 2 Number Systems: Decimal, Binary, and Hex.
PIC – ch. 2c. 2.5 PIC Data formats Numbers can be – Hex – Binary – Decimal – ASCII formats.
Data Representation Hexadecimal  Although computers work in binary it is sometimes inconvenient for humans to read everything in Binary. For example in.
UHD:CS2401: A. Berrached1 The Intel x86 Hardware Organization.
DECIMALBINARY a) b) c) d) e) f) Revision Exercise DECIMALBINARY a) b) c)
Computer Organization 1 Instruction Fetch and Execute.
Chapter 2 — Instructions: Language of the Computer — 1 Memory Operands Main memory used for composite data – Arrays, structures, dynamic data To apply.
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.
Comp 335 – File Structures Hexadecimal Dumps Interpreting File Contents.
Byte Addressability Bytes are always 8 bits Word length typically ranges from 16 to 64 bits. Memory location assignments refer to successive byte locations.
CS 125 Lecture 3 Martin van Bommel. Overflow In 16-bit two’s complement, what happens if we add =
The Hexadecimal System is base 16. It is a shorthand method for representing the 8-bit bytes that are stored in the computer system. This system was chosen.
Base 16 (hexadecimal) Uses the decimal digits and the first letters of the alphabet to encode 4 binary bits (16=2 4 ) abcdef or ABCDEF.
First Foray into Programming (the hard way). A reminder from last lesson: A machine code instruction has two parts:  Op-code  Operand An instruction.
Binary Lesson 4a Hexadecimal and Binary Practice2.
Number Systems Decimal Can you write 12,045 in expanded form? Base? Allowable digits for each place?
Programmable Logic Controller
Computer Architecture & Operations I
Computer Architecture & Operations I
Data representation How do we represent data in a digital system?
1. Number Systems.
Programming in Machine Language
Slide design: Dr. Mark L. Hornick
Chapter 4 Addressing modes
2.0 COMPUTER SYSTEM 2.2 Number System and Representation
A Closer Look at Instruction Set Architectures
Number System conversions
Computer Organization and Assembly Language (COAL)
Instruction Formats Each instruction consists of two parts:
CSCI206 - Computer Organization & Programming
Number Systems Base 2, 10, 16.
CSCI206 - Computer Organization & Programming
The University of Adelaide, School of Computer Science
Binary Lesson 3 Hexadecimal
8085 MICROPROCESSOR 8085 CPU Registers and Status Flags S Z AC P C A B
There are 10 types of people of people in this world…
Binary Lesson 3 Hexadecimal
Binary Lesson 3 Hexadecimal
Computer Instructions
MARIE: An Introduction to a Simple Computer
Binary Lesson 3 Hexadecimal
A Closer Look at Instruction Set Architectures
Data representation How do we represent data in a digital system?
Binary Lesson 4 Hexadecimal and Binary Practice
COMS 361 Computer Organization
Binary Lesson 4 Hexadecimal and Binary Practice
Remember the 10 types of people of people in this world…
CS334: MIPS language _Mars simulator Lab 2_1
Data representation How do we represent data in a digital system?
Presentation transcript:

Exercise 1: Binary number and hex number Decimal Hex 0000 0001 1 0010 2 0011 3 0100 4 0101 5 0110 6 0111 7 1000 8 1001 9 1010 10 A 1011 11 B 1100 12 C 1101 13 D 1110 14 E 1111 15 F Exercise 1: Binary number and hex number A binary number can be 1 or 0 4 binary numbers make up a hexadecimal (hex) number (0->F) Exercise1 Convert 3AH into binary . Convert a binary number 100001011100B into hex and decimal.

Exercise2 : A simple program , fill in ‘?’ After power up, first instruction is in 0000H, PC=0000H Address (H=Hex) 8-bit content (data)=instructions (Hex) PC before Running the instruction (hex) PC after 0BC8 Instruction k = 25: (meaning R0<=R0+1) ? … 0AC1 0AC0 Instruction j = 24 (meaning :goto 0BC8) 0001 Instruction 2=xx 0000 Instruction1=2B (meaning : goto 0AC0H)

Exercise 3: Program to find 2+3=?, Fill in ‘?’ PC=program counter; R0=general purpose register 0 Address (H=Hex) 8-bit content (data) The machine code is make up for this example Before the instruction is run After the instruction is run PC R0 0F00 What is the Content after the program is run? 0AD3 3F=stop ? 0AD2 C0=Save R0 into address location 0F00 and clear R0 0AD1 2E=Add 2 to Reg .R0 0AD0 15=Move 3 into Reg. R0 … 0001 0000 2B=Goto address 0AD0 0 (after reset)

Exercise 4: More/less significant bytes Consider the hexadecimal (base 16) 32-bit number 12342A3F(H)=1x167+2x166+3x165+4x164+2x163+10x162+3x161+15x160 This number has four bytes 12, 34, 2A, 3F (4x8=32-bits) Bytes/bits with higher weighting are “more significant” e.g. the byte 34 is more significant than 2A Bytes/bits with lower weighting are “less significant” We also use terms “most significant byte/bit” and “least significant byte/bit” Excise4: For 12342A3F(H) Write the binary number. What is the most significant byte/bit? What is the least significant byte/bit?

Exercise 5, fill in ‘?’ Save 0x2EAB057E in memory starting from 0x4000 Address (data in each address location must be 8-bit) Little endian data Big endian data 0x4000 7E ? 0x4001 0x4002 0x4003