0% found this document useful (0 votes)
9 views9 pages

Memory Segmentation

تقسيم الذاكرة الاساسية في الكمبيوتر

Uploaded by

khkha415
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views9 pages

Memory Segmentation

تقسيم الذاكرة الاساسية في الكمبيوتر

Uploaded by

khkha415
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Lecture 7

Microprocessors

Prepared By:

Firas Abdulrahman Yosif


Microprocessors

Memory Segmentation
Memory Segmentation:

 The memory in an 8086 based system is organized as segmented


memory.
 The CPU 8086 is able to access 1MB of physical memory. The
complete 1MB of memory can be divided into 16 segments, each of
64KB size and is addressed by one of the segment register.
 The 16-bit contents of the segment register actually point to the
starting location of a particular segment. The address of the segments
may be assigned as 0000H to F000h respectively.
 To address a specific memory location within a segment, we need an
offset address. The offset address values are from 0000H to FFFFH
so that the physical addresses range from 00000H to FFFFFH.
 A program can have more than four segments, but can only access
four segments at a time.

1
‫‪Microprocessors‬‬

‫‪Memory Segmentation‬‬
‫‪Physical Address:‬‬
‫الحظنا أن الذاكرة بطول ‪ 1‬ميغا بايت أي أنها مرقمة من ‪ 00000h‬إلى ‪ FFFFFh‬لذلك فإننا نحتاج‬
‫أثناء عنونة المقاطع إلى رقم ست عشري بطول ‪ 20‬بت وذلك ألن تمثيل رقم ست عشري بطول‬
‫خمس خانات)وهو المستخدم في ترقيم حجرات الذاكرة ) يحتاج إلى عشرين بت ولكن سجالت‬
‫المقاطع و التي نستخدمها في العنونة هي بطول ‪ 16‬بت فقط األمر الذي يضطرنا إلى استنتاج‬
‫عنوان فيزيائي بسعة عشرين بت للوصول الى جميع مواقع الذاكرة التي حجمها ‪. 1MB‬‬

‫وعندما تحتاج وحدة مواجهة المسارات ‪ (BIU) Bus Interface Unit‬الوصول الى االيعازات‬
‫او المعطيات في الذاكرة فأنها تقوم بتوليد العنوان الفيزيائي ‪ Physical Address‬من العنوان‬
‫المنطقي )‪ )Logical address‬داخل الـ ‪ processor‬ومن ثم يتم حسابه داخل وحدة التنفيذ‬
‫‪ execution unit‬ايضا داخل المعالج‪.‬‬

‫‪2‬‬
‫‪Microprocessors‬‬

‫يتمثل العنوان الفيزيائي بـ ‪ 20 bit‬حيث من خالله يتم الوصول الى جميع مواقع الذاكرة ‪RAM‬‬
‫ويتم حسابه حسب العالقة التالية‪:‬‬

‫‪Physical Address= Segment register X 10 + Offset register‬‬

‫والمخطط في الشكل( ‪)1‬ادناه يمثل عملية توليد العنوان الفيزيائي‪:‬‬

‫‪Figure )1( Block Diagram of Physical Address Generation Operation‬‬

‫‪The physical Address is obtained in the following way:‬‬


‫‪ )1‬نأخذ قيمة سجل المقطع الممثلة بالنظام الست عشري و نضربها بعشرة في النظام الست عشري‬
‫فتنزاح قيمة سجل مقطع الذاكرة خانة واحدة نحو اليسار فنحصل على سجل ذات ‪. 20 bit‬‬
‫‪ )2‬نجمع قيمة السجل المساعد او يسمى العنوان الفعال ‪ effective address‬مع مقطع الذاكرة و‬
‫الممثلة أيضا بالنظام الست عشري فتكون النتيجة هي حصولنا على العنوان الفيزيائي‬

‫‪3‬‬
Microprocessors

