20
D75P 34 – HNC Computer Architecture Interim Week Hexadecimal revisited! © C Nyssen/Aberdeen College 2003 All images © C Nyssen/Aberdeen College except where stated Clipart on slide 2 © www.clipart.com with non-distribution licence Prepared 29/9/03

D75P 34 – HNC Computer Architecture Interim Week Hexadecimal revisited! © C Nyssen/Aberdeen College 2003 All images © C Nyssen/Aberdeen College except

Embed Size (px)

Citation preview

Page 1: D75P 34 – HNC Computer Architecture Interim Week Hexadecimal revisited! © C Nyssen/Aberdeen College 2003 All images © C Nyssen/Aberdeen College except

D75P 34 – HNC Computer Architecture

Interim Week

Hexadecimal revisited!

© C Nyssen/Aberdeen College 2003All images © C Nyssen/Aberdeen College except where statedClipart on slide 2 © www.clipart.com with non-distribution licencePrepared 29/9/03

Page 2: D75P 34 – HNC Computer Architecture Interim Week Hexadecimal revisited! © C Nyssen/Aberdeen College 2003 All images © C Nyssen/Aberdeen College except

In order to complete the Memory Map

assessment question, you must first be very, very

familiar with decimal – hexadecimal conversions.

Page 3: D75P 34 – HNC Computer Architecture Interim Week Hexadecimal revisited! © C Nyssen/Aberdeen College 2003 All images © C Nyssen/Aberdeen College except

Hexadecimal means a “number base” of 16, from “hex” meaning 6, and “decimal”, meaning 10. It is used solely as a convenient translation “language” from the computer’s native counting language – binary – to ours, decimal.

So although a computer “thinks” in binary, it displays the results in hex!

Page 4: D75P 34 – HNC Computer Architecture Interim Week Hexadecimal revisited! © C Nyssen/Aberdeen College 2003 All images © C Nyssen/Aberdeen College except

The ancient Egyptians used 12….

The Greeks and Arabs used 10…

The Romans did not use number bases at all! So although they were good at building, painting and administration, they never

developed complex mathematical systems as the Greeks and Arabs

did.

The Ancient Babylonians used number bases of 60….

Page 5: D75P 34 – HNC Computer Architecture Interim Week Hexadecimal revisited! © C Nyssen/Aberdeen College 2003 All images © C Nyssen/Aberdeen College except

We already saw that computers are very basic things – they can only recognise two states, thus giving us the term “binary”.

They can accomplish quite a lot with just two states, though – combinations of binary digits can be used to represent ….

Page 6: D75P 34 – HNC Computer Architecture Interim Week Hexadecimal revisited! © C Nyssen/Aberdeen College 2003 All images © C Nyssen/Aberdeen College except

Numbers…..

… Letters …

Colours …

…and many other things besides!

Page 7: D75P 34 – HNC Computer Architecture Interim Week Hexadecimal revisited! © C Nyssen/Aberdeen College 2003 All images © C Nyssen/Aberdeen College except

Unfortunately for us, although computers can handle large strings of similar looking numbers…..

…the human eye gets very confused when presented with large groups of identical-looking objects!

Page 8: D75P 34 – HNC Computer Architecture Interim Week Hexadecimal revisited! © C Nyssen/Aberdeen College 2003 All images © C Nyssen/Aberdeen College except

This is part of a program written for one of the first electronic computers, the Manchester Mark 1, in 1948.

In those days all programming was done in binary. This was very tedious and prone to lots of errors!

Page 9: D75P 34 – HNC Computer Architecture Interim Week Hexadecimal revisited! © C Nyssen/Aberdeen College 2003 All images © C Nyssen/Aberdeen College except

So nowadays we convert the binary stored by the computer into hex, to make it easier to read and understand.

1101 1111 0000 0100

Page 10: D75P 34 – HNC Computer Architecture Interim Week Hexadecimal revisited! © C Nyssen/Aberdeen College 2003 All images © C Nyssen/Aberdeen College except

To convert a decimal number – 7896532 - to

hexadecimal …

…start by dividing by 16 …

…and continue until you run out of numbers.

(When dividing, just do the whole numbers,

ignore the remainders for the moment…)

