Toward a general purpose computer II Example: Game of Life.

Slides:



Advertisements
Similar presentations
Machine cycle.
Advertisements

Microprocessors.
Central Processing Unit
1 Datapath and Control (Multicycle datapath) CDA 3101 Discussion Section 11.
Toward a general purpose computer Example: Game of Life.
ARITHMETIC LOGIC SHIFT UNIT
Memory - Registers Instruction Sets
Fall 2007 MIPS Datapath (Single Cycle and Multi-Cycle)
Chapter 16 Control Unit Implemntation. A Basic Computer Model.
Computer Structure - Datapath and Control Goal: Design a Datapath  We will design the datapath of a processor that includes a subset of the MIPS instruction.
Class 9.1 Computer Architecture - HUJI Computer Architecture Class 9 Microprogramming.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 4: IT Students.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 4:
Computing Systems The Processor: Datapath and Control.
Micro-operations Are the functional, or atomic, operations of a processor. A single micro-operation generally involves a transfer between registers, transfer.
Computer Science 210 Computer Organization The von Neumann Architecture.
Presented by: Sergio Ospina Qing Gao. Contents ♦ 12.1 Processor Organization ♦ 12.2 Register Organization ♦ 12.3 Instruction Cycle ♦ 12.4 Instruction.
Stack Stack Pointer A stack is a means of storing data that works on a ‘Last in first out’ (LIFO) basis. It reverses the order that data arrives and is.
Processor: Datapath and Control
Model Computer CPU Arithmetic Logic Unit Control Unit Memory Unit
Princess Sumaya Univ. Computer Engineering Dept. Chapter 5:
Gary MarsdenSlide 1University of Cape Town Chapter 5 - The Processor  Machine Performance factors –Instruction Count, Clock cycle time, Clock cycles per.
Computer Organization CSC 405 (VSC) Very Simple Computer.
Computer Science 101 Computer Systems Organization ALU, Control Unit, Instruction Set.
A summary of TOY. 4 Main Components Data Processor Control Processor Memory Input/Output Device.
Exam 2 Review Two’s Complement Arithmetic Ripple carry ALU logic and performance Look-ahead techniques Basic multiplication and division ( non- restoring)
A four function ALU A 00 ADD B MUX SUB 11 Result AND OR
Design of a 8-bit RISC Micro controller Core By Ayush Mittal( ) Rakesh Kumar Sahoo( ) Under Guidance of Dr. M.B.Srinivas.
September 26, 2001Systems Architecture I1 Systems Architecture I (CS ) Lecture 2: Implementation of a Simplified Computer Jeremy R. Johnson Wednesday,
COMPILERS CLASS 22/7,23/7. Introduction Compiler: A Compiler is a program that can read a program in one language (Source) and translate it into an equivalent.
Computer Organization CDA 3103 Dr. Hassan Foroosh Dept. of Computer Science UCF © Copyright Hassan Foroosh 2002.
Dale & Lewis Chapter 5 Computing components
Computer Architecture Lecture 10 MIPS Control Unit Ralph Grishman Oct NYU.
CPU Overview Computer Organization II 1 February 2009 © McQuain & Ribbens Introduction CPU performance factors – Instruction count n Determined.
Computer Organization Instructions Language of The Computer (MIPS) 2.
Datapath and Control AddressInstruction Memory Write Data Reg Addr Register File ALU Data Memory Address Write Data Read Data PC Read Data Read Data.
Jeremy R. Johnson William M. Mongan
Chapter 20 Computer Operations Computer Studies Today Chapter 20.
MIPS Processor.
Design a MIPS Processor (II)
CS161 – Design and Architecture of Computer Systems
Basic Computer Organization and Design
CS 270: Mathematical Foundations of Computer Science
CS161 – Design and Architecture of Computer Systems
Computer Science 210 Computer Organization
Systems Architecture I
von Neumann Architecture CPU
MIPS Processor.
Processor (I).
CS/COE0447 Computer Organization & Assembly Language
The fetch-execute cycle
The Processor and Machine Language
Single-Cycle CPU DataPath.
Design of the Control Unit for One-cycle Instruction Execution
CSCI206 - Computer Organization & Programming
MIPS Processor.
Systems Architecture I (CS ) Lecture 2: A Simplified Computer
Processor Organization and Architecture
Rocky K. C. Chang 6 November 2017
Systems Architecture I
The Processor Lecture 3.2: Building a Datapath with Control
von Neumann Architecture CPU
Vishwani D. Agrawal James J. Danaher Professor
Review: The whole processor
Basic components Instruction processing
Systems Architecture I
UNIT – III Microprogrammed Control
MIPS Processor.
Presentation transcript:

