انت هنا الان : شبكة جامعة بابل > موقع الكلية > نظام التعليم الالكتروني > مشاهدة المحاضرة
الكلية كلية العلوم للبنات
القسم قسم الحاسبات
المرحلة 2
أستاذ المادة نور كاظم ايوب مهدي المهدي
14/04/2017 19:55:50
Lecture 5: Addressing mode By Noor Kadhum Architecture For 2nd class- Computer Dep. Babylon University -Sciences College For Women ------------------------------------------------------------------------------------ Introduction Addressing modes are one of the important threads( المواضيع ) that attract full attention of compiler writers and those who programmed using assembly language directly. Addressing modes are an aspect of the instruction set architecture in most CPU designs. The various addressing mode helps to identify the type of operands in the instruction. The instructions have different addressing mode differ in storing , speed of implementation , and the manner of implementation. To make the computer knows the type of operand to know where the value is stored (in a register, in memory, stack, or brought with the instruction) a modification of standard formats described so far is done by adding additional field called addressing mode field, for example: The old 1-address format will be
Now, how can we determine the number of bits for the new field "addressing mode "? the length of addressing mode field is Inferred from: the No. of addressing mode supported by the processor. Convert the No. of supported addressing mode to the form 2n The exponent ( n) will be the No. of bits for (addressing mode field).
Or simply: No. of addressing mode supported by the processor = 2 the No. of bits for (addressing mode). For example , If the Computer can support 8 addressing mode, then the No. of bits in the addressing mode field will be : 8 ? 23 ? n=3 ? the no. of bits =3. Effective address (E.A) The memory consists of no. of locations and each location has unique address, for example : In C++, to define a variable named x as integer number, we use the instruction : Int x; To give the variable x a value, we read this value through the instruction: Cin>>x; address content 1000 Cin >> x; 1001 700 . . . 2099 25 Internally, the previous instructions cause to reserve (حجز) a location in the memory with a specific address and the content of this location is the value that is read by the user/ programmer:
The instruction “ cin>>x;” is resident in the location of address 1000, while the address 2099 contains the value of variable x which is equal to 25. The address of the value (in memory) is called the effective address(EA). The location 2099 is an effective address of the value 25.
The types of addressing mode Computer architectures differ in the number of addressing modes they support. Most RISC machines have only about five simple addressing modes, while CISC machines such as the DEC VAX supermini have over a dozen addressing modes, some of which are very complex. The IBM System/360 mainframe had only three addressing modes; a few more have been added for the System/390. This leads us to the presence of several types of addressing modes and The common types are : 1- Value (offset) addressing mode To find the effective address in this type we use the following equation: EA= value + address part in the instruction the value may be in : a- Pc (relative) : in the case of branch instruction and the law will be : b- XR (index) : in the case of matrix. c- BR (base) : in the case of complete memory pages from location to another.
2- implied addressing mode This mode is used for the instructions that are consisted of opcode only i.e. the instruction related with AC or STACK. There is no effective address for this type but the value is stored in the STACK or AC. 3- memory addressing mod This type has three subtypes: immediate : the value is stored directly in the instruction. direct : the effective address is stored directly in the instruction. indirect mode : the instruction stores the address of the effective address.
address content 30 add R1, 31 31 700 . . . 700 50
value E.A Result # ref. immediate 31 30 R1= R1 +value R1= 100+31 R1= 131 1 direct 700 31 R1= R1 +value R1= 100+700 R1= 800 2 indirect 50 700 R1= R1 +value R1= 100+50 R1= 150 3 Memory
4- Register This type has four subtypes: a- direct : the value is stored directly in general register. b- indirect : the effective address is stored directly in a general register; in our lectures we denote this type by using [] with the second parameter, for example : add R1, [R2] c- auto increment : it is the same as (register indirect mode) but after the implementation of the operation, the address is incremented by 1. We use []+ with the second parameter to indicate this type of addressing mode, for example : add R1,[R2]+ d- auto decrement : before the implementation of the operation the address stored in the general register is decremented by 1. We use - [] with the second parameter to refer to this type of addressing mode, for example : add R1, - [R2]
value E.A result direct 200 - R1= R1 +value R1= 100+200 R1= 300 indirect 50 200 R1= R1 +value R1= 100+50 R1= 150 auto increment 50 200 R1= R1 +value R1= 100+50 R1= 150 R2=R2+1= 201 auto decrement 70 R2=R2-1 R2=200-1 R2=199 R1= R1 +value R1= 100+70 R1= 170
address content 30 add R1, R2 31 700 . . . 199 70 200 50
Exercises: what is the no. of referencing to memory in the previous example? compute it in each case. Suppose you have the following part of memory : Find the effective address by using all types of addressing mode .
المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .
الرجوع الى لوحة التحكم
|