Physical Address=‫ مقطع الذاكرة‬x( 10h ) + )effective address(

Offset Register:
‫ ويشمل جميع السجالت التي تتحرك داخل مقاطع الذاكرة مثل‬16 bit ‫يتمثل العنوان االزاحة بـ‬
Lower offset address ‫ وهناك عنوان ازاحة ادنى‬. DI , SI , SP , BP , BX , IP‫السجالت‬
FFFF ‫ والذي يقابل‬Higher offset address‫وعنوان ازاحة االعلى‬ 0000 ‫الذي يقابل‬
.‫الموجود داخل مقاطع الذاكرة‬

‫ يتعامل دائما مع السجل‬DS ‫ ومقطع الذاكرة‬IP ‫ يتعامل دائما مع السجل‬CS ‫ السجل‬:‫مالحظة مهمة‬
SS ‫ واخيرا المقطع‬DI ‫ و‬SI ‫ يتعامل فقط مع‬ES ‫ ومقطع الذاكرة‬DI‫ و‬BX ‫ و‬SI ‫او المؤشر‬
. SP ‫ و‬BP ‫يتعامل فقط مع السجل‬

Logical Address:
:‫العنوان المنطقي والذي يربط مؤشراالزاحة مع مقطع الذاكرة ويتمثل بالعالقة التالية‬

Segment of memory: Offset register

Ex1) Assume CS=024F6h , IP=0634Ah , perform:

 Physical address
 Logical address
 Offset address
 Lower offset address
 Higher offset address

Sol.)
1. Physical Address= segment register X 10+offset register
Physical Address= CSX 10 + IP

4
Microprocessors

= 024F6h x10 + 0634Ah = 2B2AA

2. Logical address =Segment of memory: Offset register


Logical address = 024F6h : 0634Ah
3. Offset address = 0634Ah
4. Lower offset address = 024F6h x10+0000
= 024f60h
5.Higher offset address = 024F6h x10 + FFFF
=034F5Fh
Ex2) Assume BP=024D7h , IP=0B344h and SS = 058A6h perform:

 Physical address
 Logical address
 Lower offset address
 Higher offset address

Sol.)
1. Physical Address= segment register X 10+offset register
Physical Address= SSX 10 + BP
= 058A6h x10 + 024D7h
= 05AF37H
2. Logical address =Segment of memory: Offset register
Logical address = 058A6h : 024D7h
3. Lower offset address = 058A6h x10+0000
= 058A60H

5
Microprocessors

4. Higher offset address = 058A6h x10 + FFFF


=068A5FH
Ex3) Assume BP=03A87h , SI=09F44h and DS = 0C842h perform:

 Physical address
 Logical address
 Lower offset address
 Higher offset address
Sol.)
1. Physical Address= segment register X 10+offset register
Physical Address= DS X 10 + SI
= 0C842h x10 + 09F44h
= 0D2364H
2. Logical address =Segment of memory: Offset register
Logical address = 0C842h : 09F44h
3. Lower offset address = 0C842h x10+0000
= 0C8420H
4. Higher offset address = 0C842h x10 + FFFF =0D841FH
. ‫( التعليمات التالية التي يتم تنفيذها بواسطة المعالج الدقيق‬CS: IP) ‫تحدد هذه المجموعة‬
‫ فإن المعالج‬، IP = 1200H ‫ و‬CS = 1400H ‫) مثاال على أنه إذا كان‬2( ‫يوضح الشكل‬
:‫الدقيق يجلب التعليمات التالية من موقع الذاكرة‬

Physical address=Segment base address*10+Offset(Effective)


P.A = CS x 10 + EA
=1400H*10+1200H=15200H

6
‫‪Microprocessors‬‬

‫‪Figure( 2) generating a physical address‬‬


‫يحدد سجل مقطع الكود بداية مقطع الرمز ويحدد مؤشر التعليمات موقع التعليمات التالية داخل‬
‫مقطع الرمز والشكل (‪ )3‬يوضح عناوين بدايات ونهايات مقاطع الذاكرة مع السجالت التي تتعامل‬
‫معها‪.‬‬

‫‪Figure )3( A memory system showing the placement of four memory‬‬


‫‪segments.‬‬

‫‪7‬‬
‫‪Microprocessors‬‬

‫‪The main advantages of the segmented memory scheme are as follows:‬‬


‫‪ .1‬يسمح بسعة اكبرللذاكرة لتكون ‪ 1‬ميغا بايت على الرغم من أن العناوين الفعلية التي سيتم‬
‫التعامل معها بحجم ‪ 16‬بت‪.‬‬
‫‪ .2‬يسمح بوضع الكود والبيانات وأجزاء المكدسة من نفس البرنامج في أجزاء مختلفة من الذاكرة‬
‫‪،‬وذلك لحماية البيانات والرموز‪.‬‬
‫‪ .3‬يساعد على سهولة التعامل مع خزن البيانات في مواقع الذاكرة وبالتالي سرعة القراءة والكتابة‬
‫من قبل المعالج‪.‬‬

‫‪8‬‬

You might also like