Page 11: D75P 34 – HNC Computer Architecture Interim Week Hexadecimal revisited! © C Nyssen/Aberdeen College 2003 All images © C Nyssen/Aberdeen College except

Now we turn our attention to the remainders – multiply them all by 16 to get the red column on the right…..…read from the BOTTOM UP to get 787DD4h …

…or 0111 1000 0111 1101 1101 0100 in binary!

Page 12: D75P 34 – HNC Computer Architecture Interim Week Hexadecimal revisited! © C Nyssen/Aberdeen College 2003 All images © C Nyssen/Aberdeen College except

To convert from hex - DC0Fh - to decimal, you have to do some multiplying ….

Hexadecimal number base – powers of 16.

65536’s 4096’s 256’s 16’s 1’s

         

  D or 13 C or 12 0 F or 15

(13 x 4096) + (12 x 256) + (0 x 16) + (15 x 1) = 56,335.

The binary equivalent would be 1101 1100 0000 1111.

Page 13: D75P 34 – HNC Computer Architecture Interim Week Hexadecimal revisited! © C Nyssen/Aberdeen College 2003 All images © C Nyssen/Aberdeen College except

1. Work out how much memory can be addressed. This is always 2 number of address lines.

The top address will always be this number – 1.

When writing your memory map, you can follow this sequence ….

Page 14: D75P 34 – HNC Computer Architecture Interim Week Hexadecimal revisited! © C Nyssen/Aberdeen College 2003 All images © C Nyssen/Aberdeen College except

2. Notice how big the memory locations are. (They might not always be one byte!) This could be important when working out sizes later.

Draw a column and label it from 0 – top address.

Page 15: D75P 34 – HNC Computer Architecture Interim Week Hexadecimal revisited! © C Nyssen/Aberdeen College 2003 All images © C Nyssen/Aberdeen College except

3. Now begin to fill in the bits. The question might take different forms.

“Bootstrap code begins at 0 and uses 32 bytes. Assume 1 byte per address.”

Starting from 0, the top address will be NOT 32 but 31. Remember 0 counts as a number!

Page 16: D75P 34 – HNC Computer Architecture Interim Week Hexadecimal revisited! © C Nyssen/Aberdeen College 2003 All images © C Nyssen/Aberdeen College except

“I/o starts from 30h and uses 64 bits. Assume 2 bytes per address”

Conversions …

8 bits in a byte (nowadays!) 1024 bytes in a kilobyte 1024 kilobytes in a megabyte

This block uses 8 bytes, and each address uses 2 bytes. So the actual locations used will be 30h to 33h!

Page 17: D75P 34 – HNC Computer Architecture Interim Week Hexadecimal revisited! © C Nyssen/Aberdeen College 2003 All images © C Nyssen/Aberdeen College except

“The top 32 kb are used for the algorithm. Assume

16 address lines and 1 byte per address.”

The top address will be (216 – 1) = 65535, or

FFFFh.

32kb is equivalent to (32 x 1024) = 32768 bytes, or

locations.

Counting down, this gives us a starting point of

32768, or 8000h.

Page 18: D75P 34 – HNC Computer Architecture Interim Week Hexadecimal revisited! © C Nyssen/Aberdeen College 2003 All images © C Nyssen/Aberdeen College except

Note that if the space occupied is an even number of addresses, and it starts from an odd number, it must always end on an even one (and vice versa).

Page 19: D75P 34 – HNC Computer Architecture Interim Week Hexadecimal revisited! © C Nyssen/Aberdeen College 2003 All images © C Nyssen/Aberdeen College except

Remember to label all your used blocks and free space!

The essential bits…

The top address must be correct!

There will be at least two contiguous blocks.

There must be a full set of hex or decimal figures.

Page 20: D75P 34 – HNC Computer Architecture Interim Week Hexadecimal revisited! © C Nyssen/Aberdeen College 2003 All images © C Nyssen/Aberdeen College except

Summary

Although computers store things as binary values, they display things in hexadecimal.

This is important when describing a Memory Map.

The top address will be (2address bus width – 1).

Fill in the used memory as directed in the question.

Finally, label all the used blocks and free space.