Systems Architecture I

Similar documents
Propositional Calculus. Math Foundations of Computer Science

Propositional Calculus: Boolean Algebra and Simplification. CS 270: Mathematical Foundations of Computer Science Jeremy Johnson

QUESTION BANK FOR TEST

Topic #6. Processor Design

Systems Architecture

Propositional Calculus. CS 270: Mathematical Foundations of Computer Science Jeremy Johnson

CSE A215 Assembly Language Programming for Engineers

LECTURE 4. Logic Design

6.1 Combinational Circuits. George Boole ( ) Claude Shannon ( )

CS429: Computer Organization and Architecture

6.1 Combinational Circuits. George Boole ( ) Claude Shannon ( )

Part I: Translating & Starting a Program: Compiler, Linker, Assembler, Loader. Lecture 4

Injntu.com Injntu.com Injntu.com R16

Henry Lin, Department of Electrical and Computer Engineering, California State University, Bakersfield Lecture 7 (Digital Logic) July 24 th, 2012

CENG 3420 Computer Organization and Design. Lecture 06: MIPS Processor - I. Bei Yu

Chapter 4. The Processor. Instruction count Determined by ISA and compiler. We will examine two MIPS implementations

Digital Logic Design Exercises. Assignment 1

Computer Architecture: Part III. First Semester 2013 Department of Computer Science Faculty of Science Chiang Mai University

EECS Components and Design Techniques for Digital Systems. Lec 07 PLAs and FSMs 9/ Big Idea: boolean functions <> gates.

CSC258: Computer Organization. Functions and the Compiler Tool Chain

Bawar Abid Abdalla. Assistant Lecturer Software Engineering Department Koya University

Computer Organization and Levels of Abstraction

Computer Organization and Levels of Abstraction

High Performance Computing Lecture 7. Matthew Jacob Indian Institute of Science

Propositional Calculus. Math Foundations of Computer Science

CS Computer Architecture Spring Week 10: Chapter

BUILDING BLOCKS OF A BASIC MICROPROCESSOR. Part 1 PowerPoint Format of Lecture 3 of Book

Topics of this Slideset. CS429: Computer Organization and Architecture. Digital Signals. Truth Tables. Logic Design

CS222: Processor Design

CS 31: Intro to Systems Digital Logic. Kevin Webb Swarthmore College February 2, 2016

Slide Set 5. for ENCM 369 Winter 2014 Lecture Section 01. Steve Norman, PhD, PEng

DIGITAL ELECTRONICS. P41l 3 HOURS

Chapter 4. The Processor

Chapter 3 Arithmetic for Computers

Music. Numbers correspond to course weeks EULA ESE150 Spring click OK Based on slides DeHon 1. !

Systems Architecture I

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA

CS 31: Intro to Systems Digital Logic. Kevin Webb Swarthmore College February 3, 2015

Systems Architecture I

CENG 3420 Lecture 06: Datapath

ECE/CS 314 Fall 2003 Homework 2 Solutions. Question 1

Philadelphia University Student Name: Student Number:

Reference Sheet for C112 Hardware

Single Cycle Datapath

The Processor: Datapath and Control. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Code No: 07A3EC03 Set No. 1

ENCM 369 Winter 2019 Lab 6 for the Week of February 25

Recitation Session 6

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 4. The Processor

EECS150, Fall 2004, Midterm 1, Prof. Culler. Problem 1 (15 points) 1.a. Circle the gate-level circuits that DO NOT implement a Boolean AND function.

From Code to Program: CALL Con'nued (Linking, and Loading)

ICS 233 COMPUTER ARCHITECTURE. MIPS Processor Design Multicycle Implementation

Levels in Processor Design

CSE A215 Assembly Language Programming for Engineers

CS 61C: Great Ideas in Computer Architecture CALL continued ( Linking and Loading)

problem maximum score 1 10pts 2 8pts 3 10pts 4 12pts 5 7pts 6 7pts 7 7pts 8 17pts 9 22pts total 100pts

Review Topics. Midterm Exam Review Slides

