1 / 21

CDA4150 Lecture 4

CDA4150 Lecture 4. Topics Covered. Addressing Modes Multiplication of binary integers. Addressing Modes . Direct Immediate Indirect Register Direct Register Indirect Register Indirect plus Offset. Direct Addressing . Used for manipulating an absolute address.

trynt
Download Presentation

CDA4150 Lecture 4

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. CDA4150 Lecture 4

  2. Topics Covered • Addressing Modes • Multiplication of binary integers

  3. Addressing Modes • Direct • Immediate • Indirect • Register Direct • Register Indirect • Register Indirect plus Offset

  4. Direct Addressing Used for manipulating an absolute address. Example: LOAD R1, <ADDR> will load the contents of <ADDR> into R1 Memory … LOAD 3,100 5 Registers 100 0 … 1 2 200 3 5 CPU …

  5. Immediate Addressing Used when dealing with constants. Example: LOAD R1, #value will load value into R1. LOAD 3,#25 Registers 0 1 2 3 25 CPU

  6. MAR Indirect Addressing Typically used for accessing a value through a pointer. Example: LOAD R1,I,<ADDR> Contents of <ADDR> stores another address in which the contents will be loaded into R1. Memory … LOAD 1,I,500 800 800 Registers 500 0 … 1 18 2 800 18 3 CPU …

  7. Register Direct Addressing Used to copy the contents of one register into another. Example: COPY R2,R1 or MOVE R2,R1 will copy contents of R1 into R2. COPY 3,1 Registers 0 1 25 2 3 25 CPU

  8. MAR Register Indirect Addressing Typically used for accessing a list of consecutive memory locations. Example: LOAD R2,<R1> will load the contents of address stored in R1 into R2 Memory … LOAD 2,1 200 Registers 100 0 … 1 200 2 18 200 18 3 CPU …

  9. Registers 0 + 1 2 3 Register Indirect Addressing plus Offset Typically used when accessing array and structures. Example: LOAD R2,R1,offset will load the contents of address stored in R1+offset into R2 LOAD 2,1,500 Memory … 100 100 18 … CPU 18 600 …

  10. Multiplication of two binary integers • Consider multiplying two 4 bit integers in a 4 bit machine 1011 multiplicand (MDR) X 1101 multiplier (Q) 1000 1111 result (R) Result is 8 bits resulting in overflow condition!

  11. Design Representation R (result) C A Q (multiplier) MDR (multiplicand) ALU Carry over

  12. Multiplication of two binary integers R C Q3 Q2 Q1 Q0 MDR (multiplicand) ALU Carry over

  13. Initial Conditions 0 0 0 0 0 1 1 0 1 1 0 1 1 ALU Carry over

  14. Steps to Follow Initial Step: A = to MDR • Test Q0 for 1 or 0 • a. If Q0 = 1; C, A=A+MDR Move bits to right.. (shift_right C-A-Q) b. If Q0 = 0; (shift_right C-A-Q) • Do step 1 until all bits in Q are tested

  15. Step-by-Step • Fill initial values 0 0 0 0 0 1 1 0 1 1 0 1 1 A C Q0 = 1 MDR

  16. Step-by-Step • Set A = MDR 0 1 0 1 1 1 1 0 1 1 0 1 1 A C Q0 = 1 MDR

  17. Q0 = 1 • C = A+MDR 0 1 0 1 1 1 1 0 1 1 0 1 1 MDR A Q0 = 1 0 0 1 0 1 1 1 1 0 1 0 1 1 MDR A Q0 = 1 • Shift bits to the right Step-by-Step

  18. Q0 = 0 0 0 1 0 1 1 1 1 0 1 0 1 1 MDR A Q0 = 1 0 0 0 1 0 1 1 1 1 1 0 1 1 MDR A Q0 = 1 • Shift bits to the right Step-by-Step

  19. Q1 = 1 • C = A + MDR 0 1 1 0 1 1 1 1 1 1 0 1 1 MDR A Q0 = 1 0 0 1 1 0 1 1 1 1 1 0 1 1 MDR A Q0 = 1 • Shift bits to the right Step-by-Step

  20. Q1 = 1 • C = A + MDR 1 0 0 0 1 1 1 1 1 1 0 1 1 MDR A Q0 = 1 0 1 0 0 0 1 1 1 1 1 0 1 1 MDR A Q0 = 1 • Shift bits to the right Step-by-Step

  21. 0 1 0 0 0 1 1 1 1 1 0 1 1 MDR A Q0 = 1 R Step-by-Step • All Bits in Q tested • R = result 0 1 0 0 1 1 1 1 1 1 0 1 1 MDR A Q0 = 1

More Related