introduc on to marie
play

Introduc>on to MARIE 2 Schedule Today Introduce - PowerPoint PPT Presentation

Computer Systems and Networks ECPE 170 Jeff Shafer University of the Pacific Introduc>on to MARIE 2 Schedule Today Introduce


  1. ì ¡ Computer ¡Systems ¡and ¡Networks ¡ ECPE ¡170 ¡– ¡Jeff ¡Shafer ¡– ¡University ¡of ¡the ¡Pacific ¡ Introduc>on ¡to ¡ MARIE ¡

  2. 2 ¡ Schedule ¡ ì Today ¡ ì Introduce ¡MARIE ¡ ì Wed ¡15 th ¡and ¡Fri ¡17 th ¡ ¡ ì Assembly ¡programming ¡tutorial ¡ Computer ¡Systems ¡and ¡Networks ¡ Spring ¡2012 ¡

  3. 3 ¡ Recap ¡– ¡MARIE ¡Overview ¡ ì How ¡does ¡the ¡MARIE ¡architecture ¡represent ¡ posiEve/negaEve ¡numbers? ¡ ì Binary, ¡two’s ¡complement ¡data ¡representa>on ¡ ì How ¡is ¡MARIE’s ¡main ¡memory ¡configured? ¡ ¡ (# ¡of ¡words, ¡size ¡of ¡each ¡word) ¡ ì 4K ¡words, ¡16 ¡bits ¡wide, ¡word-­‑addressable ¡ ¡ Computer ¡Systems ¡and ¡Networks ¡ Spring ¡2012 ¡

  4. 4 ¡ Recap ¡– ¡MARIE ¡Overview ¡ ì MARIE ¡has ¡ seven ¡registers ¡ for ¡control ¡and ¡data ¡ movement ¡ ì AC? ¡ ì MAR? ¡ ì MBR? ¡ ì PC? ¡ ì IR? ¡ ì InReg? ¡ ì OutReg? ¡ Computer ¡Systems ¡and ¡Networks ¡ Spring ¡2012 ¡

  5. 5 ¡ Recap ¡– ¡MARIE ¡Data ¡Path ¡ ì Common ¡data ¡bus ¡ Links ¡main ¡memory ¡and ¡registers ¡ ì Each ¡device ¡iden>fied ¡by ¡unique ¡ ì number ¡ Bus ¡has ¡control ¡lines ¡that ¡iden>fy ¡ ì device ¡used ¡in ¡opera>on ¡ ì Dedicated ¡data ¡paths ¡ Permits ¡data ¡transfer ¡between ¡ ì accumulator ¡(AC), ¡memory ¡buffer ¡ register ¡(MBR), ¡and ¡ALU ¡without ¡using ¡ main ¡data ¡bus ¡ Computer ¡Systems ¡and ¡Networks ¡ Spring ¡2012 ¡

  6. 6 ¡ Recap ¡– ¡MARIE ¡ISA ¡ ì What ¡is ¡an ¡InstrucEon ¡Set ¡Architecture ¡(ISA)? ¡ ì Interface ¡between ¡hardware ¡and ¡soTware ¡ ì Specifies ¡the ¡format ¡of ¡processor ¡instruc>ons ¡ ¡ ì Specifies ¡the ¡primi>ve ¡opera>ons ¡the ¡processor ¡can ¡ perform ¡ Computer ¡Systems ¡and ¡Networks ¡ Spring ¡2012 ¡

  7. 7 ¡ Recap ¡– ¡MARIE ¡Instructions ¡(Full) ¡ Binary ¡ Hex ¡ InstrucEon ¡ Meaning ¡ See ¡table ¡ 4.7 ¡in ¡ 1 ¡ Load ¡contents ¡of ¡address ¡X ¡into ¡AC ¡ 0001 LOAD X book! ¡ 2 ¡ Store ¡contents ¡of ¡AC ¡at ¡address ¡X ¡ 0010 STORE X 3 ¡ Add ¡contents ¡of ¡address ¡X ¡to ¡AC ¡ 0011 ADD X 4 ¡ Subtract ¡contents ¡of ¡address ¡X ¡from ¡AC ¡ 0100 SUBT X 5 ¡ Input ¡value ¡from ¡keyboard ¡into ¡AC ¡ 0101 INPUT 6 ¡ Output ¡value ¡in ¡AC ¡to ¡display ¡ 0110 OUTPUT 7 ¡ Terminate ¡program ¡ 0111 HALT 8 ¡ Skip ¡next ¡instruc>on ¡on ¡condi>on ¡based ¡on ¡AC ¡value ¡ 1000 SKIPCOND 9 ¡ Load ¡value ¡of ¡X ¡into ¡PC ¡ 1001 JUMP X A ¡ Set ¡AC ¡to ¡0 ¡ 1010 CLEAR B ¡ Add ¡contents ¡of ¡address ¡Mem[X] ¡to ¡AC ¡ 1011 ADDI X C ¡ Load ¡contents ¡of ¡address ¡Mem[X] ¡into ¡PC ¡ 1100 JUMPI X D ¡ Load ¡contents ¡of ¡address ¡Mem[X] ¡into ¡AC ¡ ¡ 1101 LOADI X E ¡ Store ¡contents ¡of ¡AC ¡at ¡address ¡Mem[X] ¡ Computer ¡Systems ¡and ¡Networks ¡ 1110 STOREI X Spring ¡2012 ¡

  8. 8 ¡ Recap ¡– ¡MARIE ¡Instructions ¡ ì How ¡does ¡MARIE ¡format ¡instrucEons ¡in ¡computer ¡ memory? ¡ ¡ ì Two ¡fields ¡ ì Opcode ¡(4 ¡bits) ¡– ¡Opera>on ¡code ¡ ì Address ¡(12 ¡bits) ¡– ¡Address ¡to ¡operate ¡to/from ¡ Computer ¡Systems ¡and ¡Networks ¡ Spring ¡2012 ¡

  9. 9 ¡ ì ¡ MARIE ¡Programming ¡ Computer ¡Systems ¡and ¡Networks ¡ Spring ¡2012 ¡

  10. 10 ¡ A ¡Simple ¡Program ¡ ì Consider ¡this ¡simple ¡MARIE ¡program ¡ Computer ¡Systems ¡and ¡Networks ¡ Spring ¡2012 ¡

  11. 11 ¡ A ¡Simple ¡Program ¡ ì What ¡happens ¡inside ¡the ¡computer ¡when ¡our ¡ program ¡runs? ¡ ì Instruc>on ¡1: ¡ LOAD ¡104 ¡ Computer ¡Systems ¡and ¡Networks ¡ Spring ¡2012 ¡

  12. 12 ¡ A ¡Simple ¡Program ¡ ì Instruc>on ¡2: ¡ ADD ¡105 ¡ Computer ¡Systems ¡and ¡Networks ¡ Spring ¡2012 ¡

  13. 13 ¡ ì ¡ Assembler ¡ Computer ¡Systems ¡and ¡Networks ¡ Spring ¡2012 ¡

  14. 14 ¡ Role ¡of ¡Assembler ¡ ì Mnemonic ¡instruc>ons: ¡LOAD ¡104 ¡ ì “Easy” ¡for ¡humans ¡to ¡write ¡and ¡understand ¡ ì Impossible ¡for ¡computers ¡to ¡understand ¡ ì Role ¡of ¡ assembler ¡ ì Translate ¡instruc>ons ¡from ¡assembly ¡language ¡( for ¡ humans ) ¡into ¡machine ¡language ¡( for ¡computers ) ¡ Computer ¡Systems ¡and ¡Networks ¡ Spring ¡2012 ¡

  15. 15 ¡ Assembler ¡versus ¡Compiler ¡ ì What’s ¡the ¡difference ¡between ¡an ¡assembler ¡and ¡a ¡ compiler? ¡ ¡Which ¡has ¡the ¡harder ¡job? ¡ ì Assembly ¡language ¡ è ¡machine ¡language ¡ ì One-­‑to-­‑one ¡correspondence ¡ ì Assembler ¡is ¡simple! ¡ ì High-­‑level ¡language ¡ è ¡machine ¡language ¡ ì Many-­‑to-­‑one ¡correspondence ¡ ì Compiler ¡is ¡complicated! ¡ Computer ¡Systems ¡and ¡Networks ¡ Spring ¡2012 ¡

  16. 16 ¡ Assembler ¡Operation ¡ ì Assemblers ¡create ¡an ¡ object ¡file ¡ (containing ¡ machine ¡code) ¡from ¡mnemonic ¡assembly ¡source ¡ code ¡in ¡ two ¡passes ¡ ì Pass ¡1 ¡ ì Assemble ¡as ¡much ¡of ¡the ¡program ¡as ¡possible ¡ ì Builds ¡a ¡ symbol ¡table ¡ (contains ¡memory ¡references ¡ for ¡all ¡ symbols ¡in ¡the ¡program) ¡ ì Pass ¡2 ¡ ì Complete ¡instruc>ons. ¡Fill ¡in ¡addresses ¡stored ¡in ¡the ¡ symbol ¡table ¡ Computer ¡Systems ¡and ¡Networks ¡ Spring ¡2012 ¡

  17. 17 ¡ Assembler ¡Operation ¡ ì Example ¡program ¡ HEX ¡and ¡DEC ¡direc>ves ¡to ¡ ì specify ¡radix ¡of ¡constants ¡ ì Assembler ¡ Pass ¡#1 ¡ Create ¡symbol ¡table ¡ ì Create ¡par>ally-­‑assembled ¡ ì instruc>ons ¡ ParEally-­‑ Symbol ¡ Assembled ¡ Table: ¡ Program: ¡ Name, ¡ Address ¡ Computer ¡Systems ¡and ¡Networks ¡ Spring ¡2012 ¡

  18. 18 ¡ Assembler ¡Operation ¡ ì Assembler ¡ Pass ¡#2 ¡ ì Fill ¡in ¡details ¡from ¡symbol ¡table ¡ Symbol ¡ Machine ¡ Program ¡ Table ¡ Code ¡ Computer ¡Systems ¡and ¡Networks ¡ Spring ¡2012 ¡

  19. 19 ¡ Assembler ¡Operation ¡ Machine ¡Code: ¡ Program: ¡ Symbol ¡Table: ¡ Computer ¡Systems ¡and ¡Networks ¡ Spring ¡2012 ¡

  20. 20 ¡ ì ¡ More ¡MARIE ¡Instructions ¡ Computer ¡Systems ¡and ¡Networks ¡ Spring ¡2012 ¡

  21. 21 ¡ New ¡Addressing ¡Modes! ¡ ì Direct ¡addressing ¡mode ¡ ì All ¡the ¡instruc8ons ¡covered ¡to ¡date… ¡ ì The ¡address ¡of ¡the ¡operand ¡is ¡explicitly ¡stated ¡in ¡the ¡ instruc>on ¡ ì New: ¡ Indirect ¡addressing ¡mode ¡ ì The ¡address ¡of ¡the ¡address ¡of ¡the ¡operand ¡is ¡given ¡ in ¡the ¡instruc>on ¡ ì Just ¡like ¡ pointers ¡in ¡COMP ¡51/53 ¡ Computer ¡Systems ¡and ¡Networks ¡ Spring ¡2012 ¡

  22. 22 ¡ Indirect ¡Addressing ¡Mode ¡Instructions ¡ ì Four ¡new ¡instruc>ons ¡use ¡ indirect ¡addressing ¡ mode: ¡Load ¡/ ¡store ¡/ ¡add ¡/ ¡jump ¡indirect ¡ ¡ ì LOADI ¡ X ¡ and ¡ STOREI ¡ X ¡– ¡specified ¡the ¡address ¡of ¡ the ¡address ¡of ¡the ¡operand ¡to ¡be ¡loaded ¡or ¡stored ¡ ¡ ì In ¡RTL ¡: ¡ ¡ STOREI X LOADI X MAR ← X MAR ← X MBR ← M[MAR] MBR ← M[MAR] MAR ← MBR MAR ← MBR MBR ← M[MAR] MBR ← AC AC ← MBR M[MAR] ← MBR Computer ¡Systems ¡and ¡Networks ¡ Spring ¡2012 ¡

  23. 23 ¡ Indirect ¡Addressing ¡Mode ¡Instructions ¡ ì ADDI ¡ X ¡-­‑ ¡Combina>on ¡of ¡ LOADI ¡ X ¡and ¡ ADD ¡ X : ¡ ì In ¡RTL: ¡ ¡ ADDI X MAR ← X MBR ← M[MAR] MAR ← MBR MBR ← M[MAR] AC ← AC + MBR Computer ¡Systems ¡and ¡Networks ¡ Spring ¡2012 ¡

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend