#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2007
    Posts
    41
    Rep Power
    8

    Question How to calculate physical address?


    Can anyone help me calculate a physical address for a memory location? I know the bus width (BW), segment address (SA), and logical address (LA).

    Memory location #1: BW - 12 bits, SA - A5h, LA - 09h

    Memory location #2: BW - 20 bits, SA - 2E1h, LA - 81Bh

    The SA and LA have to be represented by numbers the size of a register (WORDs) and the final answer has to be in hex. Thanks.
  2. #2
  3. Trapped on the forums...help
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2003
    Location
    /Users/edman007
    Posts
    4,617
    Rep Power
    905
    homework?

    you should Google that yourself, no one is going to do your homework, you should know what it is

    BTW, you haven't given enough information, that stuff is highly architecture dependent, so i would suggest reading some documentation for that architecture, but since this sounds like a homework problem i'm going to say just look at your notes from class and/or google it. its not hard to figure out and having someone do it for you isn't going to help you learn
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2007
    Posts
    41
    Rep Power
    8

    Exclamation


    Originally Posted by edman007
    homework?

    you should Google that yourself, no one is going to do your homework, you should know what it is

    BTW, you haven't given enough information, that stuff is highly architecture dependent, so i would suggest reading some documentation for that architecture, but since this sounds like a homework problem i'm going to say just look at your notes from class and/or google it. its not hard to figure out and having someone do it for you isn't going to help you learn
    Well, if I haven't given enough information, then it must be a trick question because I mentioned everything.

    I'm not asking you to do it. I'm asking for help to do it.

    Here is what I have in my notes:

    20-bit physical address
    SA - 1280h (0001 0010 1000 0000)
    LA - 0321h (0000 0011 0010 0001)

    So, 0001 0010 1000 0000 0000 (012800h)
    + 0000 0011 0010 0001 ( 0321h)
    =0001 0010 1011 0010 0001 (012B21h)

    Why was an extra set of 0000 added to the SA?

    What does adding the SA and LA have to do with it? That must be the physical address, right?

    Also, what does the bus width have to do with anything? It doesn't seem to come up in my notes.

    Can you help me with that at least? Thanks.
  6. #4
  7. Trapped on the forums...help
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2003
    Location
    /Users/edman007
    Posts
    4,617
    Rep Power
    905
    showing that helps

    the segment register is a register containing part of the address, its only the higher order bits, then the logical address is the lower order bits of the address, the two numbers are combined to give you a final address that can be used to access the RAM

    its needed because you may be working on say a 16-bit system but have 1MB of RAM (an 8088 is like this..i think), a 16-bit system is not capable of addressing more then 64k of memory, if you want to access 1MB of memory you need 20 bits, this is where the SA register comes in, the upper bits are stored in SA and the lower bits go in the LA, when you access memory you move the SA into a bus-width register (not accessible to the program, so not really a register), then shift it to the left so that its upper most bit is the upper most bit of the SA is the upper most bit in the bus-width register, then you add the LA into the bus-width register and use this 20-bit register for the RAM address

    so the bus width is important because it tells you how far to shift to the left, in your last example


    SA - 0x1280
    LA - 0x0321

    --the bus is 20 bits, so it looks like this

    0x000000
    0x1280 -- SA that space needs to get filled with zeros
    after you aligned it up on the left (20-16 = 4 bits on the right of it)

    0x12800
    +0x00321 -- LA this is right aligned
    ---------------------
    0x12B21 -- your final answer

    Comments on this post

    • aitken325i agrees
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2007
    Posts
    41
    Rep Power
    8
    Originally Posted by edman007
    showing that helps

    the segment register is a register containing part of the address, its only the higher order bits, then the logical address is the lower order bits of the address, the two numbers are combined to give you a final address that can be used to access the RAM

    its needed because you may be working on say a 16-bit system but have 1MB of RAM (an 8088 is like this..i think), a 16-bit system is not capable of addressing more then 64k of memory, if you want to access 1MB of memory you need 20 bits, this is where the SA register comes in, the upper bits are stored in SA and the lower bits go in the LA, when you access memory you move the SA into a bus-width register (not accessible to the program, so not really a register), then shift it to the left so that its upper most bit is the upper most bit of the SA is the upper most bit in the bus-width register, then you add the LA into the bus-width register and use this 20-bit register for the RAM address

    so the bus width is important because it tells you how far to shift to the left, in your last example


    SA - 0x1280
    LA - 0x0321

    --the bus is 20 bits, so it looks like this

    0x000000
    0x1280 -- SA that space needs to get filled with zeros
    after you aligned it up on the left (20-16 = 4 bits on the right of it)

    0x12800
    +0x00321 -- LA this is right aligned
    ---------------------
    0x12B21 -- your final answer
    Are these right? Are the LA right?


    5.a

    BW (12 bits)
    SA (A5h) 1010 0101
    LA (09h) 1001

    1010 0101 0000 0000 (0xA500)
    + 1001 (0x9h) <=== Is this right?

    1010 0101 0000 1001 (0xA509)

    5.b

    BW (20 bits)
    SA (2E1h) 0010 1110 0001
    LA (81Bh) 1000 0001 1011

    0010 1110 0001 0000 0000 (0x2E1)
    + 1000 0001 1011 (0x81B) <=== Is this right?

    0010 1110 1001 0001 1011 (0x2E91B)

    Thank you for your help. I really appreciate it.
  10. #6
  11. Trapped on the forums...help
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2003
    Location
    /Users/edman007
    Posts
    4,617
    Rep Power
    905
    Originally Posted by JWest46088
    Are these right? Are the LA right?



    5.a)
    BW (12 bits) <-- your bus width is 12 bits, that means that your answer MUST be 12 bits, so right away i can tell your answer is wrong

    both the SA and the LA are 8 bits, your bus is 12 bits, so you need to add four bits to each, shift the SA to the left by 4 bits, and leave the LA as is, add them up, what you have you shifted SA too much

    5.b looks right to me
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2007
    Posts
    41
    Rep Power
    8
    Originally Posted by edman007
    5.a)
    BW (12 bits) <-- your bus width is 12 bits, that means that your answer MUST be 12 bits, so right away i can tell your answer is wrong

    both the SA and the LA are 8 bits, your bus is 12 bits, so you need to add four bits to each, shift the SA to the left by 4 bits, and leave the LA as is, add them up, what you have you shifted SA too much

    5.b looks right to me
    Oh okay. I gotcha.

    Just one more thing and then I will leave you alone! For the problems I just did, I need to identify the largest amount of addressable RAM in bytes possible given the bus width. Assume the machines are byte addressable, then do the same thing for word addressable.

    Can you show me how to do that by making an example or using the example I had in my notes? If you don't want to help me anymore, I will understand. I appreciate you help though. Thanks again.
  14. #8
  15. Trapped on the forums...help
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2003
    Location
    /Users/edman007
    Posts
    4,617
    Rep Power
    905
    the number of addresses is determined by the bus width of the memory, so if you have a 2-bit bus, and at each address you have 1 byte (byte addressable) then you can access 4 bytes, alternatively it could be word addressable (with say 16-bit words), then your 2-bit memory bus would allow access to 8 bytes of memory

    as for the math behind this, well if you can't figure it out from what i said then you really need to go back to your notes/book as its something that should be trivial for you

IMN logo majestic logo threadwatch logo seochat tools logo