Midterm Exam Review. CS 2420 :: Fall 2016 Molly O'Neil

TDT4255 Computer Design. Lecture 4. Magnus Jahre. TDT4255 Computer Design

Chapter 4. The Processor

1. Prove that if you have tri-state buffers and inverters, you can build any combinational logic circuit. [4]

END-TERM EXAMINATION

Boolean Logic CS.352.F12

Sense Amplifiers 6 T Cell. M PC is the precharge transistor whose purpose is to force the latch to operate at the unstable point.

Review: Abstract Implementation View

ECE 15B COMPUTER ORGANIZATION

CS470: Computer Architecture. AMD Quad Core

McGill University Faculty of Engineering FINAL EXAMINATION Fall 2007 (DEC 2007)

Principles of Digital Techniques PDT (17320) Assignment No State advantages of digital system over analog system.

CSE140: Components and Design Techniques for Digital Systems

Chapter 5: The Processor: Datapath and Control

CS 61C: Great Ideas in Computer Architecture Introduction to Hardware: Representations and State

ECE 550D Fundamentals of Computer Systems and Engineering. Fall 2017

II/IV B.Tech (Regular/Supplementary) DEGREE EXAMINATION. Answer ONE question from each unit.

Review C program: foo.c Compiler Assembly program: foo.s Assembler Object(mach lang module): foo.o

Digital logic fundamentals. Question Bank. Unit I

Processor (I) - datapath & control. Hwansoo Han

Combinational Circuits

ﻪﺘﻓﺮﺸﻴﭘ ﺮﺗﻮﻴﭙﻣﺎﻛ يرﺎﻤﻌﻣ MIPS يرﺎﻤﻌﻣ data path and ontrol control

Slide Set 5. for ENCM 369 Winter 2018 Section 01. Steve Norman, PhD, PEng

CS 261 Fall Mike Lam, Professor. Combinational Circuits

Lecture 10: Floating Point, Digital Design

CS 2630 Computer Organization. Meeting 13: Faster arithmetic and more operations Brandon Myers University of Iowa

Chapter 4. The Processor Designing the datapath

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 4. The Processor

R a) Simplify the logic functions from binary to seven segment display code converter (8M) b) Simplify the following using Tabular method

Chapter 4. Instruction Execution. Introduction. CPU Overview. Multiplexers. Chapter 4 The Processor 1. The Processor.

2B 52 AB CA 3E A1 +29 A B C. CS120 Fall 2018 Final Prep and super secret quiz 9

Chapter 2. Boolean Expressions:

Assignment (3-6) Boolean Algebra and Logic Simplification - General Questions

CS 261 Fall Mike Lam, Professor. Logic Gates

Combinational Circuits

Review. EECS Components and Design Techniques for Digital Systems. Lec 05 Boolean Logic 9/4-04. Seq. Circuit Behavior. Outline.

Lec-6-HW-2-digitalDesign

Chapter 4. The Processor. Computer Architecture and IC Design Lab

Code No: R Set No. 1

PART B. 3. Minimize the following function using K-map and also verify through tabulation method. F (A, B, C, D) = +d (0, 3, 6, 10).

Implement a C language function that computes the factorial of a number, recursively, according to the following prototype:

4. Write a sum-of-products representation of the following circuit. Y = (A + B + C) (A + B + C)

UCB CS61C : Machine Structures

Transcription:

Systems Architecture I Topics Review of Digital Circuits and Logic Design Review of Sequential Logic Circuits Compilers, Assemblers, Linkers & Loaders Notes Courtesy of Jeremy R. Johnson Lec 2 Systems Architecture I 1

Systems Architecture I Topic 1: Review of Digital Circuits and Logic Design Lec 2 Systems Architecture I 2

Introduction Objective: To understand how the simple model computer from the previous lecture could be implemented using logic gates. Review of Boolean functions and expressions Review of logic gates Decoders, Encoders, and Multiplexors References: Dewdney, The New Turing Omnibus (Chapter 3, 13, and 28) and Sec. B1-B3 of the text. Lec 2 Systems Architecture I 3