Toward a general purpose computer II Example: Game of Life

Problems in the previous implementation 1. Similar instructions in different parts of the algorithm require different lines Very large ROM

Example N = N+1 tmp = i+1 Target = A + B

Problems in the previous implementation 2. All the variables of the algorithm are stored in registers. 1. Change in the algorithm will require change in hardware 2. Registers are expansive. 3. There is limited space.

Solution to 1 (and 2) Define more general instructions The algorithm will be a set of the general instructions.

List of instruction in game of life $3 = $1 + $2 $3 = $1 – $2 $3 = And($1,$2) $3 = OR($1,$2) $3 = Decode($1) $3 = set on less $1,$2 $1 = VAL Register no. 2

The set on less instruction $3 = set on less $1,$2 $3 = 00000…01 if $1 < $2 $3 = 00000…00 otherwise.

ALU codes The operationALU code $3 = $1 + $2000 $3 = $1 – $2001 $3 = And($1,$2)010 $3 = OR($1,$2)011 $3 = Decode($1)100 $3 = set on less $1,$2101

Solution to 2 Move the variables to the RAM We will need instructions to load and store registers in the RAM

Load and Store instructions Load addr,$1 – load address into $1 Store addr, $1 – store $1 into addr

Instruction control Goto the next instruction j Addr Jump to instruction in address addr

Control the PC branching

PC = PC+1 2.Check xxx happened If it didn’t PC = 4 3.IR  PC

PC control Jne $1,$2,Addr If $1 ≠ $2  Goto Addr Je $1,$2,Addr If $1 = $2  Goto Addr

The instructions in the system $3 = $1 + $2 $3 = $1 – $2 $3 = And($1,$2) $3 = OR($1,$2) $3 = Decode($1) $3 = set-on- less($1,$2) $1 = VAL Arithmetic/Logic operations Load addr,$1 Store addr,$1 Memory related operations j Addr Jne $1,$2,Addr Je $1,$2,Addr Control operations Instruction

Assumptions: We have 16 registers $1…$26 ($0 is always zero). The RAM has entries of 16bits (16bit address) The program ROM has entries of 32bits each.

The structure of instructions Arithmetic logic 2 bits3 bits4 bits Type: Arithmetic, memory or control Sub Type Additions, subtraction Reg1 address Reg2 Address Target Address [0-4] First 5 bits reserved Total 16 registers [5-8][9-12] [13-16]

The structure of instructions $1 = VAL 2 bits1114 bits16 bits Type: Arithmetic, memory or control Set Reg1 address The value [0-4] First 5 bits reserved [5-8][9-24]

The structure of instructions Memory instruction 2 bits1 bit004 bits16 bits Type: Arithmetic, memory or control Sub Type Store/load EmptyReg address Address load/store addr,$1 [0-4] [5-8][9-24]

The structure of instructions Control instructions 2 bits 04 bits 16 bits Type: Arithmetic, memory or control Sub Type J,jne,je EmtpyReg address Address j/jne/je $1,$2,Addr [0-4] [5-8][9-12] [13-28]

Note about the control instructions In the j instruction we ignore the first and second fields.

The components of the circuit: The ALU ALU Operation Code Operand AOperand B Result Is zero (1 bit)

The components of the circuit: The Registers Registers Data 1 Data 2 Data 1 Address Data 2 Address WriteAddress Write Data Write

The components of the circuit: The RAM RAM Data 1 Read Address WriteAddress Write Data Write Read Note 1: The RAM is the one you saw in class without the MAR and MBR Note 2: The RAM is implemented with Latches!

The components of the circuit: The PC and the program PC – holds the next address IR - holds the current instruction PC Program ROM Write IR Write

A note before implementation Several time cycles were lost because not all instructions have the same number of steps. Solution: Use a counter for the micro-instructions. CAR

