basic computer org and design 1

Upload: pratik-mane

Post on 08-Jan-2016

29 views

Category:

Documents


0 download

DESCRIPTION

aertber

TRANSCRIPT

ECE271

cpe 252: Computer Organization1

Basic Computer Organization and Designcpe 252: Computer Organization2 Instruction CodesThe Internal organization of a digital system is defined by the sequence of microoperations it performs on data stored in its registersThe user of a computer can control the process by means of a programA program is a set of instructions that specify the operations, operands, and the processing sequencecpe 252: Computer Organization3 Instruction Codes cont.A computer instruction is a binary code that specifies a sequence of micro-operations for the computer. Each computer has its unique instruction setInstruction codes and data are stored in memoryThe computer reads each instruction from memory and places it in a control registerThe control unit interprets the binary code of the instruction and proceeds to execute it by issuing a sequence of micro-operationscpe 252: Computer Organization4 Instruction Codes cont.An Instruction code is a group of bits that instructs the computer to perform a specific operation (sequence of microoperations). It is divided into parts (basic part is the operation part)The operation code of an instruction is a group of bits that defines certain operations such as add, subtract, shift, and complementcpe 252: Computer Organization5 Instruction Codes cont.The number of bits required for the operation code depends on the total number of operations available in the computer2n (or little less) distinct operations n bit operation codecpe 252: Computer Organization6 Instruction Codes cont.110010??????????Op codeControl UnitRead instruction from memoryIts an ADD operationMemorycpe 252: Computer Organization7 Instruction Codes cont.An operation must be performed on some data stored in processor registers or in memoryAn instruction code must therefore specify not only the operation, but also the location of the operands (in registers or in the memory), and where the result will be stored (registers/memory)cpe 252: Computer Organization8 Instruction Codes cont.Memory words can be specified in instruction codes by their addressProcessor registers can be specified by assigning to the instruction another binary code of k bits that specifies one of 2k registersEach computer has its own particular instruction code formatInstruction code formats are conceived by computer designers who specify the architecture of the computercpe 252: Computer Organization9Instruction Codes cont.Stored Program OrganizationAn instruction code is usually divided into operation code, operand address, etc.The simplest way to organize a computer is to have one processor register (accumulator AC) and an instruction code format with two parts (op code, address)cpe 252: Computer Organization10Instruction CodesStored Program Organization cont.OpcodeAddressInstruction FormatBinary OperandOperands (data)Processor register (Accumulator AC)

Memory 4096x16 1512110150Instructions (program)1500 15 cpe 252: Computer Organization11Instruction CodesIndirect AddressThere are three Addressing Modes used for address portion of the instruction code:Immediate: the operand is given in the address portion (constant)Direct: the address points to the operand stored in the memoryIndirect: the address points to the pointer (another address) stored in the memory that references the operand in memoryOne bit of the instruction code can be used to distinguish between direct & indirect addressescpe 252: Computer Organization125-1 Instruction CodesIndirect Address cont.OpcodeAddressInstruction Format1514120I110ADD45722Operand4571ADD300351350300Operand1350+AC+ACDirect AddressIndirect addressEffective addresscpe 252: Computer Organization13 Computer RegistersComputer instructions are normally stored in consecutive memory locations and executed sequentially one at a timeThe control reads an instruction from a specific address in memory and executes it, and so onThis type of sequencing needs a counter to calculate the address of the next instruction after execution of the current instruction is completedcpe 252: Computer Organization14Computer Registers cont.It is also necessary to provide a register in the control unit for storing the instruction code after it is read from memoryThe computer needs processor registers for manipulating data and a register for holding a memory addresscpe 252: Computer Organization15List of BC RegistersDR 16 Data Register Holds memory operandAR 12 Address Register Holds address for memoryAC 16 Accumulator Processor registerIR 16 Instruction Register Holds instruction codePC 12 Program Counter Holds address of instructionTR 16 Temporary Register Holds temporary dataINPR 8 Input Register Holds input characterOUTR 8 Output Register Holds output character

Registers in the Basic Computer110PC150IR150TR70OUTR150DR150AC110ARINPR07Memory