Boolean Functions A Boolean variable has two possible values (true/false) (1/0). A Boolean function has a number of Boolean input variables and has a Boolean valued output. A Boolean function can be described using a truth table. There are 2 2n Boolean functions of n variables. x 0 x 1 s Multiplexor function f s x 0 x 1 f 0 0 0 0 0 0 1 0 0 1 0 1 0 1 1 1 1 0 0 0 1 0 1 1 1 1 0 0 1 1 1 1 Lec 2 Systems Architecture I 4

Boolean Expressions An expression built up from variables, and, or, and not. x y x y 0 0 0 0 1 0 1 0 0 1 1 1 x y x + y 0 0 0 0 1 1 1 0 1 1 1 1 x x 0 1 1 0 and or not Lec 2 Systems Architecture I 5

Boolean Expressions A Boolean expression is a Boolean function. Any Boolean function can be written as a Boolean expression Disjunctive normal form (sums of products) For each row in the truth table where the output is true, write a product such that the corresponding input is the only input combination that is true Not unique E.G. (multiplexor function) s x 0 x 1 + s x 0 x 1 + s x 0 x 1 + s x 0 x 1 s x 0 x 1 f 0 0 0 0 0 0 1 0 0 1 0 1 0 1 1 1 1 0 0 0 1 0 1 1 1 1 0 0 1 1 1 1 Lec 2 Systems Architecture I 6

Boolean Logic Boolean expressions can be simplified using rules of Boolean logic Identity law: A + 0 = A and A 1 = A. Zero and One laws: A + 1 = 1 and A 0 = 0. Inverse laws: A + A = 1 and A A = 0. Commutative laws: A + B = B + A and A B = B A. Associative laws: A + (B + C) = (A + B) + C and A (B C) = (A B) C. Distributive laws: A (B + C) = (A B) + (A C) and A + (B C) = (A + B) (A + C) DeMorgan s laws: A + B = A B and A B = A + B The reason for simplifying is to obtain shorter expressions, which we will see leads to simpler logic circuits. Lec 2 Systems Architecture I 7

Simplification of Boolean Expressions Simplifying multiplexor expression using Boolean algebra s x 0 x 1 + s x 0 x 1 + s x 0 x 1 + s x 0 x 1 = s x 0 x 1 + s x 0 x 1 + s x 1 x 0 + s x 1 x 0 (commutative law) = s x 0 (x 1 + x 1 ) + s x 1 (x 0 + x 0 ) (distributive law) = s x 0 1 + s x 1 1 (inverse law) = s x 0 + s x 1 (identity law) Verify that the Boolean function corresponding to this expression has the same truth table as the original function. Lec 2 Systems Architecture I 8

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 A B or gate A B inverter (not) A Lec 2 Systems Architecture I 9

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 x 0 x 1 s Lec 2 Systems Architecture I 10

Logic Circuits Here is the circuit for the simplified multiplexor expression x 0 x 1 s Lec 2 Systems Architecture I 11

Nand Gates A nand gate is an inverted and gate x y x y 0 0 1 0 1 1 1 0 1 1 1 0 nand All Boolean functions can be implemented using nand gates (and and not can be implemented using nand) x = x x Lec 2 Systems Architecture I 12

Decoder A decoder is a logic circuit that has n inputs (think of this as a binary number) and 2 n outputs. The output corresponding to the binary input is set to 1 and all other outputs are set to 0. d 0 b 0 d 1 b 1 d 2 d 3 Lec 2 Systems Architecture I 13

Encoder An encoder is the opposite of a decoder. It is a logic circuit that has 2 n inputs and n outputs. The output equal to the input line (in binary) that is set to 1 is set to 1. d 0 d 1 b 0 d 2 d 3 b 1 Lec 2 Systems Architecture I 14

Multiplexor A multiplexor is a switch which routes n inputs to one output. The input is selected using a decoder. d 0 d 1 d 2 d 3 s 1 s 0 Lec 2 Systems Architecture I 15

