1 / 10

Machine Code

Machine Code. 1 high level language instruction ≥ 1 machine language instr. 1 assembly language instruction = 1 machine language instr. For 68000, 1 machine language instruction = 1 to 5 words. typically: word 1 operation code, size and type of operands words 2-3

Download Presentation

Machine Code

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. Machine Code 1 high level language instruction ≥ 1 machine language instr. 1 assembly language instruction = 1 machine language instr. For 68000, 1 machine language instruction = 1 to 5 words. typically: • word 1 • operation code, size and type of operands • words 2-3 • immediate operand (1-2 words, if any) • source effective address (1-2 words, if any) • words 4-5 • destination effective address (1-2 words, if any) NOTE: words 2 to 5 are typically not shown in the manual; assumes programmer can figure this out

  2. Machine Code • Immediate data • if byte, low byte of extension word • if word, one extension word • if longword, two extension words:high half : low half • Memory addresses • we always assume xxx.L or longword • Displacement addressing modes • if d(An), d is an extension word (d can be 16 bits) • if d(An,Rm.s), extension word = txxxs000dddddddd (d can only be 8 bits)where t=1(Rm = Ax) or t=0(Rm = Dx) s=1(Rm.L) or s=0(Rm.W) • if An = PC, extension word stores the offset (not responsible for this case)

  3. Machine Code e.g. TRAP #15 e.g. ABCD D0,D1 vs ABCD -(A0),-(A1)

  4. e.g. OR.B D1,D2 vs OR.W #5,D2 vs OR.L NUM,D4

  5. e.g. MOVE.W #$3332,NUM

  6. Instruction Timing Notation: n(r/w) n = number of clock periods for instruction (total) r = number of read cycles for instruction w = number of write cycles for instruction Assumes: t(1 read cycle) = t(1 write cycle) = 4 clock periods n = (r x 4) + (w x 4) + internal processing time e.g. 12(3/0) = 12 clock periods (3 x 4 + 0 x 4 + 0) e.g. 18(3/1) = 18 clock periods (3 x 4 + 1 x 4 + 2)

  7. Instruction Timing e.g. MOVEA.L #R2Z,A1 • look up instruction in table 8-3;where source = #<data> and destination = An • execution time is 12(3/0) • 3 reads from memory • 1st word of machine code • 2 machine code extension words for the immediate data • 0 writes to memory • 0 clock periods for internal processing

  8. Instruction Timing e.g. MOVE.W NUM1,NUM2 • look up instruction in table 8-2; where source = xxx.L and destination = xxx.L(we always assume long for addresses) • execution time is 28(6/1) • 6 reads from memory • 1st word of machine code • 2 extension words for address of NUM1 • 2 extension words for address of NUM2 • fetch of data from NUM1 • 1 write to memory • write data to NUM2 • 0 clock periods for internal processing

  9. Instruction Timing … wait states • if memory is slower than 4 clock periods, longer memory access cycle will insert wait states • must add the wait states to the total instruction time. Assume memory takes an additional 2 wait states (i.e. 2 more clock cycles per memory r/w). if original execution time was 18(3/1) = 18 clock periods (3 x 4 + 1 x 4 + 2) the execution time with the slower memory is ?(3/1) = (3 x (4+2) + 1 x (4+2) + 2) = 26 clock periods

  10. Reading/Expectations Reading: • Section 8: 16-Bit Instruction Execution Times [pages 8-1 to 8-11] in M68000 8-/16-/32-Bit Microprocessors User’s Manual[pdf, 184 p; Motorola] • Add the execution time section to your reference material. Bring it to the exam. • M68000 Machine Code[pdf, 21p; N. Znotinas] • Add the machine code section to your reference material. Bring it to the exam. Expectations: • you are responsible for all material in the reading • you should be able to generate the machine code for any instruction • you should be able to determine the timing for any section of code

More Related