Tuesday, September 09, 2003

Computer Arch.

Computer Systems 2nd Editon, Warford, J. Stanley

Chapter 4 Section 1 and 2
We can look at a specific computer and learn things just for it, ignoring other computers or we can look at a hypothetical computer to learn in general how all computers work. We will use a hypothetical machine called Pep/7. Neither is the best solution, but this will be the way we choose to do things. The notes that follow are on a hypothetical machine.
4.1 Hardware
   CentralProcessing Unit (CPU)
   The Pep/7 contains seven specialized registers in its CPU   
  1. 4 bit status (NZVC)
  2. 16 bit accumulator(A)
  3. 16 bit index (X)
  4. 16 bit base (B)
  5. 16 Bit Program Counter (PC)
  6. 16 Bit stack pointer (SP)
  7. 24 bit instruction register (IR)
In the status register V and C bits hold information for overflow and carry. N and Z are for negative and zero. Accumulator A is where the results are stored. The rest of the registers , X, B, PC, and SP perform special functions.


   Main Memory
   Pep/7 computer contains 32,768 8 bit storage locations or 32, 768 Bytes. (32KBytes) The addresses are from 0 000 to 7FFF (o to 32,767)
   In the Pep/7 a Word is two adjacent bytes, i.e. 16 bits.
   When looking at the contents of an address and an address it is very easy to get the two mixed up. Be carefl not to do that. When written very ofter the format will be in Hexidecimal.

   Input Device
   The Pep/7 has two means of input, keyboard and file (gui will use a window)
   Output Device
   The Pep/7 has two means of exput, screen and file (gui will use a window)
   Data and Control
   Data flows from the input device to the bus by a control signal. The CPU has data flow in and out of it and sends the contol signals out. Main memory has data flow in and out and recives a signal to do so. Output receives data by the control signal.
   Instruction Format
    Since all computers have their own set of instructions wired into them ours wil be no different. We will have 32 instructions that we will use. Each instruction specifier is a single byte and then is followed by a operand specifier, a place where the action is going to take place either to or from. If they do not have an operand specifier they are called unuary instructions. The instructions would be built as follows
  1. 5 bit operation code
  2. 1 bit register specifier (which register it will effect)
  3. 2 bit addrssing mode specifier
The register specifier is 0 if it will change A (Accumulator) or 1 if it will change X (index register). The 2 bit addressing mode is 00 for immediate, 01 for direct, 10 for stack relative, and 11 for Indexed. This is the register that will be affected.

4.2Character I/O and Direct Addressing
Input and output are done by the ASCII charachter set. Pressing a key sends a ASCII code to the bus and then to memory. At this level though all is done through address locations.
   Direct Addresing
   adressing mode specifier specifies the memory location that you will work with. 01 is direct addressing and the perand is the specified address. We will now look at 12 codes from the Pep/7

00000 Stop Execution
Stops the computer (Pep/7 computer that is)

00001 Load Operand into Register R
Loads one word into either index register (1) or accumulator (0)Sets the N bit if info transfered is negative, sets Z if ti is 0. otherwise clears them. It does not change what in memory but what is in register is blown away.

00010 Store Register R to Operand
Reverse of one shown before. Takes information from register and loads it into a memory location. Register is not effected but memory location is altered.

00011 Add Operand to Register R
Takes what is in memory locations specified and adds it to register specified and stores in register.

00100 Subtract Operand from Register R
Similiar to Add but it does a subtraction instead.

00101 AND Operand to Register R
Does the boolean operation to memory location and register and stores in register.

00110 OR Operad to Register R
Similar to AND but Bollean OR is done instead.

00111 Ones' Compliment of Register R
does 1's compliment to registry and stores back in registry. No memory used.

01010 Load Byte Operator into Register R
Loads a byte (1/2 of a word) into register. Moves info into the right 1/2 of the register. It leaves left half unchanged.

01011 Store Byte from Register R to Operand
Stores right 1/2 of register into memory location listed.

11011 Charachter Input to Operand
Takes ASCII character on the input stream and moves it to a byte in memory. Ignores the register bit.

11100 Charachter Output from Operand
takes the ASCII charachter in memory location and sends it to output device.

No comments:

Post a Comment