Logic Design CSCI 370 Computer Architecture Overview of

  • Slides: 19
Download presentation
Logic Design CSCI 370: Computer Architecture

Logic Design CSCI 370: Computer Architecture

Overview of Logic Design • Fundamental Hardware Requirements • Communication • How to get

Overview of Logic Design • Fundamental Hardware Requirements • Communication • How to get values from one place to another • Computation • Storage • Bits are Our Friends • Everything expressed in terms of values 0 and 1 • Communication • Low or high voltage on wire • Computation • Compute Boolean functions • Storage • Store bits of information

Digital Signals 0 1 0 Voltage Time • Use voltage thresholds to extract discrete

Digital Signals 0 1 0 Voltage Time • Use voltage thresholds to extract discrete values from continuous signal • Simplest version: 1 -bit signal • Either high range (1) or low range (0) • With guard range between them • Not strongly affected by noise or low quality circuit elements • Can make circuits simple, small, and fast

Computing with Logic Gates • Outputs are Boolean functions of inputs • Respond continuously

Computing with Logic Gates • Outputs are Boolean functions of inputs • Respond continuously to changes in inputs • With some, small delay Rising Delay Voltage Falling Delay a && b b a Time

Combinational Circuits Acyclic Network Primary Inputs Primary Outputs • Acyclic Network of Logic Gates

Combinational Circuits Acyclic Network Primary Inputs Primary Outputs • Acyclic Network of Logic Gates • Continously responds to changes on primary inputs • Primary outputs become (after some delay) Boolean functions of primary inputs

Bit Equality a Bit equal HCL Expression eq bool eq = (a&&b)||(!a&&!b) b •

Bit Equality a Bit equal HCL Expression eq bool eq = (a&&b)||(!a&&!b) b • Generate 1 if a and b are equal • Hardware Control Language (HCL) • Very simple hardware description language • Boolean operations have syntax similar to C logical operations • We’ll use it to describe control logic for processors

Word Equality b 63 a 63 b 62 a 62 Bit equal Word-Level Representation

Word Equality b 63 a 63 b 62 a 62 Bit equal Word-Level Representation eq 63 B eq 62 A HCL Representation Eq b 1 a 1 b 0 a 0 = Eq Bit equal bool Eq = (A == B) eq 1 eq 0 • 64 -bit word size • HCL representation • Equality operation • Generates Boolean value

Bit-Level Multiplexor s Bit MUX b a • Control signal s • Data signals

Bit-Level Multiplexor s Bit MUX b a • Control signal s • Data signals a and b • Output a when s=1, b when s=0 HCL Expression bool out = (s&&a)||(!s&&b) out

Word Multiplexor Word-Level Representation s s b 63 B out 63 a 63 b

Word Multiplexor Word-Level Representation s s b 63 B out 63 a 63 b 62 A MUX Out HCL Representation out 62 a 62 int Out = [ s : A; 1 : B; ]; • Select input word A or B depending on control signal s • HCL representation b 0 a 0 out 0 • Case expression • Series of test : value pairs • Output value for first successful test

HCL Word-Level Examples Minimum of 3 Words C B A MIN 3 Min 3

HCL Word-Level Examples Minimum of 3 Words C B A MIN 3 Min 3 • Find minimum of three input int Min 3 = [ words A < B && A < C : A; • HCL case expression B < A && B < C : B; • Final case guarantees match 1 : C; ]; 4 -Way Multiplexor s 1 s 0 D 1 D 2 D 3 MUX 4 Out 4 int Out 4 = [ !s 1&&!s 0: D 0; !s 1 : D 1; !s 0 : D 2; 1 : D 3; ]; n Select one of 4 inputs based on two control bits n HCL case expression Simplify tests by assuming sequential matching n

Arithmetic Logic Unit 0 Y X A B A L U 1 Y A

Arithmetic Logic Unit 0 Y X A B A L U 1 Y A X+Y OF ZF CF X B 2 Y A L U A X-Y OF ZF CF X Y A L U B • Combinational logic • Continuously responding to inputs • Control signal selects function computed • Corresponding to 4 arithmetic/logical operations in Y 86 -64 • Also computes values for condition codes 3 A X&Y OF ZF CF X B A L U X^Y OF ZF CF

Registers Structure i 7 i 6 i 5 i 4 i 3 i 2

Registers Structure i 7 i 6 i 5 i 4 i 3 i 2 i 1 i 0 D C Q+ o 7 D C Q+ o 6 D C Q+ o 5 D C Q+ o 4 D C Q+ o 3 D C Q+ o 2 D C Q+ o 1 D C Q+ o 0 Clock • Stores word of data • Different from program registers seen in assembly code • Collection of edge-triggered latches • Loads input on rising edge of clock I O Clock

Register Operation State = x Input = y Output = x x State =

Register Operation State = x Input = y Output = x x State = y Rising clock • Stores data bits • For most of time acts as barrier between input and output • As clock rises, loads input Output = y y

State Machine Example Comb. Logic 0 A L U In • Accumulator circuit •

State Machine Example Comb. Logic 0 A L U In • Accumulator circuit • Load or accumulate on each cycle 0 Out MUX 1 Load Clock Load In x 0 Out x 1 x 0 x 2 x 0+x 1 x 3 x 0+x 1+x 2 x 3 x 4 x 5 x 3+x 4+x 5

Random-Access Memory val. A src. A Read ports val. B src. B A Register

Random-Access Memory val. A src. A Read ports val. B src. B A Register file val. W W B • Stores multiple words of memory • Address input specifies which word to read or write • Register file • Holds values of program registers • %rax, %rsp, etc. • Register identifier serves as address • ID 15 (0 x. F) implies no read or write performed • Multiple Ports • Can read and/or write multiple words in one cycle • Each has separate address and data input/output Clock dst. W Write port

Register File Timing • Reading val. A src. A x val. B src. B

Register File Timing • Reading val. A src. A x val. B src. B A • Like combinational logic • Output data generated based on input address 2 x Register file • After some delay • Writing B • Like register • Update only as clock rises 2 2 x Register file val. W W Clock dst. W y 2 Rising clock 2 y Register file val. W W Clock dst. W

Hardware Control Language • Very simple hardware description language • Can only express limited

Hardware Control Language • Very simple hardware description language • Can only express limited aspects of hardware operation • Parts we want to explore and modify • Data Types • bool: Boolean • a, b, c, … • int: words • A, B, C, … • Does not specify word size---bytes, 64 -bit words, … • Statements • bool a = bool-expr ; • int A = int-expr ;

HCL Operations • Classify by type of value returned • Boolean Expressions • Logic

HCL Operations • Classify by type of value returned • Boolean Expressions • Logic Operations • a && b, a || b, !a • Word Comparisons • A == B, A != B, A <= B, A > B • Set Membership • A in { B, C, D } • Same as A == B || A == C || A == D • Word Expressions • Case expressions • [ a : A; b : B; c : C ] • Evaluate test expressions a, b, c, … in sequence • Return word expression A, B, C, … for first successful test

Summary • Computation • Performed by combinational logic • Computes Boolean functions • Continuously

Summary • Computation • Performed by combinational logic • Computes Boolean functions • Continuously reacts to input changes • Storage • Registers • Hold single words • Loaded as clock rises • Random-access memories • • Hold multiple words Possible multiple read or write ports Read word when address input changes Write word as clock rises