The components of the circuit: CAR, example with arithmetic instruction CAR = 0: IR  PC, PC=PC+1, CAR=CAR++ CAR = 1: Perform the code CAR = 0 Goto the next instruction

The components of the circuit: CAR, example with jne $1,$2,Addr CAR = 0: IR  PC, PC=PC+1, CAR=CAR++ CAR = 1: $1-$2, if not zero PC  Addr CAR = 0 Goto the next instruction

The components of the circuit: CAR, example with arithmetic instruction CAR = 0: IR  PC, PC=PC+1, CAR=CAR++ CAR = 1: Perform the code Goto the next instruction For efficiency, we will NOT use the ALU here.

The CAR circuit CAR Adder 1 MUX C1 000

ALU 16 Registers RAM PC Program ROM IR [BITS 13-28] [BITS 5-8] [BITS 9-12] [BITS 9-24] 2 [BITS 13-16] [BITS 5-8] [BITS 9-24] [BITS 5-8] 3

ALU 16 Registers RAM PC Program ROM IR Mirco-instructions [BITS 0-4] All the control in the system CAR [BITS 13-28] [BITS 5-8] [BITS 9-12] [BITS 9-24] [BITS 13-16] [BITS 5-8] [BITS 9-24] [BITS 5-8]

ALU 16 Registers RAM PC Program ROM IR Write Read Write ALUop IRloadPCload Mux3 Mux2 Mux1 Mux4 Mux5 CAR control

The micro-instruction ROM Inst.CAR ALU op PC load IR load RAM read RAM write Reg Write CAR control Mux 12345

The micro-instruction ROM Example: Inst.CAR ALUopPC load IR load RAM read RAM write Reg Write CAR control Mux XX X00 CAR = 0: IR  PC, PC=PC+1, CAR=CAR++ CAR = 1: $3=$2+$1 CAR = 0

The micro-instruction ROM Example: Inst.CAR ALUop PC load IR load RAM read RAM write Reg Write CAR control Mux XX X00 CAR = 0: IR  PC, PC=PC+1, CAR=CAR++ CAR = 1: $3=$2+$1 CAR = 0 The meaning is: Put in PC the result Of PC+1 We don’t care about these

The micro-instruction ROM Example: Inst.CAR ALUop PC load IR load RAM read RAM write Reg Write CAR control Mux XX X00 CAR = 0: IR  PC, PC=PC+1, CAR=CAR++ CAR = 1: $3=$2+$1 CAR = 0

In addition In order to implement the jne instruction we need a conditional write on the PC. The essence is in here

Addition to the ROM: Inst.CAR Branch Equal Branch NotEqual 1-bit flags that are used in the jne,je

ALU PC Program ROM IR Mirco-instructions Zero status bit Branch equal Branch not equal PC write

The program ROM AddressInstructionMeaning $3=$2+$1 0001…… Instruction type 00 Instruction sub type Reg1 Reg2 Reg3

Saving more space The fetch is divided into 2 cycles Fetch instruction Goto Right instruction The ROM will depend on the CAR alone

CAR Arithmetic = 1 micro instruction Load = 2 micro instructions Store = 2 micro instructions

CAR – the instruction-CAR table InstructionCAR Arithmetic Operation Load Store

CAR – Order of execution CAR Fetch00000 Goto the right instruction InstructionCAR Arithmetic Operation Load Store Assume we are executing the instruction Load …

CAR – Order of execution CAR Fetch00000 Goto the right instruction InstructionCAR Arithmetic Operation Load Store Assume we are executing the instruction Load …

CAR – Order of execution CAR Fetch00000 Goto the right CAR InstructionCAR Arithmetic Operation Load Store Assume we are executing the instruction Load …

Implementation of the Goto in the CAR circuit CAR Adder 1 MUX C1C2 000 Instruction CAR table The Instruction

ALU 16 Registers RAM PC Program ROM IR Mirco-instructions [BITS 0-4] All the control in the system CAR [BITS 13-28] [BITS 5-8] [BITS 9-12] [BITS 9-24] [BITS 13-16] [BITS 5-8] [BITS 9-24] [BITS 5-8]

The micro-instruction ROM CAR ALU op PC load IR load RAM read RAM write Reg Write CAR control Mux The micro instruction ROM depends on the CAR only now.