Implementing Logic Gates with Transistors +V +V gate output A B A NAND B ground ground A Transistor NOT Gate A Transistor NAND Gate Lec 2 Systems Architecture I 16

Prove De Morgan s laws. Exercises Conjunctive normal form consists of products of sums. Obtain a conjunctive normal form for the multiplexor on slide 5 and draw the corresponding circuit. How does the number of gates compare with the circuit on slide 9. Design a 3 8 decoder. Design an 8 3 encoder. Redesign the multiplexor on slide 14 using only inverters, three-input NAND gates, and a single four-input NAND gate. Show a transistor NOR gate. Lec 2 Systems Architecture I 17

Systems Architecture I Topic 2: Review of Sequential Logic Circuits Lec 2 Systems Architecture I 18

Introduction Objective: To understand how data can be stored in a computer. Sequential vs. Combinational Logic Flip-flop Timed flip-flop Implementing computer memory Review of the simple computer model References: Dewdney, The New Turing Omnibus (Chapter 38 and 48) and Sec. B4-B7 of the text. Lec 2 Systems Architecture I 19

Combinational vs. Sequential Circuits A combinational circuit is a logic circuit without any loops. The same outputs are always computed for the same inputs. A sequential circuit contains two-state memory elements which can remember the state over time. The outputs depend on both the inputs and the current state. The state changes over time which is marked off in discrete steps by pulses emanating from a clock. The pulses coordinate activity. Lec 2 Systems Architecture I 20

Flip-Flop (SR-Latch) A sequential logic circuit with two states. The two states are (Q=0, Q =1) and (Q=1,Q =0) Provided the input (R = 0, S = 0) is not allowed, the flip-flop can only be in one of these two states. R Q S Q Lec 2 Systems Architecture I 21

Flip-Flop States The state (Q=0,Q =1) corresponds to storing a 0. The state (Q=1,Q =0) corresponds to storing a 1. If S (set) is 1, then the state is set to 1. If R (reset) is 1, then the state is set to 0. If R & S are 1, the state does not change. Old Q R S Q Next Q 0 1 1 1 0 R 0 1 0 1 0 0 0 1 1 1 1 1 1 0 1 S 1 1 0 0 0 1 0 1 0 1 Q Q Lec 2 Systems Architecture I 22

Flip-Flop States The transitions of the flip-flop are conveniently described in the following state transition diagram (finite state machine). The arcs are labeled by the RS inputs that cause the transition. In the diagram, state 0 is when Q = 0 and Q = 1, and state 1 is when Q = 1 and Q = 0. 01 10 10 1 0 11 01 11 Lec 2 Systems Architecture I 23

A Clocked Flip-Flop R Q clock S Q Lec 2 Systems Architecture I 24

N-bit Register A state variable containing N-bits Built from an array of N flip-flops State changes when load selected and the clock is high Lec 2 Systems Architecture I 25

N-bit Register X 1 R Q S Q X 2 R Q S Q load clock Lec 2 Systems Architecture I 26

Memory Cell read = 1/write = 0 input R Q S Q output select Lec 2 Systems Architecture I 27

Memory Input N = 2 k words each l bits Inputs k address bits l data-in bits (for write) flag to select read /write Address Memory Output Outputs l data-out bits (for read) R/W Built from N l array of memory cells input, output, flag, select Decoder used to decode address Lec 2 Systems Architecture I 28

read/write Memory input input input input D e c o d e r 0 1 7 output output output output Lec 2 Systems Architecture I 29

LOAD PC INC LOAD MAR MUX 0 1 2 3 s Memory READ/ WRITE LOAD IR(C) IR(O) Decoder LOAD MBR MUX 0 1 s q q 9 8 q 7 q 6 q 5 q 4 q 3 q 2 q 1 q 0 x 13 x 1 x 12 x 2 x 11 x 3 x 10 x 4 x 9 x 5 x 8 x 7 t t 9 8 t 7 t 6 t 5 t 4 t 3 t 2 t 1 t x 0 6 INC 0 1 2 3 MUX s CLEAR LOAD AC ALU LOAD AD MUX 0 1 s Decoder T Lec 2 Systems Architecture I 30

