1 / 16

Building Your Own Machine The Universal Machine (UM) Introduction

COMP 40: Machine Structure and Assembly Language Programming. Building Your Own Machine The Universal Machine (UM) Introduction. Noah Mendelsohn Tufts University Email: noah@cs.tufts.edu Web: http://www.cs.tufts.edu/~noah. COMP 40 R oadmap. Building Useful Applications in your Language.

cian
Download Presentation

Building Your Own Machine The Universal Machine (UM) Introduction

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. COMP 40: Machine Structure and Assembly Language Programming Building Your Own MachineThe Universal Machine (UM)Introduction Noah Mendelsohn Tufts UniversityEmail: noah@cs.tufts.edu Web: http://www.cs.tufts.edu/~noah

  2. COMP 40 Roadmap Building Useful Applications in your Language Ramp up your Programming Skills Big programs that teach you abstraction, pointers, locality, machine representations of data Building a Language Processor on your Emulator Intel Assembler ProgrammingThe Bomb! Emulating your own hardware in software

  3. Introducing theUniversal Machine

  4. Why work with the UM? • AMD64 is complicated – UM has 14 instructions • Easy to implement (HW or SW) • Learn more about assemblers and linkers • Learn to write assembler code • You will write an emulator for this machine – emulation is a wonderful and important technique! • The term UM traces to the work of Alan Turing Detailed specification for the UM will come with your next assignment

  5. UM Highlights • 8 32 bit registers (no floating point) • 14 RISC-style (simple) instructions • Load/store architecture: all manipulation done in registers • Segmented memory • Executing code lives in segment 0 • Programs can create and map new zero-filled segments • Any segment can be cloned to be come the new code segment (0) • Simple byte-oriented I/O • Does not have explicit: • Jump/branch • Subtract • Shift

  6. 14 UM Instructions • Arithmetic and data • Add, multiply, diviicde (not subtract!) • Load value • Conditional move • Logical • Bitwise nand (~and) • Memory management • Map/unmap segment • Segmented load/store • Load program • I/O • Input (one byte), Output (one byte) • Misc • Halt

  7. 14 UM Instructions • Arithmetic and data • Add, multiply, diviicde (not subtract!) • Load value • Conditional move • Logical • Bitwise nand (~and) • Memory management • Map/unmap segment • Segmented load/store • Load program • I/O • Input (one byte), Output (one byte) • Misc • Halt Add:$r[A] := ($r[B] + $r[C]) mod 232 Documented in the form of assignmentstatements (register transfer langauge – RTL)

  8. 14 UM Instructions Instruction Format 32 16 0 • Arithmetic and data • Add, multiply, diviicde (not subtract!) • Load value • Conditional move • Logical • Bitwise nand (~and) • Memory management • Map/unmap segment • Segmented load/store • Load program • I/O • Input (one byte), Output (one byte) • Misc • Halt OP R1 RB RC Add:$r[A] := ($r[B] + $r[C]) mod 232

  9. 14 UM Instructions Instruction Format 32 16 0 • Arithmetic and data • Add, multiply, diviicde (not subtract!) • Load value • Conditional move • Logical • Bitwise nand (~and) • Memory management • Map/unmap segment • Segmented load/store • Load program • I/O • Input (one byte), Output (one byte) • Misc • Halt 3 R1 RB RC 4 bits to selectone of 14 operations Add:$r[A] := ($r[B] + $r[C]) mod 232

  10. 14 UM Instructions Instruction Format 32 16 0 • Arithmetic and data • Add, multiply, diviicde (not subtract!) • Load value • Conditional move • Logical • Bitwise nand (~and) • Memory management • Map/unmap segment • Segmented load/store • Load program • I/O • Input (one byte), Output (one byte) • Misc • Halt OP R1 RB RC 3 bits to selectone of 8 registers Add:$r[A] := ($r[B] + $r[C]) mod 232

  11. What’s different from AMD64? • Very few instructions – can we do real work? • Pointers to words not bytes • Segmented memory model • AMD/Intel has I/O, but we did not study it • No floating point

  12. Next time we will discuss in more detail • Memory models and the segmented memory of the UM • I/O • How programs start and execute • Building complex instructions from simple ones

  13. ComputabilityandTuring-Completeness

  14. Emulators

  15. Emulators • Hardware or software that implements another machine architecture • Great way to learn about machines: • The emulator you write will do in software the same thing machines do in hw • Terrific tool for • Testing code before hardware is ready • Performance analysis (e.g. our testcachesim) • Evaluating processor/memory design before committing to build chip • Moving systems to a new architecture (e.g. Apple move from PowerPC to Intel)

  16. Question? • How would you implement an emulator for the UM?

More Related