4096 x 16cpe 252: Computer Organization16Memory-Reference Instructions (OP-code = 000 ~ 110)

Computer InstructionsBasic Computer Instruction code format15 1412 110IOpcodeAddressRegister-Reference Instructions (OP-code = 111, I = 0)

Input-Output Instructions(OP-code =111, I = 1)15 12 110Register operation0 1 1 115 12 110I/O operation1 1 1 1cpe 252: Computer Organization17BASIC COMPUTER INSTRUCTIONS Hex CodeSymbol I = 0 I = 1 DescriptionAND 0xxx 8xxx AND memory word to ACADD 1xxx 9xxx Add memory word to ACLDA 2xxx Axxx Load AC from memorySTA 3xxx Bxxx Store content of AC into memoryBUN 4xxx Cxxx Branch unconditionallyBSA 5xxx Dxxx Branch and save return addressISZ 6xxx Exxx Increment and skip if zero

CLA 7800 Clear ACCLE 7400 Clear ECMA 7200 Complement ACCME 7100 Complement ECIR 7080 Circulate right AC and ECIL 7040 Circulate left AC and EINC 7020 Increment ACSPA 7010 Skip next instr. if AC is positiveSNA 7008 Skip next instr. if AC is negativeSZA 7004 Skip next instr. if AC is zeroSZE 7002 Skip next instr. if E is zeroHLT 7001 Halt computer

INP F800 Input character to ACOUT F400 Output character from ACSKI F200 Skip on input flagSKO F100 Skip on output flagION F080 Interrupt onIOF F040 Interrupt off

cpe 252: Computer Organization18Computer InstructionsInstruction Set CompletenessThe set of instructions are said to be complete if the computer includes a sufficient number of instructions in each of the following categories:Arithmetic, logical, and shift instructionsInstructions for moving information to and from memory and processor registersProgram control instructions together with instructions that check status conditionsInput & output instructionscpe 252: Computer Organization19 Timing & ControlThe timing for all registers in the basic computer is controlled by a master clock generatorThe clock pulses are applied to all flip-flops and registers in the system, including the flip-flops and registers in the control unitThe clock pulses do not change the state of a register unless the register is enabled by a control signal (i.e., Load)

cpe 252: Computer Organization20 Instruction CycleA program is a sequence of instructions stored in memoryThe program is executed in the computer by going through a cycle for each instruction (in most cases)Each instruction in turn is subdivided into a sequence of sub-cycles or phasescpe 252: Computer Organization21 Instruction Cycle cont.Instruction Cycle Phases:1- Fetch an instruction from memory2- Decode the instruction3- Read the effective address from memory if the instruction has an indirect address4- Execute the instructionThis cycle repeats indefinitely unless a HALT instruction is encounteredcpe 252: Computer Organization22 Instruction CycleFetch and DecodeInitially, the Program Counter (PC) is loaded with the address of the first instruction in the programMEMORY REFERENCE INSTRUCTIONSThe actual execution of the instruction will require a sequence of micro-operationThis is because the data stored in the memory cannot be processed directly.The data must be read from memory to registers where they can be operated on with logic circuits.cpe 252: Computer Organization23MEMORY REFERENCE INSTRUCTIONSE.g. AND to ACPerform AND logic operation on the data stored in register AC and memory. ADD to AC Perform ADD arithmetic operation on the data stored in register AC and memory. STA AC Stores the content of the AC into memoycpe 252: Computer Organization24cpe 252: Computer Organization25 Input-Output and InterruptInstructions and data stored in memory must come from some input deviceComputational results must be transmitted to the user through some output deviceFor the system to communicate with an input device, serial information is shifted into the input register INPRTo output information, it is stored in the output register OUTRcpe 252: Computer Organization26 Input-Output and Interruptcont.Input-output

terminalSerial

communication

interfaceComputer

registers and

flip-flopsPrinterKeyboardReceiver

interfaceTransmitter

interfaceOUTRACINPRSerial Communications PathParallel Communications Pathcpe 252: Computer Organization27 Input-Output and Interruptcont.Device sends a signal to the OS to request attention.OS preempts running process to handle device request (switches context away from the running process) to handle events)This would require hardware support.