Thread: microprocessor

  1. #1
    DESTINY BEN10's Avatar
    Join Date
    Jul 2008
    Location
    in front of my computer
    Posts
    804

    microprocessor

    Hello all,
    I dont know why I always get stuck in the microprocessors things. I'm having a course of 8086 microprocessor. I ahve following questions. Please answer them in detail-
    1. The address bus is of 20 bits, so this means that 8086 can access 1M of memory. I dont understand what this means. Does this mean that we can attach 1M of RAM to it? Please explain in detail as if you are explaining a real stupid. Really I'm a real noooooooooob when it comes to deal with memory and registers.
    2. Why does the 8086 need 4 segment registers of 64K? I've also read 8085 but there was no need of such segment registers.
    I have gone through my book and few websites but none of them explains the memory part in detail.
    Thanks
    HOPE YOU UNDERSTAND.......

    By associating with wise people you will become wise yourself
    It's fine to celebrate success but it is more important to heed the lessons of failure
    We've got to put a lot of money into changing behavior


    PC specifications- 512MB RAM, Windows XP sp3, 2.79 GHz pentium D.
    IDE- Microsoft Visual Studio 2008 Express Edition

  2. #2
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    BEN10 you know our policy here about homework!

    But since I don't actually know the answer for a fact, I will give you a clue about what I would guess (in an educated way) for #1: How big can an (unsigned) int be if it is 20 bits long? In other words, what is the largest number you can represent with 20 bits, if the smallest is 0x0?

    A much less educated guess for #2 has something to do with the number of instruction pointers maintained by the processor.
    Last edited by MK27; 09-10-2009 at 11:19 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  3. #3
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    In each case, the limit is because you have a binary number of a certain length stored in a certain device. The maximum value of that number is how much memory that device can address.

  4. #4
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    An 8086 wired in Harvard configuration can address 4MB of memory, warning this is an advanced configuration used (AFAIK) only in embedded designs and your instructor is unlikely to have even heard of it, so I wouldn't mention it in class. 4 segment registers are needed because, well, they aren't really needed, they just make the processor more flexible.

  5. #5
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065
    A couple of keywords to search for would be "Protected mode", "Gate A20", and snot, it left. About 3 years ago I had to write a boot loader for an i486 clone. I actually _had_ to learn all that crap to get it to work, however, I cannot recall what any of the terminology means at the moment.

  6. #6
    DESTINY BEN10's Avatar
    Join Date
    Jul 2008
    Location
    in front of my computer
    Posts
    804
    @MK27
    This is not a homework I'm not asking for someone to code something for me. I'm just asking for make the concepts clear to me. And yes I do know that 2^20=1M, but what I dont understand is what this means? The resources say that it can address 1MB of memory, here is where I get confused.
    So, please if somebody know it better help me in understanding it.
    HOPE YOU UNDERSTAND.......

    By associating with wise people you will become wise yourself
    It's fine to celebrate success but it is more important to heed the lessons of failure
    We've got to put a lot of money into changing behavior


    PC specifications- 512MB RAM, Windows XP sp3, 2.79 GHz pentium D.
    IDE- Microsoft Visual Studio 2008 Express Edition

  7. #7
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by BEN10 View Post
    @MK27
    This is not a homework I'm not asking for someone to code something for me. I'm just asking for make the concepts clear to me. And yes I do know that 2^20=1M, but what I dont understand is what this means? The resources say that it can address 1MB of memory, here is where I get confused.
    So, please if somebody know it better help me in understanding it.
    Do you mean why is the size of the address space equal to 2^N where N is the number of address bits? That's because with N bits it is possible to describe 2^N possible values. We can use each of those values to refer to a byte of memory so that each byte has its own address.

    Or are you confused about how a 16-bit segment address and a 16-bit segment offset combine to produce a 20-bit address? That's an oddity peculiar to real mode x86.

    If an address is given as SEGMENT:OFFSET, then the absolute physical address is SEGMENT*16 + OFFSET. You should be able to see that there is more than one way to refer to the same physical address. The address 0x0001:0000 and the address 0x0000:0010 both refer to physical address 0x10, because 1*16+0 == 16 and also 0*16+16 == 16.

    This produces a huge overlap in the address space such that each byte of memory can be addressed in 4096 different ways. These 4096 ways represent a redundancy in the address space of 12 bits (2^12 == 4096). Thus, although you have 32 bits of address, you lose 12 bits because of this overlapping, resulting in (effectively) a 20-bit address space.

    Edit: If you're observant you notice that there are some addresses which don't have 4096 different ways of addressing them. For instance, physical address 0x0 can only be written as 0x0000:0000. This might lead you to wonder where these "missing" addresses have gone. In fact, they appear at the very top of the address space as an extra 64k (okay, actually 65519 bytes) of memory you can access beyond the 1M barrier. I only mention this because I'm sure abachler will point it out if I don't
    Last edited by brewbuck; 09-10-2009 at 10:02 PM.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  8. #8
    DESTINY BEN10's Avatar
    Join Date
    Jul 2008
    Location
    in front of my computer
    Posts
    804
    Thanks brewbuck for a helpful reply. What I'm asking is that what do they mean when they say that the microprocessor can address 1M(for 20bitaddress bus) or 64K(for 16 bit) of memory. Could you elaborate this one please. I know how do they get it(2^20 or 2^16), but I dont undertsand what is actually its meaning. In some places they say it can address 1M of memory and in other places they say it can address 1MByte of meomory(why not 1Mbit)? I hope now my question is clear.
    EDIT: My second question is why is their a need of segment registers in 8086, why not a full 20bit address rather than dividing the address in 4segments?
    Last edited by BEN10; 09-10-2009 at 10:08 PM.
    HOPE YOU UNDERSTAND.......

    By associating with wise people you will become wise yourself
    It's fine to celebrate success but it is more important to heed the lessons of failure
    We've got to put a lot of money into changing behavior


    PC specifications- 512MB RAM, Windows XP sp3, 2.79 GHz pentium D.
    IDE- Microsoft Visual Studio 2008 Express Edition

  9. #9
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Well, either 1 M or 1 Mbyte or 1 megabyte all mean the same thing -- 1048576 ( == 2^20 ) bytes.

    There are several reasons why addresses refer to bytes instead of bits. For one, each bit having its own address doesn't turn out to be helpful in practice (i.e. it makes it more difficult to write programs). It also reduces the amount of RAM that could be addressed by a given number of address bits.

    On the other hand, why don't addresses refer to 32-bit quantities instead of 8-bit quantities (for instance)? Well, there ARE some machines like that. The advantage is that you get a larger memory (4 times what you could address with byte addressing). The disadvantage is that types which are less than 32 bits large are more difficult to manipulate (the C type 'char' would be very inefficient for instance).

    Of course, all molds are broken, and I'm sure there are machines out there where each bit has its own address.

    EDIT: To be clear, the memory is not divided into four segments, the processor's VIEW of the memory is divided because it only has four segment registers. As for why the addressing is not directly 20-bit, it's a complicated thing. For one, having these overlapping segments is actually convenient in many ways. It means that data can be divided up into 64k-sized chunks and moved around in memory. It's sort of like a primitive form of virtual memory but without any protection. For another, the architecture was inherently 16-bit, and it would have been inefficient to have 20-bit address values flowing through the processor -- especially so because most applications would never need to use that much memory to begin with.

    It's weird how this stuff all made so much sense back when it was widely used, and these days people (quite rightly) ask questions like this.
    Last edited by brewbuck; 09-10-2009 at 10:20 PM.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  10. #10
    DESTINY BEN10's Avatar
    Join Date
    Jul 2008
    Location
    in front of my computer
    Posts
    804
    This is what I found on one of the websites:
    The 'width' of the address bus (i.e. the number of signals (bits) that comprise it) determine how much memory can be addressed. Hence, if you have a 16-bit address bus, you can represent a number (in binary) up to 2^16 (=65536) possible values (actually the range used is 0-65535), so you can individually refer to 65536 different memory addresses, or 64K of memory*.

    (* This is actually not strictly the case; when people refer to '64k of memory' they mean 64k bytes (8-bit values) of memory. If you've got a 16-bit address bus (so 65536 possible address) and a 16-bit data bus, you can still address 65536 different physical memory locations, but each one is a 16-bit value. As a 16-bit value can also be considered as two 8-bit bytes, you can address 128k(bytes) of actual memory with this setup)
    What does the footnote mean?
    HOPE YOU UNDERSTAND.......

    By associating with wise people you will become wise yourself
    It's fine to celebrate success but it is more important to heed the lessons of failure
    We've got to put a lot of money into changing behavior


    PC specifications- 512MB RAM, Windows XP sp3, 2.79 GHz pentium D.
    IDE- Microsoft Visual Studio 2008 Express Edition

  11. #11
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by BEN10 View Post
    This is what I found on one of the websites:

    What does the footnote mean?
    It means what I said in the third paragraph of my previous post.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  12. #12
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    I don't understand why you are so confused. You know what an address is, right, eg, a pointer address? Notice the units with malloc are integer bytes. If I have a million possible addresses, then I can access up to 1M of memory.

    The address bus delivers an address to the processor. If it is 20-bits wide, that is an observation about a physical characteristic of the bus: it's a pathway thru which a simultaneous "sequence" of bits flows (ie, they do not actually occur one after the other, 010101001, they occur all at once, in a row, 20 of them). If one such row is a memory address, and the addresses are integers, the range of addresses will be from 0 to 2^20-1. Even if there are a million gigabytes hooked up to the processor, it can only make use of 1Mb because it cannot processes addresses for any more than that.

    I suppose you could make each unit of memory larger, but then you would have to write software exclusively for such an arrangement (I think), because as you know from programming, it is fundamental that one address refer to one byte, 8 bits. Although the address of each byte actually requires 20 bits to store (in the 8086), of course they actually are not stored anywhere, they are abstractions that refer to places in physical memory.
    Last edited by MK27; 09-11-2009 at 08:12 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  13. #13
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    This discussion is bringing back terrible memories of having to bank switch to access a frame buffer that was larger than 64k. Real mode was just awful and we stayed in it for way way too long. Intel had protected mode as of the 386 and yet we really didn't use it all that much until the Pentium 1 when W95 came out. The 486 actually had a very good protected mode and games frequently made use of it via Rational Systems DOS4GW extender or some other extender....but the OS was sadly all in real mode. Also brings back memories of EMM386 (EMS) and HIMEM.SYS (XMS) and the awful re-entrancy problems in DOS. Only good thing about those days is that they are gone.

    This also made memory configs a huge mess. There was barely enough room for MSCDEX, your mouse, sound, and other drivers in upper memory.

  14. #14
    DESTINY BEN10's Avatar
    Join Date
    Jul 2008
    Location
    in front of my computer
    Posts
    804
    Quote Originally Posted by MK27 View Post
    Even if there are a million gigabytes hooked up to the processor, it can only make use of 1Mb because it cannot processes addresses for any more than that.
    That's what my question is, what's get "hooked" up with the processor to make use of the 1MB of memory. Is it RAM of 1MB size? The various places of RAM is given addresses varying from 00000H uptill 1MB and whatever is stored in these addresses gets executed by our system. Is this true?
    Last edited by BEN10; 09-11-2009 at 10:17 PM.
    HOPE YOU UNDERSTAND.......

    By associating with wise people you will become wise yourself
    It's fine to celebrate success but it is more important to heed the lessons of failure
    We've got to put a lot of money into changing behavior


    PC specifications- 512MB RAM, Windows XP sp3, 2.79 GHz pentium D.
    IDE- Microsoft Visual Studio 2008 Express Edition

  15. #15
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by BEN10 View Post
    That's what my question is, what's get "hooked" up with the processor to make use of the 1MB of memory. Is it RAM of 1MB size? The various places of RAM is given addresses varying from 00000H uptill 1MB and whatever is stored in these addresses gets executed by our system. Is this true?
    The physical memory is connected to the processor via the system bus. Looks to me like the address bus is considered part of the system bus:

    system bus demonstration (ROM and RAM)

    The RAM is connected to the north bridge on the mother board, and the north bridge connects to the processor via the system bus, also called the Front Side Bus. If you look at your motherboard, the processor, the north bridge, and the RAM are very easy to see (the north bridge has a big square heat sink on it, like the processor, but less elaborate).

    This is a FSB chip, I believe. So the "address bus" is part of it. I also figure each of the little pin legs represents a one bit pathway, in which case you can see how all the bits line up. But I don't know that for sure.
    Last edited by MK27; 09-12-2009 at 06:40 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. assembly for M8 microprocessor series
    By GanglyLamb in forum Tech Board
    Replies: 3
    Last Post: 03-15-2006, 05:34 PM
  2. What's cooler than free boobs? 5 free assembly books from AMD.
    By Silvercord in forum A Brief History of Cprogramming.com
    Replies: 47
    Last Post: 02-13-2003, 08:22 PM
  3. Replies: 8
    Last Post: 01-30-2003, 04:29 PM
  4. a microprocessor thing!
    By badhri in forum C Programming
    Replies: 8
    Last Post: 05-29-2002, 10:58 AM
  5. Replies: 9
    Last Post: 03-13-2002, 10:46 AM