CS 270: Mathematical Foundations of Computer Science

Slides:



Advertisements
Similar presentations
Part 4: combinational devices
Advertisements

6-1 Chapter 6 - Datapath and Control Department of Information Technology, Radford University ITEC 352 Computer Organization Principles of Computer Architecture.
Control path Recall that the control path is the physical entity in a processor which: fetches instructions, fetches operands, decodes instructions, schedules.
Chapter 7 Henry Hexmoor Registers and RTL
ARITHMETIC LOGIC SHIFT UNIT
Chapter 16 Control Unit Operation No HW problems on this chapter. It is important to understand this material on the architecture of computer control units,
Chapter 16 Control Unit Implemntation. A Basic Computer Model.
Propositional Calculus Math Foundations of Computer Science.
More Basics of CPU Design Lecture for CPSC 5155 Edward Bosworth, Ph.D. Computer Science Department Columbus State University.
1 CS Programming Languages Random Access Machines Jeremy R. Johnson.
Micro-operations Are the functional, or atomic, operations of a processor. A single micro-operation generally involves a transfer between registers, transfer.
University of Texas Pan AmDr. John P. Abraham Information Technology Computer Architecture Dr. John P. Abraham.
Quiz # 2 Chapters 4, 5, & 6.
Systems Architecture I1 Propositional Calculus Objective: To provide students with the concepts and techniques from propositional calculus so that they.
Binary Addition CSC 103 September 17, 2007.
Lecture 16 Today’s topics: –MARIE Instruction Decoding and Control –Hardwired control –Micro-programmed control 1.
Apr. 3, 2000Systems Architecture I1 Systems Architecture I (CS ) Lecture 3: Review of Digital Circuits and Logic Design Jeremy R. Johnson Mon. Apr.
Chapter 4 MARIE: An Introduction to a Simple Computer.
1 Arithmetic Logic Unit ALU. 2 The Bus Concept 3 CPU Building Blocks  Registers (IR, PC, ACC)  Control Unit (CU)  Arithmetic Logic Unit (ALU)
Lec 3bSystems Architecture1 Systems Architecture Lecture 3b: Review of Sequential Logic Circuits Jeremy R. Johnson Anatole D. Ruslanov William M. Mongan.
Model Computer CPU Arithmetic Logic Unit Control Unit Memory Unit
Logic Design CS 270: Mathematical Foundations of Computer Science Jeremy Johnson.
Lec 15Systems Architecture1 Systems Architecture Lecture 15: A Simple Implementation of MIPS Jeremy R. Johnson Anatole D. Ruslanov William M. Mongan Some.
Lec 5 Basic Computer Organization
Computer Organization CSC 405 (VSC) Very Simple Computer.
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.
CBP 2006Comp 4070 Concepts and Philosophy of Computing 1 Wrestling with Complex Stuff. With the Correct Approach, even the smallest guy will succeed!
Computer Organization and Assembly Languages Yung-Yu Chuang 2005/09/29
May 9, 2001Systems Architecture I1 Systems Architecture I (CS ) Lab 5: Introduction to VHDL Jeremy R. Johnson May 9, 2001.
Designing a CPU –Reading a programs instruction from memory –Decoding the instruction –Executing the instruction –Transferring Data to/From memory / IO.
Jeremy R. Johnson William M. Mongan
Logic Gates Dr.Ahmed Bayoumi Dr.Shady Elmashad. Objectives  Identify the basic gates and describe the behavior of each  Combine basic gates into circuits.
BASIC COMPUTER ARCHITECTURE HOW COMPUTER SYSTEMS WORK.
Types of Micro-operation  Transfer data between registers  Transfer data from register to external  Transfer data from external to register  Perform.
Functions of Processor Operation Addressing modes Registers i/o module interface Memory module interface Interrupts.
Stored Program Concept Learning Objectives Learn the meaning of the stored program concept The processor and its components The fetch-decode-execute and.
Dr.Ahmed Bayoumi Dr.Shady Elmashad
Today’s Agenda Exam 2 Part 2 (11:15am-12:30pm)
Computer Organization and Architecture + Networks
Lecture 13 - Introduction to the Central Processing Unit (CPU)
Micro-Operations A computer executes a program Fetch/execute cycle
Jeremy R. Johnson Wed. Sept. 29, 1999
Digital Logic Last Time … This Time … Control Path, Arithmetic Ops a
BASIC COMPUTER ORGANIZATION AND DESIGN
The Processor and Machine Language
Basics Combinational Circuits Sequential Circuits Ahmad Jawdat
Jeremy R. Johnson Anatole D. Ruslanov William M. Mongan
Functional Units.
Systems Architecture I (CS ) Lecture 1: Random Access Machines
Design of the Control Unit for One-cycle Instruction Execution
MARIE: An Introduction to a Simple Computer
Week 7: Gates and Circuits: PART II
Systems Architecture I (CS ) Lecture 2: A Simplified Computer
COSC 2021: Computer Organization Instructor: Dr. Amir Asif
CDCA 2203 Elements of Computer Architecture Open University Malaysia
William Stallings Computer Organization and Architecture 8th Edition
Digital Logic.
Computer Architecture
COMS 361 Computer Organization
Chapter 14 Control Unit Operation
A Discussion on Assemblers
Systems Architecture I
Computer Organization and Assembly Languages Yung-Yu Chuang 2005/09/29
Digital Circuits and Logic
CHAPTER-3 REGISTER TRANSFER LANGUAGE AND MICROOPERATIONS
Information Representation: Machine Instructions
Systems Architecture I (CS ) Lecture 1: Random Access Machines
UNIT – III Microprogrammed Control
Presentation transcript:

