View
217
Download
0
Category
Preview:
Citation preview
CSC 235CSC 235
Computer OrganizationComputer Organization
Computer OrganizatonComputer Organizaton
Top_Level StructureTop_Level Structure The von-Neumann MachineThe von-Neumann Machine Stack MachineStack Machine Accumulator MachineAccumulator Machine Load/Store MachineLoad/Store Machine AssemblersAssemblers
Top Level StructureTop Level Structure
Input/OutputInput/Output Main MemoryMain Memory Central Processing Unit (CPU)Central Processing Unit (CPU) System Interconnection (Bus)System Interconnection (Bus)
Structure - Top Level
Computer
Main Memory
InputOutput
SystemsInterconnection
Peripherals
Communicationlines
CentralProcessing Unit
Computer
Structure - The CPU
Computer Arithmeticand Login Unit
ControlUnit
Internal CPUInterconnection
Registers
CPU
I/O
Memory
SystemBus
CPU
The von Neumann Machine
• Stored Program concept
• Main memory storing programs and data
• ALU operating on binary data
• Control unit interpreting instructions from memory and executing
• Input and output equipment operated by control unit
• Princeton Institute for Advanced Studies
– IAS
• Completed 1952
Structure of von Neumann machine
MainMemory
Arithmetic and Logic Unit
Program Control Unit
InputOutputEquipment
IAS - details
• 1000 x 40 bit words
– Binary number
– 2 x 20 bit instructions
• Set of registers (storage in CPU)
– Memory Buffer Register
– Memory Address Register
– Instruction Register
– Instruction Buffer Register
– Program Counter
– Accumulator
– Multiplier Quotient
Structure of IAS - detail
MainMemory
Arithmetic and Logic Unit
Program Control Unit
InputOutputEquipment
MBR
Arithmetic & Logic Circuits
MQAccumulator
MAR
ControlCircuits
IBR
IR
PC
Address
Instructions& Data
Central Processing Unit
The execution cycleThe execution cycle
PCPC = 0; // program counter initialized = 0; // program counter initialized DoDo {{ INSTRUCTION = MEMORY[PC];INSTRUCTION = MEMORY[PC];
PC++;PC++;DECODE(INSTRUCTION);DECODE(INSTRUCTION);FETCH(OPERANDS);FETCH(OPERANDS);EXECUTE;EXECUTE;STORE(RESULTS);STORE(RESULTS);
} WHILE (INSTRUCTION != HALT)} WHILE (INSTRUCTION != HALT)
The Stack MachineThe Stack Machine
All operations use the top of Stack.All operations use the top of Stack. Operands are on top of stackOperands are on top of stack Operation pops its operands from the top Operation pops its operands from the top
of stack.of stack. Operation is performedOperation is performed The result is pushed back on the top of The result is pushed back on the top of
stackstack See figure 1.3 of text (next slide).See figure 1.3 of text (next slide).
x = a + b;x = a + b;
Push a;Push a; // fetch a from memory and // fetch a from memory and push it onto stack push it onto stack
Push b;Push b; // fetch b from memory and // fetch b from memory and push it onto stack push it onto stack
AddAdd // pop top two values from// pop top two values from top of stack, add them and top of stack, add them and push result onto stackpush result onto stack
Store xStore x // pop top value off stack and // pop top value off stack and put put it in memory location of x it in memory location of x
Accumulator MachinesAccumulator Machines
One operand is in the special register One operand is in the special register called the accumulatorcalled the accumulator
The other operand (if any) is found in The other operand (if any) is found in memorymemory
The operation is performed and the The operation is performed and the result is left in the accumulatorresult is left in the accumulator
x = a + b;
• Load a; // fetch a from memory and put in accumulator
• add b; // fetch b from memory and and add it to the
accumulator leaving the answer in the
accumulator• Store x // copy accumulator to
memory location of x
Load/Store MachinesLoad/Store Machines
Each operand is in a registerEach operand is in a register The operation is performed using the The operation is performed using the
appropriate registersappropriate registers The result is put in a registerThe result is put in a register
Load/Store VariationsLoad/Store Variations
PDP-11PDP-11 VAX 11VAX 11 Motorola 68000Motorola 68000 Intel 80x86Intel 80x86 Sun Microsystems SPARC computersSun Microsystems SPARC computers
PDP, VAX, Motorolax = a + bPDP, VAX, Motorolax = a + b
move a, r0move a, r0// r0 = a// r0 = a move b, r1move b, r1 // r1 = b// r1 = b add r0, r1add r0, r1 // r1 = r0 + r1// r1 = r0 + r1 move r1, xmove r1, x// x = r1// x = r1
AssemblersAssemblers
All code/data is in binaryAll code/data is in binary Hard for humans to understandHard for humans to understand Assemblers allow mnemonics to be usedAssemblers allow mnemonics to be used Assemblers allow names for memory locationsAssemblers allow names for memory locations Assemblers allow labels to used on instructionsAssemblers allow labels to used on instructions Different machines have different assemblersDifferent machines have different assemblers Same machines can have different assemblersSame machines can have different assemblers
Setting Up for saSetting Up for sa
Make the directory Make the directory binbin in your home directory. Use in your home directory. Use emacs to add emacs to add $home/bin$home/bin to your path variable in to your path variable in your .login file.your .login file.
Make sure the directory Make sure the directory /usr/ccs/bin/usr/ccs/bin is in your path is in your path variable in your .login file. If not, put it there, then variable in your .login file. If not, put it there, then save .login. save .login.
Copy the program Copy the program sasa from the public directory from the public directory /export/home/public/spiegel/csc235/export/home/public/spiegel/csc235 to your to your bin bin directory.directory.
Give the command Give the command source .login source .login to make the to make the changes effective.changes effective.
Testing saTesting sa
Make a directory csc235 in your home Make a directory csc235 in your home directory.directory.
Copy the file addxy.m from the public Copy the file addxy.m from the public directory to the csc235 directory.directory to the csc235 directory.
Give the command Give the command sa addxysa addxy to test the setup of to test the setup of sasa. If it does not compile and run correctly, re-. If it does not compile and run correctly, re-check the previous steps. If it still does not check the previous steps. If it still does not work, see a GA or your professor.work, see a GA or your professor.
Recommended