Systems Architecture I Topic 3: Compilers, Assemblers, Linkers & Loaders Lec 2 Systems Architecture I 31

Introduction Objective: To introduce the role of compilers, assemblers, linkers and loaders. To see what is underneath a C program: assembly language, machine language, and executable. Lec 2 Systems Architecture I 32

Below Your Program Example from a Unix system Source Files: count.c and main.c Corresponding assembly code: count.s and main.s Corresponding machine code (object code): count.o and main.o Library functions: libc.a Executable file: a.out format for a.out and object code: ELF (Executable and Linking Format) Lec 2 Systems Architecture I 33

Producing an Executable Program Example from a Unix system (SGI Challenge running IRIX 6.5) Compiler: count.c and main.c count.s and main.s gcc -S count.c main.c Assembler: count.s and main.s count.o and main.o gcc -c count.s main.s as count.s -o count.o Linker/Loader: count.o main.o libc.a a.out gcc main.o count.o ld main.o count.o -lc (additional libraries are required) Lec 2 Systems Architecture I 34

Source Files void main() { int n,s; int count(int n) { int i,s; } printf("enter upper limit: "); scanf("%d",&n); s = count(n); printf("sum of i from 1 to %d = %d\n",n,s); s = 0; for (i=1;i<=n;i++) s = s + i; return s; } Lec 2 Systems Architecture I 35

Assembly Code for MIPS (count.s) #.file 1 "count.c" count:.lfb1: 6.option pic2.section.text.text.align 2.globl count.ent.lcfi0: count.frame $fp,48,$31 # vars= 16, regs= 2/0, args= 0, extra= 1.mask 0x50000000,-8.fmask 0x00000000,0 subu sd $sp,$sp,48 $fp,40($sp) Lec 2 Systems Architecture I 36

.LCFI1: sd.lcfi2:.lcfi3:.l3: $28,32($sp) move $fp,$sp.set noat lui $1,%hi(%neg(%gp_rel(count))) addiu daddu.set at sw sw li sw lw lw slt $2,$3,$2 beq b.l4 $1,$1,%lo(%neg(%gp_rel(count))) $gp,$1,$25 $4,16($fp) $0,24($fp) $2,1 # 0x1 $2,20($fp) $2,20($fp) $3,16($fp) $2,$0,.L6 Lec 2 Systems Architecture I 37 L6:.L5:.L4:.L2: lw lw $2,24($fp) $3,20($fp) addu $2,$2,$3 sw lw $2,24($fp) $2,20($fp) addu $3,$2,1 sw b.l3 lw.lfe1: $3,20($fp) $3,24($fp) move $2,$3 b.l2 move $sp,$fp ld $fp,40($sp) ld $28,32($sp) addu j $31.end count $sp,$sp,48

Executable Program for MIPS (a.out) 0000000 7f45 4c46 0102 0100 0000 0000 0000 0000 0000020 0002 0008 0000 0001 1000 1060 0000 0034 0000040 0000 6c94 2000 0024 0034 0020 0007 0028 0000060 0023 0022 0000 0006 0000 0034 1000 0034 0000100 1000 0034 0000 00e0 0000 00e0 0000 0004 0000120 0000 0004 0000 0003 0000 0114 1000 0114 0000140 1000 0114 0000 0015 0000 0015 0000 0004 0000160 0000 0001 7000 0002 0000 0130 1000 0130 0000200 1000 0130 0000 0080 0000 0080 0000 0004 0000220 0000 0008 7000 0000 0000 01b0 1000 01b0 0000240 1000 01b0 0000 0018 0000 0018 0000 0004 0000260 0000 0004 0000 0002 0000 01c8 1000 01c8 0000300 1000 01c8 0000 0108 0000 0108 0000 0004 0000320 0000 0004 0000 0001 0000 0000 1000 0000 0000340 1000 0000 0000 3000 0000 3000 0000 0005 Lec 2 Systems Architecture I 38