CS 270: Mathematical Foundations of Computer Science Logic Design CS 270: Mathematical Foundations of Computer Science Jeremy Johnson

September 4, 1997 Logic Design Objective: To provide an important application of propositional logic to the design and simplification of logic circuits. 2 2

Topics Logic gates Logic circuits Simplification of logic circuits September 4, 1997 Topics Logic gates and, or, inverter nand Logic circuits Encoder, decoder, multiplexor Simplification of logic circuits Full adder Implementation of a simple processor 3 3

September 4, 1997 Logic Circuits A single line labeled x is a logic circuit. One end is the input and the other is the output. If A and B are logic circuits so are: and gate or gate inverter (not) A B A B A 4 4

Multi-Input Gates Cascaded and gate September 4, 1997 Multi-Input Gates Cascaded and gate A  B  C  D  ((A  B)  C)  D  (A  B)  (C  D)  A  (B  (C  D)) A A B B C C D D A B C D 5 5

September 4, 1997 Logic Circuits Given a boolean expression it is easy to write down the corresponding logic circuit Here is the circuit for the original multiplexor expression x0 x1 s 6 6

September 4, 1997 Logic Circuits Here is the circuit for the simplified multiplexor expression x0 x1 s 7 7

Nand Nand – negation of the conjunction operation: September 4, 1997 Nand Nand – negation of the conjunction operation: A nand gate is an inverted and gate: x y x | y 0 0 1 0 1 1 1 0 1 1 1 0 8 8

Implementing Logic Gates with Transistors +V +V A NAND B A output gate B ground ground A Transistor NOT Gate A Transistor NAND Gate

September 4, 1997 Decoder A decoder is a logic circuit that has n inputs (think of this as a binary number) and 2n outputs. The output corresponding to the binary input is set to 1 and all other outputs are set to 0. d0 b0 d1 b1 d2 d3 10 10

September 4, 1997 Encoder An encoder is the opposite of a decoder. It is a logic circuit that has 2n inputs and n outputs. The output equal to the input line (in binary) that is set to 1 is set to 1. d0 d1 b0 d2 b1 d3 11 11

September 4, 1997 Multiplexor A multiplexor is a switch which routes n inputs to one output. The input is selected using a decoder. d0 d1 d2 d3 s1 s0 12 12

XOR “One or the other, but not both” Notation for circuits: x y x  y 0 0 0 0 1 1 1 0 1 1 1 0 Notation for circuits: x x y y

Full Adder Used to add to binary numbers stored as an array of bits using carry ripple addition Three binary inputs a, b and CarryIn Two binary outputs Sum and CarryOut such that a + b + CarryIn = 2*CarryOut + Sum Carry 110 A 101 B 111 A+B = 1100 14

Exercise Derive a truth table for the output bits (Sum and CarryOut) of a full adder. Using the truth table derive a sum of products expression for Sum and CarryOut. Draw a circuit for these expressions. Using properties of Boolean algebra simplify your expressions. Draw the simplified circuits. 15

Building a Computer from Logic Gates September 4, 1997 Building a Computer from Logic Gates Objective: To develop a simple model of a computer and its execution that is capable of executing RAM programs. To introduce the concept of abstraction in computer design. The model will be given schematically with timing sequences. RAL instructions will be implemented using microinstructions described in a notation called “Register Transfer Language” (RTL). The control logic for implementing microinstructions will be described at the gate level. References: Dewdney, The New Turing Omnibus (Chapter 48). Lec 2 Systems Architecture

