1 / 15

MICROPROCESSORS

MICROPROCESSORS. Yrd. Doç. Dr. Mehmet Ali Aktaş. Memory. The function of a memory is to store information – almost the same as we said for the register .

jacie
Télécharger la présentation

MICROPROCESSORS

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. MICROPROCESSORS Yrd. Doç. Dr. Mehmet Ali Aktaş

  2. Memory • The function of a memory is to store information – almost the same aswe said for the register. • Generally, a register lives within themicroprocessor and stores small quantities of data for immediate useand it can do useful little tricks like shift and rotate. • The ability to remember data after the poweris switched off is the dividing line between the two main types of memory. • If it loses its data when the power is switched off, then we callthe memory RAM or volatile memory. If it can hold on to the datawithout power, we call it ROM or non-volatile memory

  3. Memory • RAM • The letters RAM stands for Random Access Memory • The memory comes in an integrated circuit looking like a smallmicroprocessor and is usually called a memory chip. • Inside, there are a large number of registers, hundreds, thousands, millions dependingon the size of the memory. • So, each of the internal cells may have 4, 8, 16, 32, or 64 bits stored in flip-flops.

  4. Memory • In prehistoric computing days, the memory would be loaded in order.The first group of bits would go into location 0, the next would go intolocation 2, then location 3 and so on rather like a shift register. Thismeant that the time to load or recover the information would increaseas we started to fill the memory and have to move further down thememory. This was called sequential access memory (or serial access memory), abbreviated to SAM. • To overcome this problem, we developed a way to access any memorylocation in the same amount of time regardless of where in thememory it happens to be stored. This system was called random access memory or RAM.

  5. Memory • Accessing memory • Each location in a memory is given a number, called an address. InFigure, the 16 locations of memory would be numbered from0 to 15, or in binary 0000–11112. • The cells are formed into arectangular layout, in this case a 4 x4 square with four columns and four rows. • To use a cell, the row containing the cell must be selected and thecolumn containing the cell must also be activated. The shaded cell inFigure has the address 0110 which means that it is in row 01 and in column 10.

  6. Memory • Two types of RAM • Static RAM • These are constructed of flip-flops. The problem with the flip-flop isthat it draws current all the time. • The benefit is that they are very fast and are used where speedof access is important. Static RAM is often called SRAM. • Dynamic RAM • These store the information in capacitors, which are small componentsthat store an electrical charge in the form of static electricity. • In use, the electricity stored in each capacitor leaks away because of the imperfectinsulation. So, after a little while the charge has to be replacedotherwise the DRAM will be empty and all the stored information willbe lost. This replacing is called ‘refreshing’ and has to be performed atintervals of about 2 ms by a DRAM control circuit.

  7. Memory • Three types of ROM • Programmable ROM (PROM) • This chip is supplied with all the data held at zero by means of smallinternal fuses. When one of the fuses is blown, the associated bitchanges from 0 to 1. To blow the fuses a piece of programming equipment is needed. • Erasable programmable ROM (EPROM) • As the name would suggest, this chip allows us to program it, thenchange our mind and try again. To erase the data there are twomethods – ultraviolet light or electrical voltage pulses. • Electrically erasable programmable ROM (EEPROM) • This chip uses electrical voltage pulses as inputs to clear the previousdata and is then reprogrammed by EPROM programmer

  8. Memory • Pin layout of an EPROM

  9. Pin layout of a SRAM

  10. ProgrammingUsing Machine Code And Assembly • We can use a microprocessor as part of a computer or as part of adynamite process controller and the only essential difference is in theinstructions that it is given. • Since the microprocessor has no intelligence at all, it relies entirely onfollowing a sequence of instructions as we discussed in the fetch–execute cycle. • Each microprocessor has a built-in list ofinstructions that it can understand. This list is called its ‘instruction set’and may consist of about a hundred or so instructions which must beput together in the right order to carry out the function required.

  11. ProgrammingUsing Machine CodeAnd Assembly • Machine code • The binary code that is understood by the microprocessor is calledmachine code and consists of streams of binary bits. They are fed fromthe RAM or ROM memory chips in blocks of 8, 16, 32 or 64depending on the microprocessor in use. • We can investigate the instruction necessary to add two numbers together. Oneof the numbers is already stored in the accumulator or register A. Let’sassume this is the number 25H. • In comes the instruction: 11000110 00010101. It is in two parts, thefirst byte, 11000110, means add the following number to the number stored in the accumulator. • This first byte which contains the instructionis called the operation code, usually abbreviated to ‘op code’. Thesecond byte, 00010101, is the number 15H.

  12. ProgrammingUsing Machine CodeAnd Assembly • The problems with machine code • There are so many. The program is not friendly: 1100011000010101 hardly compares with ‘Add 15H to the number 25H’ foreasy understanding. There is nothing about 11000110 whichreminds us of its meaning ‘add the following number to the numberstored in the accumulator’ so a program would need to belaboriously decoded byte by byte. • Typing in streams of ones and zeros is so boring that we will makemany mistakes, particularly when we remember that a real programmay be ten thousand times longer than this.

  13. ProgrammingUsing Machine CodeAnd Assembly • Assembly language, the second generation language • Assembly language was designed to do the same work as machinecode but be much easier to use. It replaced all the ones and zeros withletters that were easier to remember but it is still a low-level language. • The assembly equivalent of our machine code example 1100011000010101 is the code ADD A,m. This means ‘add any nuMber ,m tothe value stored in the accumulator. We can see immediately that itwould be far easier to guess the meaning of ADD A,m than 1100011000010101 and so it makes programming much easier. • SLA E for shift to the left, the contents of register E. • LD B 25H load the B register with the number 25H.

  14. ProgrammingUsing Machine CodeAnd Assembly • Now see how easy it makes it by guessing the meaning of these: • INC H • LD C 48H • Finally, have a go at one that we have not considered yet. • LD B B • If SLA E means shift the contents of register E one place to the left, thenSRA E means shift the bits one place to the right. LD C 48H means putthe number 48H into the C register. LD B B enables us to copy thenumber stored in the B register into the B register.

More Related