Exam 2 Review

Here are the major topics we covered since the last exam. Note that some things dealing with C++ programming are not considered part of the testable material!

Moving Data

We looked at the most significant thing you need to know about how machines work. They simply mode data between a bunch of components that process any signals coming their way. The timing of all of this is controlled by a control unit, but basically, the machine sis just a simple bunch of digital parts linked by wires.

  • Creating Components - generic class with basic parts
    • Simple Registers - no processing, just hold data
    • Input set - one or more input signal lines
    • Output set - one or more output signal lines
    • Tick - makes things happen
  • Creating Wires - used to transfer data between components
    • single Input - only one signal can drive a wire
    • Multiple outputs - a wire can drive more than one output
    • Tock? - makes the data move along the wire

Simulator

A simulator seeks to model how a real machine works. To build one we need to model each part in the machine, and model how data moves around in that machine. We set out to do this with a few fairly simpel C++ classes and used inheritance to build custom parts. We used digital wires to move data from part to part, and used simple methods to tell each internal part when to do whatever it was trained to do!

  • Basic Parts - derived from base component class
    • Memory - where data can be saved
    • Registers - internal and very fast
      • IM _ where instructions live (usually read only after loading)
      • DM - where data lives (read/write)
    • ALU - used for processing data using arithmetic and logic
    • Multiplexor - selects one of several possible sources, Used to gate signals as they move along

Fetch Unit

Instruction processing begins with the fetch unit. This part accesses instruction memory using a simple program counter (PC) which holds the address of the next instruction to process. That address is routed to the instruction memory and the next instruction is fetched and passed along.

  • Register Transfer Language - used to describe what we need to happen
  • Parts Needed
    • PC - tracks next instruction
    • IM - instructions to fetch
    • IR = current instruction fetched
    • Updating the PC
      • Normal sequencing - add instruction size to PC and store it back
      • Branch control - if we branch, we need to change the PC storing the new address

Decode Unit

Once the instruction reached the decoder, it is checked, and broken up into usable fields which control aspects of the rest of the machine. If needed, the decoder will get more data from IM in case the first chunk fetched is not a complete instruction.

The decoder is also responsible for updating the PC if needed.

  • Parts Needed
    • Decode logic = break an instruction up into fields
      • constants
      • Register selectors
      • Other control bits
    • Internal Registers - usually only a few, but they are fast!
    • Additional data from IM? - Decode may need to go back and fetch more from IM

Instruction Set Architecture

Most machines are designed based on the need to do some kind of processing. Designers study how the users plan on using the machine, and come up with instructions to make it easy to get their job done.

  • Designing a machine based on instructions
    • Study sample code!
    • Invent instruction that make processing high level code easier.
  • Use RTL to describe each instruction
  • Derive machine from RTL
  • Packing instructions to save space in IM
    • Decoding gets harder
  • Binary “code” needs to be loaded into the machine’s memory modules
    • Intel HEX files - used to store binary data for microcontrolers

Memory Unit

We store data in several places in a modern machine. Each memory nut we need can be custom tuned for its intended purpose.

  • Array of cells
    • Register memory is designed to allow reading two data items at one time for speed.
    • usually bytes, but may be bigger for instructions
  • Control lines needed
    • Address - which “index” (address) will we access.
    • Data in - incoming data for writes
    • Data out - outgoing data for reads
    • R/W signal - which operation are we doing
  • Tick - do the action

Execute Unit

This is where data is manipulated, generating new results. Somw hting the processor does do not need this stage, so signals may pass through unmodified.

  • Parts Needed
    • ALU - to process data
    • MUX to select inputs for processing in the ALU
      • Registers -
      • immediate data

Store

We did not reach this stage yet. This is where the data memory lives. Some instructions will write data into the DM. Other instructions may not access this memory at all (storing data back in registers.