SCRAM A Simple but Complete Random Access Machine. This computer can execute RAL instructions. 8-bit words 16 word memory (4 address bits) Instructions (4 bit opcode, 4 bit operand) 7 registers PC (program counter) IR (instruction register - IR(C) = instruction code, IR(O) = operand MAR (memory address register) MBR (memory buffer register) AC (accumulator) AD (register for addition internal to the ALU - arithmetic logic unit) Driven by the CLU (control logic unit) A timer T generates pulses that are decoded into separate input lines to the CLU Lec 2 Systems Architecture

Fetch and Execute A cycle of operation consists of two stages The fetch cycle gets the next executable instruction and loads it into the IR The execute cycle performs the instruction in the IR The fetch and execute cycles are written as a sequence of micro-instructions described in a notation called “Register Transfer Language” (RTL) Important: this machine uses a timer T that “ticks” several times per each of the two cycles; therefore, the fetch and execute cycles consist of several clock cycles. Lec 2 Systems Architecture

CLU MAR Memory PC MUX IR(C) IR(O) MUX MBR Decoder MUX AC MUX ALU September 4, 1997 LOAD READ/ WRITE MAR Memory LOAD PC INC MUX s 0 1 2 3 LOAD IR(C) IR(O) LOAD MUX MBR 1 s Decoder 1 2 3 MUX LOAD q9 q8 q7 q6 q5 q4 q3 q2 q1 x13 x12 x11 x10 x9 x8 x7 x6 AC x1 x2 x3 x4 x5 s MUX 1 CLU ALU s LOAD AD t9 t8 t7 t6 t5 t4 t3 t2 t1 t0 INC CLEAR Decoder T Lec 2 Systems Architecture

September 4, 1997 Instruction Opcodes LDA 0001 X; Load contents of memory address X into the AC LDI 0010 X; Indirectly load contents of address X into the AC STA 0011 X; Store contents of AC at memory address X STI 0100 X; Indirectly store contents of AC at address X ADD 0101 X; Add contents of address X to the AC SUB 0110 X; Subtract contents of address X from the AC JMP 0111 X; Jump to the instruction labeled X JMZ 1000 X; Jump to instruction X if the AC contains 0 Lec 2 Systems Architecture

Microprogram Fetch cycle Execute cycle (LDA) t0: MAR  PC September 4, 1997 Microprogram Fetch cycle t0: MAR  PC t1: MBR  M; PC  PC + 1 t2: IR  MBR Execute cycle (LDA) q1t3: MAR  IR(O) q1t4: MBR  M q1t5: AC  MBR Lec 2 Systems Architecture

Microprogram Execute cycle (LDI) Execute cycle (ADD) q2t3: MAR  IR(O) September 4, 1997 Microprogram Execute cycle (LDI) q2t3: MAR  IR(O) q2t4: MBR  M q2t5: MAR  MBR q2t6: MBR  M q2t7: AC  MBR Execute cycle (ADD) q5t3: MAR  IR(O) q5t4: MBR  M q5t5: AD  MBR q5t6: AD  AD + AC q5t7: AC  AD Lec 2 Systems Architecture

Microprogram Execute cycle (JMP) – PC relative addressing September 4, 1997 Microprogram Execute cycle (JMP) – PC relative addressing q7t3: AC  PC q7t4: AD  AC q7t5: AC  IR(0) q7t6: AD  AD + AC q7t7: AC  AD q7t8: PC  AC Execute cycle (JMP) – absolute addressing q7t3: AC  IR(0) q7t4: PC  AC Lec 2 Systems Architecture

Control Logic for the Fetch Cycle September 4, 1997 Control Logic for the Fetch Cycle t0: MAR  PC t1: MBR  M; PC  PC + 1 t2: IR  MBR t0 x10 x10 x4 t1 x7 x2 x5 x13 t2 x1 Lec 2 Systems Architecture

MAR  PC CLU MAR Memory PC MUX IR(C) IR(O) MUX MBR Decoder MUX AC MUX September 4, 1997 LOAD READ/ WRITE MAR Memory LOAD PC INC MUX s 0 1 2 3 LOAD IR(C) IR(O) LOAD MUX MBR 1 s Decoder MUX 1 2 3 LOAD q9 q8 q7 q6 q5 q4 q3 q2 q1 x13 x12 x11 x10 x9 x8 x7 x6 AC x1 x2 x3 x4 x5 s MUX 1 CLU ALU s LOAD AD t9 t8 t7 t6 t5 t4 t3 t2 t1 t0 INC CLEAR MAR  PC Decoder T Lec 2 Systems Architecture

MBR  M; PC  PC + 1 CLU MAR Memory PC MUX IR(C) IR(O) MUX MBR Decoder September 4, 1997 LOAD READ/ WRITE MAR Memory LOAD PC INC MUX s 0 1 2 3 LOAD IR(C) IR(O) LOAD MUX MBR 1 s Decoder MUX 1 2 3 LOAD q9 q8 q7 q6 q5 q4 q3 q2 q1 x13 x12 x11 x10 x9 x8 x7 x6 AC x1 x2 x3 x4 x5 s MUX 1 CLU ALU s LOAD AD t9 t8 t7 t6 t5 t4 t3 t2 t1 t0 MBR  M; PC  PC + 1 INC CLEAR Decoder T Lec 2 Systems Architecture

IR  MBR CLU MAR Memory PC MUX IR(C) IR(O) MUX MBR Decoder MUX AC MUX September 4, 1997 LOAD READ/ WRITE MAR Memory LOAD PC INC MUX s 0 1 2 3 LOAD IR(C) IR(O) LOAD MUX MBR 1 s Decoder MUX 1 2 3 LOAD q9 q8 q7 q6 q5 q4 q3 q2 q1 x13 x12 x11 x10 x9 x8 x7 x6 AC x1 x2 x3 x4 x5 s MUX 1 CLU ALU s LOAD AD t9 t8 t7 t6 t5 t4 t3 t2 t1 t0 INC CLEAR IR  MBR Decoder T Lec 2 Systems Architecture

Logic for Loading the Accumulator September 4, 1997 Logic for Loading the Accumulator q1 x10 t3 MAR  IR(0) x10 x4 x2 t4 x7 MBR  M x5 t5 x11 AC  MBR x11 x12 Lec 2 Systems Architecture

MAR  IR(0) CLU MAR Memory PC MUX IR(C) IR(O) MUX MBR Decoder MUX AC September 4, 1997 LOAD READ/ WRITE MAR Memory LOAD PC INC MUX s 0 1 2 3 LOAD IR(C) IR(O) LOAD MUX MBR 1 s Decoder MUX 1 2 3 LOAD q9 q8 q7 q6 q5 q4 q3 q2 q1 x13 x12 x11 x10 x9 x8 x7 x6 AC x1 x2 x3 x4 x5 s MUX 1 CLU ALU s LOAD AD t9 t8 t7 t6 t5 t4 t3 t2 t1 t0 INC CLEAR MAR  IR(0) Decoder T Lec 2 Systems Architecture

MBR  M CLU MAR Memory PC MUX IR(C) IR(O) MUX MBR Decoder MUX AC MUX September 4, 1997 LOAD READ/ WRITE MAR Memory LOAD PC INC MUX s 0 1 2 3 LOAD IR(C) IR(O) LOAD MUX MBR 1 s Decoder MUX 1 2 3 LOAD q9 q8 q7 q6 q5 q4 q3 q2 q1 x13 x12 x11 x10 x9 x8 x7 x6 AC x1 x2 x3 x4 x5 s MUX 1 CLU ALU s LOAD AD t9 t8 t7 t6 t5 t4 t3 t2 t1 t0 INC CLEAR MBR  M Decoder T Lec 2 Systems Architecture

AC  MBR CLU MAR Memory PC MUX IR(C) IR(O) MUX MBR Decoder MUX AC MUX September 4, 1997 LOAD READ/ WRITE MAR Memory LOAD PC INC MUX s 0 1 2 3 LOAD IR(C) IR(O) LOAD MUX MBR 1 s Decoder MUX 1 2 3 LOAD q9 q8 q7 q6 q5 q4 q3 q2 q1 x13 x12 x11 x10 x9 x8 x7 x6 AC x1 x2 x3 x4 x5 s MUX 1 CLU ALU s LOAD AD t9 t8 t7 t6 t5 t4 t3 t2 t1 t0 INC CLEAR AC  MBR Decoder T Lec 2 Systems Architecture

CLU Logic Some of the output lines from the two previous slides appear in both circuits. It is necessary to have some logic to connect and coordinate the individual outputs to the wires leaving the CLU. Lec 2 Systems Architecture

September 4, 1997 Exercises Write microprograms for STA, STI, and JMZ. Implement the microprograms in standard logic. Design the portion of the CLU that determines the two output lines labeled x10. Input to this circuit will be one or both of the lines previously labeled x10 in the individual circuits for LDA, LDI, and the other circuits. Convert the following program to the equivalent set of binary words, as indicated in this chapter. This is called machine code. Trace the execution of the program by listing the q, t, and x variables. LDA 1 ADD 2 STA 3 Lec 2 Systems Architecture