Presentation is loading. Please wait.

Presentation is loading. Please wait.

Exercise 1: Binary number and hex number

Similar presentations


Presentation on theme: "Exercise 1: Binary number and hex number"— Presentation transcript:

1 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 B into hex and decimal.

2 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)

3 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)

4 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?

5 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


Download ppt "Exercise 1: Binary number and hex number"

Similar presentations


Ads by Google